The following describes the shared API between the UART RX Server and UART TX Server code.
Define the parity configuration.
Enum Values:
Configure the number of stop bits.
Enum Values:
Start bit polarity configuration (currently unused).
Enum Values:
Configure and run the Multi-UART TX & RX server threads using internal clocks for TX & RX.
Parameters: |
|
---|
Configure and run the Multi-UART TX & RX server threads using an external clock for TX.
Parameters: |
|
---|
The following describes the public API for use in applications and the API’s usage.
The file multi_uart_tx_conf.h must be provided in the application source code. This file should comprise of the following defines:
UART_TX_USE_EXTERNAL_CLOCK
Define whether to use an external clock reference for transmit - do not define this if using the internal clocking
UART_TX_CHAN_COUNT
Define the number of channels that are to be supported, must fit in the port. Also, must be a power of 2 (i.e. 1,2,4,8) - not all channels have to be utilised
UART_TX_CLOCK_RATE_HZ
This defines the master clock rate - if using an external clock then set this appropriately (e.g. 1843200 for a 1.8432MHz external clock)
UART_TX_MAX_BAUD
Define the maximum application baud rate - this implementation is validated to 115200 baud
UART_TX_CLOCK_DIVIDER
This should be defined as (UART_TX_CLOCK_RATE_HZ/UART_TX_MAX_BAUD_RATE). But some use cases may require a custom divide.
UART_TX_OVERSAMPLE
Define the oversampling of the clock - this is where the UART_TX_CLOCK_DIVIDER is > 255 (otherwise set to 1) - only used when using an internal clock reference
UART_TX_BUF_SIZE
Define the buffer size in UART word entries - needs to be a power of 2 (i.e. 1,2,4,8,16,32)
UART_TX_IFB
Define the number of interframe bits
Structure used to hold ports - used to enable extensibility in the future.
Structure Members:
Structure to hold configuration information and data for the UART channel TX side - this should only be interacted with via the API and not accessed directly.
Configure the UART channel.
Parameters: |
|
---|---|
Returns: | Return 0 on success |
Pause the Multi-UART TX thread for reconfiguration.
Parameters: |
|
---|
Release the UART into normal operation - must be called after uart_tx_reconf_pause.
Parameters: |
|
---|
Assemble full word for transmission.
Parameters: |
|
---|---|
Returns: | Full UART word in the format (msb -> lsb) STOP|PARITY|DATA|START |
Assemble UART word from UART Character and insert into the appropriate UART buffer.
Parameters: |
|
---|---|
Returns: | 0 for OK, -1 for buffer full |
The following describes the public API for use in applications and the API’s usage.
The file multi_uart_rx_conf.h must be provided in the application source code. This file should comprise of the following defines:
UART_RX_CHAN_COUNT
Define the number of channels that are to be supported, must fit in the port. Also, must be a power of 2 (i.e. 1,2,4,8) - not all channels have to be utilised
UART_RX_CLOCK_RATE_HZ
This defines the master clock rate - in this implementation this is the system clock in Hertz. This should be 100000000.
UART_RX_MAX_BAUD
Define the maximum application baud rate - this implementation is validated to 115200 baud
UART_RX_CLOCK_DIVIDER
This should be defined as (UART_RX_CLOCK_RATE_HZ/UART_RX_MAX_BAUD). But some use cases may require a custom divide.
UART_RX_OVERSAMPLE
Define receive oversample for maximum baud rate. This should be left at 4.
Structure used to hold ports - used to enable extensibility in the future.
Structure Members:
Structure to hold configuration information and data for the UART channel RX side - this should only be interacted with via the API and not accessed directly.
Structure Members:
length of the UART character
number of bits in UART word e.g.
Start bit + 8 bit data + parity + 2 stop bits is a 12 bit UART word
define baud rate in relation to max baud rate
define if output is inverted (set to 1)
sample in bit stream to use
Stop bit configuration.
Parity mode configuration.
Polarity mode of start/stop bits.
Configure the UART channel.
Parameters: |
|
---|---|
Returns: | Return 0 on success |
Pause the UART via channel for reconfiguration.
Parameters: |
|
---|
Release the UART into normal operation - must be called after uart_rx_reconf_pause.
Parameters: |
|
---|
Validate received UART word according to channel configuration and provide a cleaned UART character.
Parameters: |
|
---|---|
Returns: | Return 0 on valid data, -1 on validation fail |
This API provides a number of functions that allow the access of architecture specific functionality within C where XC semantics are not available.
Get time from timer.
Parameters: |
|
---|---|
Returns: | timestamp from timer |
Wait for a time period defined by delta.
Parameters: |
|
---|---|
Returns: | timestamp on completion of pause |
Wait until a specific time stamp.
Parameters: |
|
---|---|
Returns: | timestamp on completion of pause |
Send integer value across a streaming channel end.
Parameters: |
|
---|
Get unsigned integer from streaming chanend.
Parameters: |
|
---|---|
Returns: | value received over the channel |
Get token from streaming chanend.
Parameters: |
|
---|---|
Returns: | token received over channel |