17#ifndef ZEPHYR_MODEM_PPP_
18#define ZEPHYR_MODEM_PPP_
40enum modem_ppp_receive_state {
42 MODEM_PPP_RECEIVE_STATE_HDR_SOF = 0,
43 MODEM_PPP_RECEIVE_STATE_HDR_FF,
44 MODEM_PPP_RECEIVE_STATE_HDR_7D,
45 MODEM_PPP_RECEIVE_STATE_HDR_23,
47 MODEM_PPP_RECEIVE_STATE_WRITING,
49 MODEM_PPP_RECEIVE_STATE_UNESCAPING,
52enum modem_ppp_transmit_state {
53 MODEM_PPP_TRANSMIT_STATE_IDLE = 0,
54 MODEM_PPP_TRANSMIT_STATE_SOF,
55 MODEM_PPP_TRANSMIT_STATE_PROTOCOL,
56 MODEM_PPP_TRANSMIT_STATE_DATA,
57 MODEM_PPP_TRANSMIT_STATE_EOF,
75 struct modem_pipe *pipe;
78 enum modem_ppp_receive_state receive_state;
81 struct net_pkt *rx_pkt;
84 enum modem_ppp_transmit_state transmit_state;
85 struct net_pkt *tx_pkt;
89 struct ring_buf transmit_rb;
91 struct k_fifo tx_pkt_fifo;
94 struct k_work send_work;
95 struct k_work process_work;
97#if defined(CONFIG_NET_STATISTICS_PPP)
98 struct net_stats_ppp stats;
101#if CONFIG_MODEM_STATS
102 struct modem_stats_buffer receive_buf_stats;
103 struct modem_stats_buffer transmit_buf_stats;
107struct modem_ppp_config {
108 const struct device *dev;
147int modem_ppp_init_internal(
const struct device *dev);
170#define MODEM_DEV_PPP_DEFINE(_dev, _name, _init_iface, _prio, _mtu, _buf_size) \
171 extern const struct ppp_api modem_ppp_ppp_api; \
173 static uint8_t _CONCAT(_name, _receive_buf)[_buf_size]; \
174 static uint8_t _CONCAT(_name, _transmit_buf)[_buf_size]; \
176 static struct modem_ppp _name = { \
177 .init_iface = _init_iface, \
178 .receive_buf = _CONCAT(_name, _receive_buf), \
179 .transmit_buf = _CONCAT(_name, _transmit_buf), \
180 .buf_size = _buf_size, \
182 static const struct modem_ppp_config _CONCAT(_name, _config) = { \
186 NET_DEVICE_INIT(_CONCAT(ppp_net_dev_, _name), "modem_ppp_" #_name, \
187 modem_ppp_init_internal, NULL, &_name, &_CONCAT(_name, _config), _prio, \
188 &modem_ppp_ppp_api, PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), _mtu)
195#define MODEM_DT_INST_PPP_DEFINE(inst, _name, _init_iface, _prio, _mtu, _buf_size) \
196 MODEM_DEV_PPP_DEFINE(DEVICE_DT_INST_GET(inst), _name, _init_iface, _prio, _mtu, _buf_size)
203#define MODEM_PPP_DEFINE(_name, _init_iface, _prio, _mtu, _buf_size) \
204 MODEM_DEV_PPP_DEFINE(NULL, _name, _init_iface, _prio, _mtu, _buf_size)
long atomic_t
Definition atomic_types.h:15
int modem_ppp_attach(struct modem_ppp *ppp, struct modem_pipe *pipe)
Attach pipe to instance and connect.
struct net_if * modem_ppp_get_iface(struct modem_ppp *ppp)
Get network interface modem PPP instance is bound to.
void modem_ppp_release(struct modem_ppp *ppp)
Release pipe from instance.
void(* modem_ppp_init_iface)(struct net_if *iface)
L2 network interface init callback.
Definition ppp.h:34
Public API for network interface.
Network packet buffer descriptor API.
state
Definition parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
Network Interface structure.
Definition net_if.h:726