EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1
uartdrv.h File Reference

UARTDRV API definition. More...

#include "em_device.h"
#include "em_usart.h"
#include "em_cmu.h"
#include "ecode.h"
#include "uartdrv_config.h"
#include "dmadrv.h"

Go to the source code of this file.

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

Version
4.2.1

License

(C) Copyright 2014 Silicon Labs, http://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.