From 200f8b8a6a2b51abb939ed8bc7b9c627283d9023 Mon Sep 17 00:00:00 2001 From: proski Date: Thu, 7 May 2009 20:40:54 +0000 Subject: [PATCH] Fix compilation with HAL_DEBUG=1 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 | 21 +++++++++++++++++++++ ath_hal/ah_osdep.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/ath_hal/ah_os.c b/ath_hal/ah_os.c index b4c9667..5102a4b 100644 --- a/ath_hal/ah_os.c +++ b/ath_hal/ah_os.c @@ -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. */ diff --git a/ath_hal/ah_osdep.h b/ath_hal/ah_osdep.h index fe3f978..8360e8a 100644 --- a/ath_hal/ah_osdep.h +++ b/ath_hal/ah_osdep.h @@ -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); -- 2.35.1