arch/xtensa/src/common/espressif: Introduce espnow

Move espnow:
 arch/xtensa/src/esp32 -> arch/xtensa/src/common/espressif

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
This commit is contained in:
Laczen JMS 2025-04-03 10:10:24 +02:00 committed by Lup Yuen Lee
parent 58ed9934c2
commit 58463d9484
4 changed files with 1761 additions and 0 deletions

View file

@ -754,6 +754,46 @@ config ESPRESSIF_WIFI_WLAN_BUFFER_OPTIMIZATION
endmenu # ESPRESSIF_WIFI
config ESPRESSIF_ESPNOW_PKTRADIO
bool "ESPNOW pktradio support"
depends on ESPRESSIF_WLAN
depends on WIRELESS_PKTRADIO
default n
---help---
Enable using espnow for pktradio, the addressing of nodes is
based on a PANID and PANADDRESS. Node communication is limited
to nodes with the same PANID. There is a direct relation
between the PANADDRESS and the ipv6 address of a node:
PANADDRESS: 0xaabb
ipv6 address: AAAA 0000 0000 0000 0000 00ff fe00 bbaa
For local link AAAA is fe80.
if ESPRESSIF_ESPNOW_PKTRADIO
config ESPRESSIF_ESPNOW_PKTRADIO_FRAMELEN
int "ESPNOW pktradio frame length"
range 127 250
default 196
---help---
Frame size used for espnow transmitions. Ensure that this is
set equal for all nodes.
config ESPRESSIF_ESPNOW_PKTRADIO_PANID
hex "ESPNOW pktradio node panid"
range 0x0 0xffff
default 0x0
---help---
PANID for espnow pktradio.
config ESPRESSIF_ESPNOW_PKTRADIO_PANADDR
hex "ESPNOW pktradio node address"
range 0x0 0xffff
default 0xfffe
---help---
PANADDRESS for espnow pktradio.
endif #ESPRESSIF_ESPNOW_PKTRADIO
config ESP_PHY_IRQSTATE_FLAGS_NUMBER
int "Number of IRQ status lists for PHY initialization"
default 3

View file

@ -78,6 +78,10 @@ CHIP_CSRCS += esp_wifi_utils.c
ifeq ($(CONFIG_ESPRESSIF_WLAN),y)
CHIP_CSRCS += esp_wlan.c
endif
ifeq ($(CONFIG_ESPRESSIF_ESPNOW_PKTRADIO), y)
CHIP_CSRCS += esp_espnow_pktradio.c
EXTRA_LIBS += -lespnow
endif
endif
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,77 @@
/****************************************************************************
* arch/xtensa/src/common/espressif/esp_espnow_pktradio.h
*
* SPDX-License-Identifier: Apache-2.0
*
* 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_XTENSA_SRC_COMMON_ESPRESSIF_ESP_ESPNOW_PKTRADIO_H
#define __ARCH_XTENSA_SRC_COMMON_ESPRESSIF_ESP_ESPNOW_PKTRADIO_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
#ifdef CONFIG_ESPRESSIF_ESPNOW_PKTRADIO
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: pktradio_espnow
*
* Description:
* Initialize and register the 6LoWPAN over espnow MAC network driver.
*
* Input Parameters:
* None
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
int pktradio_espnow(void);
#endif /* CONFIG_ESPRESSIF_ESPNOW_PKTRADIO */
#ifdef __cplusplus
}
#endif
#undef EXTERN
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_XTENSA_SRC_COMMON_ESPRESSIF_ESP_ESPNOW_PKTRADIO_H */