SmartSnippets DA1459x SDK
Data Structures | Macros | Enumerations | Functions | Variables

Definition of API for the UART Low Level Driver. More...

#include <stdbool.h>
#include <stdint.h>
#include "sdk_defs.h"

Go to the source code of this file.

Data Structures

struct  uart_config
 UART configuration structure definition. More...
 

Macros

#define HW_UART_REG_FIELD_MASK(instance, reg, field)   (UART##instance##_UART##instance##_##reg##_REG_##field##_Msk)
 Get the mask of a field of a UART register. More...
 
#define HW_UART_REG_FIELD_POS(instance, reg, field)   (UART##instance##_UART##instance##_##reg##_REG_##field##_Pos)
 Get the bit position of a field of a UART register. More...
 
#define HW_UART_REG_GETF(id, reg, field)   ((UBA(id)->UART2_##reg##_REG & (UART2_UART2_##reg##_REG_##field##_Msk)) >> (UART2_UART2_##reg##_REG_##field##_Pos))
 Get the value of a field of a UART register. More...
 
#define HW_UART_REG_SETF(id, reg, field, new_val)
 Set the value of a field of a UART register. More...
 
#define HW_UART_DMA_SUPPORT   dg_configUART_DMA_SUPPORT
 DMA support for UART.
 

Enumerations

enum  HW_UART_INT
 Interrupt Identification codes. More...
 
enum  HW_UART_BAUDRATE {
  HW_UART_BAUDRATE_1200 = 0, HW_UART_BAUDRATE_2400 = 1, HW_UART_BAUDRATE_4800 = 2, HW_UART_BAUDRATE_9600 = 3,
  HW_UART_BAUDRATE_14400 = 4, HW_UART_BAUDRATE_19200 = 5, HW_UART_BAUDRATE_28800 = 6, HW_UART_BAUDRATE_38400 = 7,
  HW_UART_BAUDRATE_57600 = 8, HW_UART_BAUDRATE_115200 = 9, HW_UART_BAUDRATE_230400 = 10, HW_UART_BAUDRATE_256000 = 11,
  HW_UART_BAUDRATE_460800 = 12, HW_UART_BAUDRATE_500000 = 13, HW_UART_BAUDRATE_921600 = 14, HW_UART_BAUDRATE_1000000 = 15,
  HW_UART_BAUDRATE_2000000 = 16, HW_UART_BAUDRATE_3000000 = 17, HW_UART_BAUDRATE_MAX
}
 Baud rates. More...
 
enum  HW_UART_DATABITS
 Character format. More...
 
enum  HW_UART_PARITY
 Parity. More...
 
enum  HW_UART_STOPBITS { HW_UART_STOPBITS_1 = 0, HW_UART_STOPBITS_2 = 1 }
 Stop bits. More...
 
enum  HW_UART_ERROR { ,
  HW_UART_ERR_OE = 1, HW_UART_ERR_PE = 2, HW_UART_ERR_FE = 3, HW_UART_ERR_BI = 4,
  HW_UART_ERR_RFE = 5
}
 Uart errors. More...
 
enum  HW_UART_CONFIG_ERR { ,
  HW_UART_CONFIG_ERR_RX_FIFO = 1, HW_UART_CONFIG_ERR_TX_FIFO = 2, HW_UART_CONFIG_ERR_RXTX_FIFO = 3, HW_UART_CONFIG_ERR_RX_SIZE = 4,
  HW_UART_CONFIG_ERR_TX_SIZE = 5
}
 Configuration errors. More...
 

Functions

__STATIC_INLINE bool hw_uart_is_busy (HW_UART_ID uart)
 Check if a serial transfer is in progress. More...
 
uint8_t hw_uart_read (HW_UART_ID uart)
 Read one byte from UART. More...
 
void hw_uart_write (HW_UART_ID uart, uint8_t data)
 Write one byte to UART. More...
 
uint16_t hw_uart_abort_receive (HW_UART_ID uart)
 Stop asynchronous read from UART. More...
 
uint16_t hw_uart_abort_send (HW_UART_ID uart)
 Stop asynchronous transmit from UART. More...
 
uint16_t hw_uart_peek_received (HW_UART_ID uart)
 Get number of bytes currently received by asynchronous read. More...
 
uint16_t hw_uart_peek_transmitted (HW_UART_ID uart)
 Get number of bytes currently sent by asynchronous read. More...
 
__STATIC_INLINE uint8_t hw_uart_rxdata_getf (HW_UART_ID uart)
 Read receive buffer register. More...
 
__STATIC_INLINE void hw_uart_txdata_setf (HW_UART_ID uart, uint8_t data)
 Write byte to the transmit holding register. More...
 
void hw_uart_write_buffer (HW_UART_ID uart, const void *data, uint16_t len)
 Writes number of bytes to UART synchronously. More...
 
HW_UART_CONFIG_ERR hw_uart_send (HW_UART_ID uart, const void *data, uint16_t len, hw_uart_tx_callback cb, void *user_data)
 Write number of bytes to UART. More...
 
HW_UART_CONFIG_ERR hw_uart_receive (HW_UART_ID uart, void *data, uint16_t len, hw_uart_rx_callback cb, void *user_data)
 Read number of bytes from UART. More...
 
void hw_uart_receive_error_checking (HW_UART_ID uart, void *data, uint16_t len, hw_uart_rx_callback cb, void *user_data, hw_uart_err_callback err_cb, void *error_data)
 Read number of bytes from UART with error checking. More...
 
__STATIC_INLINE void hw_uart_rec_data_int_set (HW_UART_ID uart, uint8_t recdataavail)
 Set the Received Data Available interrupt. More...
 
__STATIC_INLINE void hw_uart_tx_empty_int_set (HW_UART_ID uart, uint8_t txempty)
 Set the Transmit Holding Register empty interrupt. More...
 
__STATIC_INLINE void hw_uart_linestat_int_set (HW_UART_ID uart, uint8_t linestat)
 Set the Line Status interrupt. More...
 
__STATIC_INLINE void hw_uart_pthre_int_set (HW_UART_ID uart, uint8_t pthre)
 Set the Programmable THRE interrupt. More...
 
__STATIC_INLINE HW_UART_INT hw_uart_get_interrupt_id (HW_UART_ID uart)
 Get the Interrupt ID. More...
 
__STATIC_INLINE void hw_uart_write_scr (const HW_UART_ID uart, uint8_t value)
 Write Scratch pad register. More...
 
__STATIC_INLINE uint8_t hw_uart_read_scr (const HW_UART_ID uart)
 Read Scratch pad register. More...
 
void hw_uart_set_sclk (const HW_UART_ID uart, bool sclk)
 Configure the serial clock input of the UART (divN or div1) More...
 
HW_UART_BAUDRATE hw_uart_baudrate_get (HW_UART_ID uart)
 Get the baud rate setting. More...
 
void hw_uart_baudrate_set (HW_UART_ID uart, HW_UART_BAUDRATE baud_rate)
 Set the baud rate. More...
 
__STATIC_INLINE bool hw_uart_is_data_ready (HW_UART_ID uart)
 Check if there is data available for read. More...
 
__STATIC_INLINE bool hw_uart_is_fifo_enabled (HW_UART_ID uart)
 Get the FIFO mode setting. More...
 
__STATIC_INLINE void hw_uart_disable_fifo (HW_UART_ID uart)
 Disable both FIFOs. More...
 
__STATIC_INLINE void hw_uart_enable_fifo (HW_UART_ID uart)
 Enable both FIFOs. More...
 
__STATIC_INLINE bool hw_uart_receive_fifo_not_empty (HW_UART_ID uart)
 Check if receive FIFO is not empty. More...
 
__STATIC_INLINE bool hw_uart_transmit_fifo_not_full (HW_UART_ID uart)
 Check if transmit FIFO is not full. More...
 
__STATIC_INLINE bool hw_uart_transmit_fifo_empty (HW_UART_ID uart)
 Check if transmit FIFO is empty. More...
 
__STATIC_INLINE uint16_t hw_uart_receive_fifo_count (HW_UART_ID uart)
 Read number of bytes in receive FIFO. More...
 
__STATIC_INLINE uint16_t hw_uart_transmit_fifo_count (HW_UART_ID uart)
 Read number of bytes in transmit FIFO. More...
 
__STATIC_INLINE void hw_uart_enable_loopback (HW_UART_ID uart)
 Enable loopback. More...
 
__STATIC_INLINE void hw_uart_disable_loopback (HW_UART_ID uart)
 Disable loopback. More...
 
uint8_t hw_uart_fifo_en_getf (HW_UART_ID uart)
 Get the FIFO mode setting. More...
 
__STATIC_INLINE void hw_uart_fifo_en_setf (HW_UART_ID uart, uint8_t en)
 Enable or disable the UART FIFO mode. More...
 
__STATIC_INLINE uint8_t hw_uart_rx_fifo_tr_lvl_getf (HW_UART_ID uart)
 Get the receive FIFO trigger level at which the Received Data Available Interrupt is generated. More...
 
__STATIC_INLINE void hw_uart_rx_fifo_tr_lvl_setf (HW_UART_ID uart, uint8_t tr_lvl)
 Set the receive FIFO trigger level at which the Received Data Available Interrupt is generated. More...
 
uint8_t hw_uart_tx_fifo_tr_lvl_getf (HW_UART_ID uart)
 Get the transmit FIFO trigger level at which the Transmit Holding Register Empty (THRE) Interrupt is generated. More...
 
__STATIC_INLINE void hw_uart_tx_fifo_tr_lvl_setf (HW_UART_ID uart, uint8_t tr_lvl)
 Set the transmit FIFO trigger level at which the Transmit Holding Register Empty (THRE) Interrupt is generated. More...
 
__STATIC_INLINE void hw_uart_tx_fifo_flush (HW_UART_ID uart)
 Reset UART transmit FIFO. More...
 
__STATIC_INLINE void hw_uart_rx_fifo_flush (HW_UART_ID uart)
 Reset UART receive FIFO. More...
 
__STATIC_INLINE bool hw_uart_read_buf_empty (HW_UART_ID uart)
 Check whether reading buffer is empty. More...
 
__STATIC_INLINE bool hw_uart_write_buf_full (HW_UART_ID uart)
 Check whether writing buffer is full. More...
 
__STATIC_INLINE bool hw_uart_transmit_empty (HW_UART_ID uart)
 Check whether transmitter is empty. More...
 
HW_UART_CONFIG_ERR hw_uart_init (HW_UART_ID uart, const uart_config *cfg)
 Set UART line settings. More...
 
void hw_uart_deinit (HW_UART_ID uart)
 Disables UART controller. More...
 
void hw_uart_reinit (HW_UART_ID uart, const uart_config *cfg)
 Re-initialize UART registers. More...
 
void hw_uart_cfg_get (HW_UART_ID uart, uart_config *cfg)
 Get UART line settings. More...
 
uint8_t hw_uart_afce_getf (HW_UART_ID uart)
 Get the Auto Flow Control Enable (AFCE) setting. More...
 
void hw_uart_afce_setf (HW_UART_ID uart, uint8_t afce)
 Enable or disable Auto Flow Control. More...
 
uint8_t hw_uart_loopback_getf (HW_UART_ID uart)
 Get UART diagnostic mode status. More...
 
void hw_uart_loopback_setf (HW_UART_ID uart, uint8_t lb)
 Set UART in diagnostic mode. More...
 
uint8_t hw_uart_rts_getf (HW_UART_ID uart)
 Get RTS output value. More...
 
void hw_uart_rts_setf (HW_UART_ID uart, uint8_t rtsn)
 Set RTS output value. More...
 
HW_UART_ERROR hw_uart_error_getf (HW_UART_ID uart)
 Get the line status register error. More...
 
uint8_t hw_uart_rx_fifo_err_getf (HW_UART_ID uart)
 Get the value of the Receiver FIFO Error bit. More...
 
uint8_t hw_uart_is_tx_fifo_empty (HW_UART_ID uart)
 Get the value of the Transmitter Empty bit. More...
 
uint8_t hw_uart_thr_empty_getf (HW_UART_ID uart)
 Get the value of the Transmit Holding Register Empty bit. More...
 
uint8_t hw_uart_break_int_getf (HW_UART_ID uart)
 Get the value of the Break Interrupt bit. More...
 
uint8_t hw_uart_frame_err_getf (HW_UART_ID uart)
 Get the value of the Framing Error bit. More...
 
uint8_t hw_uart_parity_err_getf (HW_UART_ID uart)
 Get the value of the Parity Error bit. More...
 
uint8_t hw_uart_overrun_err_getf (HW_UART_ID uart)
 Get the value of the Overrun Error bit. More...
 
uint8_t hw_uart_cts_getf (HW_UART_ID uart)
 Get CTS input status. More...
 
uint8_t hw_uart_delta_cts_getf (HW_UART_ID uart)
 Get Delta CTS. More...
 
bool hw_uart_tx_in_progress (const HW_UART_ID uart)
 Check if buffered write is in progress. More...
 
bool hw_uart_rx_in_progress (const HW_UART_ID uart)
 Check if buffered read is in progress. More...
 

Variables

const uint32_t hw_uart_divisor [HW_UART_BAUDRATE_MAX]
 Baud rates dividers. More...
 

Detailed Description

Definition of API for the UART Low Level Driver.

Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates. All rights reserved. Confidential Information.

This software ("Software") is supplied by Renesas Electronics Corporation and/or its affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable, revocable, non-sub-licensable right and license to use the Software, solely if used in or together with Renesas products. You may make copies of this Software, provided this copyright notice and disclaimer ("Notice") is included in all such copies. Renesas reserves the right to change or discontinue the Software at any time without notice.

THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS SOFTWARE.