mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
Merge branch 'support/ieee802154_lib_CI_rules' into 'master'
ieee802154: add 154 lib CI initialization See merge request espressif/esp-idf!20560
This commit is contained in:
@@ -163,6 +163,14 @@ build_pytest_examples_esp32h2:
|
|||||||
IDF_TARGET: esp32h2
|
IDF_TARGET: esp32h2
|
||||||
TEST_DIR: examples
|
TEST_DIR: examples
|
||||||
|
|
||||||
|
build_pytest_components_esp32h2:
|
||||||
|
extends:
|
||||||
|
- .build_pytest_template
|
||||||
|
- .rules:build:component_ut-esp32h2
|
||||||
|
variables:
|
||||||
|
IDF_TARGET: esp32h2
|
||||||
|
TEST_DIR: components
|
||||||
|
|
||||||
build_pytest_components_esp32:
|
build_pytest_components_esp32:
|
||||||
extends:
|
extends:
|
||||||
- .build_pytest_template
|
- .build_pytest_template
|
||||||
|
@@ -137,6 +137,7 @@ build:integration_test:
|
|||||||
- usb # USB Device & Host tests
|
- usb # USB Device & Host tests
|
||||||
- spi_multi # UT_C2_SPI_DUAL
|
- spi_multi # UT_C2_SPI_DUAL
|
||||||
- adc # component_ut_pytest_esp32x_adc
|
- adc # component_ut_pytest_esp32x_adc
|
||||||
|
- i154
|
||||||
patterns:
|
patterns:
|
||||||
- "{0}-{1}-{2}"
|
- "{0}-{1}-{2}"
|
||||||
- "{0}-{2}"
|
- "{0}-{2}"
|
||||||
|
@@ -542,6 +542,8 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:component_ut-esp32:
|
.rules:build:component_ut-esp32:
|
||||||
rules:
|
rules:
|
||||||
@@ -565,6 +567,8 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:component_ut-esp32c2:
|
.rules:build:component_ut-esp32c2:
|
||||||
rules:
|
rules:
|
||||||
@@ -584,6 +588,8 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:component_ut-esp32c3:
|
.rules:build:component_ut-esp32c3:
|
||||||
rules:
|
rules:
|
||||||
@@ -606,6 +612,32 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
|
.rules:build:component_ut-esp32h2:
|
||||||
|
rules:
|
||||||
|
- <<: *if-revert-branch
|
||||||
|
when: never
|
||||||
|
- <<: *if-protected
|
||||||
|
- <<: *if-label-build
|
||||||
|
- <<: *if-label-component_ut
|
||||||
|
- <<: *if-label-component_ut_esp32h2
|
||||||
|
- <<: *if-label-target_test
|
||||||
|
- <<: *if-label-unit_test
|
||||||
|
- <<: *if-label-unit_test_esp32h2
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-build_components
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-build_system
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-component_ut
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-component_ut-adc
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:component_ut-esp32s2:
|
.rules:build:component_ut-esp32s2:
|
||||||
rules:
|
rules:
|
||||||
@@ -628,6 +660,8 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:component_ut-esp32s3:
|
.rules:build:component_ut-esp32s3:
|
||||||
rules:
|
rules:
|
||||||
@@ -650,6 +684,8 @@
|
|||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test:
|
.rules:build:custom_test:
|
||||||
rules:
|
rules:
|
||||||
@@ -674,6 +710,8 @@
|
|||||||
changes: *patterns-custom_test
|
changes: *patterns-custom_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test-esp32:
|
.rules:build:custom_test-esp32:
|
||||||
rules:
|
rules:
|
||||||
@@ -693,6 +731,8 @@
|
|||||||
changes: *patterns-custom_test
|
changes: *patterns-custom_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test-esp32c2:
|
.rules:build:custom_test-esp32c2:
|
||||||
rules:
|
rules:
|
||||||
@@ -709,6 +749,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test-esp32c3:
|
.rules:build:custom_test-esp32c3:
|
||||||
rules:
|
rules:
|
||||||
@@ -727,6 +769,8 @@
|
|||||||
changes: *patterns-custom_test
|
changes: *patterns-custom_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test-esp32s2:
|
.rules:build:custom_test-esp32s2:
|
||||||
rules:
|
rules:
|
||||||
@@ -745,6 +789,8 @@
|
|||||||
changes: *patterns-custom_test
|
changes: *patterns-custom_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:custom_test-esp32s3:
|
.rules:build:custom_test-esp32s3:
|
||||||
rules:
|
rules:
|
||||||
@@ -763,6 +809,8 @@
|
|||||||
changes: *patterns-custom_test
|
changes: *patterns-custom_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:docker:
|
.rules:build:docker:
|
||||||
rules:
|
rules:
|
||||||
@@ -846,6 +894,8 @@
|
|||||||
changes: *patterns-example_test-usb
|
changes: *patterns-example_test-usb
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-example_test-wifi
|
changes: *patterns-example_test-wifi
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:example_test-esp32c2:
|
.rules:build:example_test-esp32c2:
|
||||||
rules:
|
rules:
|
||||||
@@ -870,6 +920,8 @@
|
|||||||
changes: *patterns-example_test-usb
|
changes: *patterns-example_test-usb
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-example_test-wifi
|
changes: *patterns-example_test-wifi
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:example_test-esp32c3:
|
.rules:build:example_test-esp32c3:
|
||||||
rules:
|
rules:
|
||||||
@@ -899,6 +951,8 @@
|
|||||||
changes: *patterns-example_test-usb
|
changes: *patterns-example_test-usb
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-example_test-wifi
|
changes: *patterns-example_test-wifi
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:example_test-esp32h2:
|
.rules:build:example_test-esp32h2:
|
||||||
rules:
|
rules:
|
||||||
@@ -957,6 +1011,8 @@
|
|||||||
changes: *patterns-example_test-usb
|
changes: *patterns-example_test-usb
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-example_test-wifi
|
changes: *patterns-example_test-wifi
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:build:example_test-esp32s3:
|
.rules:build:example_test-esp32s3:
|
||||||
rules:
|
rules:
|
||||||
@@ -1112,6 +1168,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test
|
changes: *patterns-unit_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1135,6 +1193,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test
|
changes: *patterns-unit_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1157,6 +1217,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test-sdio
|
changes: *patterns-unit_test-sdio
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1177,6 +1239,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test
|
changes: *patterns-unit_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1199,6 +1263,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test
|
changes: *patterns-unit_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1221,6 +1287,8 @@
|
|||||||
changes: *patterns-build_system
|
changes: *patterns-build_system
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-downloadable-tools
|
changes: *patterns-downloadable-tools
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test
|
changes: *patterns-unit_test
|
||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
@@ -1339,6 +1407,19 @@
|
|||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-component_ut-adc
|
changes: *patterns-component_ut-adc
|
||||||
|
|
||||||
|
.rules:test:component_ut-esp32h2-i154:
|
||||||
|
rules:
|
||||||
|
- <<: *if-revert-branch
|
||||||
|
when: never
|
||||||
|
- <<: *if-protected
|
||||||
|
- <<: *if-label-build-only
|
||||||
|
when: never
|
||||||
|
- <<: *if-label-component_ut
|
||||||
|
- <<: *if-label-component_ut_esp32h2
|
||||||
|
- <<: *if-label-target_test
|
||||||
|
- <<: *if-dev-push
|
||||||
|
changes: *patterns-target_test-i154
|
||||||
|
|
||||||
.rules:test:component_ut-esp32s2:
|
.rules:test:component_ut-esp32s2:
|
||||||
rules:
|
rules:
|
||||||
- <<: *if-revert-branch
|
- <<: *if-revert-branch
|
||||||
|
@@ -516,6 +516,14 @@ component_ut_pytest_esp32c3_sdspi:
|
|||||||
- build_pytest_components_esp32c3
|
- build_pytest_components_esp32c3
|
||||||
tags: [ esp32c3, sdcard_spimode ]
|
tags: [ esp32c3, sdcard_spimode ]
|
||||||
|
|
||||||
|
component_ut_pytest_esp32h2_i154:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
- .rules:test:component_ut-esp32h2-i154
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32h2
|
||||||
|
tags: [ esp32h2, ieee802154 ]
|
||||||
|
|
||||||
example_test_pytest_openthread_br:
|
example_test_pytest_openthread_br:
|
||||||
extends:
|
extends:
|
||||||
- .pytest_examples_dir_template
|
- .pytest_examples_dir_template
|
||||||
|
6
components/ieee802154/.build-test-rules.yml
Normal file
6
components/ieee802154/.build-test-rules.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||||
|
|
||||||
|
components/ieee802154/test_apps/test_ieee802154:
|
||||||
|
enable:
|
||||||
|
- if: IDF_TARGET == "esp32h2"
|
||||||
|
reason: only test on esp32h2
|
@@ -0,0 +1,5 @@
|
|||||||
|
# This is the project CMakeLists.txt file for the test subproject
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(test_ieee802154)
|
@@ -0,0 +1,3 @@
|
|||||||
|
| Supported Targets | ESP32-H2 |
|
||||||
|
| ----------------- | -------- |
|
||||||
|
|
@@ -0,0 +1,11 @@
|
|||||||
|
set(srcs "test_app_main.c"
|
||||||
|
"src/ieee802154_cmd.c")
|
||||||
|
|
||||||
|
set(include "."
|
||||||
|
"include")
|
||||||
|
|
||||||
|
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
|
||||||
|
# the component can be registered as WHOLE_ARCHIVE
|
||||||
|
idf_component_register(SRCS ${srcs}
|
||||||
|
INCLUDE_DIRS include
|
||||||
|
WHOLE_ARCHIVE)
|
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
void register_ieee802154_cmd(void);
|
@@ -0,0 +1,162 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_ieee802154.h"
|
||||||
|
#include "esp_console.h"
|
||||||
|
#include "linenoise/linenoise.h"
|
||||||
|
#include "argtable3/argtable3.h"
|
||||||
|
#include "ieee802154_cmd.h"
|
||||||
|
#include "esp_phy_init.h"
|
||||||
|
|
||||||
|
static uint8_t s_tx_frame[131] = { 0 };
|
||||||
|
static const char* TAG = "i154test";
|
||||||
|
|
||||||
|
static void register_rx(void);
|
||||||
|
static void register_tx(void);
|
||||||
|
|
||||||
|
void register_ieee802154_cmd(void)
|
||||||
|
{
|
||||||
|
register_rx();
|
||||||
|
register_tx();
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
struct arg_int *length;
|
||||||
|
struct arg_lit *cca_enable;
|
||||||
|
struct arg_int *frame;
|
||||||
|
struct arg_int *offset;
|
||||||
|
struct arg_end *end;
|
||||||
|
} tx_args;
|
||||||
|
|
||||||
|
static int process_tx(int argc, char **argv)
|
||||||
|
{
|
||||||
|
uint8_t tx_frame[128] = { 0 };
|
||||||
|
uint8_t offset = 0;
|
||||||
|
bool cca = false;
|
||||||
|
int nerrors = arg_parse(argc, argv, (void **) &tx_args);
|
||||||
|
if (nerrors != 0) {
|
||||||
|
arg_print_errors(stderr, tx_args.end, argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
memset(tx_frame, 0, sizeof(tx_frame));
|
||||||
|
|
||||||
|
if (tx_args.offset->count && (tx_args.offset->ival[0] >= 0 && tx_args.offset->ival[0] <= 3)) {
|
||||||
|
offset = tx_args.offset->ival[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tx_args.length->count) {
|
||||||
|
tx_frame[0] = tx_args.length->ival[0];
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < tx_frame[0]; i++) {
|
||||||
|
tx_frame[i + 1] = i;
|
||||||
|
}
|
||||||
|
} else if (tx_args.frame->count) {
|
||||||
|
tx_frame[0] = tx_args.frame->count;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < tx_frame[0]; i++) {
|
||||||
|
tx_frame[i + 1] = tx_args.frame->ival[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tx_args.cca_enable->count) {
|
||||||
|
cca = true;
|
||||||
|
}
|
||||||
|
memcpy(s_tx_frame+offset, tx_frame, sizeof(tx_frame));
|
||||||
|
esp_ieee802154_transmit(s_tx_frame, cca);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void register_tx(void)
|
||||||
|
{
|
||||||
|
tx_args.length =
|
||||||
|
arg_int0("l", "length", "<len>", "frame length");
|
||||||
|
tx_args.cca_enable =
|
||||||
|
arg_lit0("C", "cca_enable", "set cca trigging tx mode true");
|
||||||
|
tx_args.frame =
|
||||||
|
arg_intn(NULL, NULL, "<n>", 0, 127, "transmit raw frame");
|
||||||
|
tx_args.offset =
|
||||||
|
arg_int0("o", "offset", "<offset>", "tx buffer offset");
|
||||||
|
tx_args.end = arg_end(5);
|
||||||
|
|
||||||
|
const esp_console_cmd_t cmd = {
|
||||||
|
.command = "tx",
|
||||||
|
.help = "transmit IEEE 802154 MAC frame",
|
||||||
|
.hint = NULL,
|
||||||
|
.func = &process_tx,
|
||||||
|
.argtable = &tx_args
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
struct arg_int *receive;
|
||||||
|
struct arg_end *end;
|
||||||
|
} rx_args;
|
||||||
|
|
||||||
|
static int process_rx(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int nerrors = arg_parse(argc, argv, (void **) &rx_args);
|
||||||
|
if (nerrors != 0) {
|
||||||
|
arg_print_errors(stderr, rx_args.end, argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_args.receive->count == 1) {
|
||||||
|
if (rx_args.receive->ival[0] == 0) {
|
||||||
|
esp_ieee802154_sleep();
|
||||||
|
ESP_LOGI(TAG, "radio exit receive mode");
|
||||||
|
} else if (rx_args.receive->ival[0] == 1) { // receive, non-blocking
|
||||||
|
ESP_LOGI(TAG, "RX Start");
|
||||||
|
esp_ieee802154_receive();
|
||||||
|
esp_ieee802154_set_rx_when_idle(true);
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "no valid arguments");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "no valid arguments");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void register_rx(void)
|
||||||
|
{
|
||||||
|
rx_args.receive =
|
||||||
|
arg_int0("r", "receive", "<mode>", "configure the radio receive mode, 0: disable; 1: enable");
|
||||||
|
rx_args.end = arg_end(2);
|
||||||
|
|
||||||
|
const esp_console_cmd_t cmd = {
|
||||||
|
.command = "rx",
|
||||||
|
.help = "enable/disable the receive mode",
|
||||||
|
.hint = NULL,
|
||||||
|
.func = &process_rx,
|
||||||
|
.argtable = &rx_args
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||||
|
}
|
||||||
|
|
||||||
|
void esp_ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info)
|
||||||
|
{
|
||||||
|
ESP_EARLY_LOGI(TAG, "Tx Done %d bytes", frame[0]);
|
||||||
|
for(uint8_t idx = 1; idx < frame[0]; idx+=8) {
|
||||||
|
ESP_EARLY_LOGI(TAG, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
frame[idx], frame[idx+1], frame[idx+2], frame[idx+3],
|
||||||
|
frame[idx+4], frame[idx+5], frame[idx+6], frame[idx+7]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void esp_ieee802154_receive_done(uint8_t *frame, esp_ieee802154_frame_info_t *frame_info)
|
||||||
|
{
|
||||||
|
ESP_EARLY_LOGI(TAG, "Rx Done %d bytes", frame[0]);
|
||||||
|
for(uint8_t idx = 1; idx < frame[0]; idx+=8) {
|
||||||
|
ESP_EARLY_LOGI(TAG, "%02x %02x %02x %02x %02x %02x %02x %02x",
|
||||||
|
frame[idx], frame[idx+1], frame[idx+2], frame[idx+3],
|
||||||
|
frame[idx+4], frame[idx+5], frame[idx+6], frame[idx+7]);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_console.h"
|
||||||
|
#include "esp_vfs_dev.h"
|
||||||
|
#include "esp_vfs_fat.h"
|
||||||
|
#include "nvs.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
#include "esp_ieee802154.h"
|
||||||
|
#include "esp_phy_init.h"
|
||||||
|
#include "ieee802154_cmd.h"
|
||||||
|
|
||||||
|
#define PROMPT_STR "ieee802154"
|
||||||
|
|
||||||
|
static void initialize_nvs(void)
|
||||||
|
{
|
||||||
|
esp_err_t err = nvs_flash_init();
|
||||||
|
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||||
|
ESP_ERROR_CHECK( nvs_flash_erase() );
|
||||||
|
err = nvs_flash_init();
|
||||||
|
}
|
||||||
|
ESP_ERROR_CHECK(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
esp_ieee802154_enable();
|
||||||
|
esp_phy_enable();
|
||||||
|
esp_console_repl_t *repl = NULL;
|
||||||
|
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
|
||||||
|
/* Prompt to be printed before each line.
|
||||||
|
* This can be customized, made dynamic, etc.
|
||||||
|
*/
|
||||||
|
repl_config.prompt = PROMPT_STR ">";
|
||||||
|
repl_config.max_cmdline_length = 256;
|
||||||
|
|
||||||
|
initialize_nvs();
|
||||||
|
|
||||||
|
/* Register commands */
|
||||||
|
esp_console_register_help_command();
|
||||||
|
register_ieee802154_cmd();
|
||||||
|
|
||||||
|
esp_console_dev_uart_config_t hw_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
|
||||||
|
ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl));
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_console_start_repl(repl));
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytest_embedded_idf.dut import IdfDut
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.esp32h2
|
||||||
|
@pytest.mark.ieee802154
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'count, config, beta_target', [
|
||||||
|
(2, 'release', 'esp32h2beta2'),
|
||||||
|
], indirect=True
|
||||||
|
)
|
||||||
|
def test_based_txrx(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||||
|
transmit = dut[0]
|
||||||
|
receive = dut[1]
|
||||||
|
receive.expect('ieee802154>', timeout=60)
|
||||||
|
receive.write('rx -r 1')
|
||||||
|
receive.expect('RX Start', timeout=60)
|
||||||
|
transmit.expect('ieee802154>', timeout=60)
|
||||||
|
transmit.write('tx -l 10')
|
||||||
|
transmit.expect('Tx Done 10 bytes', timeout=60)
|
||||||
|
transmit.expect('00 01 02 03 04 05 06 07', timeout=60)
|
||||||
|
transmit.expect('08 09 00 00 00 00 00 00', timeout=60)
|
||||||
|
receive.expect('Rx Done 10 bytes', timeout=60)
|
||||||
|
receive.expect('00 01 02 03 04 05 06 07', timeout=60)
|
@@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
@@ -0,0 +1,5 @@
|
|||||||
|
# This file was generated using idf.py save-defconfig. It can be edited manually.
|
||||||
|
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
|
||||||
|
#
|
||||||
|
CONFIG_IDF_TARGET="esp32h2"
|
||||||
|
CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2=y
|
@@ -65,6 +65,7 @@ markers =
|
|||||||
adc: ADC related tests should run on adc runners
|
adc: ADC related tests should run on adc runners
|
||||||
|
|
||||||
# multi-dut markers
|
# multi-dut markers
|
||||||
|
ieee082154: ieee082154 related tests should run on ieee082154 runners.
|
||||||
i154_multi_dut: tests should be used for i154, such as openthread.
|
i154_multi_dut: tests should be used for i154, such as openthread.
|
||||||
wifi_two_dut: tests should be run on runners which has two wifi duts connected.
|
wifi_two_dut: tests should be run on runners which has two wifi duts connected.
|
||||||
generic_multi_device: generic multiple devices whose corresponding gpio pins are connected to each other.
|
generic_multi_device: generic multiple devices whose corresponding gpio pins are connected to each other.
|
||||||
|
Reference in New Issue
Block a user