uartdrv.h File Reference
UARTDRV API definition.
- Version
 - 5.5.0
 
License
Copyright 2016 Silicon Laboratories, Inc, www.silabs.com
This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
       Definition in file
       
        uartdrv.h
       
       .
      
       #include "
       
        em_device.h
       
       "
      
      
       #include "
       
        em_usart.h
       
       "
      
      
       #include "
       
        em_leuart.h
       
       "
      
      
       #include "
       
        em_gpio.h
       
       "
      
      
       #include "
       
        em_cmu.h
       
       "
      
      
       #include "
       
        ecode.h
       
       "
      
      
       #include "uartdrv_config.h"
      
      
       #include "
       
        dmadrv.h
       
       "
      
      
         Data Structures | 
       |
| struct | UARTDRV_Buffer_FifoQueue_t | 
| 
         Transfer operation FIFO queue typedef.
          | 
       |
| struct | UARTDRV_Buffer_t | 
| 
         UART transfer buffer.
          | 
       |
| struct | UARTDRV_HandleData | 
| struct | UARTDRV_InitLeuart_t | 
| struct | UARTDRV_InitUart_t | 
         Macros | 
       |
| #define | DEFINE_BUF_QUEUE (qSize, qName) | 
| #define | ECODE_EMDRV_UARTDRV_ABORTED ( ECODE_EMDRV_UARTDRV_BASE | 0x00000009) | 
| 
         A UART transfer has been aborted.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_BUSY ( ECODE_EMDRV_UARTDRV_BASE | 0x00000004) | 
| 
         The UART port is busy.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_CLOCK_ERROR ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000F) | 
| 
         Unable to set a desired baudrate.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_DMA_ALLOC_ERROR ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000E) | 
| 
         Unable to allocate DMA channels.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_FRAME_ERROR ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000D) | 
| 
         A UART frame error. Data is ignored.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_IDLE ( ECODE_EMDRV_UARTDRV_BASE | 0x00000008) | 
| 
         No UART transfer is in progress.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_ILLEGAL_HANDLE ( ECODE_EMDRV_UARTDRV_BASE | 0x00000002) | 
| 
         An illegal UART handle.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_ILLEGAL_OPERATION ( ECODE_EMDRV_UARTDRV_BASE | 0x00000005) | 
| 
         An illegal operation on the UART port.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_OK ( ECODE_OK ) | 
| 
         A successful return value.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_PARAM_ERROR ( ECODE_EMDRV_UARTDRV_BASE | 0x00000003) | 
| 
         An illegal input parameter.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_PARITY_ERROR ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000C) | 
| 
         A UART parity error frame. Data is ignored.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_QUEUE_EMPTY ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000B) | 
| 
         A UART operation queue is empty.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_QUEUE_FULL ( ECODE_EMDRV_UARTDRV_BASE | 0x0000000A) | 
| 
         A UART operation queue is full.
          | 
       |
| #define | ECODE_EMDRV_UARTDRV_WAITING ( ECODE_EMDRV_UARTDRV_BASE | 0x00000001) | 
| 
         An operation is waiting in queue.
          | 
       |
| #define | UARTDRV_STATUS_RXBLOCK (1 << 3) | 
| 
         The receiver is blocked; incoming frames will be discarded.
          | 
       |
| #define | UARTDRV_STATUS_RXDATAV (1 << 7) | 
| 
         Data is available in the receive buffer.
          | 
       |
| #define | UARTDRV_STATUS_RXEN (1 << 0) | 
| 
         The receiver is enabled.
          | 
       |
| #define | UARTDRV_STATUS_RXFULL (1 << 8) | 
| 
         The receive buffer is full.
          | 
       |
| #define | UARTDRV_STATUS_TXBL (1 << 6) | 
| 
         The transmit buffer is empty.
          | 
       |
| #define | UARTDRV_STATUS_TXC (1 << 5) | 
| 
         A transmit operation is complete. No more data is available in the transmit buffer and shift register.
          | 
       |
| #define | UARTDRV_STATUS_TXEN (1 << 1) | 
| 
         The transmitter is enabled.
          | 
       |
| #define | UARTDRV_STATUS_TXIDLE (1 << 13) | 
| 
         The transmitter is idle.
          | 
       |
| #define | UARTDRV_STATUS_TXTRI (1 << 4) | 
| 
         The transmitter is tristated.
          | 
       |
         Typedefs | 
       |
| 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.
          | 
       |
| typedef uint32_t | UARTDRV_Count_t | 
| 
         A UART transfer count.
          | 
       |
| typedef enum UARTDRV_FlowControlState | UARTDRV_FlowControlState_t | 
| 
         Flow Control state.
          | 
       |
| typedef enum UARTDRV_FlowControlType | UARTDRV_FlowControlType_t | 
| 
         Flow Control method.
          | 
       |
| typedef UARTDRV_HandleData_t * | UARTDRV_Handle_t | 
| 
         Handle pointer.
          | 
       |
| typedef struct UARTDRV_HandleData | UARTDRV_HandleData_t | 
| typedef uint32_t | UARTDRV_Status_t | 
| 
         A UART status return type. Bitfield of UARTDRV_STATUS_* values.
          | 
       |
         Enumerations | 
       |
| enum | 
         
          UARTDRV_AbortType
         
         {
          uartdrvAbortTransmit = 1, uartdrvAbortReceive = 2, uartdrvAbortAll = 3 }  | 
       
| 
         Transfer abort type.
          | 
       |
| enum | 
         
          UARTDRV_FlowControlState
         
         {
          uartdrvFlowControlOn = 0, uartdrvFlowControlOff = 1, uartdrvFlowControlAuto = 2 }  | 
       
| 
         Flow Control state.
          | 
       |
| enum | 
         
          UARTDRV_FlowControlType
         
         {
          uartdrvFlowControlNone = 0, uartdrvFlowControlSw = 1, uartdrvFlowControlHw = 2, uartdrvFlowControlHwUart = 3 }  | 
       
| 
         Flow Control method.
          | 
       |
         Functions | 
       |
| Ecode_t | UARTDRV_Abort ( UARTDRV_Handle_t handle, UARTDRV_AbortType_t type) | 
| 
         Abort ongoing UART transfers.
          | 
       |
| Ecode_t | UARTDRV_DeInit ( UARTDRV_Handle_t handle) | 
| 
         Deinitialize a UART driver instance.
          | 
       |
| UARTDRV_FlowControlState_t | UARTDRV_FlowControlGetPeerStatus ( UARTDRV_Handle_t handle) | 
| 
         Check the peer's flow control status.
          | 
       |
| UARTDRV_FlowControlState_t | UARTDRV_FlowControlGetSelfStatus ( UARTDRV_Handle_t handle) | 
| 
         Check the self flow control status.
          | 
       |
| Ecode_t | UARTDRV_FlowControlIgnoreRestrain ( UARTDRV_Handle_t handle) | 
| 
         Enable transmission when restrained by flow control.
          | 
       |
| 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. Send XON/XOFF if software flow control is enabled.
          | 
       |
| Ecode_t | UARTDRV_FlowControlSetPeerStatus ( UARTDRV_Handle_t handle, UARTDRV_FlowControlState_t state) | 
| 
         Set peer UART flow control state. Pause/resume transmit accordingly. Only for manual software flow control.
          | 
       |
| UARTDRV_Count_t | UARTDRV_ForceReceive ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t maxLength) | 
| 
         Direct receive without interrupts or callback. This is a blocking function.
          | 
       |
| Ecode_t | UARTDRV_ForceTransmit ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count) | 
| 
         Direct transmit without interrupts or callback. This is a blocking function. that ignores flow control if enabled.
          | 
       |
| UARTDRV_Status_t | UARTDRV_GetPeripheralStatus ( UARTDRV_Handle_t handle) | 
| 
         Return the status of the UART peripheral associated with a given handle.
          | 
       |
| uint8_t | UARTDRV_GetReceiveDepth ( UARTDRV_Handle_t handle) | 
| 
         Return the number of queued receive operations.
          | 
       |
| 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.
          | 
       |
| uint8_t | UARTDRV_GetTransmitDepth ( UARTDRV_Handle_t handle) | 
| 
         Returns the number of queued transmit operations.
          | 
       |
| 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.
          | 
       |
| __STATIC_INLINE Ecode_t | UARTDRV_Init ( UARTDRV_Handle_t handle, UARTDRV_InitUart_t *initData) | 
| 
         Initialize a U(S)ART driver instance.
          | 
       |
| Ecode_t | UARTDRV_InitLeuart ( UARTDRV_Handle_t handle, const UARTDRV_InitLeuart_t *initData) | 
| 
         Initialize a LEUART driver instance.
          | 
       |
| Ecode_t | UARTDRV_InitUart ( UARTDRV_Handle_t handle, const UARTDRV_InitUart_t *initData) | 
| 
         Initialize a U(S)ART driver instance.
          | 
       |
| Ecode_t | UARTDRV_PauseTransmit ( UARTDRV_Handle_t handle) | 
| 
         Pause an ongoing transmit operation.
          | 
       |
| Ecode_t | UARTDRV_Receive ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count, UARTDRV_Callback_t callback) | 
| 
         Start a non-blocking receive.
          | 
       |
| Ecode_t | UARTDRV_ReceiveB ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count) | 
| 
         Start a blocking receive.
          | 
       |
| Ecode_t | UARTDRV_ResumeTransmit ( UARTDRV_Handle_t handle) | 
| 
         Resume a paused transmit operation.
          | 
       |
| Ecode_t | UARTDRV_Transmit ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count, UARTDRV_Callback_t callback) | 
| 
         Start a non-blocking transmit.
          | 
       |
| Ecode_t | UARTDRV_TransmitB ( UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count) | 
| 
         Start a blocking transmit.
          | 
       |