EFM32 Zero Gecko Software Documentation  efm32zg-doc-4.2.1
UARTDRV

UARTDRV Universal asynchronous receiver/transmitter driver, see UARTDRV Universal asynchronous receiver/transmitter driver page for detailed documentation.

. More...

Data Structures

struct  UARTDRV_Buffer_t
 UART transfer buffer. More...
 
struct  UARTDRV_Buffer_FifoQueue_t
 Transfer operation FIFO queue typedef. More...
 
struct  UARTDRV_Init_t
 
struct  UARTDRV_HandleData
 

Macros

#define ECODE_EMDRV_UARTDRV_OK   (ECODE_OK)
 Success return value.
 
#define ECODE_EMDRV_UARTDRV_WAITING   (ECODE_EMDRV_UARTDRV_BASE | 0x00000001)
 Operation is waiting in queue.
 
#define ECODE_EMDRV_UARTDRV_ILLEGAL_HANDLE   (ECODE_EMDRV_UARTDRV_BASE | 0x00000002)
 Illegal UART handle.
 
#define ECODE_EMDRV_UARTDRV_PARAM_ERROR   (ECODE_EMDRV_UARTDRV_BASE | 0x00000003)
 Illegal input parameter.
 
#define ECODE_EMDRV_UARTDRV_BUSY   (ECODE_EMDRV_UARTDRV_BASE | 0x00000004)
 The UART port is busy.
 
#define ECODE_EMDRV_UARTDRV_ILLEGAL_OPERATION   (ECODE_EMDRV_UARTDRV_BASE | 0x00000005)
 Illegal operation on UART port.
 
#define ECODE_EMDRV_UARTDRV_IDLE   (ECODE_EMDRV_UARTDRV_BASE | 0x00000008)
 No UART transfer in progress.
 
#define ECODE_EMDRV_UARTDRV_ABORTED   (ECODE_EMDRV_UARTDRV_BASE | 0x00000009)
 UART transfer has been aborted.
 
#define ECODE_EMDRV_UARTDRV_QUEUE_FULL   (ECODE_EMDRV_UARTDRV_BASE | 0x0000000A)
 UART operation queue is full.
 
#define ECODE_EMDRV_UARTDRV_QUEUE_EMPTY   (ECODE_EMDRV_UARTDRV_BASE | 0x0000000B)
 UART operation queue is empty.
 
#define ECODE_EMDRV_UARTDRV_PARITY_ERROR   (ECODE_EMDRV_UARTDRV_BASE | 0x0000000C)
 UART parity error frame. Data is ignored.
 
#define ECODE_EMDRV_UARTDRV_FRAME_ERROR   (ECODE_EMDRV_UARTDRV_BASE | 0x0000000D)
 UART frame error. Data is ignored.
 
#define ECODE_EMDRV_UARTDRV_DMA_ALLOC_ERROR   (ECODE_EMDRV_UARTDRV_BASE | 0x0000000E)
 Unable to allocated DMA channels.
 
#define DEFINE_BUF_QUEUE(qSize, qName)
 

Typedefs

typedef uint32_t UARTDRV_Count_t
 UART transfer count.
 
typedef uint32_t UARTDRV_Status_t
 UART status return type.
 
typedef enum UARTDRV_FlowControlType UARTDRV_FlowControlType_t
 Flow Control method.
 
typedef enum UARTDRV_FlowControlState UARTDRV_FlowControlState_t
 Flow Control state.
 
typedef enum UARTDRV_AbortType UARTDRV_AbortType_t
 Transfer abort type.
 
typedef void(* UARTDRV_Callback_t) (struct UARTDRV_HandleData *handle, Ecode_t transferStatus, uint8_t *data, UARTDRV_Count_t transferCount)
 UARTDRV transfer completion callback function. More...
 
typedef struct UARTDRV_HandleData UARTDRV_HandleData_t
 
typedef UARTDRV_HandleData_tUARTDRV_Handle_t
 Handle pointer.
 

Enumerations

enum  UARTDRV_FlowControlType {
  uartdrvFlowControlNone = 0,
  uartdrvFlowControlSw = 1,
  uartdrvFlowControlHw = 2
}
 Flow Control method. More...
 
enum  UARTDRV_FlowControlState {
  uartdrvFlowControlOn = 0,
  uartdrvFlowControlOff = 1,
  uartdrvFlowControlAuto = 2
}
 Flow Control state. More...
 
enum  UARTDRV_AbortType {
  uartdrvAbortTransmit = 1,
  uartdrvAbortReceive = 2,
  uartdrvAbortAll = 3
}
 Transfer abort type. More...
 

Functions

Ecode_t UARTDRV_Init (UARTDRV_Handle_t handle, UARTDRV_Init_t *initData)
 Initialize a UART driver instance. More...
 
Ecode_t UARTDRV_DeInit (UARTDRV_Handle_t handle)
 Deinitialize a UART driver instance. More...
 
UARTDRV_Status_t UARTDRV_GetReceiveStatus (UARTDRV_Handle_t handle, uint8_t **buffer, UARTDRV_Count_t *bytesReceived, UARTDRV_Count_t *bytesRemaining)
 Check the status of the UART and gather information about any ongoing receive operations. More...
 
UARTDRV_Status_t UARTDRV_GetTransmitStatus (UARTDRV_Handle_t handle, uint8_t **buffer, UARTDRV_Count_t *bytesSent, UARTDRV_Count_t *bytesRemaining)
 Check the status of the UART and gather information about any ongoing transmit operations. More...
 
uint8_t UARTDRV_GetReceiveDepth (UARTDRV_Handle_t handle)
 Returns the number of queued receive operations. More...
 
uint8_t UARTDRV_GetTransmitDepth (UARTDRV_Handle_t handle)
 Returns the number of queued transmit operations. More...
 
Ecode_t UARTDRV_Transmit (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count, UARTDRV_Callback_t callback)
 Start a non-blocking transmit. More...
 
Ecode_t UARTDRV_Receive (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count, UARTDRV_Callback_t callback)
 Start a non-blocking receive. More...
 
Ecode_t UARTDRV_TransmitB (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Start a blocking transmit. More...
 
Ecode_t UARTDRV_ReceiveB (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Start a blocking receive. More...
 
Ecode_t UARTDRV_ForceTransmit (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Direct transmit without interrupts or callback. Blocking function that ignores flow control if enabled. More...
 
UARTDRV_Count_t UARTDRV_ForceReceive (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t maxLength)
 Direct receive without interrupts or callback. Blocking function. More...
 
Ecode_t UARTDRV_Abort (UARTDRV_Handle_t handle, UARTDRV_AbortType_t type)
 Abort an ongoing UART transfer. More...
 
UARTDRV_FlowControlState_t UARTDRV_FlowControlGetSelfStatus (UARTDRV_Handle_t handle)
 Checks the self's flow control status. More...
 
UARTDRV_FlowControlState_t UARTDRV_FlowControlGetPeerStatus (UARTDRV_Handle_t handle)
 Checks the peer's flow control status. More...
 
Ecode_t UARTDRV_FlowControlSet (UARTDRV_Handle_t handle, UARTDRV_FlowControlState_t state)
 Set UART flow control state. Set nRTS pin if hardware flow control is enabled. More...
 
Ecode_t UARTDRV_FlowControlIgnoreRestrain (UARTDRV_Handle_t handle)
 Enables transmission when restrained by flow control. More...
 

Detailed Description

UARTDRV Universal asynchronous receiver/transmitter driver

The source files for the UART driver library resides in the emdrv/uartdrv folder, and are named uartdrv.c and uartdrv.h.


Introduction

The UART driver support the UART capabilities of the USART and UART peripherals, but not the LEUART peripherals. The driver is fully reentrant and multiple driver instances can coexist. The driver does not buffer or queue data, but it queues UART transmit and receive operations. Both blocking and non-blocking transfer functions are available. Non-blocking transfer functions report transfer completion with callback functions. Transfers are done using DMA. Simple direct/forced transmit and receive functions are also available. Note that these functions are blocking and not suitable for low energy applications as they use CPU polling.

UART hardware flow control (CTS/RTS) is fully supported by the driver. UART software flow control (XON/XOFF) is partially supported by the driver. Read more about flow control support in Flow Control Support.

Note
Transfer completion callback functions are called from within the DMA interrupt handler with interrupts disabled.


Configuration Options

Some properties of the UARTDRV driver are compile-time configurable. These properties are set in a file named uartdrv_config.h. A template for this file, containing default values, resides in the emdrv/config folder. To configure UARTDRV for your application, provide your own configuration file. These are the available configuration parameters with default values defined.

  // Maximum concurrent receive operations
  #define EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS    6

  // Maximum concurrent transmit operations
  #define EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS    6

  // Set to 1 to enable hardware flow control
  #define EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE    1

  // Maximum number of driver instances. This maximum applies only when EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE = 1
  #define EMDRV_UARTDRV_MAX_DRIVER_INSTANCES      4

  // UART software flow control code: request peer to start TX
  #define UARTDRV_FC_SW_XON                       0x11

  // UART software flow control code: request peer to stop TX
  #define UARTDRV_FC_SW_XOFF                      0x13

The properties of each UART driver instance are set at run-time via the UARTDRV_Init_t data structure input parameter to the UARTDRV_Init() function.


The API

This section contain brief descriptions of the functions in the API. You will find detailed information on input and output parameters and return values by clicking on the hyperlinked function names. Most functions return an error code, ECODE_EMDRV_UARTDRV_OK is returned on success, see ecode.h and uartdrv.h for other error codes.

Your application code must include one header file: uartdrv.h.

UARTDRV_Init(), UARTDRV_DeInit()
These functions initializes or deinitializes the UARTDRV driver. Typically UARTDRV_Init() is called once in your startup code.

UARTDRV_GetReceiveStatus(), UARTDRV_GetTransmitStatus()
Query the status of a current transmit or receive operations. Reports number of items (frames) transmitted and remaining.

UARTDRV_GetReceiveDepth(), UARTDRV_GetTransmitDepth()
Get the number of queued receive or transmit operations.

UARTDRV_Transmit(), UARTDRV_Receive()
UARTDRV_TransmitB(), UARTDRV_ReceiveB()
UARTDRV_ForceTransmit(), UARTDRV_ForceReceive()
Transfer functions come in both blocking and non-blocking versions, the blocking versions have an uppercase B (for Blocking) at the end of their function name. Blocking functions will not return before the transfer has completed. The non-blocking functions signal transfer completion with a callback function. UARTDRV_ForceTransmit() and UARTDRV_ForceReceive() are also blocking. These two functions access the UART peripheral directly without using DMA or interrupts. UARTDRV_ForceTransmit() does not respect flow control. UARTDRV_ForceReceive() forces RTS low.

UARTDRV_Abort()
Abort current transmit or receive operations.

UARTDRV_FlowControlSet(), UARTDRV_FlowControlGetSelfStatus(), UARTDRV_FlowControlGetPeerStatus()
Set and get flow control status of self or peer device. Note that the return value from these two functions depends on the flow control mode set by UARTDRV_FlowControlSet() or UARTDRV_Init().

UARTDRV_FlowControlIgnoreRestrain()
Enables transmission when restrained by flow control.


Flow Control Support

If UART flow control is not required, make sure EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE is set to 0. This reduces the code size and complexity of the driver.

There are two types of flow control supported, hardware and software. To enable any of these, set EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE to 1 in uartdrv_config.h.


Hardware Flow Control

UART hardware flow control uses two additional pins for flow control handshaking, the clear-to-send (CTS) and ready-to-send (RTS) pins. RTS is an output and CTS is an input. These are active low signals. When CTS is high, the UART transmitter should stop sending frames. A receiver should set RTS high when it is no longer capable of receiving data.

To support hardware flow control, the driver includes the GPIOINT driver to emulate a hardware implementation of UART CTS/RTS flow control. Some revisions of the USART peripheral does not have CTS/RTS hardware support.

To enable hardware flow control, perform the following steps:

  1. Set EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE to 1.
  2. In the UARTDRV_Init_t passed to UARTDRV_Init(), set UARTDRV_Init_t::fcType = uartdrvFlowControlHw.
  3. Define the pins for CTS and RTS by setting ctsPort, ctsPin, rtsPort and rtsPin in the UARTDRV_Init_t passed to UARTDRV_Init().
Note
Because of the limitations in GPIO interrupt hardware, you cannot select CTS pins in multiple driver instances with the same pin number. Ie. pin A0 and B0 cannot serve as CTS pins in two concurrent driver instances.

RTS is set high whenever there are no RX operations queued. The UART transmitter is halted when the CTS pin goes high. The transmitter completes the current frame before halting. DMA transfers are also halted.


Software Flow Control

UART software flow control uses in-band signaling, meaning the receiver sends special flow control characters to the transmitter and thereby removes the need for dedicated wires for flow control. The two symbols UARTDRV_FC_SW_XON and UARTDRV_FC_SW_XOFF are defined in uartdrv_config.h.

To enable support for software flow control, perform the following steps:

  1. Set EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE to 1.
  2. In the UARTDRV_Init_t passed to UARTDRV_Init(), set UARTDRV_Init_t::fcType = uartdrvFlowControlSw.
Note
Software flow control is partial only.

The application must monitor buffers and make decisions on when to send XON/XOFF. XON/XOFF can be sent to the peer using UARTDRV_FlowControlSet(). If the application implements a specific packet format where the flow control codes may appear only in fixed positions, then the application should not use UARTDRV_FlowControlSet(), but implement read and write of XON/XOFF into packet buffers. If the application code fully implements all the flow control logic, then EMDRV_UARTDRV_HW_FLOW_CONTROL_ENABLE should be set to 0 to reduce code space.


Example

#include "uartdrv.h"

// Define receive/transmit operation queues
DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, rxBufferQueueI0);
DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, txBufferQueueI0);

// Configuration for USART0, location 1
#define MY_UART                                                        \
{                                                                      \
  USART0,                                                              \
  115200,                                                              \
  _USART_ROUTE_LOCATION_LOC1,                                          \
  (USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE,                    \
  (USART_Parity_TypeDef)USART_FRAME_PARITY_NONE,                       \
  (USART_OVS_TypeDef)USART_CTRL_OVS_X16,                               \
  false,                                                               \
  uartdrvFlowControlHw,                                                \
  (GPIO_Port_TypeDef)AF_USART0_CS_PORT(_USART_ROUTE_LOCATION_LOC1),    \
  (GPIO_Port_TypeDef)AF_USART0_CS_PIN(_USART_ROUTE_LOCATION_LOC1),     \
  (GPIO_Port_TypeDef)AF_USART0_CLK_PORT(_USART_ROUTE_LOCATION_LOC1),   \
  (GPIO_Port_TypeDef)AF_USART0_CLK_PIN(_USART_ROUTE_LOCATION_LOC1),    \
  (UARTDRV_Buffer_FifoQueue_t *)&rxBufferQueueI0,                      \
  (UARTDRV_Buffer_FifoQueue_t *)&txBufferQueueI0                       \
}

UARTDRV_HandleData_t handleData;
UARTDRV_Handle_t handle = &handleData;

int main(void)
{
  uint8_t buffer[10];
  UARTDRV_Init_t initDataA0 = MY_UART;

  UARTDRV_Init(handle, &initDataA0);

  // Transmit data using a blocking transmit function
  UARTDRV_Transmit(handle, buffer, 10);
}

Macro Definition Documentation

#define DEFINE_BUF_QUEUE (   qSize,
  qName 
)
Value:
typedef struct { \
uint16_t head; \
uint16_t tail; \
uint16_t used; \
const uint16_t size; \
UARTDRV_Buffer_t fifo[qSize]; \
} _##qName; \
static volatile _##qName qName = \
{ \
.head = 0, \
.tail = 0, \
.used = 0, \
.size = qSize, \
}

Macros to define fifo and buffer queues, can't use a typedef becuase the size of the fifo array in the queues can change.

Definition at line 140 of file uartdrv.h.

Typedef Documentation

typedef void(* UARTDRV_Callback_t) (struct UARTDRV_HandleData *handle, Ecode_t transferStatus, uint8_t *data, UARTDRV_Count_t transferCount)

The callback function is called when a transfer has completed. An application should check the transferStatus and itemsTransferred values.

Parameters
[in]handleThe UARTDRV device handle used to start the transfer.
[in]transferStatusNumber of bytes actually transferred.
[in]itemsTransferredNumber of bytes transferred.

Definition at line 113 of file uartdrv.h.

UART driver instance handle data structure. The handle is allocated by the application using UARTDRV. There may be several concurrent driver instances in an application. The application must not modify the contents of this handle.

Enumeration Type Documentation

Enumerator
uartdrvFlowControlNone 

None.

uartdrvFlowControlSw 

Software XON/XOFF.

uartdrvFlowControlHw 

nRTS/nCTS hardware handshake

Definition at line 71 of file uartdrv.h.

Enumerator
uartdrvFlowControlOn 

XON or nRTS/nCTS low.

uartdrvFlowControlOff 

XOFF or nRTS/nCTS high.

uartdrvFlowControlAuto 

This driver controls the state.

Definition at line 79 of file uartdrv.h.

Enumerator
uartdrvAbortTransmit 

Abort current and queued transmit operations.

uartdrvAbortReceive 

Abort current and queued receive operations.

uartdrvAbortAll 

Abort all current and queued operations.

Definition at line 87 of file uartdrv.h.

Function Documentation

Ecode_t UARTDRV_Init ( UARTDRV_Handle_t  handle,
UARTDRV_Init_t initData 
)
Parameters
[out]handlePointer to a UART driver handle, refer to UARTDRV_Handle_t.
[in]initDataPointer to an initialization data structure, refer to UARTDRV_Init_t.
Returns
ECODE_EMDRV_UARTDRV_OK on success. On failure an appropriate UARTDRV Ecode_t is returned.

Definition at line 591 of file uartdrv.c.

References _USART_ROUTE_LOCATION_SHIFT, UARTDRV_Init_t::baudRate, USART_InitAsync_TypeDef::baudrate, USART_TypeDef::CMD, CMU_ClockEnable(), cmuClock_GPIO, cmuClock_HFPER, cmuClock_USART1, UARTDRV_Init_t::ctsPin, USART_InitAsync_TypeDef::databits, DMADRV_AllocateChannel(), DMADRV_Init(), dmadrvPeripheralSignal_USART1_RXDATAV, dmadrvPeripheralSignal_USART1_TXBL, ECODE_EMDRV_DMADRV_OK, ECODE_EMDRV_UARTDRV_DMA_ALLOC_ERROR, ECODE_EMDRV_UARTDRV_ILLEGAL_HANDLE, ECODE_EMDRV_UARTDRV_OK, ECODE_EMDRV_UARTDRV_PARAM_ERROR, USART_InitAsync_TypeDef::enable, GPIOINT_CallbackRegister(), GPIOINT_Init(), INT_Disable(), INT_Enable(), UARTDRV_Init_t::mvdis, USART_InitAsync_TypeDef::mvdis, UARTDRV_Init_t::oversampling, USART_InitAsync_TypeDef::oversampling, UARTDRV_Init_t::parity, USART_InitAsync_TypeDef::parity, UARTDRV_Init_t::port, UARTDRV_Init_t::portLocation, USART_TypeDef::ROUTE, UARTDRV_Init_t::rxQueue, UARTDRV_Init_t::stopBits, USART_InitAsync_TypeDef::stopbits, UARTDRV_Init_t::txQueue, uartdrvFlowControlAuto, uartdrvFlowControlNone, uartdrvFlowControlOn, USART1, USART_CMD_CLEARRX, USART_CMD_CLEARTX, USART_Enable(), USART_FRAME_DATABITS_EIGHT, USART_InitAsync(), USART_INITASYNC_DEFAULT, USART_IntClear(), USART_ROUTE_RXPEN, USART_ROUTE_TXPEN, usartDisable, and usartEnableTx.

Ecode_t UARTDRV_DeInit ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
ECODE_EMDRV_UARTDRV_OK on success. On failure an appropriate UARTDRV Ecode_t is returned.

Definition at line 809 of file uartdrv.c.

References CMU_ClockEnable(), DMADRV_DeInit(), DMADRV_FreeChannel(), DMADRV_StopTransfer(), ECODE_EMDRV_UARTDRV_ILLEGAL_HANDLE, ECODE_EMDRV_UARTDRV_OK, GPIOINT_CallbackRegister(), UARTDRV_FlowControlSet(), uartdrvFlowControlOn, USART_CMD_RXDIS, USART_CMD_TXDIS, and USART_Reset().

UARTDRV_Status_t UARTDRV_GetReceiveStatus ( UARTDRV_Handle_t  handle,
uint8_t **  buffer,
UARTDRV_Count_t itemsReceived,
UARTDRV_Count_t itemsRemaining 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]bufferPointer to the current data buffer.
[in]itemsReceivedCurrent bytes received count.
[in]itemsRemainingCurrent bytes remaining count.
Returns
UART status.

Definition at line 956 of file uartdrv.c.

References UARTDRV_Buffer_t::data, DMADRV_TransferRemainingCount(), rxBuffer, and UARTDRV_Buffer_t::transferCount.

UARTDRV_Status_t UARTDRV_GetTransmitStatus ( UARTDRV_Handle_t  handle,
uint8_t **  buffer,
UARTDRV_Count_t itemsSent,
UARTDRV_Count_t itemsRemaining 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]bufferPointer to the current data buffer.
[in]itemsSentCurrent bytes sent count.
[in]itemsRemainingCurrent bytes remaining count.
Returns
UART status.

Definition at line 1015 of file uartdrv.c.

References UARTDRV_Buffer_t::data, DMADRV_TransferRemainingCount(), and UARTDRV_Buffer_t::transferCount.

uint8_t UARTDRV_GetReceiveDepth ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
The number of queued operations.

Definition at line 934 of file uartdrv.c.

uint8_t UARTDRV_GetTransmitDepth ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
The number of queued operations.

Definition at line 993 of file uartdrv.c.

Ecode_t UARTDRV_Transmit ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  count,
UARTDRV_Callback_t  callback 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]dataTransmit data buffer.
[in]countNumber of bytes to transmit.
[in]callbackTransfer completion callback.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1350 of file uartdrv.c.

References UARTDRV_Buffer_t::callback, UARTDRV_Buffer_t::data, ECODE_EMDRV_UARTDRV_OK, ECODE_EMDRV_UARTDRV_WAITING, UARTDRV_Buffer_t::itemsRemaining, UARTDRV_Buffer_t::transferCount, and UARTDRV_Buffer_t::transferStatus.

Ecode_t UARTDRV_Receive ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  count,
UARTDRV_Callback_t  callback 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]dataReceive data buffer.
[in]countNumber of bytes received.
[in]callbackTransfer completion callback.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1241 of file uartdrv.c.

References UARTDRV_Buffer_t::callback, UARTDRV_Buffer_t::data, ECODE_EMDRV_UARTDRV_OK, ECODE_EMDRV_UARTDRV_WAITING, UARTDRV_Buffer_t::itemsRemaining, UARTDRV_Buffer_t::transferCount, UARTDRV_Buffer_t::transferStatus, and uartdrvFlowControlOn.

Ecode_t UARTDRV_TransmitB ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  count 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]dataTransmit data buffer.
[in]countNumber of bytes to transmit.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1397 of file uartdrv.c.

References UARTDRV_Buffer_t::callback, UARTDRV_Buffer_t::data, ECODE_EMDRV_UARTDRV_OK, ECODE_EMDRV_UARTDRV_WAITING, EMU_EnterEM1(), UARTDRV_Buffer_t::itemsRemaining, UARTDRV_Buffer_t::transferCount, and UARTDRV_Buffer_t::transferStatus.

Ecode_t UARTDRV_ReceiveB ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  count 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]dataReceive data buffer.
[in]countNumber of bytes received.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1293 of file uartdrv.c.

References UARTDRV_Buffer_t::callback, UARTDRV_Buffer_t::data, ECODE_EMDRV_UARTDRV_OK, ECODE_EMDRV_UARTDRV_WAITING, EMU_EnterEM1(), UARTDRV_Buffer_t::itemsRemaining, UARTDRV_Buffer_t::transferCount, UARTDRV_Buffer_t::transferStatus, and uartdrvFlowControlOn.

Ecode_t UARTDRV_ForceTransmit ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  count 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]dataPointer to buffer.
[in]countNumber of bytes to transmit.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1187 of file uartdrv.c.

References ECODE_EMDRV_UARTDRV_OK, USART_STATUS_TXBL, USART_STATUS_TXC, and USART_STATUS_TXENS.

UARTDRV_Count_t UARTDRV_ForceReceive ( UARTDRV_Handle_t  handle,
uint8_t *  data,
UARTDRV_Count_t  maxCount 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]datapointer to buffer.
[in]maxCountMaximum number of bytes to receive.
Returns
Number of bytes received.

Definition at line 1130 of file uartdrv.c.

References ECODE_EMDRV_UARTDRV_OK, USART_STATUS_RXDATAV, and USART_STATUS_RXENS.

UARTDRV_FlowControlState_t UARTDRV_FlowControlGetSelfStatus ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
Returns uartdrvFlowControlOn if requesting to send.

Definition at line 1094 of file uartdrv.c.

UARTDRV_FlowControlState_t UARTDRV_FlowControlGetPeerStatus ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
Returns uartdrvFlowControlOn if clear to send.

Definition at line 1079 of file uartdrv.c.

Ecode_t UARTDRV_FlowControlSet ( UARTDRV_Handle_t  handle,
UARTDRV_FlowControlState_t  state 
)
Parameters
[in]handlePointer to a UART driver handle.
[in]stateFlow control state.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1055 of file uartdrv.c.

References ECODE_EMDRV_UARTDRV_OK, and uartdrvFlowControlAuto.

Referenced by UARTDRV_DeInit().

Ecode_t UARTDRV_FlowControlIgnoreRestrain ( UARTDRV_Handle_t  handle)
Parameters
[in]handlePointer to a UART driver handle.
Returns
ECODE_EMDRV_UARTDRV_OK on success.

Definition at line 1109 of file uartdrv.c.

References ECODE_EMDRV_UARTDRV_OK.