libpynq
(release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
|
Go to the documentation of this file.
28 #define UART_REG_RECEIVE_FIFO 0
29 #define UART_REG_TRANSMIT_FIFO 1
30 #define UART_REG_STATUS 2
31 #define UART_REG_CONTROL 3
33 #define UART_REG_STATUS_BIT_RX_FIFO_HAS_DATA 1
34 #define UART_REG_STATUS_BIT_RX_FIFO_FULL 2
35 #define UART_REG_STATUS_BIT_TX_FIFO_EMPTY 4
36 #define UART_REG_STATUS_BIT_TX_FIFO_FULL 8
38 #define UART_REG_CONTROL_BIT_CLEAR_TX_FIFO 1
39 #define UART_REG_CONTROL_BIT_CLEAR_RX_FIFO 2
40 #define UART_REG_CONTROL_BIT_CLEAR_FIFOS \
41 (UART_REG_CONTROL_BIT_CLEAR_RX_FIFO | UART_REG_CONTROL_BIT_CLEAR_TX_FIFO)
44 static volatile uint32_t *uart_ptrs[
NUM_UARTS] = {
55 }
else if (uart ==
UART1) {
65 if (uart_ptrs[uart] == NULL) {
66 pynq_error(
"UART%d has not been initialized.\n", uart);
69 uart_ptrs[uart] = NULL;
72 void uart_send(
const int uart,
const uint8_t data) {
76 if (uart_ptrs[uart] == NULL) {
77 pynq_error(
"UART%d has not been initialized.\n", uart);
89 if (uart_ptrs[uart] == NULL) {
90 pynq_error(
"UART%d has not been initialized.\n", uart);
102 if (uart_ptrs[uart] == NULL) {
103 pynq_error(
"UART%d has not been initialized.\n", uart);
114 if (uart_ptrs[uart] == NULL) {
115 pynq_error(
"UART%d has not been initialized.\n", uart);
125 if (uart_ptrs[uart] == NULL) {
126 pynq_error(
"UART%d has not been initialized.\n", uart);
#define UART_REG_TRANSMIT_FIFO
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...
#define UART_REG_CONTROL_BIT_CLEAR_FIFOS
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...
bool uart_has_space(const int uart)
Check if the transmit FIFO for the specified UART index has space available.
void arm_shared_close(arm_shared *handle)
#define UART_REG_STATUS_BIT_TX_FIFO_FULL
#define UART_REG_STATUS_BIT_RX_FIFO_HAS_DATA
void uart_reset_fifos(const int uart)
This function resets both the transmit and receive FIFOs of the UART specified by the uart parameter....
void uart_destroy(const int uart)
Close the shared memory handle for the specified UART index.
void * arm_shared_init(arm_shared *handle, const uint32_t address, const uint32_t length)
#define UART_REG_RECEIVE_FIFO
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...
bool uart_has_data(const int uart)
Check if the receive FIFO for the specified UART index has data available.