esp_wifi_netdev.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef ESP_WIFI_NETDEV_H
20 #define ESP_WIFI_NETDEV_H
21 
22 #include <stdbool.h>
23 
24 #include "mutex.h"
25 #include "net/ethernet.h"
26 #include "net/netdev.h"
27 #include "ringbuffer.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #ifndef ESP_WIFI_BUFSIZE
37 #define ESP_WIFI_BUFSIZE (ETHERNET_MAX_LEN << 1)
38 #endif
39 
43 extern const netdev_driver_t esp_wifi_driver;
44 
48 typedef struct
49 {
52  uint8_t rx_mem[ESP_WIFI_BUFSIZE];
55  uint16_t tx_len;
56  uint8_t tx_buf[ETHERNET_MAX_LEN];
58  uint8_t event_recv;
59 #ifdef MODULE_ESP_WIFI_AP
60  uint8_t sta_connected;
61 #else /* MODULE_ESP_WIFI_AP */
62  uint8_t event_conn;
63  uint8_t event_disc;
65  bool connected;
66 #endif /* MODULE_ESP_WIFI_AP */
67 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* ESP_WIFI_NETDEV_H */
77 
netdev_driver
Structure to hold driver interface -> function mapping.
Definition: netdev.h:344
esp_wifi_netdev_t::netdev
netdev_t netdev
netdev parent struct
Definition: esp_wifi_netdev.h:50
ringbuffer.h
A utility for storing and retrieving byte data using a ring buffer.
esp_wifi_driver
const netdev_driver_t esp_wifi_driver
Reference to the netdev device driver struct.
ETHERNET_MAX_LEN
#define ETHERNET_MAX_LEN
maximum number of bytes in an ethernet frame (with FCF)
Definition: ethernet.h:48
ESP_WIFI_BUFSIZE
#define ESP_WIFI_BUFSIZE
Buffer size used for RX buffering.
Definition: esp_wifi_netdev.h:37
esp_wifi_netdev_t::event_conn
uint8_t event_conn
number of pending connect events
Definition: esp_wifi_netdev.h:62
ethernet.h
Definitions for Ethernet.
esp_wifi_netdev_t::rx_buf
ringbuffer_t rx_buf
ringbuffer for incoming packages
Definition: esp_wifi_netdev.h:53
esp_wifi_netdev_t
Device descriptor for ESP WiFi devices.
Definition: esp_wifi_netdev.h:48
esp_wifi_netdev_t::event_recv
uint8_t event_recv
number of frame received events
Definition: esp_wifi_netdev.h:58
esp_wifi_netdev_t::dev_lock
mutex_t dev_lock
device is already in use
Definition: esp_wifi_netdev.h:68
netdev.h
Definitions low-level network driver interface.
ringbuffer_t
Ringbuffer.
Definition: ringbuffer.h:36
esp_wifi_netdev_t::event_disc
uint8_t event_disc
number of pending disc events
Definition: esp_wifi_netdev.h:63
netdev
Structure to hold driver state.
Definition: netdev.h:302
esp_wifi_netdev_t::connected
bool connected
indicates whether connected to AP
Definition: esp_wifi_netdev.h:65
mutex.h
Mutex for thread synchronization.
esp_wifi_netdev_t::tx_len
uint16_t tx_len
number of bytes in transmit buffer
Definition: esp_wifi_netdev.h:55
mutex_t
Mutex structure.
Definition: mutex.h:120