Fix compilation with HAL_DEBUG=1
authorproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 7 May 2009 20:40:54 +0000 (20:40 +0000)
committerproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 7 May 2009 20:40:54 +0000 (20:40 +0000)
Provide forward declaration of struct ath_hal in ah_osdep.h.  Implement
OS_GETUPTIME (the implementation is quite primitive, as it's only used
once for some obscure condition in 5212 chips).  Implement HALDEBUG()
and ath_hal_ether_sprintf().

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@4019 0192ed92-7a03-0410-a25b-9323aeb14dbd

ath_hal/ah_os.c
ath_hal/ah_osdep.h

index b4c9667daf7dd5de80e824780426bb500deb0905..5102a4b5bf026c818c567035da679facd7c8279d 100644 (file)
@@ -264,6 +264,27 @@ ath_hal_printf(struct ath_hal *ah, HAL_BOOL prefer_alq, const char *fmt, ...)
 }
 EXPORT_SYMBOL(ath_hal_printf);
 
+#ifdef AH_DEBUG
+extern const char *ath_hal_ether_sprintf(const uint8_t *mac)
+{
+       static char buf[18];
+       sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2],
+               mac[3], mac[4], mac[5]);
+       return buf;
+}
+
+void
+HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
+{
+       if (ath_hal_debug & mask) {
+               __va_list ap;
+               va_start(ap, fmt);
+               _hal_vprintf(ah, AH_FALSE, fmt, ap);
+               va_end(ap);
+       }
+}
+#endif /* AH_DEBUG */
+
 /* Lookup a friendly name for a register address (for any we have nicknames
  * for). Names were taken from openhal ar5212regs.h. Return AH_TRUE if the
  * name is a known ar5212 register, and AH_FALSE otherwise. */
index fe3f97889c4263d75f08b1b01d040074329660d2..8360e8a5b7351843d1f357fbc403fdc9342866e3 100644 (file)
@@ -214,6 +214,7 @@ struct ath_hal_rf *const *ah_rfs_ptrs[] = {                 \
 #if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ)
 #define OS_REG_WRITE(_ah, _reg, _val)  ath_hal_reg_write(_ah, _reg, _val)
 #define OS_REG_READ(_ah, _reg)         ath_hal_reg_read(_ah, _reg)
+struct ath_hal;
 extern void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int reg,
                                       u_int32_t val);
 extern u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg);
@@ -226,6 +227,9 @@ extern u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg);
 extern void __ahdecl ath_hal_delay(int);
 #define OS_DELAY(_n)           ath_hal_delay(_n)
 
+/* Uptime in milliseconds, used by debugging code only */
+#define OS_GETUPTIME(_ah)      ((int)(1000 * jiffies / HZ))
+
 #define OS_INLINE      __inline
 #define OS_MEMZERO(_a, _n)     ath_hal_memzero((_a), (_n))
 extern void __ahdecl ath_hal_memzero(void *, size_t);