| 123456789101112131415161718192021222324252627282930 |
- #ifndef _UTILS_H__
- #define _UTILS_H__
- #include "os/os_type.h"
- #include "os/co_task.h"
- #define delay_us cpu_udelay
- static __inline__ void delay_ms(u32 ms) {
- cpu_udelay(ms*1000);
- }
- static __inline__ u16 DECODE_U16(u8 *buff) {
- return (((u16)(buff[1]) << 8) | buff[0]);
- }
- static __inline__ u32 DECODE_U24(u8 *buff) {
- return ((u32)(buff[2]) << 16 | DECODE_U16(buff));
- }
- static __inline__ u16 DECODE_U32(u8 *buff) {
- return ((u32)(buff[3]) << 24 | DECODE_U24(buff));
- }
- #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
- #define min(a,b) (a>b?b:a)
- #define MAX(x, y) ((x)>(y)?(x):(y))
- #endif /* _UTILS_H__ */
|