|
ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
|
#include <inttypes.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "socket.h"#include "w5500.h"#include "wizchip_conf.h"#include "system/error.h"

Go to the source code of this file.
Data Structures | |
| struct | NETWORK_CONFIG_T |
| Network configuration wrapper used by the W5500 driver. More... | |
| struct | UDP_CONFIG_T |
| UDP endpoint configuration. More... | |
| struct | UDP_FRAME_T |
| UDP payload container. More... | |
Macros | |
Default Network Settings | |
| #define | DEFAULT_MAC_ADDR {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56} |
| #define | DEFAULT_IP_ADDR {192, 168, 29, 20} |
| #define | DEFAULT_SUBNET_MASK {255, 255, 255, 0} |
| #define | DEFAULT_GATEWAY_ADDR {192, 168, 29, 1} |
| #define | DEFAULT_DNS_ADDR {8, 8, 8, 8} |
| #define | DEFAULT_UDP_PORT 6969 |
| #define | RX_BUF_SIZE 8192 |
| #define | TX_BUF_SIZE 8192 |
Functions | |
| void | w5500_debug_status (void) |
| Print W5500 socket/PHY debug status. | |
| void | w5500_udp_tx (UDP_CONFIG_T *send_config, const UDP_FRAME_T *frame) |
| Send one UDP frame through W5500. | |
| bool | w5500_poll_rx (UDP_CONFIG_T *send_config, UDP_FRAME_T *frame) |
| Poll W5500 for received UDP data. | |
| e2s_error_t | w5500_open_udp_socket (UDP_CONFIG_T *config) |
| Open configured UDP socket. | |
| e2s_error_t | w5500_reconfigure_udp_socket (UDP_CONFIG_T *config) |
| Reconfigure UDP socket with new endpoint settings. | |
| e2s_error_t | w5500_open_ipraw_socket (void) |
| Open IPRAW socket mode. | |
| void | w5500_set_network_defaults (NETWORK_CONFIG_T *config) |
| Fill network config with compile-time defaults. | |
| void | w5500_set_network (NETWORK_CONFIG_T *config) |
| Apply network configuration to W5500 hardware. | |
| void | w5500_driver_init (void) |
| Initialize W5500 driver and low-level interface. | |
| void | w5500_poll_udp_buffer_full_events (uint64_t *rx_full_enter_events, uint64_t *tx_full_enter_events) |
| #define DEFAULT_DNS_ADDR {8, 8, 8, 8} |
Definition at line 40 of file w5500_driver.h.
| #define DEFAULT_GATEWAY_ADDR {192, 168, 29, 1} |
Definition at line 39 of file w5500_driver.h.
| #define DEFAULT_IP_ADDR {192, 168, 29, 20} |
Definition at line 37 of file w5500_driver.h.
| #define DEFAULT_MAC_ADDR {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56} |
Definition at line 36 of file w5500_driver.h.
| #define DEFAULT_SUBNET_MASK {255, 255, 255, 0} |
Definition at line 38 of file w5500_driver.h.
| #define DEFAULT_UDP_PORT 6969 |
Definition at line 41 of file w5500_driver.h.
| #define RX_BUF_SIZE 8192 |
Definition at line 42 of file w5500_driver.h.
| #define TX_BUF_SIZE 8192 |
Definition at line 43 of file w5500_driver.h.
| void w5500_debug_status | ( | void | ) |
Print W5500 socket/PHY debug status.
Definition at line 96 of file w5500_driver.c.
References IP_SOCKET, and LOG_DEBUG.
Referenced by main().

| void w5500_driver_init | ( | void | ) |
Initialize W5500 driver and low-level interface.
Definition at line 226 of file w5500_driver.c.
References E2S_ERR_W5500_INIT_FAILED, E2S_OK, fatal_panic(), LOG_DEBUG, and w5500_apply_socket_mem_map().
Referenced by main().


| e2s_error_t w5500_open_ipraw_socket | ( | void | ) |
Open IPRAW socket mode.
Definition at line 149 of file w5500_driver.c.
References E2S_ERR_W5500_SOCKET_OPEN_FAILED, E2S_OK, IP_SOCKET, LOG_DEBUG, and LOG_ERROR.
| e2s_error_t w5500_open_udp_socket | ( | UDP_CONFIG_T * | config | ) |
Open configured UDP socket.
| send_config | Local endpoint settings. |
Definition at line 161 of file w5500_driver.c.
References E2S_ERR_W5500_SOCKET_OPEN_FAILED, E2S_OK, LOG_DEBUG, LOG_ERROR, UDP_CONFIG_T::port, and UDP_SOCKET.
Referenced by main(), and w5500_reconfigure_udp_socket().

| bool w5500_poll_rx | ( | UDP_CONFIG_T * | send_config, |
| UDP_FRAME_T * | frame | ||
| ) |
Poll W5500 for received UDP data.
| send_config | Source endpoint output (updated with sender info). |
| frame | Destination frame buffer for received payload. |
Definition at line 119 of file w5500_driver.c.
References UDP_CONFIG_T::ip_address, UDP_FRAME_T::length, LOG_DEBUG, UDP_FRAME_T::payload, UDP_CONFIG_T::port, RX_BUF_SIZE, and UDP_SOCKET.
Referenced by poll_and_enqueue_udp_rx().

| void w5500_poll_udp_buffer_full_events | ( | uint64_t * | rx_full_enter_events, |
| uint64_t * | tx_full_enter_events | ||
| ) |
Definition at line 43 of file w5500_driver.c.
References UDP_RX_REQUIRED_BYTES, and UDP_SOCKET.
Referenced by event_loop().

| e2s_error_t w5500_reconfigure_udp_socket | ( | UDP_CONFIG_T * | config | ) |
Reconfigure UDP socket with new endpoint settings.
| config | Local endpoint settings. |
Definition at line 177 of file w5500_driver.c.
References LOG_DEBUG, UDP_SOCKET, and w5500_open_udp_socket().
Referenced by ev_set_net_settings().


| void w5500_set_network | ( | NETWORK_CONFIG_T * | config | ) |
Apply network configuration to W5500 hardware.
| config | Source config object. |
Definition at line 184 of file w5500_driver.c.
References NETWORK_CONFIG_T::broadcast_address, ipv4_calc_broadcast_u8(), LOG_DEBUG, and NETWORK_CONFIG_T::net_info.
Referenced by init_app(), and w5500_set_network_defaults().


| void w5500_set_network_defaults | ( | NETWORK_CONFIG_T * | config | ) |
Fill network config with compile-time defaults.
| config | Destination config object. |
Definition at line 213 of file w5500_driver.c.
References DEFAULT_DNS_ADDR, DEFAULT_GATEWAY_ADDR, DEFAULT_IP_ADDR, DEFAULT_MAC_ADDR, DEFAULT_SUBNET_MASK, NETWORK_CONFIG_T::net_info, and w5500_set_network().
Referenced by init_app().


| void w5500_udp_tx | ( | UDP_CONFIG_T * | send_config, |
| const UDP_FRAME_T * | frame | ||
| ) |
Send one UDP frame through W5500.
| send_config | Destination endpoint. |
| frame | Frame payload to send. |
Definition at line 106 of file w5500_driver.c.
References UDP_CONFIG_T::ip_address, UDP_FRAME_T::length, LOG_DEBUG, UDP_FRAME_T::payload, UDP_CONFIG_T::port, and UDP_SOCKET.
Referenced by decode_hdlc_to_udp_tx(), and event_dispatch().
