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 */
Definitions low-level network driver interface.
#define ESP_WIFI_BUFSIZE
Buffer size used for RX buffering.
const netdev_driver_t esp_wifi_driver
Reference to the netdev device driver struct.
Definitions for Ethernet.
#define ETHERNET_MAX_LEN
maximum number of bytes in an ethernet frame (with FCF)
Definition: ethernet.h:47
Mutex for thread synchronization.
A utility for storing and retrieving byte data using a ring buffer.
Device descriptor for ESP WiFi devices.
uint16_t tx_len
number of bytes in transmit buffer
netdev_t netdev
netdev parent struct
uint8_t event_conn
number of pending connect events
ringbuffer_t rx_buf
ringbuffer for incoming packages
uint8_t event_recv
number of frame received events
mutex_t dev_lock
device is already in use
uint8_t event_disc
number of pending disc events
bool connected
indicates whether connected to AP
Mutex structure.
Definition: mutex.h:146
Structure to hold driver interface -> function mapping.
Definition: netdev.h:426
Structure to hold driver state.
Definition: netdev.h:365
Ringbuffer.
Definition: ringbuffer.h:36