Nano100AN Series BSP  V3.02.002
The Board Support Package for Nano100AN Series
ebi.h
Go to the documentation of this file.
1 /**************************************************************************/
13 #ifndef __EBI_H__
14 #define __EBI_H__
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 
35 /*---------------------------------------------------------------------------------------------------------*/
36 /* Define Base Address */
37 /*---------------------------------------------------------------------------------------------------------*/
38 #define EBI_BASE_ADDR 0x60000000
39 #define EBI_MAX_SIZE 0x20000
40 #define EBI_TIMEOUT_COUNT 0x10000
42 /* Constants for EBI data bus width */
43 #define EBI_BUSWIDTH_8BIT 8
44 #define EBI_BUSWIDTH_16BIT 16
46 /*---------------------------------------------------------------------------------------------------------*/
47 /* EBI MCLK divider */
48 /*---------------------------------------------------------------------------------------------------------*/
49 #define EBI_MCLKDIV_1 0
50 #define EBI_MCLKDIV_2 1
51 #define EBI_MCLKDIV_4 2
52 #define EBI_MCLKDIV_8 3
53 #define EBI_MCLKDIV_16 4
54 #define EBI_MCLKDIV_32 5
56 /*---------------------------------------------------------------------------------------------------------*/
57 /* EBI timing setting */
58 /*---------------------------------------------------------------------------------------------------------*/
59 #define EBI_TIMING_FASTEST 0x0
60 #define EBI_TIMING_VERYFAST 0x1
61 #define EBI_TIMING_FAST 0x2
62 #define EBI_TIMING_NORMAL 0x3
63 #define EBI_TIMING_SLOW 0x4
64 #define EBI_TIMING_VERYSLOW 0x5
65 #define EBI_TIMING_SLOWEST 0x6
68  /* end of group NANO100_EBI_EXPORTED_CONSTANTS */
69 
70 
75 /*---------------------------------------------------------------------------------------------------------*/
76 /* EBI access macros */
77 /*---------------------------------------------------------------------------------------------------------*/
78 
85 #define EBI_READ_DATA8(Addr) *((volatile unsigned char *)(EBI_BASE_ADDR+Addr))
86 
94 #define EBI_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI_BASE_ADDR+Addr))=Data
95 
102 #define EBI_READ_DATA16(Addr) *((volatile unsigned short *)(EBI_BASE_ADDR+Addr))
103 
111 #define EBI_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI_BASE_ADDR+Addr))=Data
112 
119 #define EBI_READ_DATA32(Addr) *((volatile unsigned int *)(EBI_BASE_ADDR+Addr))
120 
128 #define EBI_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI_BASE_ADDR+Addr))=Data
129 
130 /*---------------------------------------------------------------------------------------------------------*/
131 /* Functions */
132 /*---------------------------------------------------------------------------------------------------------*/
133 
134 void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel);
135 void EBI_Close(uint8_t u32Bank);
136 void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv);
137 
138  /* end of group NANO100_EBI_EXPORTED_FUNCTIONS */
140  /* end of group NANO100_EBI_Driver */
142  /* end of group NANO100_Device_Driver */
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif // __EBI_H__
150 
151 /*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel)
Initialize and enable EBI.
Definition: ebi.c:47
void EBI_Close(uint8_t u32Bank)
Disable EBI.
Definition: ebi.c:122
void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv)
Set EBI bus timings.
Definition: ebi.c:141