![]() |
Synergy Software Package User's Manual
|
Driver for the UART on SCI. More...
Data Structures | |
| struct | sci_uart_instance_ctrl_t |
| struct | uart_on_sci_cfg_t |
Enumerations | |
| enum | sci_clk_src_t { SCI_CLK_SRC_INT, SCI_CLK_SRC_EXT, SCI_CLK_SRC_EXT8X, SCI_CLK_SRC_EXT16X } |
| enum | sci_uart_rx_fifo_trigger_t { SCI_UART_RX_FIFO_TRIGGER_1 = 0x1, SCI_UART_RX_FIFO_TRIGGER_MAX = 0xF } |
Functions | |
| ssp_err_t | R_SCI_UartOpen (uart_ctrl_t *const p_api_ctrl, uart_cfg_t const *const p_cfg) |
| ssp_err_t | R_SCI_UartClose (uart_ctrl_t *const p_api_ctrl) |
| ssp_err_t | R_SCI_UartRead (uart_ctrl_t *const p_api_ctrl, uint8_t const *const p_dest, uint32_t const bytes) |
| ssp_err_t | R_SCI_UartWrite (uart_ctrl_t *const p_api_ctrl, uint8_t const *const p_src, uint32_t const bytes) |
| ssp_err_t | R_SCI_UartBaudSet (uart_ctrl_t *const p_api_ctrl, uint32_t const baudrate) |
| ssp_err_t | R_SCI_UartInfoGet (uart_ctrl_t *const p_api_ctrl, uart_info_t *const p_info) |
| ssp_err_t | R_SCI_UartVersionGet (ssp_version_t *p_version) |
| ssp_err_t | R_SCI_UartAbort (uart_ctrl_t *const p_api_ctrl, uart_dir_t communication_to_abort) |
Driver for the UART on SCI.
This module supports the UART on SCI. It implements the UART interface and drives SCI as a full-duplex UART communication port. This module can drive all SCI channels as UART ports.
Extends UART Interface.
| enum sci_clk_src_t |
| ssp_err_t R_SCI_UartAbort | ( | uart_ctrl_t *const | p_api_ctrl, |
| uart_dir_t | communication_to_abort | ||
| ) |
Provides API to abort ongoing transfer. Transmission is aborted after the current character is transmitted. Reception is still enabled after abort(). Any characters received after abort() and before the transfer is reset in the next call to read(), will arrive via the callback function with event UART_EVENT_RX_CHAR.
| SSP_SUCCESS | UART transaction aborted successfully. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL. |
| SSP_ERR_NOT_OPEN | The control block has not been opened. |
| SSP_ERR_UNSUPPORTED | The requested Abort direction is unsupported. |
| ssp_err_t R_SCI_UartBaudSet | ( | uart_ctrl_t *const | p_api_ctrl, |
| uint32_t const | baudrate | ||
| ) |
Updates the baud rate.
| SSP_SUCCESS | Baud rate was successfully changed. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL or the UART is not configured to use the internal clock. |
| SSP_ERR_INVALID_ARGUMENT | Illegal baud rate value is specified. |
| SSP_ERR_NOT_OPEN | The control block has not been opened |
Calculate new baud rate register settings.
Disables transmitter and receiver. This terminates any in-progress transmission.
Apply new baud rate register settings.
Enable receiver.
If the channel has no FIFO, enable transmitter.
| ssp_err_t R_SCI_UartClose | ( | uart_ctrl_t *const | p_api_ctrl | ) |
Disables interrupts, receiver, and transmitter. Closes lower level transfer drivers if used. Removes power and releases hardware lock.
| SSP_SUCCESS | Channel successfully closed. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL. |
| SSP_ERR_NOT_OPEN | The control block has not been opened |
Mark the channel not open so other APIs cannot use it.
Disable interrupts, receiver, and transmitter.
If reception is enabled at build time, disable reception irqs.
If transmission is enabled at build time, disable transmission irqs.
Disable baud clock output.
Close the lower level transfer instances.
Clear control block parameters.
Remove power to the channel.
Unlock the SCI channel.
| ssp_err_t R_SCI_UartInfoGet | ( | uart_ctrl_t *const | p_api_ctrl, |
| uart_info_t *const | p_info | ||
| ) |
Provides the driver information, including the maximum number of bytes that can be received or transmitted at a time.
| SSP_SUCCESS | Information stored in provided p_info. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL. |
| SSP_ERR_NOT_OPEN | The control block has not been opened |
Store number of bytes that can be read at a time.
Store number of bytes that can be written at a time.
| ssp_err_t R_SCI_UartOpen | ( | uart_ctrl_t *const | p_api_ctrl, |
| uart_cfg_t const *const | p_cfg | ||
| ) |
Configures the UART driver based on the input configurations. If reception is enabled at compile time, reception is enabled at the end of this function.
| SSP_SUCCESS | Channel opened successfully. |
| SSP_ERR_ASSERTION | Pointer to UART control block or configuration structure is NULL. |
| SSP_ERR_INVALID_ARGUMENT | Invalid parameter setting found in the configuration structure. |
| SSP_ERR_IN_USE | Control block has already been opened or channel is being used by another instance. Call close() then open() to reconfigure. |
| SSP_ERR_IRQ_BSP_DISABLED | A required interrupt does not exist in the vector table |
Make sure this channel exists.
Reserve the hardware lock.
Determine if this channel has a FIFO.
Calculate the baud rate register settings.
Configure the interrupts.
Configure the transfer interface for transmission and reception if provided.
Configuration of driver enable pin for rs485 communication mode.
Enable the SCI channel and reset the registers to their initial state.
Set the default level of the TX pin to 1.
Set the baud rate registers.
Set the UART configuration settings provided in uart_cfg_t and uart_on_sci_cfg_t.
If reception is enabled at build time, enable reception.
| ssp_err_t R_SCI_UartRead | ( | uart_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_dest, | ||
| uint32_t const | bytes | ||
| ) |
Receives user specified number of bytes into destination buffer pointer.
| SSP_SUCCESS | Data reception successfully ends. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL. Number of transfers outside the max or min boundary when transfer instance used |
| SSP_ERR_INVALID_ARGUMENT | Destination address or data size is not valid for 9-bit mode. |
| SSP_ERR_NOT_OPEN | The control block has not been opened |
| SSP_ERR_IN_USE | A previous read operation is still in progress. |
| SSP_ERR_UNSUPPORTED | SCI_UART_CFG_RX_ENABLE is set to 0 |
Configure transfer instance to receive the requested number of bytes if transfer is used for reception.
| ssp_err_t R_SCI_UartVersionGet | ( | ssp_version_t * | p_version | ) |
Provides API and code version in the user provided pointer.
| [in] | p_version | Version number set here |
| SSP_SUCCESS | Version information stored in provided p_version. |
| SSP_ERR_ASSERTION | p_version is NULL. |
| ssp_err_t R_SCI_UartWrite | ( | uart_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_src, | ||
| uint32_t const | bytes | ||
| ) |
Transmits user specified number of bytes from the source buffer pointer.
| SSP_SUCCESS | Data transmission finished successfully. |
| SSP_ERR_ASSERTION | Pointer to UART control block is NULL. Number of transfers outside the max or min boundary when transfer instance used |
| SSP_ERR_INVALID_ARGUMENT | Source address or data size is not valid for 9-bit mode. |
| SSP_ERR_NOT_OPEN | The control block has not been opened |
| SSP_ERR_IN_USE | A UART transmission is in progress |
| SSP_ERR_UNSUPPORTED | SCI_UART_CFG_TX_ENABLE is set to 0 |
Set the Driver Enable pin in RS485 half duplex mode to enable transmission.
Transmit interrupts must be disabled to start with.
Save data to transmit to the control block. It will be transmitted in the TXI ISR.
If a transfer instance is used for transmission, reset the transfer instance to transmit the requested data.
Clear the Driver Enable pin in RS485 half duplex mode to enable reception in error conditions
Trigger a TXI interrupt. This triggers the transfer instance or a TXI interrupt if the transfer instance is not used.