35 #ifndef __SERIAL_PORT_H__ 36 #define __SERIAL_PORT_H__ 38 #ifdef MTK_PORT_SERVICE_ENABLE 137 #include "serial_port_config.h" 138 #include "hal_uart.h" 289 char name[SERIAL_PORT_USER_NAME_SIZE];
352 serial_port_handle_t *handle);
373 serial_port_ctrl_cmd_t command,
This structure defines the data structure for using SERIAL_PORT_CMD_READ_DATA to read data from the s...
Definition: serial_port.h:255
UART or USB special command to get the current available space to store the transmit data...
Definition: serial_port.h:186
The first port type in the port service.
Definition: serial_port.h:172
The Serial Port Service device is invalid.
Definition: serial_port.h:209
serial_port_status_t serial_port_config_read_dev_setting(serial_port_dev_t device, serial_port_dev_setting_t *dev_setting)
This function reads current parameters for a specific device.
The Serial Port Service device is uninitialized.
Definition: serial_port.h:207
The Serial Port Service device is busy.
Definition: serial_port.h:206
UART port type in the port service.
Definition: serial_port.h:173
serial_port_status_t serial_port_open(serial_port_dev_t device, serial_port_open_para_t *para, serial_port_handle_t *handle)
This function initializes the specific device such as UART or USB.
Read data command in blocking mode.
Definition: serial_port.h:185
serial_port_status_t serial_port_config_write_dev_number(const char *user_name, serial_port_dev_t device)
This function writes new assigned device for a specific user.
The maximum number of ports in the port service of a device.
Definition: serial_port.h:164
serial_port_status_t serial_port_control(serial_port_handle_t handle, serial_port_ctrl_cmd_t command, serial_port_ctrl_para_t *para)
This function controls a specific device to read or write data or perform other operations supported ...
UART1 port in the port service of a device.
Definition: serial_port.h:154
The last valid USB port in the port service of a device.
Definition: serial_port.h:162
USB port type in the port service.
Definition: serial_port.h:174
uint32_t ret_size
The current available space to put the transmit data in.
Definition: serial_port.h:266
The invalid port number in the port service of a device.
Definition: serial_port.h:165
This structure indicates current available data received when using #SERIAL_PORT_CMD_UART_GET_READ_AV...
Definition: serial_port.h:273
serial_port_type_t serial_port_get_device_type(serial_port_dev_t device)
This function gets the device type of the serial port device.
This structure is for configuring baud rate for UART device.
Definition: serial_port.h:296
serial_port_status_t serial_port_config_dump_dev_number(uint32_t *user_count, serial_port_assign_t *port_assign)
This function dumps device assign list in NVDM, for example, device UART port0 is assigned to user AT...
The first valid UART port in the port service of a device.
Definition: serial_port.h:152
serial_port_type_t
This enum defines the port_service device types.
Definition: serial_port.h:171
USB connection event.
Definition: serial_port.h:197
uint32_t serial_port_handle_t
This defines the serial port handle for the Serial Port Service.
Definition: serial_port.h:230
serial_port_dev_t
This enum defines the port_service device.
Definition: serial_port.h:151
serial_port_get_write_avail_t serial_port_get_write_avail
Parameters for UART/USB special write command.
Definition: serial_port.h:316
UART or USB special command to get the current available size for the received data.
Definition: serial_port.h:187
This structure defines the data structure for using SERIAL_PORT_CMD_WRITE_DATA to write data to the s...
Definition: serial_port.h:245
uint8_t * data
The data to write to the serial port.
Definition: serial_port.h:246
serial_port_write_data_t serial_port_write_data_blocking
Write data parameters for blocking mode.
Definition: serial_port.h:314
The maximum number of commands.
Definition: serial_port.h:188
Write data command in blocking mode.
Definition: serial_port.h:184
Read data command.
Definition: serial_port.h:183
This defines the data structure that calls serial_port_open() to open a Serial Port Service device...
Definition: serial_port.h:281
uint32_t size
Size of the data to write to the serial port.
Definition: serial_port.h:247
serial_port_write_data_t serial_port_write_data
Write data parameters.
Definition: serial_port.h:312
hal_uart_baudrate_t
This enum defines baud rate of the UART frame.
Definition: hal_uart.h:302
This structure is for configuring a device in the Serial Port Service.
Definition: serial_port.h:303
uint32_t ret_size
The actual size of data written to the serial port.
Definition: serial_port.h:248
The Serial Port Service parameters are invalid.
Definition: serial_port.h:210
serial_port_get_read_avail_t serial_port_get_read_avail
Parameters for UART/USB special read command.
Definition: serial_port.h:317
The Serial Port Service function executed successfully.
Definition: serial_port.h:212
serial_port_register_callback_t callback
The callback function.
Definition: serial_port.h:282
serial_port_callback_event_t
This enum defines the events that trigger the user's callback.
Definition: serial_port.h:194
uint32_t size
Size of the data to read.
Definition: serial_port.h:257
Ready to write event.
Definition: serial_port.h:196
USB2 port in the port service of a device.
Definition: serial_port.h:161
The Serial Port Service function has failed.
Definition: serial_port.h:211
serial_port_dev_t device
Serial Port Service device.
Definition: serial_port.h:290
uint32_t ret_size
The size of the received data.
Definition: serial_port.h:274
void(* serial_port_register_callback_t)(serial_port_dev_t device, serial_port_callback_event_t event, void *parameter)
This defines the callback function prototype for the Serial Port Service.
Definition: serial_port.h:225
USB1 port in the port service of a device.
Definition: serial_port.h:160
serial_port_status_t serial_port_close(serial_port_handle_t handle)
This function de-initializes a specific device after using the device to release the resources for ot...
UART2 port in the port service of a device.
Definition: serial_port.h:155
UART0 port in the port service of a device.
Definition: serial_port.h:153
serial_port_read_data_t serial_port_read_data
Read data parameters.
Definition: serial_port.h:313
uint32_t ret_size
The actual size of data read from the serial port.
Definition: serial_port.h:258
The maximum number of port types in the port service.
Definition: serial_port.h:175
UART3 port in the port service of a device.
Definition: serial_port.h:156
The Serial Port Service function is not supported.
Definition: serial_port.h:208
This structure indicates current available space to put the transmit data in when using #SERIAL_PORT_...
Definition: serial_port.h:265
Write data command.
Definition: serial_port.h:182
serial_port_setting_uart_t port_setting_uart
UART device.
Definition: serial_port.h:304
serial_port_status_t serial_port_config_write_dev_setting(serial_port_dev_t device, serial_port_dev_setting_t *dev_setting)
This function writes new parameters for a specific device.
serial_port_read_data_t serial_port_read_data_blocking
Read data parameters for blocking mode.
Definition: serial_port.h:315
The first valid USB port in the port service of a device.
Definition: serial_port.h:159
USB disconnection event.
Definition: serial_port.h:198
This defines the data structure for communications between the serial port device and its user...
Definition: serial_port.h:288
uint8_t * buffer
The buffer to store the received data.
Definition: serial_port.h:256
serial_port_status_t
This enum defines the Serial Port Service status.
Definition: serial_port.h:204
This structure defines the data structure for each command in serial_port_ctrl_cmd_t.
Definition: serial_port.h:311
serial_port_ctrl_cmd_t
This enum defines the commands for each parameter in serial_port_ctrl_para_t.
Definition: serial_port.h:181
The last valid UART port in the port service of a device.
Definition: serial_port.h:157
serial_port_status_t serial_port_config_read_dev_number(const char *user_name, serial_port_dev_t *device)
This function reads assigned device for a specific user.
Ready to read event.
Definition: serial_port.h:195
hal_uart_baudrate_t baudrate
UART baud rate.
Definition: serial_port.h:297
The Serial Port Service device is not ready.
Definition: serial_port.h:205