diff options
Diffstat (limited to 'drivers/staging/csr/csr_macro.h')
-rw-r--r-- | drivers/staging/csr/csr_macro.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h index 2e3dcac4f33..e8de0a7bab9 100644 --- a/drivers/staging/csr/csr_macro.h +++ b/drivers/staging/csr/csr_macro.h | |||
@@ -31,39 +31,39 @@ extern "C" { | |||
31 | /*------------------------------------------------------------------*/ | 31 | /*------------------------------------------------------------------*/ |
32 | /* Endian conversion */ | 32 | /* Endian conversion */ |
33 | /*------------------------------------------------------------------*/ | 33 | /*------------------------------------------------------------------*/ |
34 | #define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[0]) | ((CsrUint16) ((CsrUint8 *) (ptr))[1]) << 8) | 34 | #define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[0]) | ((CsrUint16) ((u8 *) (ptr))[1]) << 8) |
35 | #define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[0]) | ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 8 | \ | 35 | #define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[0]) | ((CsrUint32) ((u8 *) (ptr))[1]) << 8 | \ |
36 | ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[3]) << 24) | 36 | ((CsrUint32) ((u8 *) (ptr))[2]) << 16 | ((CsrUint32) ((u8 *) (ptr))[3]) << 24) |
37 | #define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x00FF)); \ | 37 | #define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ |
38 | ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) >> 8)) | 38 | ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8)) |
39 | #define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x000000FF)); \ | 39 | #define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \ |
40 | ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ | 40 | ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ |
41 | ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ | 41 | ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ |
42 | ((CsrUint8 *) (ptr))[3] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) | 42 | ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) |
43 | #define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[1]) | ((CsrUint16) ((CsrUint8 *) (ptr))[0]) << 8) | 43 | #define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((u8 *) (ptr))[1]) | ((CsrUint16) ((u8 *) (ptr))[0]) << 8) |
44 | #define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((CsrUint8 *) (ptr))[2]) | \ | 44 | #define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((u8 *) (ptr))[2]) | \ |
45 | ((CsrUint24) ((CsrUint8 *) (ptr))[1]) << 8 | ((CsrUint24) ((CsrUint8 *) (ptr))[0]) << 16) | 45 | ((CsrUint24) ((u8 *) (ptr))[1]) << 8 | ((CsrUint24) ((u8 *) (ptr))[0]) << 16) |
46 | #define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[3]) | ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 8 | \ | 46 | #define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((u8 *) (ptr))[3]) | ((CsrUint32) ((u8 *) (ptr))[2]) << 8 | \ |
47 | ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[0]) << 24) | 47 | ((CsrUint32) ((u8 *) (ptr))[1]) << 16 | ((CsrUint32) ((u8 *) (ptr))[0]) << 24) |
48 | #define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) & 0x00FF)); \ | 48 | #define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[1] = ((u8) ((uint) & 0x00FF)); \ |
49 | ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) >> 8)) | 49 | ((u8 *) (ptr))[0] = ((u8) ((uint) >> 8)) |
50 | #define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[2] = ((CsrUint8) ((uint) & 0x000000FF)); \ | 50 | #define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[2] = ((u8) ((uint) & 0x000000FF)); \ |
51 | ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ | 51 | ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ |
52 | ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)) | 52 | ((u8 *) (ptr))[0] = ((u8) (((uint) >> 16) & 0x000000FF)) |
53 | #define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[3] = ((CsrUint8) ((uint) & 0x000000FF)); \ | 53 | #define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((u8 *) (ptr))[3] = ((u8) ((uint) & 0x000000FF)); \ |
54 | ((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \ | 54 | ((u8 *) (ptr))[2] = ((u8) (((uint) >> 8) & 0x000000FF)); \ |
55 | ((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \ | 55 | ((u8 *) (ptr))[1] = ((u8) (((uint) >> 16) & 0x000000FF)); \ |
56 | ((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 24) & 0x000000FF)) | 56 | ((u8 *) (ptr))[0] = ((u8) (((uint) >> 24) & 0x000000FF)) |
57 | 57 | ||
58 | /*------------------------------------------------------------------*/ | 58 | /*------------------------------------------------------------------*/ |
59 | /* XAP conversion macros */ | 59 | /* XAP conversion macros */ |
60 | /*------------------------------------------------------------------*/ | 60 | /*------------------------------------------------------------------*/ |
61 | 61 | ||
62 | #define CSR_LSB16(a) ((CsrUint8) ((a) & 0x00ff)) | 62 | #define CSR_LSB16(a) ((u8) ((a) & 0x00ff)) |
63 | #define CSR_MSB16(b) ((CsrUint8) ((b) >> 8)) | 63 | #define CSR_MSB16(b) ((u8) ((b) >> 8)) |
64 | 64 | ||
65 | #define CSR_CONVERT_8_FROM_XAP(output, input) \ | 65 | #define CSR_CONVERT_8_FROM_XAP(output, input) \ |
66 | (output) = ((CsrUint8) (input));(input) += 2 | 66 | (output) = ((u8) (input));(input) += 2 |
67 | 67 | ||
68 | #define CSR_CONVERT_16_FROM_XAP(output, input) \ | 68 | #define CSR_CONVERT_16_FROM_XAP(output, input) \ |
69 | (output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \ | 69 | (output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \ |
@@ -80,14 +80,14 @@ extern "C" { | |||
80 | (output)[1] = 0;(output) += 2 | 80 | (output)[1] = 0;(output) += 2 |
81 | 81 | ||
82 | #define CSR_ADD_UINT16_TO_XAP(output, input) \ | 82 | #define CSR_ADD_UINT16_TO_XAP(output, input) \ |
83 | (output)[0] = ((CsrUint8) ((input) & 0x00FF)); \ | 83 | (output)[0] = ((u8) ((input) & 0x00FF)); \ |
84 | (output)[1] = ((CsrUint8) ((input) >> 8));(output) += 2 | 84 | (output)[1] = ((u8) ((input) >> 8));(output) += 2 |
85 | 85 | ||
86 | #define CSR_ADD_UINT32_TO_XAP(output, input) \ | 86 | #define CSR_ADD_UINT32_TO_XAP(output, input) \ |
87 | (output)[0] = ((CsrUint8) (((input) >> 16) & 0x00FF)); \ | 87 | (output)[0] = ((u8) (((input) >> 16) & 0x00FF)); \ |
88 | (output)[1] = ((CsrUint8) ((input) >> 24)); \ | 88 | (output)[1] = ((u8) ((input) >> 24)); \ |
89 | (output)[2] = ((CsrUint8) ((input) & 0x00FF)); \ | 89 | (output)[2] = ((u8) ((input) & 0x00FF)); \ |
90 | (output)[3] = ((CsrUint8) (((input) >> 8) & 0x00FF));(output) += 4 | 90 | (output)[3] = ((u8) (((input) >> 8) & 0x00FF));(output) += 4 |
91 | 91 | ||
92 | /*------------------------------------------------------------------*/ | 92 | /*------------------------------------------------------------------*/ |
93 | /* Misc */ | 93 | /* Misc */ |