| NUC472_NUC442_BSP V3.03.003 The Board Support Package for NUC472/NUC442

ebi.h
Go to the documentation of this file.
1/****************************************************************************/
12#ifndef __EBI_H__
13#define __EBI_H__
14
15#ifdef __cplusplus
16 extern "C"
17{
18#endif
19
20
33/* Bank-0 constants */
34#define EBI0_BASE_ADDR 0x60000000
35#define EBI0_MAX_SIZE 0x400000
36
37#define EBI0_READ_DATA8(Addr) *((volatile unsigned char *)(EBI0_BASE_ADDR+Addr))
38#define EBI0_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI0_BASE_ADDR+Addr))=Data
39#define EBI0_READ_DATA16(Addr) *((volatile unsigned short *)(EBI0_BASE_ADDR+Addr))
40#define EBI0_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI0_BASE_ADDR+Addr))=Data
41#define EBI0_READ_DATA32(Addr) *((volatile unsigned int *)(EBI0_BASE_ADDR+Addr))
42#define EBI0_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI0_BASE_ADDR+Addr))=Data
43
44/* Bank-1 constants */
45#define EBI1_BASE_ADDR 0x64000000
46#define EBI1_MAX_SIZE 0x400000
47
48#define EBI1_READ_DATA8(Addr) *((volatile unsigned char *)(EBI1_BASE_ADDR+Addr))
49#define EBI1_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI1_BASE_ADDR+Addr))=Data
50#define EBI1_READ_DATA16(Addr) *((volatile unsigned short *)(EBI1_BASE_ADDR+Addr))
51#define EBI1_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI1_BASE_ADDR+Addr))=Data
52#define EBI1_READ_DATA32(Addr) *((volatile unsigned int *)(EBI1_BASE_ADDR+Addr))
53#define EBI1_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI1_BASE_ADDR+Addr))=Data
54
55/* Bank-2 constants */
56#define EBI2_BASE_ADDR 0x68000000
57#define EBI2_MAX_SIZE 0x400000
58
59#define EBI2_READ_DATA8(Addr) *((volatile unsigned char *)(EBI2_BASE_ADDR+Addr))
60#define EBI2_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI2_BASE_ADDR+Addr))=Data
61#define EBI2_READ_DATA16(Addr) *((volatile unsigned short *)(EBI2_BASE_ADDR+Addr))
62#define EBI2_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI2_BASE_ADDR+Addr))=Data
63#define EBI2_READ_DATA32(Addr) *((volatile unsigned int *)(EBI2_BASE_ADDR+Addr))
64#define EBI2_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI2_BASE_ADDR+Addr))=Data
65
66/* Bank-3 constants */
67#define EBI3_BASE_ADDR 0x6C000000
68#define EBI3_MAX_SIZE 0x400000
69
70#define EBI3_READ_DATA8(Addr) *((volatile unsigned char *)(EBI3_BASE_ADDR+Addr))
71#define EBI3_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI3_BASE_ADDR+Addr))=Data
72#define EBI3_READ_DATA16(Addr) *((volatile unsigned short *)(EBI3_BASE_ADDR+Addr))
73#define EBI3_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI3_BASE_ADDR+Addr))=Data
74#define EBI3_READ_DATA32(Addr) *((volatile unsigned int *)(EBI3_BASE_ADDR+Addr))
75#define EBI3_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI3_BASE_ADDR+Addr))=Data
76
77
78/* Constants for EBI bank number */
79#define EBI_BANK0 0
80#define EBI_BANK1 0x1
81#define EBI_BANK2 0x2
82#define EBI_BANK3 0x3
83
84/* Constants for EBI CS Active Level */
85#define EBI_CS_ACTIVE_HIGH 1
86#define EBI_CS_ACTIVE_LOW 0
87
88/* Constants for EBI data bus width */
89#define EBI_BUSWIDTH_8BIT 8
90#define EBI_BUSWIDTH_16BIT 16
91
92/* Constants for EBI separate mode */
93#define EBI_SEPARATEMODE_ENABLE 0x1
94#define EBI_SEPARATEMODE_DISABLE 0
95
96/* Constants for EBI MCLK divider */
97#define EBI_MCLKDIV_1 0
98#define EBI_MCLKDIV_2 0x1
99#define EBI_MCLKDIV_4 0x2
100#define EBI_MCLKDIV_8 0x3
101#define EBI_MCLKDIV_16 0x4
102#define EBI_MCLKDIV_32 0x5
103
104#define EBI_TIMING_FASTEST 0x0
105#define EBI_TIMING_VERYFAST 0x1
106#define EBI_TIMING_FAST 0x2
107#define EBI_TIMING_NORMAL 0x3
108#define EBI_TIMING_SLOW 0x4
109#define EBI_TIMING_VERYSLOW 0x5
110#define EBI_TIMING_SLOWEST 0x6
111 /* end of group NUC472_442_EBI_EXPORTED_CONSTANTS */
113
114
118 void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel);
119 void EBI_Close(uint32_t u32Bank);
120 void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv);
121 void EBI_EnableCrypto(uint32_t u32Bank, uint32_t *u32Key);
122 void EBI_DisbleCrypto(uint32_t u32Bank);
123
124 /* end of group NUC472_442_EBI_EXPORTED_FUNCTIONS */
126 /* end of group NUC472_442_EBI_Driver */
128 /* end of group NUC472_442_Device_Driver */
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif //__EBI_H__
136
137/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
EBI_EnableCrypto
void EBI_EnableCrypto(uint32_t u32Bank, uint32_t *u32Key)
Enable encrypt/decrypt function and set key for EBI bank 0~3.
Definition: ebi.c:191
EBI_Close
void EBI_Close(uint32_t u32Bank)
Disable EBI for bank 0~3.
Definition: ebi.c:153
EBI_Open
void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel)
Initialize EBI for Bank 0~3.
Definition: ebi.c:54
EBI_SetBusTiming
void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv)
Set EBI bus timings.
Definition: ebi.c:175
EBI_DisbleCrypto
void EBI_DisbleCrypto(uint32_t u32Bank)
Disable encrypt/decrypt function for EBI bank 0~3.
Definition: ebi.c:225