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 
9 #pragma once
10 
21 #include <stdbool.h>
22 
23 #include "mutex.h"
24 #include "net/ethernet.h"
25 #include "net/netdev.h"
26 #include "ringbuffer.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #ifndef ESP_WIFI_BUFSIZE
36 #define ESP_WIFI_BUFSIZE (ETHERNET_MAX_LEN << 1)
37 #endif
38 
42 extern const netdev_driver_t esp_wifi_driver;
43 
47 typedef struct
48 {
51  uint8_t rx_mem[ESP_WIFI_BUFSIZE];
54  uint16_t tx_len;
55  uint8_t tx_buf[ETHERNET_MAX_LEN];
57  uint8_t event_recv;
58 #ifdef MODULE_ESP_WIFI_AP
59  uint8_t sta_connected;
60 #else /* MODULE_ESP_WIFI_AP */
61  uint8_t event_conn;
62  uint8_t event_disc;
64  bool connected;
65 #endif /* MODULE_ESP_WIFI_AP */
66 
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
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:46
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:39
Structure to hold driver interface -> function mapping.
Definition: netdev.h:425
Structure to hold driver state.
Definition: netdev.h:364
Ringbuffer.
Definition: ringbuffer.h:35