ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
w5500_driver.h
Go to the documentation of this file.
1/*
2 * ether2ser — Ethernet <-> synchronous V.24 (RS-232/V.28) bridge
3 *
4 * File: src/drivers/w5500_driver.h
5 * Purpose: W5500 driver interface.
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
10 */
11
12#ifndef W5500_DRIVER_H
13#define W5500_DRIVER_H
14// Related headers
15
16// Standard library headers
17#include <inttypes.h>
18#include <stdbool.h>
19#include <stddef.h>
20#include <stdint.h>
21
22// Library Headers
23#include "socket.h"
24#include "w5500.h"
25#include "wizchip_conf.h"
26
27// Project Headers
28#include "system/error.h"
29
30// Generated headers
31
36#define DEFAULT_MAC_ADDR {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}
37#define DEFAULT_IP_ADDR {192, 168, 29, 20}
38#define DEFAULT_SUBNET_MASK {255, 255, 255, 0}
39#define DEFAULT_GATEWAY_ADDR {192, 168, 29, 1}
40#define DEFAULT_DNS_ADDR {8, 8, 8, 8}
41#define DEFAULT_UDP_PORT 6969
42#define RX_BUF_SIZE 8192
43#define TX_BUF_SIZE 8192
49typedef struct
50{
52 wiz_NetInfo net_info;
54 uint8_t broadcast_address[4];
56
60typedef struct
61{
63 uint8_t ip_address[4];
65 uint16_t port;
67
71typedef struct
72{
74 uint8_t* payload;
76 size_t length;
78
82void w5500_debug_status(void);
83
89void w5500_udp_tx(UDP_CONFIG_T* send_config, const UDP_FRAME_T* frame);
90
97bool w5500_poll_rx(UDP_CONFIG_T* send_config, UDP_FRAME_T* frame);
98
105
112
118
124
130
134void w5500_driver_init(void);
135
136void w5500_poll_udp_buffer_full_events(uint64_t* rx_full_enter_events,
137 uint64_t* tx_full_enter_events);
138
139#endif /* W5500_DRIVER_H */
e2s_error_t
Common error codes returned by ether2ser modules.
Definition error.h:27
Network configuration wrapper used by the W5500 driver.
wiz_NetInfo net_info
UDP endpoint configuration.
uint16_t port
UDP payload container.
size_t length
uint8_t * payload
void w5500_set_network_defaults(NETWORK_CONFIG_T *config)
Fill network config with compile-time defaults.
void w5500_poll_udp_buffer_full_events(uint64_t *rx_full_enter_events, uint64_t *tx_full_enter_events)
void w5500_udp_tx(UDP_CONFIG_T *send_config, const UDP_FRAME_T *frame)
Send one UDP frame through W5500.
void w5500_set_network(NETWORK_CONFIG_T *config)
Apply network configuration to W5500 hardware.
e2s_error_t w5500_open_ipraw_socket(void)
Open IPRAW socket mode.
void w5500_driver_init(void)
Initialize W5500 driver and low-level interface.
e2s_error_t w5500_open_udp_socket(UDP_CONFIG_T *config)
Open configured UDP socket.
bool w5500_poll_rx(UDP_CONFIG_T *send_config, UDP_FRAME_T *frame)
Poll W5500 for received UDP data.
e2s_error_t w5500_reconfigure_udp_socket(UDP_CONFIG_T *config)
Reconfigure UDP socket with new endpoint settings.
void w5500_debug_status(void)
Print W5500 socket/PHY debug status.