Staging: add CSR wifi module
[pandora-kernel.git] / drivers / staging / csr / csr_util.h
1 #ifndef CSR_UTIL_H__
2 #define CSR_UTIL_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
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #include "csr_types.h"
18 #include "csr_macro.h"
19
20 /*------------------------------------------------------------------*/
21 /* Bits - intended to operate on CsrUint32 values */
22 /*------------------------------------------------------------------*/
23 CsrUint8 CsrBitCountSparse(CsrUint32 n);
24 CsrUint8 CsrBitCountDense(CsrUint32 n);
25
26 /*------------------------------------------------------------------*/
27 /* Base conversion */
28 /*------------------------------------------------------------------*/
29 CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue);
30 CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue);
31 CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue);
32 CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent);
33 void CsrIntToBase10(CsrInt32 number, CsrCharString *str);
34 void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str);
35 void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str);
36
37 /*------------------------------------------------------------------*/
38 /*  String */
39 /*------------------------------------------------------------------*/
40 void *CsrMemCpy(void *dest, const void *src, CsrSize count);
41 void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count);
42 void *CsrMemMove(void *dest, const void *src, CsrSize count);
43 CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count);
44 void *CsrMemDup(const void *buf1, CsrSize count);
45 CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src);
46 CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count);
47 int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
48 CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src);
49 CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count);
50 CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2);
51 CsrSize CsrStrLen(const CsrCharString *string);
52 CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2);
53 CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
54 CsrCharString *CsrStrDup(const CsrCharString *string);
55 CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c);
56 CsrUint32 CsrStrToInt(const CsrCharString *string);
57 CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args);
58 CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count);
59
60 /*------------------------------------------------------------------*/
61 /* Filename */
62 /*------------------------------------------------------------------*/
63 const CsrCharString *CsrGetBaseName(const CsrCharString *file);
64
65 /*------------------------------------------------------------------*/
66 /* Misc */
67 /*------------------------------------------------------------------*/
68 CsrBool CsrIsSpace(CsrUint8 c);
69 #define CsrOffsetOf(st, m)  ((CsrSize) & ((st *) 0)->m)
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif