[Madwifi-cvs] revision 2818 committed
Status: Beta
Brought to you by:
otaku
From: Pavel R. <svn...@ma...> - 2007-11-02 02:05:26
|
Project : madwifi Revision : 2818 Author : proski (Pavel Roskin) Date : 2007-11-02 03:05:22 +0100 (Fri, 02 Nov 2007) Log Message : Fix support for big-endian systems Affected Files: * madwifi/trunk/tools/ath_info.c updated Modified: madwifi/trunk/tools/ath_info.c =================================================================== --- madwifi/trunk/tools/ath_info.c 2007-11-01 22:25:15 UTC (rev 2817) +++ madwifi/trunk/tools/ath_info.c 2007-11-02 02:05:22 UTC (rev 2818) @@ -96,6 +96,8 @@ #include <string.h> #include <fcntl.h> #include <sys/mman.h> +#include <endian.h> +#include <byteswap.h> #define dbg(fmt, __args__...) \ do { \ @@ -331,17 +333,21 @@ (((_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)) |