From: proski Date: Fri, 2 Nov 2007 02:05:22 +0000 (+0000) Subject: Fix support for big-endian systems X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=a9875c1c61d9b2d6d28a2c97971d11a8e391219d;p=madwifi%2F.git Fix support for big-endian systems git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@2818 0192ed92-7a03-0410-a25b-9323aeb14dbd --- diff --git a/tools/ath_info.c b/tools/ath_info.c index be1643f..3999bea 100644 --- a/tools/ath_info.c +++ b/tools/ath_info.c @@ -96,6 +96,8 @@ #include #include #include +#include +#include #define dbg(fmt, __args__...) \ do { \ @@ -331,16 +333,20 @@ static const struct ath5k_srev_name ath5k_srev_names[] = { (((_val) & (_flags)) >> _flags##_S) /* - * Read from a device register + * Access device registers */ +#if __BYTE_ORDER == __BIG_ENDIAN +#define AR5K_REG_READ(_reg) \ + __bswap_32(*((volatile u_int32_t *)(mem + (_reg)))) +#define AR5K_REG_WRITE(_reg, _val) \ + (*((volatile u_int32_t *)(mem + (_reg))) = __bswap_32(_val)) +#else #define AR5K_REG_READ(_reg) \ (*((volatile u_int32_t *)(mem + (_reg)))) - -/* - * Write to a device register - */ #define AR5K_REG_WRITE(_reg, _val) \ (*((volatile u_int32_t *)(mem + (_reg))) = (_val)) +#endif + #define AR5K_REG_ENABLE_BITS(_reg, _flags) \ AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) | (_flags))