esp32c3/wifi: Add support for the Wi-Fi in ESP32-C3

This commit introduces support for both station and softAP modes.
This commit is contained in:
Tiago Medicci Serrano 2024-04-25 13:41:36 -03:00 committed by Xiang Xiao
parent 7ed64e7234
commit c412dadcb9
19 changed files with 7353 additions and 9 deletions

View File

@ -162,6 +162,26 @@ Once booted you can use the following commands to mount the file system::
nsh> mksmartfs /dev/smart0
nsh> mount -t smartfs /dev/smart0 /mnt
sta_softap
----------
With this configuration you can run these commands to be able
to connect your smartphone or laptop to your board::
nsh> ifup wlan1
nsh> dhcpd_start wlan1
nsh> wapi psk wlan1 mypasswd 3
nsh> wapi essid wlan1 nuttxap 1
In this case, you are creating the access point ``nuttxapp`` in your board and to
connect to it on your smartphone you will be required to type the password ``mypasswd``
using WPA2.
.. tip:: Please refer to :ref:`ESP32 Wi-Fi SoftAP Mode <esp32_wi-fi_softap>`
for more information.
The ``dhcpd_start`` is necessary to let your board to associate an IP to your smartphone.
timer
-----
@ -220,3 +240,24 @@ To test it, just run the following command::
nsh> wdog -i /dev/watchdogX
Where X is the watchdog instance.
wifi
----
Enables Wi-Fi support. You can define your credentials this way::
$ make menuconfig
-> Application Configuration
-> Network Utilities
-> Network initialization (NETUTILS_NETINIT [=y])
-> WAPI Configuration
Or if you don't want to keep it saved in the firmware you can do it
at runtime::
nsh> wapi psk wlan0 mypasswd 3
nsh> wapi essid wlan0 myssid 1
nsh> renew wlan0
.. tip:: Please refer to :ref:`ESP32 Wi-Fi Station Mode <esp32_wi-fi_sta>`
for more information.

View File

@ -142,9 +142,9 @@ Peripheral Support
The following list indicates the state of peripherals' support in NuttX:
=========== ======= =====
=========== ======= ====================
Peripheral Support NOTES
=========== ======= =====
=========== ======= ====================
ADC No
AES No
Bluetooth No
@ -165,8 +165,8 @@ Timers Yes
Touch No
UART Yes
Watchdog Yes
Wifi No
=========== ======= =====
Wifi Yes WPA3-SAE supported
=========== ======= ====================
Secure Boot and Flash Encryption
================================

View File

@ -350,7 +350,7 @@ config ESP_WIRELESS
config ESPRESSIF_WIFI
bool "Wi-Fi"
depends on ESPRESSIF_ESP32C6
depends on ESPRESSIF_ESP32C3 || ESPRESSIF_ESP32C6
default n
select ESP_WIRELESS
---help---

View File

@ -28,10 +28,7 @@ EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)lib$(DELIM)$(CHIP_SERIES)
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_wifi$(DELIM)lib$(DELIM)$(CHIP_SERIES)
EXTRA_LIBS += -lphy -lcoexist
ifeq ($(CHIP_SERIES),esp32c6)
EXTRA_LIBS += -lmesh
endif
EXTRA_LIBS += -lphy -lcoexist -lmesh
ifeq ($(CONFIG_ESPRESSIF_WIFI),y)

View File

@ -50,6 +50,7 @@
#include "soc/extmem_reg.h"
#include "soc/mmu.h"
#include "soc/reg_base.h"
#include "spi_flash_mmap.h"
#include "rom/cache.h"
#ifdef CONFIG_ESPRESSIF_SIMPLE_BOOT

View File

@ -21,4 +21,11 @@
include common/Make.defs
include common/espressif/Make.defs
# Wireless interfaces.
ifeq ($(CONFIG_ESPRESSIF_WIFI),y)
CHIP_CSRCS += esp_coex_adapter.c esp_wifi_adapter.c
EXTRA_LIBS += -lcore -lnet80211 -lpp
endif
CFLAGS += ${DEFINE_PREFIX}_RETARGETABLE_LOCKING

View File

@ -0,0 +1,587 @@
/****************************************************************************
* arch/risc-v/src/esp32c3/esp_coex_adapter.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <debug.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <nuttx/spinlock.h>
#include <irq/irq.h>
#include <nuttx/kmalloc.h>
#include "esp_hr_timer.h"
#include "esp_wlan.h"
#include "esp_attr.h"
#include "esp_timer.h"
#include "soc/rtc.h"
#include "esp_private/esp_clk.h"
#include "esp_coexist_adapter.h"
#include "rom/ets_sys.h"
#include "soc/soc_caps.h"
#include "soc/system_reg.h"
#include "esp_modem_wrapper.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int64_t esp_coex_esp_timer_get_time_wrapper(void);
static int32_t esp_coex_semphr_take_from_isr_wrapper(void *semphr,
void *hptw);
static int32_t esp_coex_semphr_give_from_isr_wrapper(void *semphr,
void *hptw);
static int esp_coex_is_in_isr_wrapper(void);
/****************************************************************************
* Public Data
****************************************************************************/
coex_adapter_funcs_t g_coex_adapter_funcs =
{
._version = COEX_ADAPTER_VERSION,
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
._semphr_create = esp_coex_common_semphr_create_wrapper,
._semphr_delete = esp_coex_common_semphr_delete_wrapper,
._semphr_take_from_isr = esp_coex_semphr_take_from_isr_wrapper,
._semphr_give_from_isr = esp_coex_semphr_give_from_isr_wrapper,
._semphr_take = esp_coex_common_semphr_take_wrapper,
._semphr_give = esp_coex_common_semphr_give_wrapper,
._is_in_isr = esp_coex_is_in_isr_wrapper,
._malloc_internal = esp_coex_common_malloc_internal_wrapper,
._free = free,
._esp_timer_get_time = esp_coex_esp_timer_get_time_wrapper,
._timer_disarm = esp_coex_common_timer_disarm_wrapper,
._timer_done = esp_coex_common_timer_done_wrapper,
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: esp_coex_esp_timer_get_time_wrapper
*
* Description:
* This function retrieves the current time of the High Resolution Timer
* in microseconds. It is a wrapper around the esp_hr_timer_time_us
* function, providing a consistent interface for the coexistence module.
*
* Input Parameters:
* None.
*
* Returned Value:
* The current time of the High Resolution Timer in microseconds, as a
* 64-bit integer.
*
****************************************************************************/
static IRAM_ATTR int64_t esp_coex_esp_timer_get_time_wrapper(void)
{
return (int64_t)esp_hr_timer_time_us();
}
/****************************************************************************
* Name: esp_coex_semphr_take_from_isr_wrapper
*
* Description:
* Take a semaphore from an ISR
*
* Input Parameters:
* semphr - Semaphore data pointer.
* hptw - Unused.
*
* Returned Value:
* True if success or false if fail
*
****************************************************************************/
static int32_t IRAM_ATTR esp_coex_semphr_take_from_isr_wrapper(void *semphr,
void *hptw)
{
*(int *)hptw = 0;
return nuttx_err_to_freertos(nxsem_trywait(semphr));
}
/****************************************************************************
* Name: esp_coex_semphr_give_from_isr_wrapper
*
* Description:
* Post semaphore
*
* Input Parameters:
* semphr - Semaphore data pointer
* hptw - Unused.
*
* Returned Value:
* True if success or false if fail
*
****************************************************************************/
static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr,
void *hptw)
{
*(int *)hptw = 0;
return esp_coex_common_semphr_give_wrapper(semphr);
}
/****************************************************************************
* Name: esp_coex_is_in_isr_wrapper
*
* Description:
* This function checks if the current context is an interrupt service
* routine (ISR). It is a wrapper around the NuttX up_interrupt_context
* function.
*
* Input Parameters:
* None
*
* Returned Value:
* Returns 1 if the current context is an ISR, 0 otherwise.
*
****************************************************************************/
static int IRAM_ATTR esp_coex_is_in_isr_wrapper(void)
{
return (int)up_interrupt_context();
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp_coex_common_env_is_chip_wrapper
*
* Description:
* This function checks if the environment is a chip or FPGA.
*
* Input Parameters:
* None
*
* Returned Value:
* Returns true if the environment is a chip, false if it's an FPGA.
*
****************************************************************************/
bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void)
{
#ifdef CONFIG_IDF_ENV_FPGA
return false;
#else
return true;
#endif
}
/****************************************************************************
* Name: esp_coex_common_spin_lock_create_wrapper
*
* Description:
* Create spin lock in SMP mode
*
* Input Parameters:
* None
*
* Returned Value:
* Spin lock data pointer
*
****************************************************************************/
void *esp_coex_common_spin_lock_create_wrapper(void)
{
spinlock_t *lock;
int tmp;
tmp = sizeof(*lock);
lock = kmm_malloc(tmp);
if (!lock)
{
wlerr("Failed to alloc %d memory\n", tmp);
DEBUGPANIC();
}
spin_initialize(lock, SP_UNLOCKED);
return lock;
}
/****************************************************************************
* Name: esp_coex_common_int_disable_wrapper
*
* Description:
* Enter critical section by disabling interrupts and taking the spin lock
* if in SMP mode.
*
* Input Parameters:
* wifi_int_mux - Spin lock data pointer
*
* Returned Value:
* CPU PS value.
*
****************************************************************************/
uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux)
{
irqstate_t flags;
flags = spin_lock_irqsave((spinlock_t *)wifi_int_mux);
return (uint32_t)flags;
}
/****************************************************************************
* Name: esp_coex_common_int_restore_wrapper
*
* Description:
* Exit from critical section by enabling interrupts and releasing the spin
* lock if in SMP mode.
*
* Input Parameters:
* wifi_int_mux - Spin lock data pointer
* tmp - CPU PS value.
*
* Returned Value:
* None
*
****************************************************************************/
void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux,
uint32_t tmp)
{
irqstate_t flags = (irqstate_t)tmp;
spin_unlock_irqrestore((spinlock_t *)wifi_int_mux, flags);
}
/****************************************************************************
* Name: esp_task_yield_from_isr
*
* Description:
* Perform a solicited context switch on FreeRTOS. Do nothing in NuttX.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void)
{
}
/****************************************************************************
* Name: esp_coex_common_semphr_create_wrapper
*
* Description:
* Create and initialize semaphore
*
* Input Parameters:
* max - No meanining for NuttX
* init - semaphore initialization value
*
* Returned Value:
* Semaphore data pointer
*
****************************************************************************/
void *esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init)
{
int ret;
sem_t *sem;
int tmp;
tmp = sizeof(sem_t);
sem = kmm_malloc(tmp);
if (!sem)
{
wlerr("Failed to alloc %d memory\n", tmp);
return NULL;
}
ret = nxsem_init(sem, 0, init);
if (ret)
{
wlerr("Failed to initialize sem error=%d\n", ret);
kmm_free(sem);
return NULL;
}
return sem;
}
/****************************************************************************
* Name: esp_coex_common_semphr_delete_wrapper
*
* Description:
* Delete semaphore
*
* Input Parameters:
* semphr - Semaphore data pointer
*
* Returned Value:
* None
*
****************************************************************************/
void esp_coex_common_semphr_delete_wrapper(void *semphr)
{
sem_t *sem = (sem_t *)semphr;
nxsem_destroy(sem);
kmm_free(sem);
}
/****************************************************************************
* Name: esp_coex_common_semphr_take_wrapper
*
* Description:
* This function attempts to take (wait for) a semaphore within a certain
* period of time. It is a wrapper around the NuttX nxsem_wait and
* nxsem_tickwait functions, providing error handling and translation
* between NuttX and ESP-IDF error codes.
*
* Input Parameters:
* semphr - Pointer to the semaphore data structure.
* block_time_tick - The maximum number of system ticks to wait.
*
* Returned Value:
* Returns 0 if the semaphore was successfully taken, or a negative error
* code if the operation failed or the timeout expired.
*
****************************************************************************/
int32_t esp_coex_common_semphr_take_wrapper(void *semphr,
uint32_t block_time_tick)
{
int ret;
sem_t *sem = (sem_t *)semphr;
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING)
{
ret = nxsem_wait(sem);
}
else
{
if (block_time_tick > 0)
{
ret = nxsem_tickwait(sem, block_time_tick);
}
else
{
ret = nxsem_trywait(sem);
}
}
if (ret)
{
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n",
block_time_tick, ret);
}
return nuttx_err_to_freertos(ret);
}
/****************************************************************************
* Name: esp_coex_common_semphr_give_wrapper
*
* Description:
* This function posts (releases) a semaphore. It is a wrapper around the
* NuttX nxsem_post function, providing error handling and translation
* between NuttX and ESP-IDF error codes.
*
* Input Parameters:
* semphr - Pointer to the semaphore data structure.
*
* Returned Value:
* Returns 0 if the semaphore was successfully posted, or a negative error
* code if the operation failed.
*
****************************************************************************/
int32_t esp_coex_common_semphr_give_wrapper(void *semphr)
{
int ret;
sem_t *sem = (sem_t *)semphr;
ret = nxsem_post(sem);
if (ret)
{
wlerr("Failed to post sem error=%d\n", ret);
}
return nuttx_err_to_freertos(ret);
}
/****************************************************************************
* Name: esp_coex_common_timer_disarm_wrapper
*
* Description:
* Disable timer
*
* Input Parameters:
* timer - timer data pointer
*
* Returned Value:
* None
*
****************************************************************************/
void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
/****************************************************************************
* Name: esp_coex_common_timer_done_wrapper
*
* Description:
* Disable and free timer
*
* Input Parameters:
* ptimer - timer data pointer
*
* Returned Value:
* None
*
****************************************************************************/
void esp_coex_common_timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
/****************************************************************************
* Name: esp_coex_common_timer_setfn_wrapper
*
* Description:
* Set timer callback function and private data
*
* Input Parameters:
* ptimer - Timer data pointer
* pfunction - Callback function
* parg - Callback function private data
*
* Returned Value:
* None
*
****************************************************************************/
void esp_coex_common_timer_setfn_wrapper(void *ptimer,
void *pfunction,
void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
/****************************************************************************
* Name: esp_coex_common_timer_arm_us_wrapper
*
* Description:
* Set timer timeout period and repeat flag
*
* Input Parameters:
* ptimer - timer data pointer
* us - micro seconds
* repeat - true: run cycle, false: run once
*
* Returned Value:
* None
*
****************************************************************************/
void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer,
uint32_t us,
bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
/****************************************************************************
* Name: esp_coex_common_malloc_internal_wrapper
*
* Description:
* Drivers allocate a block of memory
*
* Input Parameters:
* size - memory size
*
* Returned Value:
* Memory pointer
*
****************************************************************************/
IRAM_ATTR void *esp_coex_common_malloc_internal_wrapper(size_t size)
{
return kmm_malloc(size);
}
/****************************************************************************
* Name: esp_coex_common_clk_slowclk_cal_get_wrapper
*
* Description:
* Get the calibration value of RTC slow clock
*
* Input Parameters:
* None
*
* Returned Value:
* The calibration value obtained using rtc_clk_cal
*
****************************************************************************/
uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void)
{
/* The bit width of WiFi light sleep clock calibration is 12 while the one
* of system is 19. It should shift 19 - 12 = 7.
*/
if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL))
{
uint64_t time_per_us = 1000000ULL;
return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >>
(RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
}
else
{
return (esp_clk_slowclk_cal_get() >>
(RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,672 @@
/****************************************************************************
* arch/risc-v/src/esp32c3/esp_wifi_adapter.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_RISCV_SRC_ESP32C3_ESP_WIFI_ADAPTER_H
#define __ARCH_RISCV_SRC_ESP32C3_ESP_WIFI_ADAPTER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/wireless/wireless.h>
#include <sys/types.h>
#include "esp_wlan.h"
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define SSID_MAX_LEN (32)
#define PWD_MAX_LEN (64)
#define CONFIG_IDF_TARGET_ESP32C3 1
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_wifi_adapter_init
*
* Description:
* Initialize ESP32S3 Wi-Fi adapter
*
* Input Parameters:
* None
*
* Returned Value:
* 0 if success or -1 if fail
*
****************************************************************************/
int esp_wifi_adapter_init(void);
/****************************************************************************
* Name: esp_wifi_notify_subscribe
*
* Description:
* Enable event notification
*
* Input Parameters:
* pid - Task PID
* event - Signal event data pointer
*
* Returned Value:
* 0 if success or -1 if fail
*
****************************************************************************/
int esp_wifi_notify_subscribe(pid_t pid, struct sigevent *event);
#ifdef ESP_WLAN_HAS_STA
/****************************************************************************
* Name: esp_wifi_sta_start
*
* Description:
* Start Wi-Fi station.
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_start(void);
/****************************************************************************
* Name: esp_wifi_sta_stop
*
* Description:
* Stop Wi-Fi station.
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_stop(void);
/****************************************************************************
* Name: esp_wifi_sta_send_data
*
* Description:
* Use Wi-Fi station interface to send 802.3 frame
*
* Input Parameters:
* pbuf - Packet buffer pointer
* len - Packet length
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_send_data(void *pbuf, size_t len);
/****************************************************************************
* Name: esp_wifi_set_password
*
* Description:
* Set/Get Wi-Fi station password
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_password(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_essid
*
* Description:
* Set/Get Wi-Fi station ESSID
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_essid(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_bssid
*
* Description:
* Set/Get Wi-Fi station BSSID
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_bssid(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_connect
*
* Description:
* Trigger Wi-Fi station connection action
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_connect(void);
/****************************************************************************
* Name: esp_wifi_sta_disconnect
*
* Description:
* Trigger Wi-Fi station disconnection action
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_disconnect(void);
/****************************************************************************
* Name: esp_wifi_sta_mode
*
* Description:
* Set/Get Wi-Fi Station mode code.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_mode(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_auth
*
* Description:
* Set/Get station authentication mode params.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_auth(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_freq
*
* Description:
* Get station frequency.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_freq(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_bitrate
*
* Description:
* Get station default bit rate (Mbps).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_bitrate(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_get_txpower
*
* Description:
* Get station transmit power (dBm).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_txpower(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_get_channel_range
*
* Description:
* Get station range of channel parameters.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_channel(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_country
*
* Description:
* Configure country info.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_country(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_sta_rssi
*
* Description:
* Get Wi-Fi sensitivity (dBm).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_sta_rssi(struct iwreq *iwr, bool set);
#endif /* ESP_WLAN_HAS_STA */
#ifdef ESP_WLAN_HAS_SOFTAP
/****************************************************************************
* Name: esp_wifi_softap_start
*
* Description:
* Start Wi-Fi softAP.
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_start(void);
/****************************************************************************
* Name: esp_wifi_softap_stop
*
* Description:
* Stop Wi-Fi softAP.
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_stop(void);
/****************************************************************************
* Name: esp_wifi_softap_send_data
*
* Description:
* Use Wi-Fi softAP interface to send 802.3 frame
*
* Input Parameters:
* pbuf - Packet buffer pointer
* len - Packet length
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_send_data(void *pbuf, size_t len);
/****************************************************************************
* Name: esp_wifi_softap_password
*
* Description:
* Set/Get Wi-Fi SoftAP password
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_password(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_essid
*
* Description:
* Set/Get Wi-Fi SoftAP ESSID
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_essid(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_bssid
*
* Description:
* Set/Get Wi-Fi softAP BSSID
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_bssid(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_connect
*
* Description:
* Trigger Wi-Fi softAP accept connection action
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_connect(void);
/****************************************************************************
* Name: esp_wifi_softap_disconnect
*
* Description:
* Trigger Wi-Fi softAP drop connection action
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_disconnect(void);
/****************************************************************************
* Name: esp_wifi_softap_mode
*
* Description:
* Set/Get Wi-Fi SoftAP mode code.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_mode(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_auth
*
* Description:
* Set/Get authentication mode params.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_auth(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_freq
*
* Description:
* Set/Get SoftAP frequency.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_freq(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_get_bitrate
*
* Description:
* Get SoftAP default bit rate (Mbps).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_bitrate(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_txpower
*
* Description:
* Get SoftAP transmit power (dBm).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_txpower(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_channel
*
* Description:
* Get SoftAP range of channel parameters.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_channel(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_country
*
* Description:
* Configure country info.
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_country(struct iwreq *iwr, bool set);
/****************************************************************************
* Name: esp_wifi_softap_rssi
*
* Description:
* Get Wi-Fi sensitivity (dBm).
*
* Input Parameters:
* iwr - The argument of the ioctl cmd
* set - true: set data; false: get data
*
* Returned Value:
* OK on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
*
****************************************************************************/
int esp_wifi_softap_rssi(struct iwreq *iwr, bool set);
#endif /* ESP_WLAN_HAS_SOFTAP */
#ifdef __cplusplus
}
#endif
#undef EXTERN
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RISCV_SRC_ESP32C3_ESP_WIFI_ADAPTER_H */

View File

@ -28,12 +28,15 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)private_include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_event$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)include$(DELIM)esp_private
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)include$(DELIM)soc
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)private_include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)include$(DELIM)$(CHIP_SERIES)
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)$(CHIP_SERIES)
@ -42,6 +45,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)port$(DELIM)include$(DELIM)private
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)port$(DELIM)public_compat
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_timer$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_wifi$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)platform_port$(DELIM)include
@ -76,15 +80,21 @@ ARCHSCRIPT += $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)src$(DELIM)esp_efuse_api.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)src$(DELIM)esp_efuse_utility.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)esp_efuse_fields.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)esp_efuse_rtc_calib.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)esp_efuse_table.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)efuse$(DELIM)$(CHIP_SERIES)$(DELIM)esp_efuse_utility.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)src$(DELIM)esp_err_to_name.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)adc_share_hw_ctrl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)clk_ctrl_os.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)cpu.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)esp_clk.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)hw_random.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)mac_addr.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)periph_ctrl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)regi2c_ctrl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)sleep_modem.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)esp_clk_tree_common.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)adc2_init_cal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)esp_clk_tree.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)cpu_region_protect.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)rtc_clk.c
@ -94,9 +104,14 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)rtc_time.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)sar_periph_ctrl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)systimer.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)lib_printf.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)phy_init.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_systimer.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)esp_err.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)port$(DELIM)brownout.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)port$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)clk.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_system$(DELIM)port$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)system_internal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)adc_hal_common.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)brownout_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)efuse_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)gpio_hal.c

View File

@ -0,0 +1,73 @@
/****************************************************************************
* boards/risc-v/esp32c3/common/include/esp_board_wlan.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_WLAN_H
#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_WLAN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_ESPRESSIF_WIFI
/****************************************************************************
* Name: board_wlan_init
*
* Description:
* Configure the wireless subsystem.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_wlan_init(void);
#endif /* CONFIG_ESPRESSIF_WIFI */
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_WLAN_H */

View File

@ -18,6 +18,7 @@
*
****************************************************************************/
cache_set_idrom_mmu_size = Cache_Set_IDROM_MMU_Size;
cache_dbus_mmu_set = Cache_Dbus_MMU_Set;
cache_ibus_mmu_set = Cache_Ibus_MMU_Set;
cache_invalidate_icache_all = Cache_Invalidate_ICache_All;

View File

@ -59,6 +59,17 @@ SECTIONS
_image_drom_lma = LOADADDR(.flash.rodata);
_image_drom_size = LOADADDR(.flash.rodata) + SIZEOF(.flash.rodata) - _image_drom_lma;
.flash.appdesc : ALIGN(0x10)
{
_rodata_reserved_start = ABSOLUTE(.); /* This is a symbol marking the flash.rodata start, this can be used for mmu driver to maintain virtual address */
_rodata_start = ABSOLUTE(.);
/* Create an empty gap within this section. Thanks to this, the end of this
* section will match .flash.rodata's begin address. Thus, both sections
* will be merged when creating the final bin image. */
. = ALIGN(ALIGNOF(.flash.rodata));
} >default_rodata_seg
.flash.rodata :
{
_srodata = ABSOLUTE(.);
@ -115,6 +126,16 @@ SECTIONS
. = ALIGN(4);
} >drom0_0_seg AT>ROM
.flash.rodata_noload (NOLOAD) :
{
/*
This is a symbol marking the flash.rodata end, this can be used for mmu driver to maintain virtual address
We don't need to include the noload rodata in this section
*/
_rodata_reserved_end = ABSOLUTE(.);
. = ALIGN (4);
} > default_rodata_seg AT > ROM
.iram0.text :
{
_iram_start = ABSOLUTE(.);
@ -263,6 +284,8 @@ SECTIONS
.flash.text : ALIGN(0x0000FFFF)
{
_stext = .;
_instruction_reserved_start = ABSOLUTE(.); /* This is a symbol marking the flash.text start, this can be used for mmu driver to maintain virtual address */
_text_start = ABSOLUTE(.);
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
@ -271,6 +294,8 @@ SECTIONS
*(.gnu.version)
. = ALIGN(4);
_text_end = ABSOLUTE(.);
_instruction_reserved_end = ABSOLUTE(.); /* This is a symbol marking the flash.text end, this can be used for mmu driver to maintain virtual address */
_etext = .;
} >irom0_0_seg AT>ROM

View File

@ -47,6 +47,8 @@ SECTIONS
*libarch.a:*esp_clk_tree_common.*(.text .text.* .literal .literal.*)
*libarch.a:*clk_tree_hal.*(.text .text.* .literal .literal.*)
*libarch.a:*rtc_init.*(.text .text.* .literal .literal.*)
*libarch.a:*regi2c_ctrl.*(.text .text.* .literal .literal.*)
*libarch.a:*gpio_periph.*(.text .text.* .literal .literal.*)
*libarch.a:*rtc_clk.*(.text .text.* .literal .literal.*)
*libarch.a:*rtc_clk_init.*(.text .text.* .literal .literal.*)
*libarch.a:*rtc_sleep.*(.text .text.* .literal .literal.*)
@ -85,6 +87,7 @@ SECTIONS
*libarch.a:*esp_rom_spiflash.*(.text .text.* .literal .literal.*)
*libarch.a:*esp_efuse_fields.*(.text .text.* .literal .literal.*)
*libarch.a:*esp_efuse_api_key.*(.text .text.* .literal .literal.*)
*libarch.a:*efuse_hal.*(.text .text.* .literal .literal.*)
*libarch.a:*log.*(.text .text.* .literal .literal.*)
*libarch.a:*log_noos.*(.text .text.* .literal .literal.*)
*libarch.a:esp_spiflash.*(.literal .text .literal.* .text.*)
@ -92,6 +95,12 @@ SECTIONS
esp_head.*(.literal .text .literal.* .text.*)
esp_start.*(.literal .text .literal.* .text.*)
*(.wifi0iram.*)
*(.wifirxiram.*)
*(.wifislpiram.*)
*(.wifiorslpiram.*)
*(.wifislprxiram.*)
} >iram0_0_seg AT > ROM
/* This section is required to skip .iram0.text area because iram0_0_seg
@ -144,6 +153,8 @@ SECTIONS
*libarch.a:*esp_clk_tree_common.*(.rodata .rodata.*)
*libarch.a:*clk_tree_hal.*(.rodata .rodata.*)
*libarch.a:*rtc_init.*(.rodata .rodata.*)
*libarch.a:*regi2c_ctrl.*(.rodata .rodata.*)
*libarch.a:*gpio_periph.*(.rodata .rodata.*)
*libarch.a:*rtc_clk.*(.rodata .rodata.*)
*libarch.a:*rtc_clk_init.*(.rodata .rodata.*)
*libarch.a:*rtc_sleep.*(.rodata .rodata.*)
@ -182,6 +193,7 @@ SECTIONS
*libarch.a:*esp_rom_spiflash.*(.rodata .rodata.*)
*libarch.a:*esp_efuse_fields.*(.rodata .rodata.*)
*libarch.a:*esp_efuse_api_key.*(.rodata .rodata.*)
*libarch.a:*efuse_hal.*(.rodata .rodata.*)
*libarch.a:*log.*(.rodata .rodata.*)
*libarch.a:*log_noos.*(.rodata .rodata.*)
*libarch.a:esp_spiflash.*(.rodata .rodata.*)
@ -228,12 +240,17 @@ SECTIONS
.flash.text : ALIGN(0xFFFF)
{
_stext = .;
_instruction_reserved_start = ABSOLUTE(.); /* This is a symbol marking the flash.text start, this can be used for mmu driver to maintain virtual address */
_text_start = ABSOLUTE(.);
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */
*(.fini.literal)
*(.fini)
*(.gnu.version)
_text_end = ABSOLUTE(.);
_instruction_reserved_end = ABSOLUTE(.); /* This is a symbol marking the flash.text end, this can be used for mmu driver to maintain virtual address */
_etext = .;
/* Similar to _iram_start, this symbol goes here so it is
@ -265,6 +282,17 @@ SECTIONS
_image_drom_lma = LOADADDR(.flash.rodata);
_image_drom_size = LOADADDR(.flash.rodata) + SIZEOF(.flash.rodata) - _image_drom_lma;
.flash.appdesc : ALIGN(0x10)
{
_rodata_reserved_start = ABSOLUTE(.); /* This is a symbol marking the flash.rodata start, this can be used for mmu driver to maintain virtual address */
_rodata_start = ABSOLUTE(.);
/* Create an empty gap within this section. Thanks to this, the end of this
* section will match .flash.rodata's begin address. Thus, both sections
* will be merged when creating the final bin image. */
. = ALIGN(ALIGNOF(.flash.rodata));
} >default_rodata_seg
.flash.rodata : ALIGN(0xFFFF)
{
_srodata = ABSOLUTE(.);
@ -273,6 +301,11 @@ SECTIONS
*(.rodata)
*(.rodata.*)
*(.rodata_wlog_verbose.*)
*(.rodata_wlog_debug.*)
*(.rodata_wlog_info.*)
*(.rodata_wlog_warning.*)
*(.rodata_wlog_error.*)
*(.srodata.*)
@ -324,6 +357,16 @@ SECTIONS
. = ALIGN(4);
} >default_rodata_seg AT > ROM
.flash.rodata_noload (NOLOAD) :
{
/*
This is a symbol marking the flash.rodata end, this can be used for mmu driver to maintain virtual address
We don't need to include the noload rodata in this section
*/
_rodata_reserved_end = ABSOLUTE(.);
. = ALIGN (4);
} > default_rodata_seg AT > ROM
/* Marks the end of IRAM code segment */
.iram0.text_end (NOLOAD) :

View File

@ -36,6 +36,10 @@ ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
CSRCS += esp_board_twai.c
endif
ifeq ($(CONFIG_ESPRESSIF_WIFI),y)
CSRCS += esp_board_wlan.c
endif
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src

View File

@ -0,0 +1,81 @@
/****************************************************************************
* boards/risc-v/esp32c3/common/src/esp_board_wlan.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <syslog.h>
#include <debug.h>
#include <nuttx/wireless/wireless.h>
#include "espressif/esp_wlan.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_wlan_init
*
* Description:
* Configure the wireless subsystem.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
int board_wlan_init(void)
{
int ret = OK;
#ifdef ESP_WLAN_HAS_STA
ret = esp_wlan_sta_initialize();
if (ret)
{
wlerr("ERROR: Failed to initialize Wi-Fi station\n");
return ret;
}
#endif /* ESP_WLAN_HAS_STA */
#ifdef ESP_WLAN_HAS_SOFTAP
ret = esp_wlan_softap_initialize();
if (ret)
{
wlerr("ERROR: Failed to initialize Wi-Fi softAP\n");
return ret;
}
#endif /* ESP_WLAN_HAS_SOFTAP */
return ret;
}

View File

@ -0,0 +1,82 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c3-generic"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C3_GENERIC=y
CONFIG_ARCH_CHIP="esp32c3"
CONFIG_ARCH_CHIP_ESP32C3_GENERIC=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESPRESSIF_SPIFLASH=y
CONFIG_ESPRESSIF_SPIFLASH_SPIFFS=y
CONFIG_ESPRESSIF_WIFI=y
CONFIG_ESPRESSIF_WIFI_STATION_SOFTAP=y
CONFIG_EXAMPLES_DHCPD=y
CONFIG_EXAMPLES_RANDOM=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETDEV_WORK_THREAD=y
CONFIG_NETUTILS_CJSON=y
CONFIG_NETUTILS_DHCPD=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIG_DEFAULT=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_INITCONF=y

View File

@ -0,0 +1,78 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NDEBUG is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c3-generic"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C3_GENERIC=y
CONFIG_ARCH_CHIP="esp32c3"
CONFIG_ARCH_CHIP_ESP32C3_GENERIC=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESPRESSIF_SPIFLASH=y
CONFIG_ESPRESSIF_SPIFLASH_SPIFFS=y
CONFIG_ESPRESSIF_WIFI=y
CONFIG_EXAMPLES_RANDOM=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETDEV_WIRELESS_IOCTL=y
CONFIG_NETDEV_WORK_THREAD=y
CONFIG_NETUTILS_CJSON=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIG_DEFAULT=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TLS_TASK_NELEM=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_WAPI=y
CONFIG_WIRELESS_WAPI_CMDTOOL=y
CONFIG_WIRELESS_WAPI_INITCONF=y

View File

@ -65,6 +65,14 @@
# include "esp_board_rmt.h"
#endif
#ifdef CONFIG_ESPRESSIF_WIFI_BT_COEXIST
# include "esp_coexist_internal.h"
#endif
#ifdef CONFIG_ESPRESSIF_WIFI
# include "esp_board_wlan.h"
#endif
#include "esp32c3-generic.h"
/****************************************************************************
@ -152,6 +160,20 @@ int esp_bringup(void)
}
#endif
#ifdef CONFIG_ESPRESSIF_WIFI_BT_COEXIST
esp_coex_adapter_register(&g_coex_adapter_funcs);
coex_pre_init();
#endif
#ifdef CONFIG_ESPRESSIF_WIFI
ret = board_wlan_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize wireless subsystem=%d\n",
ret);
}
#endif
#ifdef CONFIG_ONESHOT
ret = esp_oneshot_initialize();
if (ret < 0)