1 /******************************************************************************
2 ** File Name: chip_drv_common_io.h *
3 ** Author: Steve.Zhan *
5 ** Copyright: 2010 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************/
8 /******************************************************************************
10 **---------------------------------------------------------------------------*
11 ** DATE NAME DESCRIPTION *
12 ** 06/05/2010 Steve.Zhan Create. *
13 ******************************************************************************/
14 #ifndef _CHIP_DRV_COMMON_IO_H_
15 #define _CHIP_DRV_COMMON_IO_H_
16 /*----------------------------------------------------------------------------*
18 **------------------------------------------------------------------------- */
20 /**---------------------------------------------------------------------------*
22 **--------------------------------------------------------------------------*/
27 /**---------------------------------------------------------------------------*
29 **---------------------------------------------------------------------------*/
30 typedef uint32 DRV_WORD;
31 typedef uint8 DRV_BYTE;
32 typedef uint16 DRV_WORD16;
33 typedef uint32 DRV_WORD32;
34 typedef uint64 DRV_WORD64;
35 typedef uint32 DRV_ADDRWORD;
36 #define drv_count32 long
41 #define BIT_0 0x00000001
42 #define BIT_1 0x00000002
43 #define BIT_2 0x00000004
44 #define BIT_3 0x00000008
45 #define BIT_4 0x00000010
46 #define BIT_5 0x00000020
47 #define BIT_6 0x00000040
48 #define BIT_7 0x00000080
49 #define BIT_8 0x00000100
50 #define BIT_9 0x00000200
51 #define BIT_10 0x00000400
52 #define BIT_11 0x00000800
53 #define BIT_12 0x00001000
54 #define BIT_13 0x00002000
55 #define BIT_14 0x00004000
56 #define BIT_15 0x00008000
57 #define BIT_16 0x00010000
58 #define BIT_17 0x00020000
59 #define BIT_18 0x00040000
60 #define BIT_19 0x00080000
61 #define BIT_20 0x00100000
62 #define BIT_21 0x00200000
63 #define BIT_22 0x00400000
64 #define BIT_23 0x00800000
65 #define BIT_24 0x01000000
66 #define BIT_25 0x02000000
67 #define BIT_26 0x04000000
68 #define BIT_27 0x08000000
69 #define BIT_28 0x10000000
70 #define BIT_29 0x20000000
71 #define BIT_30 0x40000000
72 #define BIT_31 0x80000000
76 typedef uint32 ChipRegT;
77 //#define REG32(ChipReg) ( *((volatile ChipRegT*) (ChipReg)))
78 #define REG32(x) (*((volatile uint32 *)(x)))
80 typedef uint16 ChipRegT16;
81 #define REG16(ChipReg) ( *((volatile ChipRegT16*) (ChipReg)))
83 #define REG8(ChipReg) ( *((volatile uint8*) (ChipReg)))
84 #define CHIP_REG_OR(reg_addr, value) (*(volatile uint32 *)(reg_addr) |= (uint32)(value))
85 #define CHIP_REG_AND(reg_addr, value) (*(volatile uint32 *)(reg_addr) &= (uint32)(value))
86 #define CHIP_REG_GET(reg_addr) (*(volatile uint32 *)(reg_addr))
87 #define CHIP_REG_SET(reg_addr, value) (*(volatile uint32 *)(reg_addr) = (uint32)(value))
90 //Debug info Function and MacroS.
93 #define CHIP_DRV_ASSERT SCI_ASSERT
94 #define CHIP_DRV_PASSERT SCI_PASSERT
96 #define CHIP_DRV_ASSERT NULL
97 #define CHIP_DRV_PASSERT NULL
100 /**----------------------------------------------------------------------------*
101 ** Local Function Prototype **
102 **----------------------------------------------------------------------------*/
104 /**----------------------------------------------------------------------------*
105 ** Function Prototype **
106 **----------------------------------------------------------------------------*/
109 /**----------------------------------------------------------------------------*
111 **----------------------------------------------------------------------------*/
115 /**---------------------------------------------------------------------------*/