29static volatile uint32_t *uart0 = NULL;
30static volatile uint32_t *uart1 = NULL;
35 }
else if (uart ==
UART1) {
45 pynq_error(
"uart_destroy: shared memory has not been instantiated\n");
48 }
else if (uart ==
UART1) {
50 pynq_error(
"uart_destroy: shared memory has not been instantiated\n");
54 pynq_error(
"uart_destroy: channel %d does not exist\n", uart);
60 while ((uart0[2] & 8) == 8)
63 }
else if (uart ==
UART1) {
64 while ((uart1[2] & 8) == 8)
74 while ((uart0[2] & 1) == 0) {
77 }
else if (uart ==
UART1) {
78 while ((uart1[2] & 1) == 0) {
89 return ((uart0[2] & 1) != 0);
90 }
else if (uart ==
UART1) {
91 return ((uart1[2] & 1) != 0);
93 pynq_error(
"uart_has_data: invalid UART %d, must be 0..%d\n", uart,
101 return ((uart0[2] & 8) == 0);
102 }
else if (uart ==
UART1) {
103 return ((uart1[2] & 8) == 0);
105 pynq_error(
"uart_has_space: invalid UART %d, must be 0..%d\n", uart,
114 }
else if (uart ==
UART1) {
117 pynq_error(
"uart_reset_fifos: invalid UART %d, must be 0..%d\n", uart,
void arm_shared_close(arm_shared *handle)
void * arm_shared_init(arm_shared *handle, const uint32_t address, const uint32_t length)
void uart_destroy(const int uart)
Close the shared memory handle for the specified UART index.
void uart_reset_fifos(const int uart)
This function resets both the transmit and receive FIFOs of the UART specified by the uart parameter....
bool uart_has_data(const int uart)
Check if the receive FIFO for the specified UART index has data available.
bool uart_has_space(const int uart)
Check if the transmit FIFO for the specified UART index has space available.
uint8_t uart_recv(const int uart)
Receive a byte of data from the specified UART index by waiting for the receive FIFO to have data and...
void uart_send(const int uart, const uint8_t data)
Send a byte of data on the specified UART index by waiting for the transmit FIFO to have space and th...
void uart_init(const int uart)
Initialize the UART specified by the index with a shared memory handle and a buffer size of 4096 byte...