Hilscher netX microcontroller driver  V0.0.5.0
Documentation of the netX driver package

The UART driver, defined by DRV_UART_HANDLE_T. More...

Collaboration diagram for UART:

Data Structures

struct  DRV_UART_CONFIGURATION_T
 The configuration of the driver. More...
 
struct  DRV_UART_HANDLE_T
 The handle of the driver. More...
 

Macros

#define DRV_HANDLE_CHECK(handle)
 
#define DRV_UART_IRQHandler_Generator(id, _)   DRV_Default_IRQHandler_Function_Generator(DRV_UART_IRQ_HANDLER ## id,DRV_UART_IRQ_Inline_Handler,DRV_UART_DEVICE_ID_UART ## id)
 

Enumerations

enum  DRV_UART_BAUDRATEMODE_E {
  DRV_UART_BAUDRATEMODE_RESET = 0x00u,
  DRV_UART_BAUDRATEMODE_0 = 0x01u,
  DRV_UART_BAUDRATEMODE_1 = 0x02u,
  DRV_UART_BAUDRATEMODE_DEFAULT = DRV_UART_BAUDRATEMODE_1,
  DRV_UART_BAUDRATEMODE_MIN = 0x01u,
  DRV_UART_BAUDRATEMODE_MAX = 0x02u
}
 Enumeration of useful uart baudrate mode. More...
 
enum  DRV_UART_BAUDRATE_E {
  DRV_UART_BAUDRATE_300 = 3ul,
  DRV_UART_BAUDRATE_600 = 6ul,
  DRV_UART_BAUDRATE_1200 = 12ul,
  DRV_UART_BAUDRATE_2400 = 24ul,
  DRV_UART_BAUDRATE_4800 = 48ul,
  DRV_UART_BAUDRATE_9600 = 96ul,
  DRV_UART_BAUDRATE_19200 = 192ul,
  DRV_UART_BAUDRATE_38400 = 384ul,
  DRV_UART_BAUDRATE_57600 = 576ul,
  DRV_UART_BAUDRATE_115200 = 1152ul,
  DRV_UART_BAUDRATE_460800 = 4608ul,
  DRV_UART_BAUDRATE_DEFAULT = 0
}
 Enumeration of useful uart baudrates. More...
 
enum  DRV_UART_STATE_E {
  DRV_UART_STATE_CTS = 0x00000001ul,
  DRV_UART_STATE_DSR = 0x00000002ul,
  DRV_UART_STATE_DCD = 0x00000004ul,
  DRV_UART_STATE_BUSY = 0x00000008ul,
  DRV_UART_STATE_RXFE = 0x00000010ul,
  DRV_UART_STATE_TXFF = 0x00000020ul,
  DRV_UART_STATE_RXFF = 0x00000040ul,
  DRV_UART_STATE_TXFE = 0x00000080ul,
  DRV_UART_STATE_ERROR_FRAMING = 0x00010000ul,
  DRV_UART_STATE_ERROR_PARITY = 0x00020000ul,
  DRV_UART_STATE_ERROR_BREAK = 0x00040000ul,
  DRV_UART_STATE_ERROR_OVERRUN = 0x00080000ul
}
 Enumeration of uart device states. More...
 
enum  DRV_UART_WORD_LENGTH_E {
  DRV_UART_WORD_LENGTH_RESET = 0x00ul,
  DRV_UART_WORD_LENGTH_5_BITS = 0x10ul,
  DRV_UART_WORD_LENGTH_6_BITS = 0x11ul,
  DRV_UART_WORD_LENGTH_7_BITS = 0x12ul,
  DRV_UART_WORD_LENGTH_8_BITS = 0x13ul,
  DRV_UART_WORD_LENGTH_DEFAULT = DRV_UART_WORD_LENGTH_8_BITS,
  DRV_UART_WORD_LENGTH_MIN = DRV_UART_WORD_LENGTH_5_BITS,
  DRV_UART_WORD_LENGTH_MAX = DRV_UART_WORD_LENGTH_8_BITS
}
 Enumeration of the available uart word lenghts. More...
 
enum  DRV_UART_LINE_CONTROL_MASK_E {
  DRV_UART_LINE_CONTROL_MASK_FIFO_ENABLE = 0x10ul,
  DRV_UART_LINE_CONTROL_MASK_ADDITIONAL_STOP_BIT = 0x08ul,
  DRV_UART_LINE_CONTROL_MASK_EVEN_PARITY = 0x06ul,
  DRV_UART_LINE_CONTROL_MASK_ODD_PARITY = 0x02ul,
  DRV_UART_LINE_CONTROL_MASK_SEND_BREAK = 0x01ul,
  DRV_UART_LINE_CONTROL_MASK_DEFAULT = 0x00ul,
  DRV_UART_LINE_CONTROL_MASK = 0x1ful
}
 Enumeration of of the line control parameters as mask. More...
 
enum  DRV_UART_LOOP_BACK_E {
  DRV_UART_LOOP_BACK_INACTIVE = 0x00ul,
  DRV_UART_LOOP_BACK_ACTIVE = 0x01ul,
  DRV_UART_LOOP_BACK_MAX = DRV_UART_LOOP_BACK_ACTIVE
}
 Enumeration of the loop back state. More...
 
enum  DRV_UART_WATERMARK_E {
  DRV_UART_WATERMARK_UNINITIALIZED = 0x00ul,
  DRV_UART_WATERMARK_1 = 0x01ul,
  DRV_UART_WATERMARK_2 = 0x02ul,
  DRV_UART_WATERMARK_3 = 0x03ul,
  DRV_UART_WATERMARK_4 = 0x04ul,
  DRV_UART_WATERMARK_5 = 0x05ul,
  DRV_UART_WATERMARK_6 = 0x06ul,
  DRV_UART_WATERMARK_7 = 0x07ul,
  DRV_UART_WATERMARK_8 = 0x08ul,
  DRV_UART_WATERMARK_DEFAULT = DRV_UART_WATERMARK_8,
  DRV_UART_WATERMARK_9 = 0x09ul,
  DRV_UART_WATERMARK_10 = 0x0aul,
  DRV_UART_WATERMARK_11 = 0x0bul,
  DRV_UART_WATERMARK_12 = 0x0cul,
  DRV_UART_WATERMARK_13 = 0x0dul,
  DRV_UART_WATERMARK_14 = 0x0eul,
  DRV_UART_WATERMARK_15 = 0x0ful,
  DRV_UART_WATERMARK_16 = 0x10ul,
  DRV_UART_WATERMARK_MIN = DRV_UART_WATERMARK_1,
  DRV_UART_WATERMARK_MAX = DRV_UART_WATERMARK_16
}
 Enumeration of the loop back state. More...
 
enum  DRV_UART_RTS_CONTROL_MASK_E {
  DRV_UART_RTS_CONTROL_MASK_STICK_PARITY = 0x80ul,
  DRV_UART_RTS_CONTROL_MASK_CTS_ACTIVE_HIGH = 0x40ul,
  DRV_UART_RTS_CONTROL_MASK_CTS_ENABLE = 0x20ul,
  DRV_UART_RTS_CONTROL_MASK_RTS_ACTIVE_HIGH = 0x10ul,
  DRV_UART_RTS_CONTROL_MASK_ALTERNATIVE_MODE = 0x08ul,
  DRV_UART_RTS_CONTROL_MASK_USE_SYSTEM_CLOCK = 0x04ul,
  DRV_UART_RTS_CONTROL_MASK_RTS_CONTROL_BIT_SET = 0x02ul,
  DRV_UART_RTS_CONTROL_MASK_RTS_AUTOMATIC = 0x01ul,
  DRV_UART_RTS_CONTROL_MASK = 0xfful
}
 Enumeration of the rts control parameters as mask. More...
 
enum  DRV_UART_TX_MODE_MASK_E {
  DRV_UART_TX_MODE_MASK_DEFAULT = 0x00ul,
  DRV_UART_TX_MODE_MASK_RECEIVE_ONLY = 0x01ul,
  DRV_UART_TX_MODE_MASK_RTS_ACTIVE = 0x02ul,
  DRV_UART_TX_MODE_MASK = 0x03ul
}
 Enumeration of the transmit modes availabe as mask. More...
 

Functions

static void DRV_UART_Flush_DMA_Callback_Rx (void *ptDriverHandle, DRV_UART_HANDLE_T *const ptDriver)
 
static void DRV_UART_Flush_DMA_Callback_Tx (void *ptDriverHandle, DRV_UART_HANDLE_T *const ptDriver)
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_Init (DRV_UART_HANDLE_T *const ptDriver)
 Initializes the uart device and handle by the given configuration. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_DeInit (DRV_UART_HANDLE_T *const ptDriver)
 Deinitializes the uart device and handle. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_Transmit (DRV_UART_HANDLE_T *const ptDriver, uint8_t const *const data, size_t size)
 Performs a transmission of the given size of the data array via the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_Receive (DRV_UART_HANDLE_T *const ptDriver, uint8_t *const data, size_t size)
 Receives the given size and stores it into data via the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_TransmitReceive (DRV_UART_HANDLE_T *const ptDriver, uint8_t *const txData, uint8_t *const rxData, size_t size)
 Transmits and receives data of given size via the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_PutChar (DRV_UART_HANDLE_T *const ptDriver, unsigned char const cData)
 Transmits a single char via the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_GetChar (DRV_UART_HANDLE_T *const ptDriver, unsigned char *const pcData)
 Receives a single char via the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_Abort (DRV_UART_HANDLE_T *const ptDriver)
 Aborts any transmissions on the given uart. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_GetState (DRV_UART_HANDLE_T *const ptDriver, DRV_UART_STATE_E *const ptState)
 The driver and device state are returned by this function. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_GetRxState (DRV_UART_HANDLE_T *const ptDriver, DRV_UART_STATE_E *const ptState)
 The driver and device state are returned by this function. More...
 
DRV_STATUS_E DRV_UART_HANDLE_T::DRV_UART_GetTxState (DRV_UART_HANDLE_T *const ptDriver, DRV_UART_STATE_E *const ptState)
 The driver and device state are returned by this function. More...
 
__STATIC_FORCEINLINE uint32_t DRV_UART_HANDLE_T::DRV_UART_GetRxCounter (DRV_UART_HANDLE_T *const ptDriver)
 This function returns the amount of bytes received. More...
 
__STATIC_FORCEINLINE uint32_t DRV_UART_HANDLE_T::DRV_UART_GetTxCounter (DRV_UART_HANDLE_T *const ptDriver)
 This function returns the amount of bytes transmitted. More...
 
__STATIC_FORCEINLINE uint8_t volatile * DRV_UART_HANDLE_T::DRV_UART_GetStaticBuffer (DRV_UART_HANDLE_T *const ptDriver)
 This function returns the static buffer. More...
 
__STATIC_INLINE void DRV_UART_HANDLE_T::DRV_UART_Flush_Buffers (DRV_UART_HANDLE_T *const ptDriver)
 This function shall flush the software and hardware buffers of the device. More...
 
__STATIC_INLINE void DRV_UART_HANDLE_T::DRV_UART_IRQ_Inline_Handler (DRV_UART_DEVICE_ID_E const eDeviceID)
 

Variables

static DRV_UART_DEVICE_T *const s_apDeviceAddressTable [DRV_UART_DEVICE_COUNT] = DRV_UART_DEVICE_LIST
 Table of the device addresses. More...
 
static DRV_DMAC_PERIPHERAL_E const s_apDeviceDmacTable [DRV_UART_DEVICE_COUNT] = DRV_UART_DEVICE_DMA_LIST
 Table of the device associated dmac channels. More...
 
static IRQn_Type const s_apHandleIRQnTable [DRV_UART_DEVICE_COUNT] = DRV_UART_DEVICE_IRQ_LIST
 Table of the IRQ vector numbers. More...
 
static DRV_UART_HANDLE_Ts_apHandleAddressTable [DRV_UART_DEVICE_COUNT] = { 0 }
 Used for mapping the handle to an interrupt. More...
 

Detailed Description

The UART driver, defined by DRV_UART_HANDLE_T.

The UART

Macro Definition Documentation

#define DRV_HANDLE_CHECK (   handle)
Value:
if((handle)==0){ \
return DRV_ERROR_PARAM; \
}\
if((handle)->ptDevice==0){ \
return DRV_ERROR_PARAM; \
}

Define for checking the consistency of the handle or static representation of the driver.

Definition at line 63 of file netx_drv_uart.c.

#define DRV_UART_IRQHandler_Generator (   id,
 
)    DRV_Default_IRQHandler_Function_Generator(DRV_UART_IRQ_HANDLER ## id,DRV_UART_IRQ_Inline_Handler,DRV_UART_DEVICE_ID_UART ## id)

The generator define for generating irq handler source code.

Definition at line 1053 of file netx_drv_uart.c.

Enumeration Type Documentation

Enumeration of useful uart baudrates.

Enumerator
DRV_UART_BAUDRATE_300 

Baudrate of 300

DRV_UART_BAUDRATE_600 

Baudrate of 600

DRV_UART_BAUDRATE_1200 

Baudrate of 1200

DRV_UART_BAUDRATE_2400 

Baudrate of 2400

DRV_UART_BAUDRATE_4800 

Baudrate of 4800

DRV_UART_BAUDRATE_9600 

Baudrate of 9600

DRV_UART_BAUDRATE_19200 

Baudrate of 19200

DRV_UART_BAUDRATE_38400 

Baudrate of 38400

DRV_UART_BAUDRATE_57600 

Baudrate of 57600

DRV_UART_BAUDRATE_115200 

Baudrate of 115200

DRV_UART_BAUDRATE_460800 

Baudrate of 460800

DRV_UART_BAUDRATE_DEFAULT 

Baudrate of 0

Definition at line 58 of file netx_drv_uart.h.

Enumeration of useful uart baudrate mode.

Enumerator
DRV_UART_BAUDRATEMODE_RESET 

Reset value

DRV_UART_BAUDRATEMODE_0 

Calculate BaudDiv by BAUDDIV = ( (Baud Rate • 16) / 100 MHz ) • 2^16

DRV_UART_BAUDRATEMODE_1 

Calculate BaudDiv by BAUDDIV = ( 100 MHz / (16 • BaudRate) ) – 1

DRV_UART_BAUDRATEMODE_DEFAULT 

Default maps to mode 1

DRV_UART_BAUDRATEMODE_MIN 

Minimal value

DRV_UART_BAUDRATEMODE_MAX 

Maximum value

Definition at line 45 of file netx_drv_uart.h.

Enumeration of of the line control parameters as mask.

Enumerator
DRV_UART_LINE_CONTROL_MASK_FIFO_ENABLE 

Enables the fifos.

DRV_UART_LINE_CONTROL_MASK_ADDITIONAL_STOP_BIT 

Will generate two stop bits instead of one.

DRV_UART_LINE_CONTROL_MASK_EVEN_PARITY 

Use even parity.

DRV_UART_LINE_CONTROL_MASK_ODD_PARITY 

Activate parity.

DRV_UART_LINE_CONTROL_MASK_SEND_BREAK 

Break in sending.

DRV_UART_LINE_CONTROL_MASK_DEFAULT 

Nothing

DRV_UART_LINE_CONTROL_MASK 

Masks bits choseable.

Definition at line 111 of file netx_drv_uart.h.

Enumeration of the loop back state.

Enumerator
DRV_UART_LOOP_BACK_INACTIVE 

Loopback is inactive

DRV_UART_LOOP_BACK_ACTIVE 

Loopback is active for testing purposes only

DRV_UART_LOOP_BACK_MAX 

Boundary check value

Definition at line 125 of file netx_drv_uart.h.

Enumeration of the rts control parameters as mask.

Enumerator
DRV_UART_RTS_CONTROL_MASK_STICK_PARITY 

Stick parity is used.

DRV_UART_RTS_CONTROL_MASK_CTS_ACTIVE_HIGH 

CTS is active high.

DRV_UART_RTS_CONTROL_MASK_CTS_ENABLE 

CTS will be enabled.

DRV_UART_RTS_CONTROL_MASK_RTS_ACTIVE_HIGH 

RTS is active high.

DRV_UART_RTS_CONTROL_MASK_ALTERNATIVE_MODE 

Mode2 is selected.

DRV_UART_RTS_CONTROL_MASK_USE_SYSTEM_CLOCK 

The system clock is used instead of the baud rate generator. (max speed)

DRV_UART_RTS_CONTROL_MASK_RTS_CONTROL_BIT_SET 

RTS is controled by this bit.

DRV_UART_RTS_CONTROL_MASK_RTS_AUTOMATIC 

The RTS is hardware or driver driven.

DRV_UART_RTS_CONTROL_MASK 

Masks bits choseable.

Definition at line 162 of file netx_drv_uart.h.

Enumeration of uart device states.

Enumerator
DRV_UART_STATE_CTS 

CTS

DRV_UART_STATE_DSR 

DSR

DRV_UART_STATE_DCD 

DCD

DRV_UART_STATE_BUSY 

BUSY

DRV_UART_STATE_RXFE 

Rx fifo empty

DRV_UART_STATE_TXFF 

Tx fifo full

DRV_UART_STATE_RXFF 

Rx fifo full

DRV_UART_STATE_TXFE 

Rx fifo empty

DRV_UART_STATE_ERROR_FRAMING 

Framing Error

DRV_UART_STATE_ERROR_PARITY 

Parity Error

DRV_UART_STATE_ERROR_BREAK 

Break Error

DRV_UART_STATE_ERROR_OVERRUN 

Overrun Error

Definition at line 77 of file netx_drv_uart.h.

Enumeration of the transmit modes availabe as mask.

Enumerator
DRV_UART_TX_MODE_MASK_DEFAULT 

Transmit is active.

DRV_UART_TX_MODE_MASK_RECEIVE_ONLY 

Receive only.

DRV_UART_TX_MODE_MASK_RTS_ACTIVE 

Use RTS.

DRV_UART_TX_MODE_MASK 

Masks bits choseable.

Definition at line 178 of file netx_drv_uart.h.

Enumeration of the loop back state.

Enumerator
DRV_UART_WATERMARK_UNINITIALIZED 

Watermark of 8

DRV_UART_WATERMARK_1 

Watermark of 1

DRV_UART_WATERMARK_2 

Watermark of 2

DRV_UART_WATERMARK_3 

Watermark of 3

DRV_UART_WATERMARK_4 

Watermark of 4

DRV_UART_WATERMARK_5 

Watermark of 5

DRV_UART_WATERMARK_6 

Watermark of 6

DRV_UART_WATERMARK_7 

Watermark of 7

DRV_UART_WATERMARK_8 

Watermark of 8

DRV_UART_WATERMARK_DEFAULT 

Watermark default value

DRV_UART_WATERMARK_9 

Watermark of 9

DRV_UART_WATERMARK_10 

Watermark of 10

DRV_UART_WATERMARK_11 

Watermark of 11

DRV_UART_WATERMARK_12 

Watermark of 12

DRV_UART_WATERMARK_13 

Watermark of 13

DRV_UART_WATERMARK_14 

Watermark of 14

DRV_UART_WATERMARK_15 

Watermark of 15

DRV_UART_WATERMARK_16 

Watermark of 16

DRV_UART_WATERMARK_MIN 

Boundary check value

DRV_UART_WATERMARK_MAX 

Boundary check value

Definition at line 135 of file netx_drv_uart.h.

Enumeration of the available uart word lenghts.

Enumerator
DRV_UART_WORD_LENGTH_RESET 

Default uart word lenght

DRV_UART_WORD_LENGTH_5_BITS 

Word length of 5 bits

DRV_UART_WORD_LENGTH_6_BITS 

Word length of 6 bits

DRV_UART_WORD_LENGTH_7_BITS 

Word length of 7 bits

DRV_UART_WORD_LENGTH_8_BITS 

Word length of 8 bits

DRV_UART_WORD_LENGTH_DEFAULT 

Default uart word lenght

DRV_UART_WORD_LENGTH_MIN 

Minimum used for boundary checks

DRV_UART_WORD_LENGTH_MAX 

Maximum used for boundary checks

Definition at line 96 of file netx_drv_uart.h.

Function Documentation

DRV_STATUS_E DRV_UART_Abort ( DRV_UART_HANDLE_T *const  ptDriver)

Aborts any transmissions on the given uart.

The abort method will abort a uart transmission in progress.

If one uses the RxCallback, the interrupt conditions will be masked out. One has to actively receive again afterwards to enable it.

Parameters
[in,out]ptDriverThe given handle of the drivers class
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM DRV_ERROR DRV_NSUPP

Definition at line 830 of file netx_drv_uart.c.

Here is the call graph for this function:

DRV_STATUS_E DRV_UART_DeInit ( DRV_UART_HANDLE_T *const  ptDriver)

Deinitializes the uart device and handle.

The deinitialize function is supposed to reset the handle, the device and disable the interrupt signaling. The handle might be used afterwards again for initializing a UART device driver handle.

Parameters
[in,out]ptDriverThe ptDriver to be initialized
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM

Definition at line 285 of file netx_drv_uart.c.

Here is the call graph for this function:

__STATIC_INLINE void DRV_UART_Flush_Buffers ( DRV_UART_HANDLE_T *const  ptDriver)
private

This function shall flush the software and hardware buffers of the device.

This function is the hardware closest layer of the uart driver. The handle contains some variables defining the software buffer state. This state shall be equalized in this function. The transmit buffer is transfered to the transmit fifo of the device from the actual counter position to the given size. The receive fifo of the device is written to the current counter position until the given size is reached. If there is no buffer given, the function will transmit the dummy pattern specified in the attributes, and receives what is contained in the receive fifo but discard it.

Parameters
[in,out]ptDriverThe given handle of the drivers class
Returns
DRV_OK always, because there is no error condition occurring

Definition at line 315 of file netx_drv_uart.c.

Here is the caller graph for this function:

static void DRV_UART_Flush_DMA_Callback_Rx ( void *  ptDriverHandle,
DRV_UART_HANDLE_T *const  ptDriver 
)
static

This callback is used in dma operation mode. It is registered in the dmac api to get informed if the dma finished copying.

Definition at line 85 of file netx_drv_uart.c.

Here is the caller graph for this function:

static void DRV_UART_Flush_DMA_Callback_Tx ( void *  ptDriverHandle,
DRV_UART_HANDLE_T *const  ptDriver 
)
static

This callback is used in dma operation mode. It is registered in the dmac api to get informed if the dma finished copying.

Definition at line 100 of file netx_drv_uart.c.

Here is the caller graph for this function:

DRV_STATUS_E DRV_UART_GetChar ( DRV_UART_HANDLE_T *const  ptDriver,
unsigned char *const  pcData 
)

Receives a single char via the given uart.

The get character method will get the next character from the device. This is possible if there is no buffer content to be received.

This method is blocking.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[out]pcDataThe pointer to the character to be received
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM DRV_ERROR

Definition at line 777 of file netx_drv_uart.c.

__STATIC_FORCEINLINE uint32_t DRV_UART_GetRxCounter ( DRV_UART_HANDLE_T *const  ptDriver)

This function returns the amount of bytes received.

The function is defined as inline. It only returns the RxBufferCounter located in the handle. The RxBufferCounter is 0 if it is full or empty. The complete callback was issued in case it is full. Because while the complete callback is called, the counter is not reset, one is able to get the amount of data received.

Parameters
[in,out]ptDriverThe given handle of the drivers class
Returns
Bytes received

Definition at line 310 of file netx_drv_uart.h.

DRV_STATUS_E DRV_UART_GetRxState ( DRV_UART_HANDLE_T *const  ptDriver,
DRV_UART_STATE_E *const  ptState 
)

The driver and device state are returned by this function.

The get state method will check if the driver is busy in the receive patht and it will return the state of the device. One is able to skip the state by providing a null pointer.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[out]ptStateThe pointer to where the state of the device given will be stored.
Returns
DRV_OK DRV_BUSY

Definition at line 915 of file netx_drv_uart.c.

DRV_STATUS_E DRV_UART_GetState ( DRV_UART_HANDLE_T *const  ptDriver,
DRV_UART_STATE_E *const  ptState 
)

The driver and device state are returned by this function.

The get state method will check if the driver is busy and it will return the state of the device. One is able to skip the state by providing a null pointer.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[out]ptStateThe pointer to where the state of the device given will be stored.
Returns
DRV_OK DRV_BUSY

Definition at line 887 of file netx_drv_uart.c.

__STATIC_FORCEINLINE uint8_t volatile * DRV_UART_GetStaticBuffer ( DRV_UART_HANDLE_T *const  ptDriver)

This function returns the static buffer.

The function is defined as inline. It returns the rx buffer received statically. The buffer content is only valid inside the fnRxCallback. The DRV_UART_GetRxCounter defines the ammount of received bytes.

Parameters
[in,out]ptDriverThe given handle of the drivers class
Returns
Static buffer containing the received data.

Definition at line 352 of file netx_drv_uart.h.

__STATIC_FORCEINLINE uint32_t DRV_UART_GetTxCounter ( DRV_UART_HANDLE_T *const  ptDriver)

This function returns the amount of bytes transmitted.

The function is defined as inline. It only returns the TxBufferCounter located in the handle. The TxBufferCounter is 0 if it is full or empty. The complete callback was issued in case it is full. Because while the complete callback is called, the counter is not reset, one is able to get the amount of data received.

Parameters
[in,out]ptDriverThe given handle of the drivers class
Returns
Bytes transmitted

Definition at line 331 of file netx_drv_uart.h.

DRV_STATUS_E DRV_UART_GetTxState ( DRV_UART_HANDLE_T *const  ptDriver,
DRV_UART_STATE_E *const  ptState 
)

The driver and device state are returned by this function.

The get state method will check if the driver is busy in the transmit path and it will return the state of the device. One is able to skip the state by providing a null pointer.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[out]ptStateThe pointer to where the state of the device given will be stored.
Returns
DRV_OK DRV_BUSY

Definition at line 942 of file netx_drv_uart.c.

DRV_STATUS_E DRV_UART_Init ( DRV_UART_HANDLE_T *const  ptDriver)

Initializes the uart device and handle by the given configuration.

The function takes a DRV_UART_HANDLE_T pointer which contains a DRV_UART_CONFIGURATION_T structure. Those structure contains the configuration/initialization parameters of the device. While most attributes have valid default behavior, it is necessary to configure at least the DRV_UART_DEVICE_ID_E and some others.

The UARTs initialize function forces the initialization of the UART peripheral and the handle. The driver lock is set and the given parameters in the DRV_UART_CONFIGURATION_T structure are checked if there are parameter combinations not feasible. If everything is ok, the Buffers will be reset and the configuration registers are written, regarding the given attributes. At last the lock will be released.

Parameters
[out]ptDriverThe ptDriver to be
Returns
DRV_OK DRV_ERROR_PARAM DRV_NIMPL

Definition at line 126 of file netx_drv_uart.c.

Here is the call graph for this function:

__STATIC_INLINE void DRV_UART_IRQ_Inline_Handler ( DRV_UART_DEVICE_ID_E const  eDeviceID)

The interrupt handler of the uart device driver.

Parameters
[in]eDeviceIDThe device calling the interrupt
Returns
void

Definition at line 966 of file netx_drv_uart.c.

Here is the call graph for this function:

DRV_STATUS_E DRV_UART_PutChar ( DRV_UART_HANDLE_T *const  ptDriver,
unsigned char const  cData 
)

Transmits a single char via the given uart.

The put character method will put a character down to the device so that it is transmitted. This is possible if there is no buffer content to be transmitted.

This method is blocking.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[in]cDataThe character to be transmitted
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM DRV_ERROR

Definition at line 729 of file netx_drv_uart.c.

DRV_STATUS_E DRV_UART_Receive ( DRV_UART_HANDLE_T *const  ptDriver,
uint8_t *const  data,
size_t  size 
)

Receives the given size and stores it into data via the given uart.

The receive function is associated with the job to receive data of the given size via the UART initialized on the given context to the given position.

In polling mode it is blocking and in irq and dma it is non blocking.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[out]dataThe pointer to the data to be received
[in]sizeThe size of the data buffers
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM

Definition at line 494 of file netx_drv_uart.c.

Here is the call graph for this function:

DRV_STATUS_E DRV_UART_Transmit ( DRV_UART_HANDLE_T *const  ptDriver,
uint8_t const *const  data,
size_t  size 
)

Performs a transmission of the given size of the data array via the given uart.

The transmit function is associated with the job to transmit the given data of the given size via the UART initialized on the given context.

In polling mode it is blocking and in irq and dma it is non blocking.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[in]dataThe pointer to the data to be transmitted
[in]sizeThe size of the data buffers
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM

Definition at line 394 of file netx_drv_uart.c.

Here is the call graph for this function:

DRV_STATUS_E DRV_UART_TransmitReceive ( DRV_UART_HANDLE_T *const  ptDriver,
uint8_t *const  txData,
uint8_t *const  rxData,
size_t  size 
)

Transmits and receives data of given size via the given uart.

The transmit receive function is associated with the job to transmit and receive the given data of the given size via the UART initialized on the given context and receive the data to the given position.

In polling mode it is blocking and in irq and dma it is non blocking.

Parameters
[in,out]ptDriverThe given handle of the drivers class
[in]txDataThe pointer to the data to be transmitted
[out]rxDataThe pointer to the data to be received
[in]sizeThe size of the data buffers
Returns
DRV_OK DRV_LOCKED DRV_ERROR_PARAM

Definition at line 596 of file netx_drv_uart.c.

Here is the call graph for this function:

Variable Documentation

DRV_UART_DEVICE_T* const s_apDeviceAddressTable[DRV_UART_DEVICE_COUNT] = DRV_UART_DEVICE_LIST
static

Table of the device addresses.

Used to identify the device addresses by the device id.

Definition at line 39 of file netx_drv_uart.c.

Table of the device associated dmac channels.

Used to identify the device dmac channels by the device id.

Definition at line 45 of file netx_drv_uart.c.

DRV_UART_HANDLE_T* s_apHandleAddressTable[DRV_UART_DEVICE_COUNT] = { 0 }
static

Used for mapping the handle to an interrupt.

Threadsafe and reentrant because its is only written in normal context an used in interrupt context of the specific interrupt.

Definition at line 57 of file netx_drv_uart.c.

IRQn_Type const s_apHandleIRQnTable[DRV_UART_DEVICE_COUNT] = DRV_UART_DEVICE_IRQ_LIST
static

Table of the IRQ vector numbers.

Used to identify the interrupt channels by the device id.

Definition at line 51 of file netx_drv_uart.c.