BSPACM  20150113
Board Support Package for ARM Cortex-M Microcontrollers
Data Fields
sBSPACMperiphUARToperations Struct Reference

#include <bspacm/periph/uart.h>

Data Fields

int(* configure )(sBSPACMperiphUARTstate *usp, const sBSPACMperiphUARTconfiguration *cfgp)
 
int(* hw_transmit )(sBSPACMperiphUARTstate *usp, uint8_t v)
 
void(* hw_txien )(sBSPACMperiphUARTstate *usp, int enablep)
 
int(* fifo_state )(sBSPACMperiphUARTstate *usp)
 

Detailed Description

The set of operations supported by UARTs.

The underlying implementation is specific to a vendor peripheral capable of acting like a UART.

Note
The contents of this structure are not intended to be public API.

Field Documentation

int(* sBSPACMperiphUARToperations::configure) (sBSPACMperiphUARTstate *usp, const sBSPACMperiphUARTconfiguration *cfgp)

Configure (or deconfigure) a UART.

Parameters
uspthe UART peripheral state
cfgpif non-null, a pointer to information used to configure the peripheral. If null, a sign that the peripheral is no longer being used and should be shut down/deconfigured.
Returns
zero on successful (de-)configuration, otherwise a negative error code.
int(* sBSPACMperiphUARToperations::fifo_state) (sBSPACMperiphUARTstate *usp)

Determine whether there is anything pending in the device: material that has been received but not consumed by the application, or material that has been submitted for transmission but has not yet gone out over the channel.

Parameters
uspthe UART abstraction being used
Returns
a combination of bits defined in eBSPACMperiphUARTfifoState. A value of zero indicates that no material is pending. A negative value indicates an error, e.g. that the UART is unconfigured.
int(* sBSPACMperiphUARToperations::hw_transmit) (sBSPACMperiphUARTstate *usp, uint8_t v)

Attempt to transmit an octet by adding it to the hardware transmit FIFO.

Parameters
uspthe UART abstraction being used
vthe octet to be transmitted
Returns
v if the transmission was accepted by the hardware, otherwise a negative error code.
void(* sBSPACMperiphUARToperations::hw_txien) (sBSPACMperiphUARTstate *usp, int enablep)

Enable or disable the interrupt associated with UART transmission.

The management model of this implementation is that the UART transmit interrupt is enabled only when there is pending material in the software transmit fifo. Thus it is the caller's responsibility to queue data and enable the interrupt when hw_transmit fails.

Under normal circumstances the transmit interrupt is disabled within the interrupt handler when the software FIFO is emptied.

Note
On some platforms (include TM4C) space in the hardware fifo must be filled before enabling the TX interrupt will work, because that interrupt is signalled by a full-to-not-full transmission. On other platforms (including EFM32) the interrupt is constant buffer-space-available signal, for which filling the hardware fifo is fine albeit not necessary.
Parameters
uspthe UART abstraction being used
enablepa non-zero value if the interrupt is to be enabled; a zero value will disable the interrupt (not a normal way to use this function).

The documentation for this struct was generated from the following file: