Data Structures | |
struct | XMC_UART_CH_CONFIG_t |
Macros | |
#define | XMC_UART0_CH0 XMC_USIC0_CH0 |
#define | XMC_UART0_CH1 XMC_USIC0_CH1 |
#define | XMC_UART1_CH0 XMC_USIC1_CH0 |
#define | XMC_UART1_CH1 XMC_USIC1_CH1 |
#define | XMC_UART2_CH0 XMC_USIC2_CH0 |
#define | XMC_UART2_CH1 XMC_USIC2_CH1 |
Enumerations | |
enum | XMC_UART_CH_EVENT_t |
enum | XMC_UART_CH_INPUT_SAMPLING_FREQ_t |
enum | XMC_UART_CH_INPUT_t |
enum | XMC_UART_CH_INTERRUPT_NODE_POINTER_t |
enum | XMC_UART_CH_STATUS_FLAG_t |
enum | XMC_UART_CH_STATUS_t |
The UART driver uses Universal Serial Interface Channel(USIC) module to implement UART protocol. It provides APIs to configure USIC channel for UART communication. The driver enables the user in getting the status of UART protocol events, configuring interrupt service requests, protocol related parameter configuration etc.
UART driver features:
#define XMC_UART0_CH0 XMC_USIC0_CH0 |
USIC0 channel 0 base address
#define XMC_UART0_CH1 XMC_USIC0_CH1 |
USIC0 channel 1 base address
#define XMC_UART1_CH0 XMC_USIC1_CH0 |
USIC1 channel 0 base address
#define XMC_UART1_CH1 XMC_USIC1_CH1 |
USIC1 channel 1 base address
#define XMC_UART2_CH0 XMC_USIC2_CH0 |
USIC2 channel 0 base address
#define XMC_UART2_CH1 XMC_USIC2_CH1 |
USIC2 channel 1 base address
enum XMC_UART_CH_EVENT_t |
UART configuration events. The enums can be used for configuring events using the CCR register.
enum XMC_UART_CH_INPUT_t |
UART channel interrupt node pointers
UART portocol status. The enum values can be used for getting the status of UART channel.
enum XMC_UART_CH_STATUS_t |
void XMC_UART_CH_ClearStatusFlag | ( | XMC_USIC_CH_t *const | channel, |
const uint32_t | flag | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
flag | UART events to be cleared. Range: Use XMC_UART_CH_STATUS_FLAG_t enumerations for event bitmasks. XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc. |
void XMC_UART_CH_DisableDataTransmission | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
void XMC_UART_CH_DisableEvent | ( | XMC_USIC_CH_t *const | channel, |
const uint32_t | event | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
event | Bitmask of events to disable. Use the type XMC_UART_CH_EVENT_t for naming events. Range: XMC_UART_CH_EVENT_RECEIVE_START, XMC_UART_CH_EVENT_DATA_LOST, XMC_UART_CH_EVENT_TRANSMIT_SHIFT, XMC_UART_CH_EVENT_TRANSMIT_BUFFER, etc. |
void XMC_UART_CH_DisableInputDigitalFilter | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_DisableInputInversion | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_DisableInputSync | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_DisableMasterClock | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
void XMC_UART_CH_EnableDataTransmission | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
void XMC_UART_CH_EnableEvent | ( | XMC_USIC_CH_t *const | channel, |
const uint32_t | event | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
event | Event bitmasks to enable. Use the type XMC_UART_CH_EVENT_t for naming events. Range: XMC_UART_CH_EVENT_RECEIVE_START, XMC_UART_CH_EVENT_DATA_LOST, XMC_UART_CH_EVENT_TRANSMIT_SHIFT, XMC_UART_CH_EVENT_TRANSMIT_BUFFER, etc. |
void XMC_UART_CH_EnableInputDigitalFilter | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_EnableInputInversion | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_EnableInputSync | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
void XMC_UART_CH_EnableMasterClock | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
uint16_t XMC_UART_CH_GetReceivedData | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
uint32_t XMC_UART_CH_GetStatusFlag | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
void XMC_UART_CH_Init | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_CONFIG_t *const | config | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0, XMC_UART1_CH1,XMC_UART2_CH0, XMC_UART2_CH1 |
config | Constant pointer to UART configuration structure of type XMC_UART_CH_CONFIG_t. |
void XMC_UART_CH_InitEx | ( | XMC_USIC_CH_t * | channel, |
const XMC_UART_CH_CONFIG_t *const | config, | ||
bool | init_brg | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0, XMC_UART1_CH1,XMC_UART2_CH0, XMC_UART2_CH1 |
config | Constant pointer to UART configuration structure of type XMC_UART_CH_CONFIG_t. |
init_brg | Selects if the baudrate generator should be configured automatically. |
void XMC_UART_CH_SelectInterruptNodePointer | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INTERRUPT_NODE_POINTER_t | interrupt_node, | ||
const uint32_t | service_request | ||
) |
channel | Pointer to USIC channel handler of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
interrupt_node | Interrupt node pointer to be configured. Range: XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. |
service_request | Service request number. Range: 0 to 5. |
XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate | ( | XMC_USIC_CH_t *const | channel, |
uint32_t | rate, | ||
uint32_t | oversampling | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1 ,XMC_UART1_CH0, XMC_UART1_CH1, XMC_UART2_CH0, XMC_UART2_CH1 |
rate | Desired baudrate. Range: minimum value = 100, maximum value depends on the peripheral clock frequency and oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) |
oversampling | Required oversampling. The value indicates the number of time quanta for one symbol of data. This can be related to the number of samples for each logic state of the data signal. Range: 4 to 32. Value should be chosen based on the protocol used. |
XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrateEx | ( | XMC_USIC_CH_t *const | channel, |
uint32_t | rate, | ||
uint32_t | oversampling, | ||
bool | normal_divider_mode | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1 ,XMC_UART1_CH0, XMC_UART1_CH1, XMC_UART2_CH0, XMC_UART2_CH1 |
rate | Desired baudrate. Range: minimum value = 100, maximum value depends on the peripheral clock frequency and oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) |
oversampling | Required oversampling. The value indicates the number of time quanta for one symbol of data. This can be related to the number of samples for each logic state of the data signal. Range: 4 to 32. Value should be chosen based on the protocol used. |
normal_divider_mode | Selects normal divider mode for baudrate generator instead of default fractional divider decreasing jitter of signal at the cost of frequency selection |
void XMC_UART_CH_SetFrameLength | ( | XMC_USIC_CH_t *const | channel, |
const uint8_t | frame_length | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
frame_length | Number of data bits in each UART frame. Range: minimum= 1, maximum= 64. |
void XMC_UART_CH_SetInputSamplingFreq | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input, | ||
const XMC_UART_CH_INPUT_SAMPLING_FREQ_t | sampling_freq | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). |
sampling_freq | Input sampling frequency. Range: XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH, XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER. |
void XMC_UART_CH_SetInputSource | ( | XMC_USIC_CH_t *const | channel, |
const XMC_UART_CH_INPUT_t | input, | ||
const uint8_t | source | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
input | UART channel input stage of type XMC_UART_CH_INPUT_t. Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5). | ||||||||||||||||
source | Input source select for the input stage. The table provided below maps the decimal value with the input source.
|
void XMC_UART_CH_SetInterruptNodePointer | ( | XMC_USIC_CH_t *const | channel, |
const uint8_t | service_request | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
service_request | Service request number for generating protocol interrupts. Range: 0 to 5. |
void XMC_UART_CH_SetPulseLength | ( | XMC_USIC_CH_t *const | channel, |
const uint8_t | pulse_length | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
pulse_length | Length of the zero pulse in number of time quanta. Range: 0 to 7. |
void XMC_UART_CH_SetSamplePoint | ( | XMC_USIC_CH_t *const | channel, |
const uint32_t | sample_point | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
sample_point | Sample point among the number of samples. Range: minimum= 0, maximum= oversampling (DCTQ). |
void XMC_UART_CH_SetWordLength | ( | XMC_USIC_CH_t *const | channel, |
const uint8_t | word_length | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
word_length | Data word length. Range: minimum= 1, maximum= 16. |
void XMC_UART_CH_Start | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
XMC_UART_CH_STATUS_t XMC_UART_CH_Stop | ( | XMC_USIC_CH_t *const | channel | ) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
void XMC_UART_CH_Transmit | ( | XMC_USIC_CH_t *const | channel, |
const uint16_t | data | ||
) |
channel | Constant pointer to USIC channel handle of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
data | Data to be transmitted. Range: 16 bit unsigned data within the range 0 to 65535. Actual size of data transmitted depends on the configured number of bits for the UART protocol in the register SCTR. |
void XMC_UART_CH_TriggerServiceRequest | ( | XMC_USIC_CH_t *const | channel, |
const uint32_t | service_request_line | ||
) |
channel | Pointer to USIC channel handler of type XMC_USIC_CH_t Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1 |
service_request_line | service request number of the event to be triggered. Range: 0 to 5. |