Low level access functions.
More...
|
| uart_status_en | uart_put_blocking (uart_instance_en id, char *put_buff, uint32_t num, uint32_t timeout, bool wait_for_tx_fifo_drain) |
| |
| uart_status_en | uart_put_char_blocking (uart_instance_en id, char chr, uint32_t timeout) |
| |
| uart_status_en | uart_get_blocking (uart_instance_en id, char *get_buff, uint32_t num, uint32_t timeout) |
| |
| uart_status_en | uart_get_char_blocking (uart_instance_en id, char *p_chr, uint32_t timeout) |
| |
| void | uart_enable_ints (uart_instance_en id, uint32_t mask) |
| |
| uint32_t | uart_get_enabled_ints (uart_instance_en id) |
| |
| uart_hw_status_t | uart_get_status (uart_instance_en id) |
| |
| void | uart_set_tx_fifo_trigger (uart_instance_en id, uart_tx_fifo_trigger_en thres) |
| |
| void | uart_set_rx_fifo_trigger (uart_instance_en id, uart_rx_fifo_trigger_en thres) |
| |
| uart_tx_fifo_trigger_en | uart_get_tx_fifo_trigger (uart_instance_en id) |
| |
| uart_rx_fifo_trigger_en | uart_get_rx_fifo_trigger (uart_instance_en id) |
| |
| uint32_t | uart_get_num_in_tx_fifo (uart_instance_en id) |
| |
| uint32_t | uart_get_num_in_rx_fifo (uart_instance_en id) |
| |
| void | uart_put_break (uart_instance_en id, bool send_break) |
| |
| uart_int_id_en | uart_get_interrupt_id (uart_instance_en id) |
| |
| bool | uart_room_to_transmit (uart_instance_en id) |
| |
| bool | uart_recv_char_avail (uart_instance_en id) |
| |
| void | uart_put_char (uart_instance_en id, char chr) |
| |
| char | uart_get_char (uart_instance_en id) |
| |
Low level access functions.
◆ uart_put_blocking()
Performs a blocking transmit operation over UART for the specified instance. Sends data from the provided buffer and blocks until all bytes are transmitted or the timeout occurs.
- Parameters
-
| id | UART Instance ID. |
| put_buff | Pointer to the buffer containing data to be transmitted. |
| num | Number of bytes to transmit. |
| timeout | Loop count to wait before timing out. |
| wait_for_tx_fifo_drain | If true, wait until all data is fully sent. If false, return after writing to the TX FIFO. |
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_put_char_blocking()
Transmits a single character through UART in a blocking manner for the specified instance.
Waits until there is room in the transmit FIFO to write the character. Uses a loop counter as a timeout mechanism to avoid indefinite blocking if FIFO remains full.
- Parameters
-
| id | UART Instance ID. |
| chr | Character to transmit |
| timeout | Loop count to wait before timing out |
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_get_blocking()
Performs a blocking receive operation over UART for the specified instance. Waits for the specified number of bytes to be received or until the timeout expires.
- Parameters
-
| id | UART Instance ID. |
| get_buff | Pointer to the buffer where received data will be stored. |
| num | Number of bytes to receive. |
| timeout | Loop count to wait before timing out. |
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_get_char_blocking()
Receives a single character from UART in a blocking manner for the specified instance.
Waits until a character is available in the receive FIFO, then reads it into the pointer. Uses a loop counter as a timeout mechanism to prevent indefinite blocking if no char arrives.
- Parameters
-
| id | UART Instance ID. |
| p_chr | Pointer to variable where received character will be stored |
| timeout | Loop count to wait before timing out |
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_enable_ints()
Enables/Disables UART interrupts by setting bits in the IER register for the specified UART instance. Performs a read-modify-write to preserve other control bits.
The interrupt mask bit values:
- 1: Interrupt enable
- 0: Interrupt disable
- Parameters
-
| id | UART Instance ID. |
| mask | Bitmask of UART interrupts to enable/disable. |
Refer to uart_int_id_en for the list of valid interrupt IDs.
- Returns
- None
◆ uart_get_enabled_ints()
Gets the currently enabled UART interrupts for the specified instance.
- Parameters
-
- Returns
- Bitmask of currently enabled UART interrupts.
Refer to uart_int_id_en for the list of valid interrupt IDs.
◆ uart_get_status()
Retrieves the current UART hardware status for the specified instance by reading and combining the USR (UART Status Register) and LSR (Line Status Register). The combined status is returned as a structured bitfield representation.
- Parameters
-
- Returns
- uart_hw_status_t Updated UART hardware status structure.
◆ uart_set_tx_fifo_trigger()
Sets the transmit FIFO trigger threshold for the specified UART instance.
This threshold defines when the UART transmit interrupt is generated based on the number of bytes remaining in the transmit FIFO.
- Parameters
-
| id | UART Instance ID. |
| thres | Threshold value to set for the transmit FIFO trigger. Refer to uart_tx_fifo_trigger_en for the list of TX FIFO trigger levels. |
- Returns
- None
◆ uart_set_rx_fifo_trigger()
Sets the receive FIFO trigger threshold for the specified UART instance.
This threshold defines when the UART receive interrupt is generated based on the number of bytes in the receive FIFO.
- Parameters
-
| id | UART Instance ID. |
| thres | Threshold value to set for the receive FIFO trigger. Refer to uart_rx_fifo_trigger_en for the list of RX FIFO trigger levels. |
- Returns
- None
◆ uart_get_tx_fifo_trigger()
Gets the transmit FIFO trigger threshold for the specified UART instance.
- Parameters
-
- Returns
- uart_tx_fifo_trigger_en The current transmit FIFO trigger threshold value.
◆ uart_get_rx_fifo_trigger()
Gets the receive FIFO trigger threshold for the specified UART instance.
- Parameters
-
- Returns
- uart_rx_fifo_trigger_en The current receive FIFO trigger threshold value.
◆ uart_get_num_in_tx_fifo()
Retrieves the number of bytes currently present in the UART Transmit FIFO.
- Parameters
-
- Returns
- Number of bytes currently stored in the TX FIFO
◆ uart_get_num_in_rx_fifo()
Retrieves the number of bytes currently present in the UART Receive FIFO.
- Parameters
-
- Returns
- Number of bytes currently stored in the RX FIFO
◆ uart_put_break()
Sends or stops sending a break signal on the UART TX line.
- Parameters
-
| id | UART Instance ID. |
| send_break | Boolean flag to start (True) or stop (False) break |
- Returns
- None
◆ uart_get_interrupt_id()
Retrieves the current UART Interrupt Identification value.
- Parameters
-
- Returns
- uart_int_id_en Interrupt ID value indicating the current interrupt source/status
◆ uart_room_to_transmit()
Checks whether there is room available in the UART transmitter buffer to accept new data.
- Parameters
-
- Returns
- True if there is room to transmit, False if there is no room to transmit
◆ uart_recv_char_avail()
Checks if a character has been received by the UART.
This function checks the Data Ready (DR) bit in the Line Status Register (LSR) to determine whether data is available in the UART receive FIFO.
- Parameters
-
- Returns
- True if data is available to be read, False if no data is available.
◆ uart_put_char()
Writes a single character to the UART transmit holding register without checking if there is room.
This function writes a character directly to the UART's Transmit Holding Register (THR), initiating transmission if the UART is ready. It does not check whether there is room available before writing; calling code must ensure the transmitter is ready.
- Parameters
-
| id | UART Instance ID. |
| chr | Character to transmit |
- Returns
- None
◆ uart_get_char()
Reads a single character from the UART receive buffer without checking if there is data available or not.
This function reads the next available character from the UART's Receive Buffer Register (RBR). It assumes that data is already available to read.
- Parameters
-
- Returns
- The received character from the UART