18#ifndef ZEPHYR_INCLUDE_MODEM_PPP_H_
19#define ZEPHYR_INCLUDE_MODEM_PPP_H_
43 MODEM_PPP_STATE_ATTACHED_BIT = 0,
45 MODEM_PPP_STATE_DEAD_BIT,
48enum modem_ppp_receive_state {
50 MODEM_PPP_RECEIVE_STATE_HDR_SOF = 0,
51 MODEM_PPP_RECEIVE_STATE_HDR_FF,
52 MODEM_PPP_RECEIVE_STATE_HDR_FF_UNESCAPE,
53 MODEM_PPP_RECEIVE_STATE_HDR_CTRL_UNESCAPE,
54 MODEM_PPP_RECEIVE_STATE_HDR_CTRL,
56 MODEM_PPP_RECEIVE_STATE_WRITING,
58 MODEM_PPP_RECEIVE_STATE_UNESCAPING,
60 MODEM_PPP_RECEIVE_STATE_UNSOLICITED_NO_CARRIER,
63enum modem_ppp_transmit_state {
64 MODEM_PPP_TRANSMIT_STATE_IDLE = 0,
65 MODEM_PPP_TRANSMIT_STATE_SOF,
66 MODEM_PPP_TRANSMIT_STATE_PROTOCOL,
67 MODEM_PPP_TRANSMIT_STATE_DATA,
68 MODEM_PPP_TRANSMIT_STATE_EOF,
86 struct modem_pipe *pipe;
89 enum modem_ppp_receive_state receive_state;
93 struct net_pkt *rx_pkt;
96 enum modem_ppp_transmit_state transmit_state;
97 struct net_pkt *tx_pkt;
101 struct ring_buf transmit_rb;
103 struct k_fifo tx_pkt_fifo;
106 struct k_work send_work;
107 struct k_work process_work;
109#if defined(CONFIG_NET_STATISTICS_PPP)
110 struct net_stats_ppp stats;
113#if CONFIG_MODEM_STATS
114 struct modem_stats_buffer receive_buf_stats;
115 struct modem_stats_buffer transmit_buf_stats;
119struct modem_ppp_config {
120 const struct device *dev;
159int modem_ppp_init_internal(
const struct device *dev);
181#define MODEM_DEV_PPP_DEFINE(_dev, _name, _init_iface, _mtu, _buf_size) \
182 extern const struct ppp_api modem_ppp_ppp_api; \
184 static uint8_t _CONCAT(_name, _receive_buf)[_buf_size]; \
185 static uint8_t _CONCAT(_name, _transmit_buf)[_buf_size]; \
187 static struct modem_ppp _name = { \
188 .init_iface = _init_iface, \
189 .receive_buf = _CONCAT(_name, _receive_buf), \
190 .transmit_buf = _CONCAT(_name, _transmit_buf), \
191 .buf_size = _buf_size, \
193 static const struct modem_ppp_config _CONCAT(_name, _config) = { \
197 NET_DEVICE_INIT(_CONCAT(ppp_net_dev_, _name), "modem_ppp_" #_name, \
198 modem_ppp_init_internal, NULL, &_name, &_CONCAT(_name, _config), \
199 CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
200 &modem_ppp_ppp_api, PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), _mtu)
207#define MODEM_DT_INST_PPP_DEFINE(inst, _name, _init_iface, _mtu, _buf_size) \
208 MODEM_DEV_PPP_DEFINE(DEVICE_DT_INST_GET(inst), _name, _init_iface, _mtu, _buf_size)
215#define MODEM_PPP_DEFINE(_name, _init_iface, _mtu, _buf_size) \
216 MODEM_DEV_PPP_DEFINE(NULL, _name, _init_iface, _mtu, _buf_size)
long atomic_t
Atomic integer variable.
Definition atomic_types.h:31
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:35
PPP (Point-to-Point Protocol).
Public API for network interface.
Network packet buffer descriptor API.
state
Definition parser_state.h:29
Header file for the ring buffer API.
__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:513
Network Interface structure.
Definition net_if.h:764
Header file for the Atomic operations API.