![]() |
LibDriver CH9121X
|
driver ch9121x header file More...
#include <stdio.h>#include <stdint.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | ch9121x_handle_s |
| ch9121x handle structure definition More... | |
| struct | ch9121x_info_s |
| ch9121x information structure definition More... | |
Macros | |
| #define | CH9121X_UART_PRE_DELAY 50 |
| ch9121x uart pre delay definition | |
| #define | DRIVER_CH9121X_LINK_INIT(HANDLE, STRUCTURE) |
| initialize ch9121x structure | |
| #define | DRIVER_CH9121X_LINK_UART_INIT(HANDLE, FUC) |
| link uart_init function | |
| #define | DRIVER_CH9121X_LINK_UART_DEINIT(HANDLE, FUC) |
| link uart_deinit function | |
| #define | DRIVER_CH9121X_LINK_UART_READ(HANDLE, FUC) |
| link uart_read function | |
| #define | DRIVER_CH9121X_LINK_UART_WRITE(HANDLE, FUC) |
| link uart_write function | |
| #define | DRIVER_CH9121X_LINK_UART_FLUSH(HANDLE, FUC) |
| link uart_flush function | |
| #define | DRIVER_CH9121X_LINK_RESET_GPIO_INIT(HANDLE, FUC) |
| link reset_gpio_init function | |
| #define | DRIVER_CH9121X_LINK_RESET_GPIO_DEINIT(HANDLE, FUC) |
| link reset_gpio_deinit function | |
| #define | DRIVER_CH9121X_LINK_RESET_GPIO_WRITE(HANDLE, FUC) |
| link reset_gpio_write function | |
| #define | DRIVER_CH9121X_LINK_CFG_GPIO_INIT(HANDLE, FUC) |
| link cfg_gpio_init function | |
| #define | DRIVER_CH9121X_LINK_CFG_GPIO_DEINIT(HANDLE, FUC) |
| link cfg_gpio_deinit function | |
| #define | DRIVER_CH9121X_LINK_CFG_GPIO_WRITE(HANDLE, FUC) |
| link cfg_gpio_write function | |
| #define | DRIVER_CH9121X_LINK_DELAY_MS(HANDLE, FUC) |
| link delay_ms function | |
| #define | DRIVER_CH9121X_LINK_DEBUG_PRINT(HANDLE, FUC) |
| link debug_print function | |
Typedefs | |
| typedef struct ch9121x_handle_s | ch9121x_handle_t |
| ch9121x handle structure definition | |
| typedef struct ch9121x_info_s | ch9121x_info_t |
| ch9121x information structure definition | |
Functions | |
| uint8_t | ch9121x_info (ch9121x_info_t *info) |
| get chip's information | |
| uint8_t | ch9121x_init (ch9121x_handle_t *handle) |
| initialize the chip | |
| uint8_t | ch9121x_deinit (ch9121x_handle_t *handle) |
| close the chip | |
| uint8_t | ch9121x_read (ch9121x_handle_t *handle, uint8_t *buf, uint16_t *len) |
| read data | |
| uint8_t | ch9121x_write (ch9121x_handle_t *handle, uint8_t *buf, uint16_t len) |
| write data | |
| uint8_t | ch9121x_get_version (ch9121x_handle_t *handle, uint8_t *version) |
| get version | |
| uint8_t | ch9121x_reset (ch9121x_handle_t *handle) |
| reset the chip | |
| uint8_t | ch9121x_save_to_eeprom (ch9121x_handle_t *handle) |
| save to eeprom | |
| uint8_t | ch9121x_config_and_reset (ch9121x_handle_t *handle) |
| config and reset the chip | |
| uint8_t | ch9121x_exit (ch9121x_handle_t *handle) |
| exit | |
| uint8_t | ch9121x_set_dhcp (ch9121x_handle_t *handle, ch9121x_bool_t enable) |
| enable or disable dhcp | |
| uint8_t | ch9121x_get_dhcp (ch9121x_handle_t *handle, ch9121x_bool_t *enable) |
| get dhcp status | |
| uint8_t | ch9121x_set_mac (ch9121x_handle_t *handle, uint8_t mac[6]) |
| set mac address | |
| uint8_t | ch9121x_get_mac (ch9121x_handle_t *handle, uint8_t mac[6]) |
| get chip mac | |
| uint8_t | ch9121x_clear_mac (ch9121x_handle_t *handle) |
| clear mac address | |
| uint8_t | ch9121x_set_ip (ch9121x_handle_t *handle, uint8_t ip[4]) |
| set ip address | |
| uint8_t | ch9121x_get_ip (ch9121x_handle_t *handle, uint8_t ip[4]) |
| get ip address | |
| uint8_t | ch9121x_set_subnet_mask (ch9121x_handle_t *handle, uint8_t mask[4]) |
| set subnet mask | |
| uint8_t | ch9121x_get_subnet_mask (ch9121x_handle_t *handle, uint8_t mask[4]) |
| get subnet mask | |
| uint8_t | ch9121x_set_gateway (ch9121x_handle_t *handle, uint8_t ip[4]) |
| set gateway | |
| uint8_t | ch9121x_get_gateway (ch9121x_handle_t *handle, uint8_t ip[4]) |
| get gateway | |
| uint8_t | ch9121x_get_status (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_status_t *status) |
| get status | |
| uint8_t | ch9121x_set_mode (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_mode_t mode) |
| set mode | |
| uint8_t | ch9121x_get_mode (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_mode_t *mode) |
| get mode | |
| uint8_t | ch9121x_set_source_port (ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t num) |
| set source port | |
| uint8_t | ch9121x_get_source_port (ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t *num) |
| get source port | |
| uint8_t | ch9121x_set_dest_ip (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t ip[4]) |
| set dest ip | |
| uint8_t | ch9121x_get_dest_ip (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t ip[4]) |
| get dest ip | |
| uint8_t | ch9121x_set_dest_port (ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t num) |
| set dest port | |
| uint8_t | ch9121x_get_dest_port (ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t *num) |
| get dest port | |
| uint8_t | ch9121x_set_uart_baud (ch9121x_handle_t *handle, ch9121x_port_t port, uint32_t baud) |
| set uart baud | |
| uint8_t | ch9121x_get_uart_baud (ch9121x_handle_t *handle, ch9121x_port_t port, uint32_t *baud) |
| get uart baud | |
| uint8_t | ch9121x_set_uart_config (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t data_bit, ch9121x_parity_t parity, uint8_t stop_bit) |
| set uart config | |
| uint8_t | ch9121x_get_uart_config (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t *data_bit, ch9121x_parity_t *parity, uint8_t *stop_bit) |
| get uart config | |
| uint8_t | ch9121x_set_uart_timeout (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t timeout) |
| set uart timeout | |
| uint8_t | ch9121x_get_uart_timeout (ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t *timeout) |
| get uart timeout | |
| uint8_t | ch9121x_uart_timeout_convert_to_register (ch9121x_handle_t *handle, uint16_t ms, uint8_t *reg) |
| convert the uart timeout to the register raw data | |
| uint8_t | ch9121x_uart_timeout_convert_to_data (ch9121x_handle_t *handle, uint8_t reg, uint16_t *ms) |
| convert the register raw data to the offset | |
| uint8_t | ch9121x_set_source_port_random (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_bool_t enable) |
| enable or disable random source port number | |
| uint8_t | ch9121x_get_source_port_random (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_bool_t *enable) |
| get random source port number status | |
| uint8_t | ch9121x_set_uart_buffer_length (ch9121x_handle_t *handle, ch9121x_port_t port, uint32_t len) |
| set uart buffer length | |
| uint8_t | ch9121x_get_uart_buffer_length (ch9121x_handle_t *handle, ch9121x_port_t port, uint32_t *len) |
| get uart buffer length | |
| uint8_t | ch9121x_set_uart_flush (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_bool_t enable) |
| enable or disable uart auto flush | |
| uint8_t | ch9121x_get_uart_flush (ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_bool_t *enable) |
| get uart auto flush status | |
| uint8_t | ch9121x_set_port2 (ch9121x_handle_t *handle, ch9121x_bool_t enable) |
| enable or disable uart port2 | |
| uint8_t | ch9121x_set_disconnect_with_no_rj45 (ch9121x_handle_t *handle, ch9121x_bool_t enable) |
| enable or disable disconnect with no rj45 | |
| uint8_t | ch9121x_get_disconnect_with_no_rj45 (ch9121x_handle_t *handle, ch9121x_bool_t *enable) |
| get disconnect with no rj45 status | |
| uint8_t | ch9121x_set_domain (ch9121x_handle_t *handle, char *domain) |
| set chip domain | |
| uint8_t | ch9121x_set_eth_cfg (ch9121x_handle_t *handle, ch9121x_bool_t enable) |
| set eth cfg | |
| uint8_t | ch9121x_get_eth_cfg (ch9121x_handle_t *handle, ch9121x_bool_t *enable) |
| get eth cfg | |
| uint8_t | ch9121x_set_uart_clock_mode (ch9121x_handle_t *handle, ch9121x_uart_clock_mode_t mode) |
| set uart clock mode | |
| uint8_t | ch9121x_get_uart_clock_mode (ch9121x_handle_t *handle, ch9121x_uart_clock_mode_t *mode) |
| get uart clock mode | |
| uint8_t | ch9121x_get_phy_status (ch9121x_handle_t *handle, ch9121x_phy_status_t *status) |
| get phy status | |
| uint8_t | ch9121x_set_tcp_retry_mode (ch9121x_handle_t *handle, uint8_t t) |
| set tcp retry mode | |
| uint8_t | ch9121x_get_tcp_retry_mode (ch9121x_handle_t *handle, uint8_t *t) |
| get tcp retry mode | |
| uint8_t | ch9121x_set_flow_control (ch9121x_handle_t *handle, ch9121x_bool_t enable) |
| enable or disable flow control | |
| uint8_t | ch9121x_get_flow_control (ch9121x_handle_t *handle, ch9121x_bool_t *enable) |
| get flow control status | |
| uint8_t | ch9121x_set_arp_retry (ch9121x_handle_t *handle, uint8_t period, uint8_t times) |
| set arp retry | |
| uint8_t | ch9121x_tcp_retry_time_convert_to_register (ch9121x_handle_t *handle, uint16_t ms, uint8_t *reg) |
| convert the tcp retry time to the register raw data | |
| uint8_t | ch9121x_tcp_retry_time_convert_to_data (ch9121x_handle_t *handle, uint8_t reg, uint16_t *ms) |
| convert the register raw data to the tcp retry time | |
| uint8_t | ch9121x_arp_retry_period_convert_to_register (ch9121x_handle_t *handle, uint16_t ms, uint8_t *reg) |
| convert the arp retry period to the register raw data | |
| uint8_t | ch9121x_arp_retry_period_convert_to_data (ch9121x_handle_t *handle, uint8_t reg, uint16_t *ms) |
| convert the register raw data to the arp retry period | |
| uint8_t | ch9121x_set_command (ch9121x_handle_t *handle, uint8_t *param, uint16_t len, uint8_t *out, uint16_t out_len, uint16_t pre_delay, uint16_t timeout) |
| set command | |
driver ch9121x header file
Copyright (c) 2015 - present LibDriver All rights reserved
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Date | Version | Author | Description |
|---|---|---|---|
| 2026/05/15 | 1.0 | Shifeng Li | first upload |
Definition in file driver_ch9121x.h.