42 #define UART1_BASE (0x80005000)
43 #define UART2_BASE (0x8000B000)
118 static volatile struct UART_struct *
const UART1 = (
void *) (UART1_BASE);
119 static volatile struct UART_struct *
const UART2 = (
void *) (UART2_BASE);
122 #ifndef REG_NO_COMPAT
127 #define UCON_SAMP_8X 0
128 #define UCON_SAMP_16X 1
132 #define URXCON (0x0c)
133 #define UTXCON (0x10)
135 #define UBRCNT (0x18)
137 #define UART1_UCON ((volatile uint32_t *) ( UART1_BASE + UCON ))
138 #define UART1_USTAT ((volatile uint32_t *) ( UART1_BASE + USTAT ))
139 #define UART1_UDATA ((volatile uint32_t *) ( UART1_BASE + UDATA ))
140 #define UART1_URXCON ((volatile uint32_t *) ( UART1_BASE + URXCON ))
141 #define UART1_UTXCON ((volatile uint32_t *) ( UART1_BASE + UTXCON ))
142 #define UART1_UCTS ((volatile uint32_t *) ( UART1_BASE + UCTS ))
143 #define UART1_UBRCNT ((volatile uint32_t *) ( UART1_BASE + UBRCNT ))
145 #define UART2_UCON ((volatile uint32_t *) ( UART2_BASE + UCON ))
146 #define UART2_USTAT ((volatile uint32_t *) ( UART2_BASE + USTAT ))
147 #define UART2_UDATA ((volatile uint32_t *) ( UART2_BASE + UDATA ))
148 #define UART2_URXCON ((volatile uint32_t *) ( UART2_BASE + URXCON ))
149 #define UART2_UTXCON ((volatile uint32_t *) ( UART2_BASE + UTXCON ))
150 #define UART2_UCTS ((volatile uint32_t *) ( UART2_BASE + UCTS ))
151 #define UART2_UBRCNT ((volatile uint32_t *) ( UART2_BASE + UBRCNT ))
160 #define UART1_TX_BUFFERSIZE 1024
161 extern volatile uint32_t u1_tx_head, u1_tx_tail;
162 void uart1_putc(
char c);
171 #define UART1_RX_BUFFERSIZE 128
172 #if UART1_RX_BUFFERSIZE > 32
173 extern volatile uint32_t u1_rx_head, u1_rx_tail;
174 #define uart1_can_get() ((u1_rx_head!=u1_rx_tail) || (*UART1_URXCON > 0))
176 #define uart1_can_get() (*UART1_URXCON > 0)
178 uint8_t uart1_getc(
void);
181 #define UART2_TX_BUFFERSIZE 1024
182 extern volatile uint32_t u2_tx_head, u2_tx_tail;
183 void uart2_putc(
char c);
185 #define UART2_RX_BUFFERSIZE 128
186 #if UART2_RX_BUFFERSIZE > 32
187 extern volatile uint32_t u2_rx_head, u2_rx_tail;
188 #define uart2_can_get() ((u2_rx_head!=u2_rx_tail) || (*UART2_URXCON > 0))
190 #define uart2_can_get() (*UART2_URXCON > 0)
192 uint8_t uart2_getc(
void);