mbed library sources

Fork of mbed-src by mbed official

Embed: (wiki syntax)

« Back to documentation index

Asynchronous Serial Hardware Abstraction Layer

Asynchronous Serial Hardware Abstraction Layer

Functions

int serial_tx_asynch (serial_t *obj, void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
 Begin asynchronous TX transfer.
void serial_rx_asynch (serial_t *obj, void *rx, size_t rx_length, uint8_t rx_width, uint32_t handler, uint32_t event, uint8_t char_match, DMAUsage hint)
 Begin asynchronous RX transfer (enable interrupt for data collecting) The used buffer is specified in the serial object - rx_buff.
uint8_t serial_tx_active (serial_t *obj)
 Attempts to determine if the serial peripheral is already in use for TX.
uint8_t serial_rx_active (serial_t *obj)
 Attempts to determine if the serial peripheral is already in use for RX.
int serial_irq_handler_asynch (serial_t *obj)
 The asynchronous TX and RX handler.
void serial_tx_abort_asynch (serial_t *obj)
 Abort the ongoing TX transaction.
void serial_rx_abort_asynch (serial_t *obj)
 Abort the ongoing RX transaction It disables the enabled interrupt for RX and flush RX hardware buffer if RX FIFO is used.

Function Documentation

int serial_irq_handler_asynch ( serial_t obj )

The asynchronous TX and RX handler.

Parameters:
objThe serial object
Returns:
Returns event flags if a RX transfer termination condition was met or 0 otherwise
void serial_rx_abort_asynch ( serial_t obj )

Abort the ongoing RX transaction It disables the enabled interrupt for RX and flush RX hardware buffer if RX FIFO is used.

Parameters:
objThe serial object
uint8_t serial_rx_active ( serial_t obj )

Attempts to determine if the serial peripheral is already in use for RX.

Parameters:
objThe serial object
Returns:
Non-zero if the RX transaction is ongoing, 0 otherwise
void serial_rx_asynch ( serial_t obj,
void *  rx,
size_t  rx_length,
uint8_t  rx_width,
uint32_t  handler,
uint32_t  event,
uint8_t  char_match,
DMAUsage  hint 
)

Begin asynchronous RX transfer (enable interrupt for data collecting) The used buffer is specified in the serial object - rx_buff.

Parameters:
objThe serial object
rxThe buffer for sending
rx_lengthThe number of words to transmit
rx_widthThe bit width of buffer word
handlerThe serial handler
eventThe logical OR of events to be registered
handlerThe serial handler
char_matchA character in range 0-254 to be matched
hintA suggestion for how to use DMA with this transfer
void serial_tx_abort_asynch ( serial_t obj )

Abort the ongoing TX transaction.

It disables the enabled interupt for TX and flush TX hardware buffer if TX FIFO is used

Parameters:
objThe serial object
uint8_t serial_tx_active ( serial_t obj )

Attempts to determine if the serial peripheral is already in use for TX.

Parameters:
objThe serial object
Returns:
Non-zero if the RX transaction is ongoing, 0 otherwise
int serial_tx_asynch ( serial_t obj,
void *  tx,
size_t  tx_length,
uint8_t  tx_width,
uint32_t  handler,
uint32_t  event,
DMAUsage  hint 
)

Begin asynchronous TX transfer.

The used buffer is specified in the serial object, tx_buff

Parameters:
objThe serial object
txThe buffer for sending
tx_lengthThe number of words to transmit
tx_widthThe bit width of buffer word
handlerThe serial handler
eventThe logical OR of events to be registered
hintA suggestion for how to use DMA with this transfer
Returns:
Returns number of data transfered, or 0 otherwise