Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
Data Structures | Macros | Typedefs | Enumerations | Functions
uart_device.h File Reference
#include <stdint.h>
#include "hdf.h"

Go to the source code of this file.

Data Structures

struct  UART_Dev_State_t
 A structure to represent UART device state. More...
 
struct  UART_Dev_LineInitData_t
 A structure to represent UART initialization information. More...
 
struct  UART_Device_t
 A structure to represent UART device driver. More...
 

Macros

#define UART_BUFF_SIZE   256
 

Typedefs

typedef const struct UART_Device_t UART_Device_Type
 
typedef void(* uart_cb_func_t) (UART_Device_Type *dev)
 
typedef const struct UART_Device_t UART_Device_t
 A structure to represent UART device driver. More...
 

Enumerations

enum  UART_devBaudRate_t {
  UART_DEV_BAUDRATE_300, UART_DEV_BAUDRATE_600, UART_DEV_BAUDRATE_1200, UART_DEV_BAUDRATE_2400,
  UART_DEV_BAUDRATE_4800, UART_DEV_BAUDRATE_9600, UART_DEV_BAUDRATE_19200, UART_DEV_BAUDRATE_38400,
  UART_DEV_BAUDRATE_57600, UART_DEV_BAUDRATE_115200, UART_DEV_BAUDRATE_230400, UART_DEV_BAUDRATE_MAX = UART_DEV_BAUDRATE_230400
}
 Enumeration for UART baud rate. More...
 
enum  UART_Dev_Parity_t { UART_DEV_PARITY_BIT_EVEN, UART_DEV_PARITY_BIT_ODD }
 Enumeration for UART parity bit. More...
 

Functions

int32_t UART_devInit (UART_Device_t *dev, UART_devBaudRate_t rate, UART_Dev_LineInitData_t *init)
 Initialize UART device. More...
 
UART_Device_tUART_devRequest (const char *name)
 Request an UART device. More...
 
int32_t UART_devDataReceived (UART_Device_t *dev)
 Get the number of bytes received. More...
 
int32_t UART_devDataPendingTX (UART_Device_t *dev)
 Check the number of bytes pending on TX. More...
 
int32_t UART_devSendByte (UART_Device_t *dev, uint8_t *data, uint32_t len)
 Send data to UART device. More...
 
int32_t UART_devReceiveByte (UART_Device_t *dev, uint8_t *data, uint32_t len)
 Receive data to UART device. More...
 
int32_t UART_devCheckError (UART_Device_t *dev)
 Check UART device for error. More...
 
int32_t UART_devResetDevice (UART_Device_t *dev)
 Reset UART device. More...
 
int32_t UART_devClearBuffer (UART_Device_t *dev)
 Clear data buffer in UART device driver. More...
 
int32_t UART_devRegisterCallback (UART_Device_t *dev, uint32_t size, void *cb)
 Register a call back function to UART device driver. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Macro Definition Documentation

#define UART_BUFF_SIZE   256

Typedef Documentation

typedef void(* uart_cb_func_t) (UART_Device_Type *dev)
typedef const struct UART_Device_t UART_Device_t

A structure to represent UART device driver.

typedef const struct UART_Device_t UART_Device_Type

Enumeration Type Documentation

Enumeration for UART parity bit.

Enumerator
UART_DEV_PARITY_BIT_EVEN 
UART_DEV_PARITY_BIT_ODD 

Enumeration for UART baud rate.

Enumerator
UART_DEV_BAUDRATE_300 
UART_DEV_BAUDRATE_600 
UART_DEV_BAUDRATE_1200 
UART_DEV_BAUDRATE_2400 
UART_DEV_BAUDRATE_4800 
UART_DEV_BAUDRATE_9600 
UART_DEV_BAUDRATE_19200 
UART_DEV_BAUDRATE_38400 
UART_DEV_BAUDRATE_57600 
UART_DEV_BAUDRATE_115200 
UART_DEV_BAUDRATE_230400 
UART_DEV_BAUDRATE_MAX 

Function Documentation

int32_t UART_devCheckError ( UART_Device_t dev)

Check UART device for error.

Parameters
devPointer to UART Device structure
Returns
0 for no error or 1 if error occurred.
int32_t UART_devClearBuffer ( UART_Device_t dev)

Clear data buffer in UART device driver.

Parameters
devPointer to UART Device structure
Returns
0 for success or error code upon a failure
int32_t UART_devDataPendingTX ( UART_Device_t dev)

Check the number of bytes pending on TX.

Parameters
devPointer to UART Device structure.
Returns
the number of bytes pending on TX or error code upon a failure
int32_t UART_devDataReceived ( UART_Device_t dev)

Get the number of bytes received.

Parameters
devPointer to UART Device structure.
Returns
the number of bytes received or error code upon a failure
int32_t UART_devInit ( UART_Device_t dev,
UART_devBaudRate_t  rate,
UART_Dev_LineInitData_t init 
)

Initialize UART device.

Parameters
devPointer to UART Device structure
rateBaud Rate
initPointer to initial data structure
Returns
0 for success or error code upon a failure
int32_t UART_devReceiveByte ( UART_Device_t dev,
uint8_t *  data,
uint32_t  len 
)

Receive data to UART device.

Parameters
devPointer to UART Device structure.
dataPointer to the data memory to store the received data.
lenThe size of the data memory.
Returns
0 for success or error code upon a failure
int32_t UART_devRegisterCallback ( UART_Device_t dev,
uint32_t  size,
void *  cb 
)

Register a call back function to UART device driver.

Parameters
devPointer to UART Device structure
sizeThe size of the data block received to trigger the callback.
cbThe pointer to the call back function.
Returns
0 for success or error code upon a failure
UART_Device_t* UART_devRequest ( const char *  name)

Request an UART device.

Parameters
nameName string of the UART device.
Returns
The pointer to the UART device or NULL upon a failure.
int32_t UART_devResetDevice ( UART_Device_t dev)

Reset UART device.

Parameters
devPointer to UART Device structure
Returns
0 for success or error code upon a failure
int32_t UART_devSendByte ( UART_Device_t dev,
uint8_t *  data,
uint32_t  len 
)

Send data to UART device.

Parameters
devPointer to UART Device structure.
dataPointer to the data memory to be sent.
lenThe size of the data memory.
Returns
0 for success or error code upon a failure