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"
Include dependency graph for uartdrv.h:
This graph shows which files directly or indirectly include this file:

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
 UART driver instance initialization structure. More...
struct  UARTDRV_HandleData_t
 UART driver instance handle data structure. More...

Defines

#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)
 Macros to define fifo and buffer queues, can't use a typedef becuase the size of the fifo array in the queues can change.

Typedefs

typedef uint32_t UARTDRV_Count_t
typedef uint32_t UARTDRV_Status_t
 UART status return 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 UARTDRV_HandleData_tUARTDRV_Handle_t
 Handle pointer.

Enumerations

enum  UARTDRV_FlowControlType_t {
  uartdrvFlowControlNone = 0,
  uartdrvFlowControlSw = 1,
  uartdrvFlowControlHw = 2
}
 

Flow Control method.

More...
enum  UARTDRV_FlowControlState_t {
  uartdrvFlowControlOn = 0,
  uartdrvFlowControlOff = 1,
  uartdrvFlowControlAuto = 2
}
 

Flow Control state.

More...
enum  UARTDRV_AbortType_t {
  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.
Ecode_t UARTDRV_DeInit (UARTDRV_Handle_t handle)
 Deinitialize a UART driver instance.
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.
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.
uint8_t UARTDRV_GetReceiveDepth (UARTDRV_Handle_t handle)
 Returns the number of queued receive operations.
uint8_t UARTDRV_GetTransmitDepth (UARTDRV_Handle_t handle)
 Returns the number of queued transmit operations.
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_Receive (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count, UARTDRV_Callback_t callback)
 Start a non-blocking receive.
Ecode_t UARTDRV_TransmitB (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Start a blocking transmit.
Ecode_t UARTDRV_ReceiveB (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Start a blocking receive.
Ecode_t UARTDRV_ForceTransmit (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t count)
 Direct transmit without interrupts or callback.
UARTDRV_Count_t UARTDRV_ForceReceive (UARTDRV_Handle_t handle, uint8_t *data, UARTDRV_Count_t maxLength)
 Direct receive without interrupts or callback.
Ecode_t UARTDRV_Abort (UARTDRV_Handle_t handle, UARTDRV_AbortType_t type)
 Abort an ongoing UART transfer.
UARTDRV_FlowControlState_t UARTDRV_FlowControlGetSelfStatus (UARTDRV_Handle_t handle)
 Checks the self's flow control status.
UARTDRV_FlowControlState_t UARTDRV_FlowControlGetPeerStatus (UARTDRV_Handle_t handle)
 Checks the peer's flow control status.
Ecode_t UARTDRV_FlowControlSet (UARTDRV_Handle_t handle, UARTDRV_FlowControlState_t state)
 Set UART flow control state.
Ecode_t UARTDRV_FlowControlIgnoreRestrain (UARTDRV_Handle_t handle)
 Enables transmission when restrained by flow control.

Detailed Description

UARTDRV API definition.

Version:
4.0.0

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.