9 #ifndef __ewf_interface_lpc_uart__h__included__
10 #define __ewf_interface_lpc_uart__h__included__
14 #if FSL_FEATURE_SOC_LPUART_COUNT > 0
15 #include "fsl_lpuart.h"
16 #elif FSL_FEATURE_SOC_USART_COUNT > 0
17 #include "fsl_usart.h"
19 #error "Do not have a supported UART peripheral."
38 #define EWF_INTERFACE_LPC_UART_RING_BUFFER_SIZE (128U)
41 #ifndef EWF_INTERFACE_LPC_UART_CONFIG_UART_RX_QUEUE_SIZE
42 #define EWF_INTERFACE_LPC_UART_CONFIG_UART_RX_QUEUE_SIZE (32)
45 #ifndef EWF_INTERFACE_LPC_UART_CONFIG_RESPONSE_QUEUE_SIZE
46 #define EWF_INTERFACE_LPC_UART_CONFIG_RESPONSE_QUEUE_SIZE (8)
49 #ifndef EWF_INTERFACE_LPC_UART_CONFIG_URC_QUEUE_SIZE
50 #define EWF_INTERFACE_LPC_UART_CONFIG_URC_QUEUE_SIZE (8)
60 #if FSL_FEATURE_SOC_LPUART_COUNT > 0
62 lpuart_handle_t handle;
63 lpuart_transfer_t tx_transfer;
64 lpuart_transfer_t rx_transfer;
65 #elif FSL_FEATURE_SOC_USART_COUNT > 0
67 usart_handle_t handle;
68 usart_transfer_t tx_transfer;
69 usart_transfer_t rx_transfer;
74 usart_config_t config;
79 ewf_platform_mutex* rx_mutex_ptr;
81 usart_transfer_t xfer;
105 #ifdef EWF_PARAMETER_CHECKING
106 #define EWF_INTERFACE_LPC_UART_INITIALIZE_HEADER(interface_ptr) \
108 (interface_ptr)->struct_magic = EWF_INTERFACE_STRUCT_MAGIC; \
109 (interface_ptr)->struct_size = EWF_INTERFACE_STRUCT_SIZE; \
110 (interface_ptr)->struct_version = EWF_INTERFACE_VERSION; \
111 (interface_ptr)->struct_type = EWF_INTERFACE_TYPE_LPC_UART; \
114 #define EWF_INTERFACE_LPC_UART_INITIALIZE_HEADER(interface_ptr)
122 #define EWF_INTERFACE_LPC_UART_STATIC_DECLARE(interface_ptr, interface_name_symb, uart_base_ptr_param, baud_rate_param) \
124 static ewf_interface_lpc_uart ewf_interface_lpc_uart__implementation__##interface_name_symb = {0}; \
125 static ewf_interface ewf_interface_lpc_uart__interface__##interface_name_symb = {0}; \
126 ewf_interface_lpc_uart__implementation__##interface_name_symb.base = uart_base_ptr_param; \
127 ewf_interface_lpc_uart__implementation__##interface_name_symb.buffer_size = EWF_INTERFACE_LPC_UART_RING_BUFFER_SIZE; \
128 ewf_interface_lpc_uart__implementation__##interface_name_symb.baud_rate = baud_rate_param; \
129 EWF_PLATFORM_MUTEX_STATIC_DECLARE( \
130 ewf_interface_lpc_uart__implementation__##interface_name_symb.rx_mutex_ptr, \
131 ewf_interface_lpc_uart__uart_rx_mutex__##interface_name_symb); \
132 EWF_PLATFORM_QUEUE_STATIC_DECLARE( \
133 ewf_interface_lpc_uart__interface__##interface_name_symb.response_queue_ptr, \
134 ewf_interface_lpc_uart__response_queue__##interface_name_symb, \
135 ewf_interface_message, \
136 EWF_INTERFACE_LPC_UART_CONFIG_RESPONSE_QUEUE_SIZE); \
137 EWF_PLATFORM_QUEUE_STATIC_DECLARE( \
138 ewf_interface_lpc_uart__interface__##interface_name_symb.urc_queue_ptr, \
139 ewf_interface_lpc_uart__urc_queue__##interface_name_symb, \
140 ewf_interface_message, \
141 EWF_INTERFACE_LPC_UART_CONFIG_URC_QUEUE_SIZE); \
142 ewf_interface_lpc_uart__interface__##interface_name_symb.hardware_start = ewf_interface_lpc_uart_hardware_start; \
143 ewf_interface_lpc_uart__interface__##interface_name_symb.hardware_stop = ewf_interface_lpc_uart_hardware_stop; \
144 ewf_interface_lpc_uart__interface__##interface_name_symb.hardware_send = ewf_interface_lpc_uart_hardware_send; \
145 ewf_interface_lpc_uart__interface__##interface_name_symb.hardware_receive = ewf_interface_lpc_uart_hardware_receive; \
146 ewf_interface_lpc_uart__interface__##interface_name_symb.implementation_ptr = &(ewf_interface_lpc_uart__implementation__##interface_name_symb); \
147 interface_ptr = &(ewf_interface_lpc_uart__interface__##interface_name_symb); \
148 EWF_INTERFACE_LPC_UART_INITIALIZE_HEADER(interface_ptr); \
The Embedded Wireless Framework host interface API.
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
ewf_result ewf_interface_lpc_uart_hardware_receive(ewf_interface *interface_ptr, uint8_t *buffer_ptr, uint32_t *buffer_length_ptr, bool wait)
Receive a buffer using the LPC UART hardware interface.
Definition: ewf_interface_lpc_uart.c:143
ewf_result ewf_interface_lpc_uart_hardware_stop(ewf_interface *interface_ptr)
Stop the LPC UART hardware interface.
Definition: ewf_interface_lpc_uart.c:109
struct _ewf_interface_lpc_uart ewf_interface_lpc_uart
The LPC UART host interface implementation data structure type.
ewf_result ewf_interface_lpc_uart_hardware_start(ewf_interface *interface_ptr)
Start the LPC UART hardware interface.
Definition: ewf_interface_lpc_uart.c:60
ewf_result ewf_interface_lpc_uart_hardware_send(ewf_interface *interface_ptr, const uint8_t *buffer_ptr, uint32_t buffer_length)
Send a buffer using the LPC UART hardware interface.
Definition: ewf_interface_lpc_uart.c:125
The LPC UART host interface implementation data structure type.
Definition: ewf_interface_lpc_uart.h:59
uint32_t buffer_size
Definition: ewf_interface_lpc_uart.h:77
uint8_t ring_buffer[EWF_INTERFACE_LPC_UART_RING_BUFFER_SIZE]
Definition: ewf_interface_lpc_uart.h:76
The interface structure definition.
Definition: ewf_interface.h:66