|  | WE310F5
    39.00.000
    | 
This section describes the M2MB APIs to perform various UART operations. More...
This section describes the M2MB APIs to perform various UART operations.
| #define M2MB_CONSOLE_PORT M2MB_UART_HS_PORT_E | 
Definition at line 52 of file m2mb_uart.h.
UART call back prototype.
Type definition of the user callback to handle UART receive and transmit events. num_bytes represent the number of bytes transmitted/received, p_cb_data represents data for the callback.
Type definition of the user callback to handle UART receive and transmit events.
| [in] | num_bytes | represent the number of bytes transmitted/received | 
| [in] | p_cb_data | represents data for the callback given as the input to UART read or write request. | 
Example
Definition at line 122 of file m2mb_uart.h.
| typedef struct M2MB_UART_CONFIG M2MB_UART_CONFIG_T | 
Structure to configure UART module.
Structure for storing the configuration of UART module. This will be used by m2mb_uart_open API to open UART module with given configuration.
| typedef VOID* M2MB_UART_HANDLE_T | 
UART Handle pointer.
This pointer represents the UART context.
Definition at line 61 of file m2mb_uart.h.
UART bits per character configuration enumeration.
This enumeration defines macros for configuration of bits per character of UART.
Definition at line 155 of file m2mb_uart.h.
UART number of stop bits configuration enumeration.
This enumeration defines macros for number of stop bits configuration.
| Enumerator | |
|---|---|
| M2MB_UART_0_5_STOP_BITS_E | 0.5 stop bits. | 
| M2MB_UART_1_0_STOP_BITS_E | 1.0 stop bit. | 
| M2MB_UART_1_5_STOP_BITS_E | 1.5 stop bits. | 
| M2MB_UART_2_0_STOP_BITS_E | 2.0 stop bits. | 
Definition at line 168 of file m2mb_uart.h.
UART parity mode configuration enumeration.
This enumeration defines macros for UART parity mode configuration.
| Enumerator | |
|---|---|
| M2MB_UART_NO_PARITY_E | No parity. | 
| M2MB_UART_ODD_PARITY_E | Odd parity. | 
| M2MB_UART_EVEN_PARITY_E | Even parity. | 
| M2MB_UART_SPACE_PARITY_E | Space parity. | 
Definition at line 142 of file m2mb_uart.h.
| enum M2MB_UART_PORT_ID_E | 
UART Port Identifier enumeration.
This enumeration defines macros for UART Port Identifiers.
| Enumerator | |
|---|---|
| M2MB_UART_HS_PORT_E | High speed port. | 
| M2MB_UART_DEBUG_PORT_E | Debug port. | 
| M2MB_UART_MAX_PORTS_E | Maximum number of ports. | 
Definition at line 129 of file m2mb_uart.h.
| M2MB_STATUS_T m2mb_uart_close | ( | M2MB_UART_HANDLE_T | p_handle | ) | 
Close UART port.
This service closes the UART
| [in] | p_handle | Pointer to the handle of UART module | 
m2mb_uart_close( uart_handle );
| M2MB_STATUS_T m2mb_uart_open | ( | M2MB_UART_HANDLE_T * | p_handle, | 
| M2MB_UART_PORT_ID_E | id, | ||
| M2MB_UART_CONFIG_T * | p_config | ||
| ) | 
Opens the UART port.
Opens the UART port and configures the corresponding clocks, interrupts, and GPIO.
| [in] | p_handle | Pointer to the handle of UART module | 
| [in] | id | Enumeration of type M2MB_UART_PORT_ID_E that specifies PORT ID | 
| [in] | p_config | Pointer to the configuration structure of UART module | 
m2mb_uart_open( &uart_handle, M2MB_UART_HS_PORT_E, &uart_cfg ); 
 
Receives data from UART port.
This service receives the data from UART port.
| [in] | h | UART handle provided by m2mb_uart_open(). | 
| [out] | size | Size pointer. it stroes the size of data received. | 
| [in] | timeout | timeout to wait for data. | 
Example
| M2MB_STATUS_T m2mb_uart_write | ( | M2MB_UART_HANDLE_T | p_handle, | 
| CHAR * | p_buf, | ||
| UINT32 | bytes_to_tx, | ||
| VOID * | p_cb_data | ||
| ) | 
Transmits data over UART port.
This service transmits the given data over UART
| [in] | p_handle | Pointer to the handle of UART module | 
| [in] | p_buf` | Pointer to the buffer of data to be transmitted | 
| [in] | bytes_to_tx | Number of bytes to be transmitted | 
| [in] | p_cb_data | Callback data to be passed when tx_cb is called during TX completion. | 
m2mb_uart_write( handle, "Hello", strlen("Hello"), NULL );