XCORE SDK
XCORE Software Development Kit
Classes | Typedefs | Functions
rtos_uart_tx_driver

Classes

struct  rtos_uart_tx_struct
 

Typedefs

typedef struct rtos_uart_tx_struct rtos_uart_tx_t
 

Functions

void rtos_uart_tx_write (rtos_uart_tx_t *ctx, const uint8_t buf[], size_t n)
 
void rtos_uart_tx_init (rtos_uart_tx_t *ctx, const port_t tx_port, const uint32_t baud_rate, const uint8_t num_data_bits, const uart_parity_t parity, const uint8_t stop_bits, hwtimer_t tmr)
 
void rtos_uart_tx_start (rtos_uart_tx_t *ctx)
 

Detailed Description

The public API for using the RTOS UART tx driver.

Typedef Documentation

◆ rtos_uart_tx_t

Typedef to the RTOS UART tx driver instance struct.

Function Documentation

◆ rtos_uart_tx_init()

void rtos_uart_tx_init ( rtos_uart_tx_t ctx,
const port_t  tx_port,
const uint32_t  baud_rate,
const uint8_t  num_data_bits,
const uart_parity_t  parity,
const uint8_t  stop_bits,
hwtimer_t  tmr 
)

Initialises an RTOS UART tx driver instance. This must only be called by the tile that owns the driver instance. It may be called either before or after starting the RTOS, but must be called before calling rtos_uart_tx_start() or any of the core UART tx driver functions with this instance.

Parameters
ctxA pointer to the UART tx driver instance to initialise.
tx_portThe port containing the transmit pin
baud_rateThe baud rate of the UART in bits per second.
num_data_bitsThe number of data bits per frame sent.
parityThe type of parity used. See uart_parity_t above.
stop_bitsThe number of stop bits asserted at the of the frame.
tmrThe resource id of the timer to be used by the UART tx.

◆ rtos_uart_tx_start()

void rtos_uart_tx_start ( rtos_uart_tx_t ctx)

Starts an RTOS UART tx driver instance. This must only be called by the tile that owns the driver instance. It may be called either before or after starting the RTOS, but must be called before any of the core UART tx driver functions are called with this instance.

rtos_uart_tx_init() must be called on this UART tx driver instance prior to calling this.

Parameters
ctxA pointer to the UART tx driver instance to start.

◆ rtos_uart_tx_write()

void rtos_uart_tx_write ( rtos_uart_tx_t ctx,
const uint8_t  buf[],
size_t  n 
)
inline

Writes data to an initialized and started UART instance. Unlike the UART rx, an xcore logical core is not reserved. The UART transmission is a function call and the the function blocks until the stop bit of the last byte to be transmittted has completed. Interrupts are masked during this time to avoid stretching of the waveform. Consequently, the tx consumes cycles from the caller thread.

Parameters
ctxA pointer to the UART Tx driver instance to use.
bufThe buffer containing data to write.
nThe number of bytes to write.