17#ifndef ZEPHYR_MODEM_PPP_
18#define ZEPHYR_MODEM_PPP_
38enum modem_ppp_receive_state {
40 MODEM_PPP_RECEIVE_STATE_HDR_SOF = 0,
41 MODEM_PPP_RECEIVE_STATE_HDR_FF,
42 MODEM_PPP_RECEIVE_STATE_HDR_7D,
43 MODEM_PPP_RECEIVE_STATE_HDR_23,
45 MODEM_PPP_RECEIVE_STATE_WRITING,
47 MODEM_PPP_RECEIVE_STATE_UNESCAPING,
50enum modem_ppp_transmit_state {
52 MODEM_PPP_TRANSMIT_STATE_IDLE = 0,
54 MODEM_PPP_TRANSMIT_STATE_SOF,
55 MODEM_PPP_TRANSMIT_STATE_HDR_FF,
56 MODEM_PPP_TRANSMIT_STATE_HDR_7D,
57 MODEM_PPP_TRANSMIT_STATE_HDR_23,
59 MODEM_PPP_TRANSMIT_STATE_PROTOCOL_HIGH,
60 MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_HIGH,
61 MODEM_PPP_TRANSMIT_STATE_PROTOCOL_LOW,
62 MODEM_PPP_TRANSMIT_STATE_ESCAPING_PROTOCOL_LOW,
64 MODEM_PPP_TRANSMIT_STATE_DATA,
65 MODEM_PPP_TRANSMIT_STATE_ESCAPING_DATA,
67 MODEM_PPP_TRANSMIT_STATE_FCS_LOW,
68 MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_LOW,
69 MODEM_PPP_TRANSMIT_STATE_FCS_HIGH,
70 MODEM_PPP_TRANSMIT_STATE_ESCAPING_FCS_HIGH,
72 MODEM_PPP_TRANSMIT_STATE_EOF,
90 struct modem_pipe *pipe;
93 enum modem_ppp_receive_state receive_state;
99 enum modem_ppp_transmit_state transmit_state;
108 struct k_fifo tx_pkt_fifo;
112 struct k_work process_work;
114#if defined(CONFIG_NET_STATISTICS_PPP)
118#if CONFIG_MODEM_STATS
119 struct modem_stats_buffer receive_buf_stats;
120 struct modem_stats_buffer transmit_buf_stats;
160int modem_ppp_init_internal(
const struct device *dev);
179#define MODEM_PPP_DEFINE(_name, _init_iface, _prio, _mtu, _buf_size) \
180 extern const struct ppp_api modem_ppp_ppp_api; \
182 static uint8_t _CONCAT(_name, _receive_buf)[_buf_size]; \
183 static uint8_t _CONCAT(_name, _transmit_buf)[_buf_size]; \
185 static struct modem_ppp _name = { \
186 .init_iface = _init_iface, \
187 .receive_buf = _CONCAT(_name, _receive_buf), \
188 .transmit_buf = _CONCAT(_name, _transmit_buf), \
189 .buf_size = _buf_size, \
192 NET_DEVICE_INIT(_CONCAT(ppp_net_dev_, _name), "modem_ppp_" # _name, \
193 modem_ppp_init_internal, NULL, &_name, NULL, _prio, &modem_ppp_ppp_api, \
194 PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), _mtu)
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:32
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:403
Definition: kernel.h:2391
A structure used to submit work.
Definition: kernel.h:3880
Network Interface structure.
Definition: net_if.h:678
Network packet.
Definition: net_pkt.h:67
All PPP specific statistics.
Definition: net_stats.h:575
A structure to represent a ring buffer.
Definition: ring_buffer.h:41