Low level access functions. More...
Low level access functions.
| 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 ) |
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.
| 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. |
| uart_status_en uart_put_char_blocking | ( | uart_instance_en | id, |
| char | chr, | ||
| uint32_t | timeout ) |
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.
| id | UART Instance ID. |
| chr | Character to transmit |
| timeout | Loop count to wait before timing out |
| uart_status_en uart_get_blocking | ( | uart_instance_en | id, |
| char * | get_buff, | ||
| uint32_t | num, | ||
| uint32_t | timeout ) |
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.
| 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. |
| uart_status_en uart_get_char_blocking | ( | uart_instance_en | id, |
| char * | p_chr, | ||
| uint32_t | timeout ) |
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.
| id | UART Instance ID. |
| p_chr | Pointer to variable where received character will be stored |
| timeout | Loop count to wait before timing out |
| void uart_enable_ints | ( | uart_instance_en | id, |
| uint32_t | mask ) |
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:
| 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.
| uint32_t uart_get_enabled_ints | ( | uart_instance_en | id | ) |
Gets the currently enabled UART interrupts for the specified instance.
| id | UART Instance ID. |
Refer to uart_int_id_en for the list of valid interrupt IDs.
| uart_hw_status_t uart_get_status | ( | uart_instance_en | id | ) |
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.
| id | UART Instance ID. |
| void uart_set_tx_fifo_trigger | ( | uart_instance_en | id, |
| uart_tx_fifo_trigger_en | thres ) |
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.
| 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. |
| void uart_set_rx_fifo_trigger | ( | uart_instance_en | id, |
| uart_rx_fifo_trigger_en | thres ) |
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.
| 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. |
| uart_tx_fifo_trigger_en uart_get_tx_fifo_trigger | ( | uart_instance_en | id | ) |
Gets the transmit FIFO trigger threshold for the specified UART instance.
| id | UART Instance ID. |
| uart_rx_fifo_trigger_en uart_get_rx_fifo_trigger | ( | uart_instance_en | id | ) |
Gets the receive FIFO trigger threshold for the specified UART instance.
| id | UART Instance ID. |
| uint32_t uart_get_num_in_tx_fifo | ( | uart_instance_en | id | ) |
Retrieves the number of bytes currently present in the UART Transmit FIFO.
| id | UART Instance ID. |
| uint32_t uart_get_num_in_rx_fifo | ( | uart_instance_en | id | ) |
Retrieves the number of bytes currently present in the UART Receive FIFO.
| id | UART Instance ID. |
| void uart_put_break | ( | uart_instance_en | id, |
| bool | send_break ) |
Sends or stops sending a break signal on the UART TX line.
| id | UART Instance ID. |
| send_break | Boolean flag to start (True) or stop (False) break |
| uart_int_id_en uart_get_interrupt_id | ( | uart_instance_en | id | ) |
Retrieves the current UART Interrupt Identification value.
| id | UART Instance ID. |
| bool uart_room_to_transmit | ( | uart_instance_en | id | ) |
Checks whether there is room available in the UART transmitter buffer to accept new data.
| id | UART Instance ID. |
| bool uart_recv_char_avail | ( | uart_instance_en | id | ) |
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.
| id | UART Instance ID. |
| void uart_put_char | ( | uart_instance_en | id, |
| char | chr ) |
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.
| id | UART Instance ID. |
| chr | Character to transmit |
| char uart_get_char | ( | uart_instance_en | id | ) |
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.
| id | UART Instance ID. |