Skip to content
Snippets Groups Projects
Commit 5e9a5e82 authored by graham sanderson's avatar graham sanderson
Browse files

Add Pico W and lwIP support

parent 77c04e45
No related branches found
No related tags found
No related merge requests found
Showing
with 1743 additions and 5 deletions
[submodule "tinyusb"]
path = lib/tinyusb
url = https://github.com/hathach/tinyusb.git
[submodule "lib/cyw43-driver"]
path = lib/cyw43-driver
url = https://github.com/georgerobotics/cyw43-driver.git
[submodule "lib/lwip"]
path = lib/lwip
url = https://github.com/lwip-tcpip/lwip.git
......@@ -110,6 +110,24 @@ instructions for other platforms, and just in general, we recommend you see [Ras
```
* Or by cloning the SDK locally, but without copying `pico_sdk_import.cmake`:
1. `git clone` this Raspberry Pi Pico SDK repository
2. Setup a `CMakeLists.txt` like:
```cmake
cmake_minimum_required(VERSION 3.13)
# initialize the SDK directly
include(/path/to/pico-sdk/pico_sdk_init.cmake)
project(my_project)
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
# rest of your project
```
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
About the simplest you can do is a single source file (e.g. hello_world.c)
......
......@@ -60,4 +60,5 @@ PREDEFINED = __not_in_flash_func(x) \
__time_critical_func(x) \
__not_in_flash(x)= \
__no_inline_not_in_flash(x)= \
__attribute__(x)=
__attribute__(x)= \
DOXYGEN_GENERATION=
......@@ -56,6 +56,13 @@
* \defgroup tinyusb_host tinyusb_host
* @}
*
* \defgroup networking Networking Libraries
* Functions for implementing networking
* @{
* \defgroup pico_lwip pico_lwip
* \defgroup pico_cyw43_arch pico_cyw43_arch
* @}
*
* \defgroup runtime Runtime Infrastructure
* Libraries that are used to provide efficient implementation of certain
* language level and C library functions, as well as CMake INTERFACE libraries
......
Subproject commit 195dfcc10bb6f379e3dea45147590db2203d3c7b
Subproject commit 239918ccc173cb2c2a62f41a40fd893f57faf1d6
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/pico.h"
#ifndef _BOARDS_PICO_W_H
#define _BOARDS_PICO_W_H
// For board detection
#define RASPBERRYPI_PICO_W
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// --- LED ---
// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip
// no PICO_DEFAULT_WS2812_PIN
// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif
// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 16
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 17
#endif
// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
#endif
// note the SMSP mode pin is on WL_GPIO1
// #define PICO_SMPS_MODE_PIN
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 0
#endif
#ifndef PICO_RP2040_B1_SUPPORTED
#define PICO_RP2040_B1_SUPPORTED 0
#endif
#ifndef CYW43_PIN_WL_HOST_WAKE
#define CYW43_PIN_WL_HOST_WAKE 24
#endif
#ifndef CYW43_PIN_WL_REG_ON
#define CYW43_PIN_WL_REG_ON 23
#endif
#ifndef CYW43_WL_GPIO_COUNT
#define CYW43_WL_GPIO_COUNT 3
#endif
#ifndef CYW43_WL_GPIO_LED_PIN
#define CYW43_WL_GPIO_LED_PIN 0
#endif
#endif
set(PICO_CYW43_SUPPORTED "1" CACHE INTERNAL "Try to add support for PICO_CYW43")
include(${CMAKE_CURRENT_LIST_DIR}/generic_board.cmake)
......@@ -10,14 +10,18 @@
#ifndef __ASSEMBLER__
/*!
* Common return codes from pico_sdk methods that return a status
* \brief Common return codes from pico_sdk methods that return a status
* \ingroup pico_base
*/
enum {
enum pico_error_codes {
PICO_OK = 0,
PICO_ERROR_NONE = 0,
PICO_ERROR_TIMEOUT = -1,
PICO_ERROR_GENERIC = -2,
PICO_ERROR_NO_DATA = -3,
PICO_ERROR_NOT_PERMITTED = -4,
PICO_ERROR_INVALID_ARG = -5,
PICO_ERROR_IO = -6,
};
#endif // !__ASSEMBLER__
......
......@@ -58,6 +58,10 @@ if (NOT PICO_BARE_METAL)
pico_add_subdirectory(tinyusb)
pico_add_subdirectory(pico_stdio_usb)
pico_add_subdirectory(cyw43_driver)
pico_add_subdirectory(pico_lwip)
pico_add_subdirectory(pico_cyw43_arch)
pico_add_subdirectory(pico_stdlib)
pico_add_subdirectory(pico_cxx_options)
......
if (DEFINED ENV{PICO_CYW43_DRIVER_PATH} AND (NOT PICO_CYW43_DRIVER_PATH))
set(PICO_CYW43_DRIVER_PATH $ENV{PICO_CYW43_DRIVER_PATH})
message("Using PICO_CYW43_DRIVER_PATH from environment ('${PICO_CYW43_DRIVER_PATH}')")
endif()
set(CYW43_DRIVER_TEST_FILE "src/cyw43.h")
if (NOT PICO_CYW43_DRIVER_PATH)
set(PICO_CYW43_DRIVER_PATH ${PICO_SDK_PATH}/lib/cyw43-driver)
if (PICO_CYW43_SUPPORTED AND NOT EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
message(WARNING "cyw43-driver submodule has not been initialized; Pico W wireless support will be unavailable
hint: try 'git submodule update --init' from your SDK directory (${PICO_SDK_PATH}).")
endif()
elseif (NOT EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
message(WARNING "PICO_CYW43_DRIVER_PATH specified but content not present.")
endif()
if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
message("cyw43-driver available at ${PICO_CYW43_DRIVER_PATH}")
pico_register_common_scope_var(PICO_CYW43_DRIVER_PATH)
# base driver without our bus
add_library(cyw43_driver_base INTERFACE)
target_sources(cyw43_driver_base INTERFACE
${PICO_CYW43_DRIVER_PATH}/src/cyw43_ll.c
${PICO_CYW43_DRIVER_PATH}/src/cyw43_stats.c
${PICO_CYW43_DRIVER_PATH}/src/cyw43_lwip.c
${PICO_CYW43_DRIVER_PATH}/src/cyw43_ctrl.c
)
target_include_directories(cyw43_driver_base INTERFACE
${PICO_CYW43_DRIVER_PATH}/src
${PICO_CYW43_DRIVER_PATH}/firmware
)
# Build the driver for cyw43 for pico w
# Firmware stuff
set(CYW43_FIRMWARE_BIN 43439A0-7.95.49.00.combined)
string(REGEX REPLACE [\\\.\-] _ CYW43_FIRMWARE_BIN_ ${CYW43_FIRMWARE_BIN})
string(REGEX MATCH [^_]+_?[^_]*_?[^_]*_?[^_]*_?[^_]* CYW43_FIRMWARE_PRETTY ${CYW43_FIRMWARE_BIN_})
set(CYW43_FIRMWARE_PRETTY fw_${CYW43_FIRMWARE_PRETTY})
set(RESOURCE_SECNAME .big_const)
set(RESOURCE_SECFLAGS contents,alloc,load,readonly,data)
set(CYW43_FIRMWARE_OBJ ${CMAKE_CURRENT_BINARY_DIR}/cyw43_resource.o)
add_custom_target(cyw43_firmware_package DEPENDS ${CYW43_FIRMWARE_OBJ})
# cyw43_resource.o contains the WiFi and BT firmware as a binary blob
add_custom_command(
OUTPUT ${CYW43_FIRMWARE_OBJ}
DEPENDS ${PICO_CYW43_DRIVER_PATH}/firmware/${CYW43_FIRMWARE_BIN}
WORKING_DIRECTORY ${PICO_CYW43_DRIVER_PATH}/firmware
COMMAND ${CMAKE_OBJCOPY} -I binary -O elf32-littlearm -B arm
--readonly-text
--rename-section .data=${RESOURCE_SECNAME},${RESOURCE_SECFLAGS}
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_start=${CYW43_FIRMWARE_PRETTY}_start
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_end=${CYW43_FIRMWARE_PRETTY}_end
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_size=${CYW43_FIRMWARE_PRETTY}_size
${CYW43_FIRMWARE_BIN} ${CYW43_FIRMWARE_OBJ}
)
add_library(cyw43_driver_picow INTERFACE)
target_sources(cyw43_driver_picow INTERFACE
${CMAKE_CURRENT_LIST_DIR}/cyw43_bus_pio_spi.c
)
pico_generate_pio_header(cyw43_driver_picow ${CMAKE_CURRENT_LIST_DIR}/cyw43_bus_pio_spi.pio)
add_dependencies(cyw43_driver_picow INTERFACE cyw43_firmware_package)
target_link_libraries(cyw43_driver_picow INTERFACE
${CYW43_FIRMWARE_OBJ}
)
target_link_libraries(cyw43_driver_picow INTERFACE
cyw43_driver_base
pico_stdlib
hardware_pio
hardware_dma
hardware_exception
)
pico_promote_common_scope_vars()
endif()
This diff is collapsed.
;
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
;
; SPDX-License-Identifier: BSD-3-Clause
;
.program spi_gap0_sample1
.side_set 1
; always transmit multiple of 32 bytes
lp: out pins, 1 side 0
jmp x-- lp side 1
public lp1_end:
set pindirs, 0 side 0
lp2:
in pins, 1 side 1
jmp y-- lp2 side 0
public end:
.program spi_gap01_sample0
.side_set 1
; always transmit multiple of 32 bytes
lp: out pins, 1 side 0
jmp x-- lp side 1
public lp1_end:
set pindirs, 0 side 0
nop side 1
lp2:
in pins, 1 side 0
jmp y-- lp2 side 1
public end:
.program spi_gap010_sample1
.side_set 1
; always transmit multiple of 32 bytes
lp: out pins, 1 side 0
jmp x-- lp side 1
public lp1_end:
set pindirs, 0 side 0
nop side 1
nop side 0
lp2:
in pins, 1 side 1
jmp y-- lp2 side 0
public end:
.program spi_gap0_sample1_regular
.side_set 1
; always transmit multiple of 32 bytes
lp: out pins, 1 side 0
jmp x-- lp side 1
public lp1_end:
set pindirs, 0 side 0
lp2:
in pins, 1 side 1
jmp y-- lp2 side 0
public end:
......@@ -36,6 +36,12 @@ void dma_channel_unclaim(uint channel) {
hw_claim_clear((uint8_t *) &_claimed, channel);
}
void dma_unclaim_mask(uint32_t mask) {
for(uint i = 0; mask; i++, mask >>= 1u) {
if (mask & 1u) dma_channel_unclaim(i);
}
}
int dma_claim_unused_channel(bool required) {
return hw_claim_unused_from_range((uint8_t*)&_claimed, required, 0, NUM_DMA_CHANNELS-1, "No DMA channels are available");
}
......
......@@ -88,12 +88,17 @@ void dma_claim_mask(uint32_t channel_mask);
/*! \brief Mark a dma channel as no longer used
* \ingroup hardware_dma
*
* Method for cooperative claiming of hardware.
*
* \param channel the dma channel to release
*/
void dma_channel_unclaim(uint channel);
/*! \brief Mark multiple dma channels as no longer used
* \ingroup hardware_dma
*
* \param channel_mask Bitfield of all channels to unclaim (bit 0 == channel 0, bit 1 == channel 1 etc)
*/
void dma_unclaim_mask(uint32_t channel_mask);
/*! \brief Claim a free dma channel
* \ingroup hardware_dma
*
......
if (PICO_CYW43_SUPPORTED) # set by BOARD=pico-w
if (TARGET cyw43_driver_picow)
message("Enabling build support for Pico W wireless.")
pico_add_impl_library(pico_cyw43_arch)
target_sources(pico_cyw43_arch INTERFACE
${CMAKE_CURRENT_LIST_DIR}/cyw43_arch.c
${CMAKE_CURRENT_LIST_DIR}/cyw43_arch_poll.c
${CMAKE_CURRENT_LIST_DIR}/cyw43_arch_threadsafe_background.c
${CMAKE_CURRENT_LIST_DIR}/cyw43_arch_freertos.c
)
target_include_directories(pico_cyw43_arch INTERFACE
${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(pico_cyw43_arch INTERFACE
pico_unique_id
cyw43_driver_picow)
if (NOT TARGET pico_lwip)
message(WARNING "lwIP is not available; Full Pico W wireless support will be unavailable too")
else()
add_library(pico_cyw43_arch_lwip_poll INTERFACE)
target_link_libraries(pico_cyw43_arch_lwip_poll INTERFACE
pico_cyw43_arch
pico_lwip
pico_lwip_nosys)
target_compile_definitions(pico_cyw43_arch_lwip_poll INTERFACE
CYW43_LWIP=1
PICO_CYW43_ARCH_POLL=1
)
add_library(pico_cyw43_arch_lwip_threadsafe_background INTERFACE)
target_link_libraries(pico_cyw43_arch_lwip_threadsafe_background INTERFACE
pico_cyw43_arch
pico_lwip
pico_lwip_nosys)
target_compile_definitions(pico_cyw43_arch_lwip_threadsafe_background INTERFACE
CYW43_LWIP=1
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
)
add_library(pico_cyw43_arch_lwip_sys_freertos INTERFACE)
target_link_libraries(pico_cyw43_arch_lwip_sys_freertos INTERFACE
pico_cyw43_arch
pico_lwip
pico_lwip_contrib_freertos)
target_compile_definitions(pico_cyw43_arch_lwip_sys_freertos INTERFACE
CYW43_LWIP=1
LWIP_PROVIDE_ERRNO=1
PICO_CYW43_ARCH_FREERTOS=1
)
endif()
add_library(pico_cyw43_arch_none INTERFACE)
target_link_libraries(pico_cyw43_arch_none INTERFACE pico_cyw43_arch)
target_compile_definitions(pico_cyw43_arch_none INTERFACE
CYW43_LWIP=0
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 # none still uses threadsafe_background to make gpio use easy
)
endif()
endif()
if (PICO_CYW43_DRIVER_PATH AND EXISTS "${PICO_CYW43_DRIVER_PATH}")
pico_add_doxygen(${PICO_CYW43_DRIVER_PATH}/src)
endif()
\ No newline at end of file
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "pico/unique_id.h"
#include "cyw43.h"
#include "pico/cyw43_arch.h"
#include "cyw43_ll.h"
#include "cyw43_stats.h"
#if CYW43_ARCH_DEBUG_ENABLED
#define CYW43_ARCH_DEBUG(...) printf(__VA_ARGS__)
#else
#define CYW43_ARCH_DEBUG(...) ((void)0)
#endif
static uint32_t country_code = PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE;
void cyw43_arch_enable_sta_mode() {
assert(cyw43_is_initialized(&cyw43_state));
cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_STA, true, cyw43_arch_get_country_code());
}
void cyw43_arch_enable_ap_mode(const char *ssid, const char *password, uint32_t auth) {
assert(cyw43_is_initialized(&cyw43_state));
cyw43_wifi_ap_set_ssid(&cyw43_state, strlen(ssid), (const uint8_t *) ssid);
if (password) {
cyw43_wifi_ap_set_password(&cyw43_state, strlen(password), (const uint8_t *) password);
cyw43_wifi_ap_set_auth(&cyw43_state, auth);
} else {
cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_OPEN);
}
cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_AP, true, cyw43_arch_get_country_code());
}
#if CYW43_ARCH_DEBUG_ENABLED
// Return a string for the wireless state
static const char* status_name(int status)
{
switch (status) {
case CYW43_LINK_DOWN:
return "link down";
case CYW43_LINK_JOIN:
return "joining";
case CYW43_LINK_NOIP:
return "no ip";
case CYW43_LINK_UP:
return "link up";
case CYW43_LINK_FAIL:
return "link fail";
case CYW43_LINK_NONET:
return "network fail";
case CYW43_LINK_BADAUTH:
return "bad auth";
}
return "unknown";
}
#endif
int cyw43_arch_wifi_connect_async(const char *ssid, const char *pw, uint32_t auth) {
if (!pw) auth = CYW43_AUTH_OPEN;
// Connect to wireless
return cyw43_wifi_join(&cyw43_state, strlen(ssid), (const uint8_t *)ssid, pw ? strlen(pw) : 0, (const uint8_t *)pw, auth, NULL, CYW43_ITF_STA);
}
// Connect to wireless, return with success when an IP address has been assigned
int cyw43_arch_wifi_connect_until(const char *ssid, const char *pw, uint32_t auth, absolute_time_t until) {
int err = cyw43_arch_wifi_connect_async(ssid, pw, auth);
if (err) return err;
int status = CYW43_LINK_UP + 1;
while(status >= 0 && status != CYW43_LINK_UP) {
int new_status = cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA);
if (new_status != status) {
status = new_status;
CYW43_ARCH_DEBUG("connect status: %s\n", status_name(status));
}
// in case polling is required
cyw43_arch_poll();
best_effort_wfe_or_timeout(until);
if (time_reached(until)) {
return PICO_ERROR_TIMEOUT;
}
}
return status == CYW43_LINK_UP ? 0 : status;
}
int cyw43_arch_wifi_connect_blocking(const char *ssid, const char *pw, uint32_t auth) {
return cyw43_arch_wifi_connect_until(ssid, pw, auth, at_the_end_of_time);
}
int cyw43_arch_wifi_connect_timeout_ms(const char *ssid, const char *pw, uint32_t auth, uint32_t timeout_ms) {
return cyw43_arch_wifi_connect_until(ssid, pw, auth, make_timeout_time_ms(timeout_ms));
}
// todo maybe add an #ifdef in cyw43_driver
uint32_t storage_read_blocks(__unused uint8_t *dest, __unused uint32_t block_num, __unused uint32_t num_blocks) {
// shouldn't be used
panic_unsupported();
}
// Generate a mac address if one is not set in otp
void cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]) {
CYW43_DEBUG("Warning. No mac in otp. Generating mac from board id\n");
pico_unique_board_id_t board_id;
pico_get_unique_board_id(&board_id);
memcpy(buf, &board_id.id[2], 6);
buf[0] &= (uint8_t)~0x1; // unicast
buf[0] |= 0x2; // locally administered
}
// Return mac address
void cyw43_hal_get_mac(__unused int idx, uint8_t buf[6]) {
// The mac should come from cyw43 otp.
// This is loaded into the state after the driver is initialised
// cyw43_hal_generate_laa_mac is called by the driver to generate a mac if otp is not set
memcpy(buf, cyw43_state.mac, 6);
}
uint32_t cyw43_arch_get_country_code(void) {
return country_code;
}
int cyw43_arch_init_with_country(uint32_t country) {
country_code = country;
return cyw43_arch_init();
}
void cyw43_arch_gpio_put(uint wl_gpio, bool value) {
invalid_params_if(CYW43_ARCH, wl_gpio >= CYW43_WL_GPIO_COUNT);
cyw43_gpio_set(&cyw43_state, (int)wl_gpio, value);
}
bool cyw43_arch_gpio_get(uint wl_gpio) {
invalid_params_if(CYW43_ARCH, wl_gpio >= CYW43_WL_GPIO_COUNT);
bool value = false;
cyw43_gpio_get(&cyw43_state, (int)wl_gpio, &value);
return value;
}
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdio.h>
#include "pico/cyw43_arch.h"
#include "hardware/gpio.h"
#include "hardware/irq.h"
#include "hardware/sync.h"
#include "cyw43_stats.h"
#if CYW43_LWIP
#include <lwip/tcpip.h>
#endif
#if PICO_CYW43_ARCH_FREERTOS
// FreeRTOS includes
#include "FreeRTOS.h"
#include "timers.h"
#include "semphr.h"
#if NO_SYS
#error example_cyw43_arch_frertos_sys requires NO_SYS=0
#endif
#ifndef CYW43_TASK_PRIORITY
#define CYW43_TASK_PRIORITY ( tskIDLE_PRIORITY + 4)
#endif
#ifndef CYW43_SLEEP_CHECK_MS
#define CYW43_SLEEP_CHECK_MS 50 // How often to run lwip callback
#endif
#define CYW43_GPIO_IRQ_HANDLER_PRIORITY 0x40
static void signal_cyw43_task(void);
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
static SemaphoreHandle_t cyw43_mutex;
#endif
static TimerHandle_t timer_handle;
static TaskHandle_t cyw43_task_handle;
static volatile bool cyw43_task_should_exit;
static SemaphoreHandle_t cyw43_worker_ran_sem;
static uint8_t cyw43_core_num;
// Called in low priority pendsv interrupt only to do lwip processing and check cyw43 sleep
static void periodic_worker(__unused TimerHandle_t handle)
{
#if CYW43_USE_STATS
static uint32_t counter;
if (counter++ % (30000 / LWIP_SYS_CHECK_MS) == 0) {
cyw43_dump_stats();
}
#endif
CYW43_STAT_INC(LWIP_RUN_COUNT);
if (cyw43_poll) {
if (cyw43_sleep > 0) {
if (--cyw43_sleep == 0) {
signal_cyw43_task();
}
}
}
}
void cyw43_await_background_or_timeout_us(uint32_t timeout_us) {
// if we are called from within an IRQ, then don't wait (we are only ever called in a polling loop)
assert(!portCHECK_IF_IN_ISR());
xSemaphoreTake(cyw43_worker_ran_sem, pdMS_TO_TICKS(timeout_us / 1000));
}
// GPIO interrupt handler to tell us there's cyw43 has work to do
static void gpio_irq_handler(void)
{
uint32_t events = gpio_get_irq_event_mask(CYW43_PIN_WL_HOST_WAKE);
if (events & GPIO_IRQ_LEVEL_HIGH) {
// As we use a high level interrupt, it will go off forever until it's serviced
// So disable the interrupt until this is done. It's re-enabled again by CYW43_POST_POLL_HOOK
// which is called at the end of cyw43_poll_func
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
signal_cyw43_task();
CYW43_STAT_INC(IRQ_COUNT);
}
}
// Low priority interrupt handler to perform background processing
static void cyw43_task(__unused void *param) {
do {
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
if (cyw43_task_should_exit) break;
cyw43_thread_enter();
if (cyw43_poll) cyw43_poll();
cyw43_thread_exit();
xSemaphoreGive(cyw43_worker_ran_sem);
__sev(); // it is possible regular code is waiting on a WFE on the other core
} while (true);
}
static void tcpip_init_done(void *param) {
xSemaphoreGive((SemaphoreHandle_t)param);
}
int cyw43_arch_init(void) {
cyw43_core_num = get_core_num();
#if configUSE_CORE_AFFINITY && configNUM_CORES > 1
TaskHandle_t task_handle = xTaskGetCurrentTaskHandle();
UBaseType_t affinity = vTaskCoreAffinityGet(task_handle);
// we must bind the main task to one core during init
vTaskCoreAffinitySet(task_handle, 1 << portGET_CORE_ID());
#endif
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
cyw43_mutex = xSemaphoreCreateRecursiveMutex();
#endif
cyw43_init(&cyw43_state);
cyw43_worker_ran_sem = xSemaphoreCreateBinary();
#if CYW43_LWIP
SemaphoreHandle_t init_sem = xSemaphoreCreateBinary();
tcpip_init(tcpip_init_done, init_sem);
xSemaphoreTake(init_sem, portMAX_DELAY);
#endif
timer_handle = xTimerCreate( "cyw43_sleep_timer", // Just a text name, not used by the kernel.
pdMS_TO_TICKS(CYW43_SLEEP_CHECK_MS),
pdTRUE, // The timers will auto-reload themselves when they expire.
NULL,
periodic_worker);
if (!timer_handle) {
return PICO_ERROR_GENERIC;
}
gpio_add_raw_irq_handler_with_order_priority(IO_IRQ_BANK0, gpio_irq_handler, CYW43_GPIO_IRQ_HANDLER_PRIORITY);
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
irq_set_enabled(IO_IRQ_BANK0, true);
cyw43_task_should_exit = false;
xTaskCreate(cyw43_task, "CYW43 Worker", configMINIMAL_STACK_SIZE, NULL, CYW43_TASK_PRIORITY, &cyw43_task_handle);
#if configUSE_CORE_AFFINITY && configNUM_CORES > 1
// the cyw43 task mus tbe on the same core so it can restore IRQs
vTaskCoreAffinitySet(cyw43_task_handle, 1 << portGET_CORE_ID());
#endif
#if configUSE_CORE_AFFINITY && configNUM_CORES > 1
vTaskCoreAffinitySet(task_handle, affinity);
#endif
return PICO_OK;
}
void cyw43_arch_deinit(void) {
assert(cyw43_core_num == get_core_num());
if (timer_handle) {
xTimerDelete(timer_handle, 0);
timer_handle = 0;
}
if (cyw43_task_handle) {
cyw43_task_should_exit = true;
signal_cyw43_task();
}
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
gpio_remove_raw_irq_handler(IO_IRQ_BANK0, gpio_irq_handler);
}
void cyw43_post_poll_hook(void) {
assert(cyw43_core_num == get_core_num());
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
}
// This is called in the gpio and low_prio_irq interrupts and on either core
static void signal_cyw43_task(void) {
if (cyw43_task_handle) {
if (portCHECK_IF_IN_ISR()) {
vTaskNotifyGiveFromISR(cyw43_task_handle, NULL);
} else {
xTaskNotifyGive(cyw43_task_handle);
}
}
}
void cyw43_schedule_internal_poll_dispatch(void (*func)(void)) {
assert(func == cyw43_poll);
signal_cyw43_task();
}
static int nesting;
// Prevent background processing in pensv and access by the other core
// These methods are called in pensv context and on either core
// They can be called recursively
void cyw43_thread_enter(void) {
// Lock the other core and stop low_prio_irq running
assert(!portCHECK_IF_IN_ISR());
#if LWIP_TCPIP_CORE_LOCKING_INPUT
// we must share their mutex otherwise we can get deadlocks with two different recursive mutexes
LOCK_TCPIP_CORE();
#else
xSemaphoreTakeRecursive(cyw43_mutex, portMAX_DELAY);
#endif
nesting++;
}
#ifndef NDEBUG
void cyw43_thread_lock_check(void) {
// Lock the other core and stop low_prio_irq running
#if LWIP_TCPIP_CORE_LOCKING_INPUT
assert(xSemaphoreGetMutexHolder(lock_tcpip_core.mut) == xTaskGetCurrentTaskHandle());
#else
assert(xSemaphoreGetMutexHolder(cyw43_mutex) == xTaskGetCurrentTaskHandle());
#endif
}
#endif
// Re-enable background processing
void cyw43_thread_exit(void) {
// Run low_prio_irq if needed
--nesting;
#if LWIP_TCPIP_CORE_LOCKING_INPUT
// we must share their mutex otherwise we can get deadlocks with two different recursive mutexes
UNLOCK_TCPIP_CORE();
#else
xSemaphoreGiveRecursive(cyw43_mutex);
#endif
if (!nesting && cyw43_task_handle != xTaskGetCurrentTaskHandle())
signal_cyw43_task();
}
void cyw43_delay_ms(uint32_t ms) {
assert(!portCHECK_IF_IN_ISR());
vTaskDelay(pdMS_TO_TICKS(ms));
}
void cyw43_delay_us(uint32_t us) {
if (us >= 1000) {
cyw43_delay_ms(us / 1000);
} else {
vTaskDelay(1);
}
}
void cyw43_arch_poll() {
}
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdio.h>
#include "hardware/gpio.h"
#include "hardware/irq.h"
#include "pico/sem.h"
#include "pico/cyw43_arch.h"
#include "cyw43_stats.h"
#if PICO_CYW43_ARCH_POLL
#include <lwip/init.h>
#include "lwip/timeouts.h"
#if CYW43_LWIP && !NO_SYS
#error PICO_CYW43_ARCH_POLL requires lwIP NO_SYS=1
#endif
#define CYW43_GPIO_IRQ_HANDLER_PRIORITY 0x40
#ifndef NDEBUG
uint8_t cyw43_core_num;
#endif
bool cyw43_poll_required;
// GPIO interrupt handler to tell us there's cyw43 has work to do
static void gpio_irq_handler(void)
{
uint32_t events = gpio_get_irq_event_mask(CYW43_PIN_WL_HOST_WAKE);
if (events & GPIO_IRQ_LEVEL_HIGH) {
// As we use a high level interrupt, it will go off forever until it's serviced
// So disable the interrupt until this is done. It's re-enabled again by CYW43_POST_POLL_HOOK
// which is called at the end of cyw43_poll_func
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
// also clear the force bit which we use to programmatically cause this handler to fire (on the right core)
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ?
&iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
hw_clear_bits(&irq_ctrl_base->intf[CYW43_PIN_WL_HOST_WAKE/8], GPIO_IRQ_LEVEL_HIGH << (4 * (CYW43_PIN_WL_HOST_WAKE & 7)));
cyw43_schedule_internal_poll_dispatch(cyw43_poll);
CYW43_STAT_INC(IRQ_COUNT);
}
}
void cyw43_post_poll_hook(void) {
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
}
int cyw43_arch_init(void) {
#ifndef NDEBUG
cyw43_core_num = (uint8_t)get_core_num();
#endif
cyw43_init(&cyw43_state);
static bool done_lwip_init;
if (!done_lwip_init) {
lwip_init();
done_lwip_init = true;
}
gpio_add_raw_irq_handler_with_order_priority(IO_IRQ_BANK0, gpio_irq_handler, CYW43_GPIO_IRQ_HANDLER_PRIORITY);
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
irq_set_enabled(IO_IRQ_BANK0, true);
return 0;
}
void cyw43_arch_deinit(void) {
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
gpio_remove_raw_irq_handler(IO_IRQ_BANK0, gpio_irq_handler);
cyw43_deinit(&cyw43_state);
}
void cyw43_schedule_internal_poll_dispatch(__unused void (*func)(void)) {
cyw43_poll_required = true;
}
void cyw43_arch_poll(void)
{
CYW43_STAT_INC(LWIP_RUN_COUNT);
sys_check_timeouts();
if (cyw43_poll) {
if (cyw43_sleep > 0) {
// todo check this; but we don't want to advance too quickly
static absolute_time_t last_poll_time;
absolute_time_t current = get_absolute_time();
if (absolute_time_diff_us(last_poll_time, current) > 1000) {
if (--cyw43_sleep == 0) {
cyw43_poll_required = 1;
}
last_poll_time = current;
}
}
// todo graham i removed this because otherwise polling can do nothing during connect.
// in the polling only case, the caller is responsible for throttling how often they call anyway.
// The alternative would be to have the call to this function from the init set the poll_required flag first
// if (cyw43_poll_required) {
cyw43_poll();
// cyw43_poll_required = false;
// }
}
}
#ifndef NDEBUG
void cyw43_thread_check() {
if (__get_current_exception() || get_core_num() != cyw43_core_num) {
panic("cyw43_thread_lock_check failed");
}
}
#endif
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdio.h>
#include "pico/cyw43_arch.h"
#include "pico/mutex.h"
#include "pico/sem.h"
#include "hardware/gpio.h"
#include "hardware/irq.h"
#include "cyw43_stats.h"
#if CYW43_LWIP
#include <lwip/init.h>
#include "lwip/timeouts.h"
#endif
// note same code
#if PICO_CYW43_ARCH_THREADSAFE_BACKGROUND
#if PICO_CYW43_ARCH_THREADSAFE_BACKGROUND && CYW43_LWIP && !NO_SYS
#error PICO_CYW43_ARCH_THREADSAFE_BACKGROUND requires lwIP NO_SYS=1
#endif
#if PICO_CYW43_ARCH_THREADSAFE_BACKGROUND && CYW43_LWIP && MEM_LIBC_MALLOC
#error MEM_LIBC_MALLOC is incompatible with PICO_CYW43_ARCH_THREADSAFE_BACKGROUND
#endif
// todo right now we are now always doing a cyw43_dispatch along with a lwip one when hopping cores in low_prio_irq_schedule_dispatch
#ifndef CYW43_SLEEP_CHECK_MS
#define CYW43_SLEEP_CHECK_MS 50 // How often to run lwip callback
#endif
static alarm_id_t periodic_alarm = -1;
static inline uint recursive_mutex_enter_count(recursive_mutex_t *mutex) {
return mutex->enter_count;
}
static inline lock_owner_id_t recursive_mutex_owner(recursive_mutex_t *mutex) {
return mutex->owner;
}
#define CYW43_GPIO_IRQ_HANDLER_PRIORITY 0x40
enum {
CYW43_DISPATCH_SLOT_CYW43 = 0,
CYW43_DISPATCH_SLOT_ADAPTER,
CYW43_DISPATCH_SLOT_ENUM_COUNT
};
#ifndef CYW43_DISPATCH_SLOT_COUNT
#define CYW43_DISPATCH_SLOT_COUNT CYW43_DISPATCH_SLOT_ENUM_COUNT
#endif
typedef void (*low_prio_irq_dispatch_t)(void);
static void low_prio_irq_schedule_dispatch(size_t slot, low_prio_irq_dispatch_t f);
static uint8_t cyw43_core_num;
#ifndef NDEBUG
static bool in_low_priority_irq;
#endif
static uint8_t low_priority_irq_num;
static bool low_priority_irq_missed;
static low_prio_irq_dispatch_t low_priority_irq_dispatch_slots[CYW43_DISPATCH_SLOT_COUNT];
static recursive_mutex_t cyw43_mutex;
semaphore_t cyw43_irq_sem;
// Called in low priority pendsv interrupt only to do lwip processing and check cyw43 sleep
static void periodic_worker(void)
{
#if CYW43_USE_STATS
static uint32_t counter;
if (counter++ % (30000 / LWIP_SYS_CHECK_MS) == 0) {
cyw43_dump_stats();
}
#endif
CYW43_STAT_INC(LWIP_RUN_COUNT);
#if CYW43_LWIP
sys_check_timeouts();
#endif
if (cyw43_poll) {
if (cyw43_sleep > 0) {
if (--cyw43_sleep == 0) {
low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_CYW43, cyw43_poll);
}
}
}
}
// Regular callback to get lwip to check for timeouts
static int64_t periodic_alarm_handler(__unused alarm_id_t id, __unused void *user_data)
{
// Do lwip processing in low priority pendsv interrupt
low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_ADAPTER, periodic_worker);
return CYW43_SLEEP_CHECK_MS * 1000;
}
void cyw43_await_background_or_timeout_us(uint32_t timeout_us) {
// if we are called from within an IRQ, then don't wait (we are only ever called in a polling loop)
if (!__get_current_exception()) {
sem_acquire_timeout_us(&cyw43_irq_sem, timeout_us);
}
}
// GPIO interrupt handler to tell us there's cyw43 has work to do
static void gpio_irq_handler(void)
{
uint32_t events = gpio_get_irq_event_mask(CYW43_PIN_WL_HOST_WAKE);
if (events & GPIO_IRQ_LEVEL_HIGH) {
// As we use a high level interrupt, it will go off forever until it's serviced
// So disable the interrupt until this is done. It's re-enabled again by CYW43_POST_POLL_HOOK
// which is called at the end of cyw43_poll_func
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
// also clear the force bit which we use to progratically cause this handler to fire (on the right core)
io_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ?
&iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
hw_clear_bits(&irq_ctrl_base->intf[CYW43_PIN_WL_HOST_WAKE/8], GPIO_IRQ_LEVEL_HIGH << (4 * (CYW43_PIN_WL_HOST_WAKE & 7)));
low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_CYW43, cyw43_poll);
CYW43_STAT_INC(IRQ_COUNT);
}
}
// Low priority interrupt handler to perform background processing
static void low_priority_irq_handler(void) {
assert(cyw43_core_num == get_core_num());
if (recursive_mutex_try_enter(&cyw43_mutex, NULL)) {
if (recursive_mutex_enter_count(&cyw43_mutex) != 1) {
low_priority_irq_missed = true;
CYW43_STAT_INC(PENDSV_DISABLED_COUNT);
} else {
CYW43_STAT_INC(PENDSV_RUN_COUNT);
#ifndef NDEBUG
in_low_priority_irq = true;
#endif
for (size_t i = 0; i < count_of(low_priority_irq_dispatch_slots); i++) {
if (low_priority_irq_dispatch_slots[i] != NULL) {
low_prio_irq_dispatch_t f = low_priority_irq_dispatch_slots[i];
low_priority_irq_dispatch_slots[i] = NULL;
f();
}
}
#ifndef NDEBUG
in_low_priority_irq = false;
#endif
}
recursive_mutex_exit(&cyw43_mutex);
} else {
CYW43_STAT_INC(PENDSV_DISABLED_COUNT);
low_priority_irq_missed = true;
}
sem_release(&cyw43_irq_sem);
}
static bool low_prio_irq_init(uint8_t priority) {
assert(get_core_num() == cyw43_core_num);
int irq = user_irq_claim_unused(false);
if (irq < 0) return false;
low_priority_irq_num = (uint8_t) irq;
irq_set_exclusive_handler(low_priority_irq_num, low_priority_irq_handler);
irq_set_enabled(low_priority_irq_num, true);
irq_set_priority(low_priority_irq_num, priority);
return true;
}
static void low_prio_irq_deinit(void) {
if (low_priority_irq_num > 0) {
irq_set_enabled(low_priority_irq_num, false);
irq_remove_handler(low_priority_irq_num, low_priority_irq_handler);
user_irq_unclaim(low_priority_irq_num);
low_priority_irq_num = 0;
}
}
int cyw43_arch_init(void) {
cyw43_core_num = get_core_num();
recursive_mutex_init(&cyw43_mutex);
cyw43_init(&cyw43_state);
sem_init(&cyw43_irq_sem, 0, 1);
// Start regular lwip callback to handle timeouts
periodic_alarm = add_alarm_in_us(CYW43_SLEEP_CHECK_MS * 1000, periodic_alarm_handler, NULL, true);
if (periodic_alarm < 0) {
return PICO_ERROR_GENERIC;
}
gpio_add_raw_irq_handler_with_order_priority(IO_IRQ_BANK0, gpio_irq_handler, CYW43_GPIO_IRQ_HANDLER_PRIORITY);
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
irq_set_enabled(IO_IRQ_BANK0, true);
#if CYW43_LWIP
lwip_init();
#endif
// start low priority handler (no background work is done before this)
bool ok = low_prio_irq_init(PICO_LOWEST_IRQ_PRIORITY);
if (!ok) {
cyw43_arch_deinit();
return PICO_ERROR_GENERIC;
}
return PICO_OK;
}
void cyw43_arch_deinit(void) {
if (periodic_alarm >= 0) {
cancel_alarm(periodic_alarm);
periodic_alarm = -1;
}
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, false);
gpio_remove_raw_irq_handler(IO_IRQ_BANK0, gpio_irq_handler);
low_prio_irq_deinit();
}
void cyw43_post_poll_hook(void) {
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, GPIO_IRQ_LEVEL_HIGH, true);
}
// This is called in the gpio and low_prio_irq interrupts and on either core
static void low_prio_irq_schedule_dispatch(size_t slot, low_prio_irq_dispatch_t f) {
assert(slot < count_of(low_priority_irq_dispatch_slots));
low_priority_irq_dispatch_slots[slot] = f;
if (cyw43_core_num == get_core_num()) {
//on same core, can dispatch directly
irq_set_pending(low_priority_irq_num);
} else {
// on wrong core, so force via GPIO IRQ which itself calls this method for the CYW43 slot.
// since the CYW43 slot always uses the same function, this is fine with the addition of an
// extra (but harmless) CYW43 slot call when another SLOT is invoked.
// We could do better, but would have to track why the IRQ was called.
io_irq_ctrl_hw_t *irq_ctrl_base = cyw43_core_num ?
&iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
hw_set_bits(&irq_ctrl_base->intf[CYW43_PIN_WL_HOST_WAKE/8], GPIO_IRQ_LEVEL_HIGH << (4 * (CYW43_PIN_WL_HOST_WAKE & 7)));
}
}
void cyw43_schedule_internal_poll_dispatch(void (*func)(void)) {
low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_CYW43, func);
}
// Prevent background processing in pensv and access by the other core
// These methods are called in pensv context and on either core
// They can be called recursively
void cyw43_thread_enter(void) {
// Lock the other core and stop low_prio_irq running
recursive_mutex_enter_blocking(&cyw43_mutex);
}
#ifndef NDEBUG
void cyw43_thread_lock_check(void) {
// Lock the other core and stop low_prio_irq running
if (recursive_mutex_enter_count(&cyw43_mutex) < 1 || recursive_mutex_owner(&cyw43_mutex) != lock_get_caller_owner_id()) {
panic("cyw43_thread_lock_check failed");
}
}
#endif
// Re-enable background processing
void cyw43_thread_exit(void) {
// Run low_prio_irq if needed
if (1 == recursive_mutex_enter_count(&cyw43_mutex)) {
// note the outer release of the mutex is not via cyw43_exit in the low_priority_irq case (it is a direct mutex exit)
assert(!in_low_priority_irq);
// if (low_priority_irq_missed) {
// low_priority_irq_missed = false;
if (low_priority_irq_dispatch_slots[CYW43_DISPATCH_SLOT_CYW43]) {
low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_CYW43, cyw43_poll);
}
// }
}
recursive_mutex_exit(&cyw43_mutex);
}
static void cyw43_delay_until(absolute_time_t until) {
// sleep can be called in IRQs, so there's not much we can do there
if (__get_current_exception()) {
busy_wait_until(until);
} else {
sleep_until(until);
}
}
void cyw43_delay_ms(uint32_t ms) {
cyw43_delay_until(make_timeout_time_ms(ms));
}
void cyw43_delay_us(uint32_t us) {
cyw43_delay_until(make_timeout_time_us(us));
}
void cyw43_arch_poll() {
// should not be necessary
// if (cyw43_poll) {
// low_prio_irq_schedule_dispatch(CYW43_DISPATCH_SLOT_CYW43, cyw43_poll);
// }
}
#if !CYW43_LWIP
static void no_lwip_fail() {
panic("You cannot use IP with pico_cyw43_arch_none");
}
void cyw43_cb_tcpip_init(cyw43_t *self, int itf) {
}
void cyw43_cb_tcpip_deinit(cyw43_t *self, int itf) {
}
void cyw43_cb_tcpip_set_link_up(cyw43_t *self, int itf) {
no_lwip_fail();
}
void cyw43_cb_tcpip_set_link_down(cyw43_t *self, int itf) {
no_lwip_fail();
}
void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t *buf) {
no_lwip_fail();
}
#endif
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment