Skip to content

Commit

Permalink
fix(eppp): Cleanup the SDIO transport before review
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cermak committed May 14, 2024
1 parent 2eec209 commit 11e145d
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 318 deletions.
23 changes: 23 additions & 0 deletions components/eppp_link/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ menu "eppp_link"

config EPPP_LINK_DEVICE_SDIO
bool "SDIO"
depends on SOC_SDMMC_HOST_SUPPORTED || SOC_SDIO_SLAVE_SUPPORTED
help
Use SDIO.

Expand All @@ -40,8 +41,30 @@ menu "eppp_link"
config EPPP_LINK_PACKET_QUEUE_SIZE
int "Packet queue size"
default 64
depends on EPPP_LINK_DEVICE_SPI
help
Size of the Tx packet queue.
You can decrease the number for slower bit rates.

choice EPPP_LINK_SDIO_ROLE
prompt "Choose SDIO host or slave"
depends on EPPP_LINK_DEVICE_SDIO
default EPPP_LINK_DEVICE_SDIO_HOST if SOC_SDMMC_HOST_SUPPORTED
help
Select which either SDIO host or slave

config EPPP_LINK_DEVICE_SDIO_HOST
bool "Host"
depends on SOC_SDMMC_HOST_SUPPORTED
help
Use SDIO host.

config EPPP_LINK_DEVICE_SDIO_SLAVE
bool "SLAVE"
depends on SOC_SDIO_SLAVE_SUPPORTED
help
Use SDIO slave.

endchoice

endmenu
15 changes: 10 additions & 5 deletions components/eppp_link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ brings in the WiFi connectivity from the "SLAVE" microcontroller.
SLAVE micro HOST micro
\|/ +----------------+ +----------------+
| | | serial line | |
+---+ WiFi NAT PPPoS |======== UART / SPI =======| PPPoS client |
+---+ WiFi NAT PPPoS |=== UART / SPI / SDIO =====| PPPoS client |
| (server)| | |
+----------------+ +----------------+
```
Expand All @@ -39,14 +39,19 @@ brings in the WiFi connectivity from the "SLAVE" microcontroller.

## Throughput

Tested with WiFi-NAPT example, no IRAM optimizations
Tested with WiFi-NAPT example

### UART @ 3Mbauds

* TCP - 2Mbits/s
* UDP - 2Mbits/s

### SPI @ 20MHz
### SPI @ 16MHz

* TCP - 6Mbits/s
* UDP - 10Mbits/s
* TCP - 5Mbits/s
* UDP - 8Mbits/s

### SDIO

* TCP - 9Mbits/s
* UDP - 11Mbits/s
28 changes: 13 additions & 15 deletions components/eppp_link/eppp_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include "esp_rom_crc.h"
#elif CONFIG_EPPP_LINK_DEVICE_UART
#include "driver/uart.h"
#elif CONFIG_EPPP_LINK_DEVICE_SDIO

#endif

static const int GOT_IPV4 = BIT0;
Expand Down Expand Up @@ -81,8 +79,6 @@ struct eppp_handle {
#elif CONFIG_EPPP_LINK_DEVICE_UART
QueueHandle_t uart_event_queue;
uart_port_t uart_port;
#elif CONFIG_EPPP_LINK_DEVICE_SDIO
essl_handle_t essl;
#endif
esp_netif_t *netif;
eppp_type_t role;
Expand All @@ -91,21 +87,17 @@ struct eppp_handle {
bool netif_stop;
};

essl_handle_t eppp_get_essl(void *h)
{
struct eppp_handle *handle = h;
return handle->essl;
}

typedef esp_err_t (*transmit_t)(void *h, void *buffer, size_t len);

#if CONFIG_EPPP_LINK_DEVICE_SDIO
esp_err_t eppp_sdio_host_tx(void *h, void *buffer, size_t len);
esp_err_t eppp_sdio_host_rx(esp_netif_t *netif, essl_handle_t h);
esp_err_t eppp_sdio_host_rx(esp_netif_t *netif);
esp_err_t eppp_sdio_slave_rx(esp_netif_t *netif);
esp_err_t eppp_sdio_slave_tx(void *h, void *buffer, size_t len);
esp_err_t eppp_sdio_host_init(essl_handle_t *h);
esp_err_t eppp_sdio_host_init(struct eppp_config_sdio_s *config);
esp_err_t eppp_sdio_slave_init(void);
void eppp_sdio_slave_deinit(void);
void eppp_sdio_host_deinit(void);
#else
static esp_err_t transmit(void *h, void *buffer, size_t len)
{
Expand Down Expand Up @@ -690,7 +682,7 @@ esp_err_t eppp_perform(esp_netif_t *netif)
if (h->role == EPPP_SERVER) {
return eppp_sdio_slave_rx(netif);
} else {
return eppp_sdio_host_rx(netif, h->essl);
return eppp_sdio_host_rx(netif);
}
}

Expand Down Expand Up @@ -736,6 +728,13 @@ void eppp_deinit(esp_netif_t *netif)
}
#elif CONFIG_EPPP_LINK_DEVICE_UART
deinit_uart(esp_netif_get_io_driver(netif));
#elif CONFIG_EPPP_LINK_DEVICE_SDIO
struct eppp_handle *h = esp_netif_get_io_driver(netif);
if (h->role == EPPP_CLIENT) {
eppp_sdio_host_deinit();
} else {
eppp_sdio_slave_deinit();
}
#endif
netif_deinit(netif);
}
Expand Down Expand Up @@ -764,11 +763,10 @@ esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
init_uart(esp_netif_get_io_driver(netif), config);
#elif CONFIG_EPPP_LINK_DEVICE_SDIO
esp_err_t ret;
struct eppp_handle *h = esp_netif_get_io_driver(netif);
if (role == EPPP_SERVER) {
ret = eppp_sdio_slave_init();
} else {
ret = eppp_sdio_host_init(&h->essl);
ret = eppp_sdio_host_init(&config->sdio);
}

if (ret != ESP_OK) {
Expand Down
9 changes: 5 additions & 4 deletions components/eppp_link/eppp_sdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
*/
#pragma once

#define MAX_PAYLOAD 1500
#define MAX_SDIO_PAYLOAD 1500
#define SDIO_ALIGN(size) (((size) + 3U) & ~(3U))
#define SDIO_PAYLOAD SDIO_ALIGN(MAX_PAYLOAD)
#define SDIO_PAYLOAD SDIO_ALIGN(MAX_SDIO_PAYLOAD)


#define SLAVE_INTR 0
// Interrupts and registers
#define SLAVE_INTR 0
#define SLAVE_REG_REQ 0

// Requests from host to slave
#define REQ_RESET 1
#define REQ_INIT 2
Loading

0 comments on commit 11e145d

Please sign in to comment.