2012-06-19 17:15:42 -06:00
|
|
|
#ifndef CSR_MACRO_H__
|
|
|
|
#define CSR_MACRO_H__
|
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
(c) Cambridge Silicon Radio Limited 2010
|
|
|
|
All rights reserved and confidential information of CSR
|
|
|
|
|
|
|
|
Refer to LICENSE.txt included with this source for details
|
|
|
|
on the license terms.
|
|
|
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2012-07-20 14:07:13 -06:00
|
|
|
#include <linux/types.h>
|
2012-06-19 17:15:42 -06:00
|
|
|
|
2012-07-20 14:07:13 -06:00
|
|
|
#define FALSE (0)
|
|
|
|
#define TRUE (1)
|
|
|
|
|
2012-06-19 17:15:42 -06:00
|
|
|
/*------------------------------------------------------------------*/
|
|
|
|
/* Endian conversion */
|
|
|
|
/*------------------------------------------------------------------*/
|
2012-07-20 13:00:10 -06:00
|
|
|
#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8)
|
2012-07-20 13:05:42 -06:00
|
|
|
#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[0]) | ((u32) ((u8 *) (ptr))[1]) << 8 | \
|
|
|
|
((u32) ((u8 *) (ptr))[2]) << 16 | ((u32) ((u8 *) (ptr))[3]) << 24)
|
2012-07-20 12:51:01 -06:00
|
|
|
#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \
|
|
|
|
((u8 *) (ptr))[1] = ((u8) ((uint) >> 8))
|
|
|
|
#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \
|
|
|
|
((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \
|
|
|
|
((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \
|
|
|
|
((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF))
|
2012-06-19 17:15:42 -06:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------*/
|
|
|
|
/* Misc */
|
|
|
|
/*------------------------------------------------------------------*/
|
|
|
|
/* Use this macro on unused local variables that cannot be removed (such as
|
|
|
|
unused function parameters). This will quell warnings from certain compilers
|
|
|
|
and static code analysis tools like Lint and Valgrind. */
|
|
|
|
#define CSR_UNUSED(x) ((void) (x))
|
|
|
|
|
|
|
|
#endif
|