56 uint8_t timeout_check;
62 uint8_t mask_check[4];
80 char domain[] =
"www.ch9121x.com";
331 mac[0] = rand() % 0xFF;
332 mac[1] = rand() % 0xFF;
333 mac[2] = rand() % 0xFF;
334 mac[3] = rand() % 0xFF;
335 mac[4] = rand() % 0xFF;
336 mac[5] = rand() % 0xFF;
346 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
389 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
395 ip[0] = rand() % 0xFF;
396 ip[1] = rand() % 0xFF;
397 ip[2] = rand() % 0xFF;
398 ip[3] = rand() % 0xFF;
412 ip[0], ip[1], ip[2], ip[3]);
431 mask[0] = rand() % 0xFF;
432 mask[1] = rand() % 0xFF;
433 mask[2] = rand() % 0xFF;
434 mask[3] = rand() % 0xFF;
448 mask[0], mask[1], mask[2], mask[3]);
467 ip[0] = rand() % 0xFF;
468 ip[1] = rand() % 0xFF;
469 ip[2] = rand() % 0xFF;
470 ip[3] = rand() % 0xFF;
484 ip[0], ip[1], ip[2], ip[3]);
735 num = rand() % 0xFFFFU;
764 num = rand() % 0xFFFFU;
796 ip[0] = rand() % 0xFF;
797 ip[1] = rand() % 0xFF;
798 ip[2] = rand() % 0xFF;
799 ip[3] = rand() % 0xFF;
828 ip[0] = rand() % 0xFF;
829 ip[1] = rand() % 0xFF;
830 ip[2] = rand() % 0xFF;
831 ip[3] = rand() % 0xFF;
863 num = rand() % 0xFFFFU;
892 num = rand() % 0xFFFFU;
1044 timeout = rand() % 0xFF;
1073 timeout = rand() % 0xFF;
1196 len = 128 + rand() % 50;
1221 len = 128 + rand() % 50;
1433#ifndef CH9121X_DISABLE_FLOW_CONTROL_TEST
1541 ms = (rand() % 10) * 5;
1572 ms = (rand() % 7) * 500;
1600 ms = (rand() % 7) * 100;
driver ch9121x register test header file
uint8_t ch9121x_set_dest_port(ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t num)
set 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_set_dest_ip(ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t ip[4])
set dest ip
uint8_t ch9121x_get_mode(ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_mode_t *mode)
get mode
uint8_t ch9121x_get_dhcp(ch9121x_handle_t *handle, ch9121x_bool_t *enable)
get dhcp status
uint8_t ch9121x_get_eth_cfg(ch9121x_handle_t *handle, ch9121x_bool_t *enable)
get eth cfg
uint8_t ch9121x_get_dest_port(ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t *num)
get dest port
struct ch9121x_info_s ch9121x_info_t
ch9121x information structure definition
uint8_t ch9121x_get_flow_control(ch9121x_handle_t *handle, ch9121x_bool_t *enable)
get flow control status
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_flush(ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_bool_t enable)
enable or disable uart auto flush
uint8_t ch9121x_get_version(ch9121x_handle_t *handle, uint8_t *version)
get version
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_clear_mac(ch9121x_handle_t *handle)
clear mac address
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_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_dest_ip(ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t ip[4])
get dest ip
uint8_t ch9121x_get_ip(ch9121x_handle_t *handle, uint8_t ip[4])
get ip address
uint8_t ch9121x_get_uart_buffer_length(ch9121x_handle_t *handle, ch9121x_port_t port, uint32_t *len)
get uart buffer length
ch9121x_phy_status_t
ch9121x phy status enumeration definition
uint8_t ch9121x_get_source_port(ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t *num)
get source port
uint8_t ch9121x_set_mode(ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_mode_t mode)
set mode
ch9121x_mode_t
ch9121x mode enumeration definition
uint8_t ch9121x_set_subnet_mask(ch9121x_handle_t *handle, uint8_t mask[4])
set subnet mask
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_set_port2(ch9121x_handle_t *handle, ch9121x_bool_t enable)
enable or disable uart port2
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_info(ch9121x_info_t *info)
get chip's information
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_get_mac(ch9121x_handle_t *handle, uint8_t mac[6])
get chip mac
uint8_t ch9121x_set_source_port(ch9121x_handle_t *handle, ch9121x_port_t port, uint16_t num)
set source port
uint8_t ch9121x_set_tcp_retry_mode(ch9121x_handle_t *handle, uint8_t t)
set tcp retry mode
uint8_t ch9121x_exit(ch9121x_handle_t *handle)
exit
ch9121x_uart_clock_mode_t
ch9121x uart clock mode enumeration definition
uint8_t ch9121x_deinit(ch9121x_handle_t *handle)
close the chip
uint8_t ch9121x_set_dhcp(ch9121x_handle_t *handle, ch9121x_bool_t enable)
enable or disable dhcp
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_eth_cfg(ch9121x_handle_t *handle, ch9121x_bool_t enable)
set eth cfg
uint8_t ch9121x_get_phy_status(ch9121x_handle_t *handle, ch9121x_phy_status_t *status)
get phy status
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_disconnect_with_no_rj45(ch9121x_handle_t *handle, ch9121x_bool_t enable)
enable or disable disconnect with no rj45
uint8_t ch9121x_set_ip(ch9121x_handle_t *handle, uint8_t ip[4])
set ip address
ch9121x_bool_t
ch9121x bool enumeration definition
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_set_gateway(ch9121x_handle_t *handle, uint8_t ip[4])
set gateway
ch9121x_status_t
ch9121x status enumeration definition
ch9121x_parity_t
ch9121x parity enumeration definition
uint8_t ch9121x_get_status(ch9121x_handle_t *handle, ch9121x_port_t port, ch9121x_status_t *status)
get status
uint8_t ch9121x_set_mac(ch9121x_handle_t *handle, uint8_t mac[6])
set mac address
uint8_t ch9121x_set_domain(ch9121x_handle_t *handle, char *domain)
set chip domain
uint8_t ch9121x_set_flow_control(ch9121x_handle_t *handle, ch9121x_bool_t enable)
enable or disable flow control
uint8_t ch9121x_get_uart_timeout(ch9121x_handle_t *handle, ch9121x_port_t port, uint8_t *timeout)
get uart timeout
uint8_t ch9121x_get_gateway(ch9121x_handle_t *handle, uint8_t ip[4])
get gateway
uint8_t ch9121x_get_subnet_mask(ch9121x_handle_t *handle, uint8_t mask[4])
get subnet mask
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_save_to_eeprom(ch9121x_handle_t *handle)
save to eeprom
uint8_t ch9121x_init(ch9121x_handle_t *handle)
initialize the chip
uint8_t ch9121x_get_tcp_retry_mode(ch9121x_handle_t *handle, uint8_t *t)
get tcp retry mode
uint8_t ch9121x_set_arp_retry(ch9121x_handle_t *handle, uint8_t period, uint8_t times)
set arp retry
struct ch9121x_handle_s ch9121x_handle_t
ch9121x handle structure definition
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_uart_clock_mode(ch9121x_handle_t *handle, ch9121x_uart_clock_mode_t *mode)
get uart clock mode
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_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
@ CH9121X_PHY_STATUS_100M_FULL_DUPLEX
@ CH9121X_PHY_STATUS_10M_HALF_DUPLEX
@ CH9121X_PHY_STATUS_DISCONNECTED
@ CH9121X_PHY_STATUS_10M_FULL_DUPLEX
@ CH9121X_PHY_STATUS_100M_HALF_DUPLEX
@ CH9121X_MODE_TCP_CLIENT
@ CH9121X_MODE_UDP_CLIENT
@ CH9121X_MODE_TCP_SERVER
@ CH9121X_MODE_UDP_SERVER
@ CH9121X_UART_CLOCK_MODE_DEFAULT
@ CH9121X_UART_CLOCK_MODE_CLASSICAL
uint8_t ch9121x_interface_cfg_gpio_deinit(void)
interface cfg gpio deinit
uint8_t ch9121x_interface_cfg_gpio_init(void)
interface cfg gpio init
void ch9121x_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t ch9121x_interface_uart_write(uint8_t *buf, uint16_t len)
interface uart write
uint8_t ch9121x_interface_uart_flush(void)
interface uart flush
uint16_t ch9121x_interface_uart_read(uint8_t *buf, uint16_t len)
interface uart read
uint8_t ch9121x_interface_reset_gpio_deinit(void)
interface reset gpio deinit
uint8_t ch9121x_interface_reset_gpio_write(uint8_t data)
interface reset gpio write
void ch9121x_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t ch9121x_interface_cfg_gpio_write(uint8_t data)
interface cfg gpio write
uint8_t ch9121x_interface_uart_deinit(void)
interface uart deinit
uint8_t ch9121x_interface_reset_gpio_init(void)
interface reset gpio init
uint8_t ch9121x_interface_uart_init(void)
interface uart init
#define DRIVER_CH9121X_LINK_UART_FLUSH(HANDLE, FUC)
link uart_flush function
#define DRIVER_CH9121X_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_CH9121X_LINK_CFG_GPIO_INIT(HANDLE, FUC)
link cfg_gpio_init function
#define DRIVER_CH9121X_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_CH9121X_LINK_UART_DEINIT(HANDLE, FUC)
link uart_deinit function
#define DRIVER_CH9121X_LINK_UART_INIT(HANDLE, FUC)
link uart_init function
#define DRIVER_CH9121X_LINK_CFG_GPIO_DEINIT(HANDLE, FUC)
link cfg_gpio_deinit function
#define DRIVER_CH9121X_LINK_RESET_GPIO_INIT(HANDLE, FUC)
link reset_gpio_init function
#define DRIVER_CH9121X_LINK_UART_WRITE(HANDLE, FUC)
link uart_write function
#define DRIVER_CH9121X_LINK_RESET_GPIO_WRITE(HANDLE, FUC)
link reset_gpio_write function
#define DRIVER_CH9121X_LINK_INIT(HANDLE, STRUCTURE)
initialize ch9121x structure
#define DRIVER_CH9121X_LINK_RESET_GPIO_DEINIT(HANDLE, FUC)
link reset_gpio_deinit function
#define DRIVER_CH9121X_LINK_CFG_GPIO_WRITE(HANDLE, FUC)
link cfg_gpio_write function
#define DRIVER_CH9121X_LINK_UART_READ(HANDLE, FUC)
link uart_read function
uint8_t ch9121x_register_test(void)
register test
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v