Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | #ifndef CSR_MACRO_H__ |
2 | #define CSR_MACRO_H__ | |
3 | /***************************************************************************** | |
4 | ||
5 | (c) Cambridge Silicon Radio Limited 2010 | |
6 | All rights reserved and confidential information of CSR | |
7 | ||
8 | Refer to LICENSE.txt included with this source for details | |
9 | on the license terms. | |
10 | ||
11 | *****************************************************************************/ | |
12 | ||
980b5a2b | 13 | #include <linux/types.h> |
635d2b00 | 14 | |
980b5a2b GKH |
15 | #define FALSE (0) |
16 | #define TRUE (1) | |
17 | ||
635d2b00 GKH |
18 | /*------------------------------------------------------------------*/ |
19 | /* Endian conversion */ | |
20 | /*------------------------------------------------------------------*/ | |
8c87f69a | 21 | #define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8) |
26a6b2e1 GKH |
22 | #define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[0]) | ((u32) ((u8 *) (ptr))[1]) << 8 | \ |
23 | ((u32) ((u8 *) (ptr))[2]) << 16 | ((u32) ((u8 *) (ptr))[3]) << 24) | |
7e6f5794 GKH |
24 | #define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ |
25 | ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8)) | |
26 | #define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \ | |
27 | ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ | |
28 | ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ | |
29 | ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) | |
635d2b00 GKH |
30 | |
31 | /*------------------------------------------------------------------*/ | |
32 | /* Misc */ | |
33 | /*------------------------------------------------------------------*/ | |
635d2b00 GKH |
34 | /* Use this macro on unused local variables that cannot be removed (such as |
35 | unused function parameters). This will quell warnings from certain compilers | |
36 | and static code analysis tools like Lint and Valgrind. */ | |
37 | #define CSR_UNUSED(x) ((void) (x)) | |
38 | ||
635d2b00 | 39 | #endif |