From 7268f0a60a8d1c019ab8999401ba6ae66a477b0d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 8 Sep 2016 20:02:26 +0800 Subject: [PATCH 001/179] components/log: add API header for logging library TW6703 --- components/log/include/esp_log.h | 120 +++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 components/log/include/esp_log.h diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h new file mode 100644 index 0000000000..e8ecf875b3 --- /dev/null +++ b/components/log/include/esp_log.h @@ -0,0 +1,120 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __ESP_LOG_H__ +#define __ESP_LOG_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Logging library + * + * In each C file which uses logging functionality, define TAG variable like this: + * + * static const char* TAG = "MyModule"; + * + * then use one of logging macros to produce output, e.g: + * + * ESP_LOGW(TAG, "Baud rate error %.1f%%. Requested: %d baud, actual: %d baud", error * 100, baud_req, baud_real); + * + * Log filtering happens both at compile time and at runtime. + * + * At compile time, filtering is done using CONFIG_ESP_LOG_LEVEL macro, set via menuconfig. + * All logging statments for levels higher than CONFIG_ESP_LOG_LEVEL will be removed by the preprocessor. + * + * At run time, all logs below CONFIG_ESP_LOG_LEVEL are enabled by default. + * esp_log_set function may be used to set logging level per tag. + * + * esp_log_set("*", ESP_LOG_ERROR); // set all components to ERROR level + * esp_log_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack + * esp_log_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client + * + * + */ + + +typedef enum { + ESP_LOG_NONE, + ESP_LOG_ERROR, + ESP_LOG_WARN, + ESP_LOG_INFO, + ESP_LOG_DEBUG, + ESP_LOG_VERBOSE +} esp_log_level_t; + + +/** + * @brief Set log level for given tag + * + * If logging for given component has already been enabled, changes previous setting. + * + * @param tag Tag of the log entries to enable. Must be a non-NULL zero terminated string. + * Value "*" means that all tags are affected. + * + * @param level Selects log level to enable. Only logs at this and lower levels will be shown. + */ +void esp_log_set(const char* tag, esp_log_level_t level); + +/** + * @brief Write message into the log + * + * This function is not intended to be used directly. Instead, use one of + * ESP_LOGE, ESP_LOGW, ESP_LOGI, ESP_LOGD, ESP_LOGV macros. + */ +void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4))); +#ifndef CONFIG_ESP_LOG_LEVEL +#define CONFIG_ESP_LOG_LEVEL ESP_LOG_NONE +#endif + +#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_ERROR) +#define ESP_LOGE( tag, format, ... ) esp_log_write(ESP_LOG_ERROR, tag, format, ##__VA_ARGS__) +#else +#define ESP_LOGE( tag, format, ... ) +#endif + +#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_WARN) +#define ESP_LOGW( tag, format, ... ) esp_log_write(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) +#else +#define ESP_LOGW( tag, format, ... ) +#endif + +#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_INFO) +#define ESP_LOGI( tag, format, ... ) esp_log_write(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) +#else +#define ESP_LOGI( tag, format, ... ) +#endif + + +#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_DEBUG) +#define ESP_LOGD( tag, format, ... ) esp_log_write(ESP_LOG_DEBUG, tag, format, ##__VA_ARGS__) +#else +#define ESP_LOGD( tag, format, ... ) +#endif + +#if (CONFIG_ESP_LOG_VERBOSE < ESP_LOG_ERROR) +#define ESP_LOGV( tag, format, ... ) esp_log_write(ESP_LOG_VERBOSE, tag, format, ##__VA_ARGS__) +#else +#define ESP_LOGV( tag, format, ... ) +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* __ESP_LOG_H__ */ From d7f7c36af07e46db03efb312873ee4f3ac1deaac Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Sep 2016 21:24:57 +0800 Subject: [PATCH 002/179] gitlab-ci: fix setting GitHub deploy key - don't run default before_script before push_master_to_github job - replace echo >> with echo > to avoid mistakes in the future --- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96006f8c8c..8ca472d084 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ before_script: # add gitlab ssh key - mkdir -p ~/.ssh - chmod 700 ~/.ssh - - echo -n $GITLAB_KEY >> ~/.ssh/id_rsa_base64 + - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config @@ -125,8 +125,9 @@ sanity_test: - CONFIG_FILE=sanity_test.yml - push_master_to_github: + before_script: + - echo "Not setting up GitLab key, not fetching submodules" stage: deploy only: - master @@ -139,7 +140,7 @@ push_master_to_github: script: - mkdir -p ~/.ssh - chmod 700 ~/.ssh - - echo -n $GH_PUSH_KEY >> ~/.ssh/id_rsa_base64 + - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config From 5ab769516d406c30928d2306490bf9b1636a6960 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Sep 2016 18:10:58 +0800 Subject: [PATCH 003/179] components/esp32: add CPU frequency selection in menuconfig Note that with WiFi stack enabled, system_init will reset frequency to 240MHz. To make this setting useful, esp32-wifi-libs submodule needs to be updated. --- components/esp32/Kconfig | 20 ++++++ components/esp32/cpu_freq.c | 68 +++++++++++++++++++ components/esp32/cpu_start.c | 3 + components/esp32/include/soc/cpu.h | 10 +++ .../include/freertos/FreeRTOSConfig.h | 2 +- 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 components/esp32/cpu_freq.c diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 36c6f7af8e..0ad32756e8 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -1,5 +1,25 @@ menu "ESP32-specific config" +choice ESP32_DEFAULT_CPU_FREQ_MHZ + prompt "CPU frequency" + default ESP32_DEFAULT_CPU_FREQ_240 + help + CPU frequency to be set on application startup. + +config ESP32_DEFAULT_CPU_FREQ_80 + bool "80 MHz" +config ESP32_DEFAULT_CPU_FREQ_160 + bool "160 MHz" +config ESP32_DEFAULT_CPU_FREQ_240 + bool "240 MHz" +endchoice + +config ESP32_DEFAULT_CPU_FREQ_MHZ + int + default 80 if ESP32_DEFAULT_CPU_FREQ_80 + default 160 if ESP32_DEFAULT_CPU_FREQ_160 + default 240 if ESP32_DEFAULT_CPU_FREQ_240 + config WIFI_ENABLED bool "Enable low-level WiFi stack" default "y" diff --git a/components/esp32/cpu_freq.c b/components/esp32/cpu_freq.c new file mode 100644 index 0000000000..c4bca44f0e --- /dev/null +++ b/components/esp32/cpu_freq.c @@ -0,0 +1,68 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include +#include "rom/ets_sys.h" +#include "sdkconfig.h" + +typedef enum{ + XTAL_40M = 40, + XTAL_26M = 26, + XTAL_24M = 24, + XTAL_AUTO = 0 +} xtal_freq_t; + +typedef enum{ + CPU_80M = 1, + CPU_160M = 2, + CPU_240M = 3, +} cpu_freq_t; + +extern void phy_get_romfunc_addr(); + +// TODO: these functions need to be moved from librtc to ESP-IDF +extern void rtc_init_lite(); +extern void rtc_set_cpu_freq(xtal_freq_t xtal_freq, cpu_freq_t cpu_freq); + +/* + * This function is not exposed as an API at this point, + * because FreeRTOS doesn't yet support dynamic changing of + * CPU frequency. Also we need to implement hooks for + * components which want to be notified of CPU frequency + * changes. + */ +void esp_set_cpu_freq() +{ + uint32_t freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; + phy_get_romfunc_addr(); + rtc_init_lite(); + cpu_freq_t freq = CPU_80M; + switch(freq_mhz) { + case 240: + freq = CPU_240M; + break; + case 160: + freq = CPU_160M; + break; + default: + freq_mhz = 80; + /* no break */ + case 80: + freq = CPU_80M; + break; + } + rtc_set_cpu_freq(XTAL_AUTO, freq); + ets_update_cpu_frequency(freq_mhz); +} + diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index d895e908eb..aebad03d41 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -22,6 +22,7 @@ #include "soc/dport_reg.h" #include "soc/io_mux_reg.h" +#include "soc/cpu.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -201,6 +202,8 @@ static void do_global_ctors(void) { extern esp_err_t app_main(void *ctx); void user_start_cpu0(void) { + esp_set_cpu_freq(); // set CPU frequency configured in menuconfig + uart_div_modify(0, (80000000 << 4) / 115200); ets_setup_syscalls(); do_global_ctors(); esp_ipc_init(); diff --git a/components/esp32/include/soc/cpu.h b/components/esp32/include/soc/cpu.h index fdcf62190e..283c0a2c6a 100644 --- a/components/esp32/include/soc/cpu.h +++ b/components/esp32/include/soc/cpu.h @@ -33,4 +33,14 @@ static inline bool cpu_in_interrupt_context(void) return (ps & PS_UM) == 0; } + +/* + * @brief Set CPU frequency to the value defined in menuconfig + * + * Called from cpu_start.c, not intended to be called from other places. + * This is a temporary function which will be replaced once dynamic + * CPU frequency changing is implemented. + */ +void esp_set_cpu_freq(); + #endif diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 95bf1e103a..e43b9cfeb3 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -100,7 +100,7 @@ #define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1 /* TODO: config freq by menuconfig */ -#define XT_CLOCK_FREQ 80000000 +#define XT_CLOCK_FREQ (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000) /* Required for configuration-dependent settings */ #include "xtensa_config.h" From 066f3358a7157613e7a3504ff656fc13f3eaea15 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Sep 2016 20:53:25 +0800 Subject: [PATCH 004/179] components/esp32: use APB_CLK_FREQ instead of a number --- components/esp32/cpu_start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index aebad03d41..de0fdb5863 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -203,7 +203,7 @@ extern esp_err_t app_main(void *ctx); void user_start_cpu0(void) { esp_set_cpu_freq(); // set CPU frequency configured in menuconfig - uart_div_modify(0, (80000000 << 4) / 115200); + uart_div_modify(0, (APB_CLK_FREQ << 4) / 115200); ets_setup_syscalls(); do_global_ctors(); esp_ipc_init(); From b3e671e7258dac81a30769222b4c8fbca0f7aa4a Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 14 Sep 2016 17:51:51 +0800 Subject: [PATCH 005/179] esp32/lib: update to 3372298f remove freq change in system_init --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 1303c92c10..3372298fe2 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 1303c92c1056b7f59b95360b58e70a21cb4a93e1 +Subproject commit 3372298fe2ff517858bdc8c64f76540b9ac7d7d5 From 716cec5ded2fe561d4c2bf46f8782991c6502b72 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Sep 2016 00:53:33 +0800 Subject: [PATCH 006/179] components/log: add implementation, update a few components to use it This also removes logging implementation from bootloader and replaces it with the one provided by the log component. Some occurrences of printf and ets_printf have been changed to ESP_LOGx APIs. --- components/bootloader/Kconfig.projbuild | 30 -- components/bootloader/src/Makefile | 4 +- .../bootloader/src/main/bootloader_log.h | 114 ------- .../bootloader/src/main/bootloader_start.c | 91 +++--- components/bootloader/src/main/component.mk | 1 - .../bootloader/src/main/flash_encrypt.c | 62 ++-- components/bootloader/src/main/secure_boot.c | 28 +- components/esp32/cpu_start.c | 23 +- components/esp32/heap_alloc_caps.c | 14 +- components/log/Kconfig | 48 +++ components/log/component.mk | 3 + components/log/include/esp_log.h | 171 +++++++++-- components/log/log.c | 283 ++++++++++++++++++ 13 files changed, 590 insertions(+), 282 deletions(-) delete mode 100644 components/bootloader/src/main/bootloader_log.h create mode 100644 components/log/Kconfig create mode 100755 components/log/component.mk create mode 100644 components/log/log.c diff --git a/components/bootloader/Kconfig.projbuild b/components/bootloader/Kconfig.projbuild index 74028b6e90..8d5f667216 100644 --- a/components/bootloader/Kconfig.projbuild +++ b/components/bootloader/Kconfig.projbuild @@ -1,33 +1,3 @@ menu "Bootloader config" -choice BOOTLOADER_LOG_LEVEL - bool "Bootloader log verbosity" - default BOOTLOADER_LOG_LEVEL_NOTICE - help - Specify how much output to see in the bootloader logs. - - Note that if MTDO is HIGH on reset, all early boot output - (including bootloader logs) are suppressed. -config BOOTLOADER_LOG_LEVEL_NONE - bool "No output" -config BOOTLOADER_LOG_LEVEL_ERROR - bool "Error" -config BOOTLOADER_LOG_LEVEL_WARN - bool "Warning" -config BOOTLOADER_LOG_LEVEL_INFO - bool "Info" -config BOOTLOADER_LOG_LEVEL_NOTICE - bool "Notice" -config BOOTLOADER_LOG_LEVEL_DEBUG - bool "Debug" -endchoice - -config BOOTLOADER_LOG_COLORS - bool "Use ANSI terminal colors in bootloader log output" - default "y" - help - Enable ANSI terminal color codes in bootloader output. - - In order to view these, your terminal program must support ANSI color codes. - endmenu diff --git a/components/bootloader/src/Makefile b/components/bootloader/src/Makefile index b6b0c1af02..065593ccbf 100644 --- a/components/bootloader/src/Makefile +++ b/components/bootloader/src/Makefile @@ -4,7 +4,7 @@ # PROJECT_NAME := bootloader -COMPONENTS := esptool_py bootloader +COMPONENTS := esptool_py bootloader log # The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included. # @@ -12,6 +12,6 @@ COMPONENTS := esptool_py bootloader IS_BOOTLOADER_BUILD := 1 #We cannot include the esp32 component directly but we need its includes. This is fixed by -#adding it in the main/Makefile directory. +EXTRA_CFLAGS := -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include include $(IDF_PATH)/make/project.mk diff --git a/components/bootloader/src/main/bootloader_log.h b/components/bootloader/src/main/bootloader_log.h deleted file mode 100644 index 1f7ec62ad5..0000000000 --- a/components/bootloader/src/main/bootloader_log.h +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed 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 __BOOT_LOG_H__ -#define __BOOT_LOG_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include "sdkconfig.h" - -#define BOOT_LOG_LEVEL_NONE (0) -#define BOOT_LOG_LEVEL_ERROR (1) -#define BOOT_LOG_LEVEL_WARN (2) -#define BOOT_LOG_LEVEL_INFO (3) -#define BOOT_LOG_LEVEL_NOTICE (4) -#define BOOT_LOG_LEVEL_DEBUG (5) - -#define Black "30" -#define Red "31" -#define Green "32" -#define Brown "33" -#define Blue "34" -#define Purple "35" -#define Cyan "36" - -#if CONFIG_BOOTLOADER_LOG_COLORS -#define LOG_COLOR(COLOR) "\033[0;"COLOR"m" -#define LOG_BOLD(COLOR) "\033[1;"COLOR"m" -#define LOG_RESET_COLOR "\033[0m" -#else -#define LOG_COLOR(...) -#define LOG_BOLD(...) -#define LOG_RESET_COLOR "" -#endif - -// BOOT_LOG_LEVEL defined by make menuconfig -#if CONFIG_BOOTLOADER_LOG_LEVEL_NONE -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_NONE -#elif CONFIG_BOOTLOADER_LOG_LEVEL_ERROR -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_ERROR -#elif CONFIG_BOOTLOADER_LOG_LEVEL_WARN -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_WARN -#elif CONFIG_BOOTLOADER_LOG_LEVEL_INFO -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_INFO -#elif CONFIG_BOOTLOADER_LOG_LEVEL_NOTICE -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_NOTICE -#elif CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG -#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_DEBUG -#else -#error "No bootloader log level set in menuconfig!" -#endif - -//printf("\033[0;36m[NOTICE][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); -#define log_notice(format, ...) \ - do{\ - if(BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_NOTICE){\ - ets_printf(LOG_COLOR(Cyan) format "\r\n", ##__VA_ARGS__); \ - ets_printf(LOG_RESET_COLOR); \ - }\ - }while(0) - -#define log_info(format, ...) \ - do{\ - if(BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_INFO){\ - ets_printf(LOG_BOLD(Cyan) format "\r\n", ##__VA_ARGS__); \ - ets_printf(LOG_RESET_COLOR); \ - }\ - }while(0) - -//printf("\033[0;31m[ERROR][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); -#define log_error(format, ...) \ - do{\ - if(BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_ERROR){\ - ets_printf(LOG_COLOR(Red) "[ERROR][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - ets_printf(LOG_RESET_COLOR); \ - }\ - }while(0) - -//printf("\033[1;33m[WARN][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); -#define log_warn(format, ...) \ - do{\ - if(BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_WARN){\ - ets_printf(LOG_BOLD(Brown) "[WARN][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - ets_printf(LOG_RESET_COLOR); \ - }\ - }while(0) - -//printf("\033[1;32m[DEBUG][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); -#define log_debug(format, ...) \ - do{\ - if(BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_DEBUG){\ - ets_printf(LOG_BOLD(Green) "[DEBUG][%s][%s][%d]\n" format "\r\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - ets_printf(LOG_RESET_COLOR); \ - }\ - }while(0) - -#ifdef __cplusplus -} -#endif - -#endif /* __BOOT_LOGGING_H__ */ diff --git a/components/bootloader/src/main/bootloader_start.c b/components/bootloader/src/main/bootloader_start.c index 2dbf0e8269..f56bc5e6b5 100644 --- a/components/bootloader/src/main/bootloader_start.c +++ b/components/bootloader/src/main/bootloader_start.c @@ -16,6 +16,7 @@ #include #include "esp_attr.h" +#include "esp_log.h" #include "rom/cache.h" #include "rom/ets_sys.h" @@ -31,11 +32,12 @@ #include "sdkconfig.h" -#include "bootloader_log.h" #include "bootloader_config.h" extern int _bss_start; extern int _bss_end; + +static const char* TAG = "boot"; /* We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset. We do have a stack, so we can do the initialization in C. @@ -130,7 +132,7 @@ uint32_t get_bin_len(uint32_t pos) { uint32_t len = 8 + 16; uint8_t i; - log_debug("pos %d %x\n",pos,*(uint8_t *)pos); + ESP_LOGD(TAG, "pos %d %x",pos,*(uint8_t *)pos); if(0xE9 != *(uint8_t *)pos) { return 0; } @@ -142,7 +144,7 @@ uint32_t get_bin_len(uint32_t pos) } else { len += 16; } - log_debug("bin length = %d\n", len); + ESP_LOGD(TAG, "bin length = %d", len); return len; } @@ -161,7 +163,7 @@ void boot_cache_redirect( uint32_t pos, size_t size ) uint32_t count = (size + 0xffff) / 0x10000; Cache_Read_Disable( 0 ); Cache_Flush( 0 ); - log_debug( "mmu set paddr=%08x count=%d", pos_aligned, count ); + ESP_LOGD(TAG, "mmu set paddr=%08x count=%d", pos_aligned, count ); cache_flash_mmu_set( 0, 0, 0x3f400000, pos_aligned, 64, count ); Cache_Read_Enable( 0 ); } @@ -183,13 +185,13 @@ bool load_partition_table(bootloader_state_t* bs, uint32_t addr) int index = 0; char *partition_usage; - log_info("Partition Table:"); - log_info("## Label Usage Type ST Offset Length"); + ESP_LOGI(TAG, "Partition Table:"); + ESP_LOGI(TAG, "## Label Usage Type ST Offset Length"); while (addr < end) { - log_debug("load partition table entry from %x(%08x)", addr, MEM_CACHE(addr)); + ESP_LOGD(TAG, "load partition table entry from %x(%08x)", addr, MEM_CACHE(addr)); memcpy(&partition, MEM_CACHE(addr), sizeof(partition)); - log_debug("type=%x subtype=%x", partition.type, partition.subtype); + ESP_LOGD(TAG, "type=%x subtype=%x", partition.type, partition.subtype); partition_usage = "unknown"; if (partition.magic == PARTITION_MAGIC) { /* valid partition definition */ @@ -244,14 +246,14 @@ bool load_partition_table(bootloader_state_t* bs, uint32_t addr) } /* print partition type info */ - log_info("%2d %-16s %-16s %02x %02x %08x %08x", index, partition.label, partition_usage, + ESP_LOGI(TAG, "%2d %-16s %-16s %02x %02x %08x %08x", index, partition.label, partition_usage, partition.type, partition.subtype, partition.pos.offset, partition.pos.size); index++; addr += sizeof(partition); } - log_info("End of partition table"); + ESP_LOGI(TAG,"End of partition table"); return true; } @@ -274,14 +276,7 @@ static bool ota_select_valid(const ota_select *s) void bootloader_main() { - //Run start routine. - /*ESP32 2ND bootload start here*/ - log_info( "\n" ); - log_info( "**************************************" ); - log_info( "* hello espressif ESP32! *" ); - log_info( "* 2nd boot is running! *" ); - log_info( "* version (%s) *", BOOT_VERSION); - log_info( "**************************************"); + ESP_LOGI(TAG, "Espressif ESP32 2nd stage bootloader v. %s", BOOT_VERSION); struct flash_hdr fhdr; bootloader_state_t bs; @@ -289,7 +284,7 @@ void bootloader_main() ota_select sa,sb; memset(&bs, 0, sizeof(bs)); - log_notice( "compile time %s\n", __TIME__ ); + ESP_LOGI(TAG, "compile time " __TIME__ ); /* close watch dog here */ REG_CLR_BIT( RTC_WDTCONFIG0, RTC_CNTL_WDT_FLASHBOOT_MOD_EN ); REG_CLR_BIT( WDTCONFIG0(0), TIMERS_WDT_FLASHBOOT_MOD_EN ); @@ -302,14 +297,14 @@ void bootloader_main() print_flash_info(&fhdr); if (!load_partition_table(&bs, PARTITION_ADD)) { - log_error("load partition table error!"); + ESP_LOGE(TAG, "load partition table error!"); return; } partition_pos_t load_part_pos; if (bs.ota_info.offset != 0) { // check if partition table has OTA info partition - //log_error("OTA info sector handling is not implemented"); + //ESP_LOGE("OTA info sector handling is not implemented"); boot_cache_redirect(bs.ota_info.offset, bs.ota_info.size ); memcpy(&sa,MEM_CACHE(bs.ota_info.offset & 0x0000ffff),sizeof(sa)); memcpy(&sb,MEM_CACHE((bs.ota_info.offset + 0x1000)&0x0000ffff) ,sizeof(sb)); @@ -325,13 +320,13 @@ void bootloader_main() spiRet1 = SPIEraseSector(bs.ota_info.offset/0x1000); spiRet2 = SPIEraseSector(bs.ota_info.offset/0x1000+1); if (spiRet1 != SPI_FLASH_RESULT_OK || spiRet2 != SPI_FLASH_RESULT_OK ) { - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return; } spiRet1 = SPIWrite(bs.ota_info.offset,(uint32_t *)&sa,sizeof(ota_select)); spiRet2 = SPIWrite(bs.ota_info.offset + 0x1000,(uint32_t *)&sb,sizeof(ota_select)); if (spiRet1 != SPI_FLASH_RESULT_OK || spiRet2 != SPI_FLASH_RESULT_OK ) { - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return; } Cache_Read_Enable(0); @@ -344,7 +339,7 @@ void bootloader_main() }else if(ota_select_valid(&sb)) { load_part_pos = bs.ota[(sb.ota_seq - 1) % bs.app_count]; }else { - log_error("ota data partition info error"); + ESP_LOGE(TAG, "ota data partition info error"); return; } } @@ -353,15 +348,15 @@ void bootloader_main() } else if (bs.test.offset != 0) { // otherwise, look for test app parition load_part_pos = bs.test; } else { // nothing to load, bail out - log_error("nothing to load"); + ESP_LOGE(TAG, "nothing to load"); return; } - log_info("Loading app partition at offset %08x", load_part_pos); + ESP_LOGI(TAG, "Loading app partition at offset %08x", load_part_pos); if(fhdr.secury_boot_flag == 0x01) { /* protect the 2nd_boot */ if(false == secure_boot()){ - log_error("secure boot failed"); + ESP_LOGE(TAG, "secure boot failed"); return; } } @@ -369,7 +364,7 @@ void bootloader_main() if(fhdr.encrypt_flag == 0x01) { /* encrypt flash */ if (false == flash_encrypt(&bs)) { - log_error("flash encrypt failed"); + ESP_LOGE(TAG, "flash encrypt failed"); return; } } @@ -395,7 +390,7 @@ void unpack_load_app(const partition_pos_t* partition) uint32_t irom_load_addr = 0; uint32_t irom_size = 0; - log_debug("bin_header: %u %u %u %u %08x\n", image_header.magic, + ESP_LOGD(TAG, "bin_header: %u %u %u %u %08x", image_header.magic, image_header.blocks, image_header.spi_mode, image_header.spi_size, @@ -420,7 +415,7 @@ void unpack_load_app(const partition_pos_t* partition) } if (address >= DROM_LOW && address < DROM_HIGH) { - log_debug("found drom section, map from %08x to %08x\n", pos, + ESP_LOGD(TAG, "found drom section, map from %08x to %08x", pos, section_header.load_addr); drom_addr = partition->offset + pos - sizeof(section_header); drom_load_addr = section_header.load_addr; @@ -430,7 +425,7 @@ void unpack_load_app(const partition_pos_t* partition) } if (address >= IROM_LOW && address < IROM_HIGH) { - log_debug("found irom section, map from %08x to %08x\n", pos, + ESP_LOGD(TAG, "found irom section, map from %08x to %08x", pos, section_header.load_addr); irom_addr = partition->offset + pos - sizeof(section_header); irom_load_addr = section_header.load_addr; @@ -439,7 +434,7 @@ void unpack_load_app(const partition_pos_t* partition) map = true; } - log_notice("section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); + ESP_LOGI(TAG, "section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); if (!load) { pos += section_header.data_len; @@ -468,29 +463,29 @@ void IRAM_ATTR set_cache_and_start_app( uint32_t irom_size, uint32_t entry_addr) { - log_debug("configure drom and irom and start\n"); + ESP_LOGD(TAG, "configure drom and irom and start"); Cache_Read_Disable( 0 ); Cache_Read_Disable( 1 ); Cache_Flush( 0 ); Cache_Flush( 1 ); uint32_t drom_page_count = (drom_size + 64*1024 - 1) / (64*1024); // round up to 64k - log_debug( "d mmu set paddr=%08x vaddr=%08x size=%d n=%d \n", drom_addr & 0xffff0000, drom_load_addr & 0xffff0000, drom_size, drom_page_count ); + ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d", drom_addr & 0xffff0000, drom_load_addr & 0xffff0000, drom_size, drom_page_count ); int rc = cache_flash_mmu_set( 0, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count ); - log_debug( "rc=%d", rc ); + ESP_LOGV(TAG, "rc=%d", rc ); rc = cache_flash_mmu_set( 1, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count ); - log_debug( "rc=%d", rc ); + ESP_LOGV(TAG, "rc=%d", rc ); uint32_t irom_page_count = (irom_size + 64*1024 - 1) / (64*1024); // round up to 64k - log_debug( "i mmu set paddr=%08x vaddr=%08x size=%d n=%d\n", irom_addr & 0xffff0000, irom_load_addr & 0xffff0000, irom_size, irom_page_count ); + ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d", irom_addr & 0xffff0000, irom_load_addr & 0xffff0000, irom_size, irom_page_count ); rc = cache_flash_mmu_set( 0, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count ); - log_debug( "rc=%d", rc ); + ESP_LOGV(TAG, "rc=%d", rc ); rc = cache_flash_mmu_set( 1, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count ); - log_debug( "rc=%d", rc ); + ESP_LOGV(TAG, "rc=%d", rc ); REG_CLR_BIT( PRO_CACHE_CTRL1_REG, (DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) | (DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 | DPORT_PRO_CACHE_MASK_DRAM1 ); REG_CLR_BIT( APP_CACHE_CTRL1_REG, (DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) | (DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 | DPORT_APP_CACHE_MASK_DRAM1 ); Cache_Read_Enable( 0 ); Cache_Read_Enable( 1 ); - log_notice("start: 0x%08x\n", entry_addr); + ESP_LOGD(TAG, "start: 0x%08x", entry_addr); typedef void (*entry_t)(void); entry_t entry = ((entry_t) entry_addr); @@ -506,11 +501,11 @@ void print_flash_info(struct flash_hdr* pfhdr) struct flash_hdr fhdr = *pfhdr; - log_debug( "[D]: magic %02x\n", fhdr.magic ); - log_debug( "[D]: blocks %02x\n", fhdr.blocks ); - log_debug( "[D]: spi_mode %02x\n", fhdr.spi_mode ); - log_debug( "[D]: spi_speed %02x\n", fhdr.spi_speed ); - log_debug( "[D]: spi_size %02x\n", fhdr.spi_size ); + ESP_LOGD(TAG, "magic %02x", fhdr.magic ); + ESP_LOGD(TAG, "blocks %02x", fhdr.blocks ); + ESP_LOGD(TAG, "spi_mode %02x", fhdr.spi_mode ); + ESP_LOGD(TAG, "spi_speed %02x", fhdr.spi_speed ); + ESP_LOGD(TAG, "spi_size %02x", fhdr.spi_size ); const char* str; switch ( fhdr.spi_speed ) { @@ -534,7 +529,7 @@ void print_flash_info(struct flash_hdr* pfhdr) str = "20MHz"; break; } - log_notice( " SPI Speed : %s", str ); + ESP_LOGI(TAG, "SPI Speed : %s", str ); @@ -566,7 +561,7 @@ void print_flash_info(struct flash_hdr* pfhdr) str = "DIO"; break; } - log_notice( " SPI Mode : %s", str ); + ESP_LOGI(TAG, "SPI Mode : %s", str ); @@ -595,6 +590,6 @@ void print_flash_info(struct flash_hdr* pfhdr) str = "1MB"; break; } - log_notice( " SPI Flash Size : %s", str ); + ESP_LOGI(TAG, "SPI Flash Size : %s", str ); #endif } diff --git a/components/bootloader/src/main/component.mk b/components/bootloader/src/main/component.mk index 1671095f1b..8c8ea4cb63 100644 --- a/components/bootloader/src/main/component.mk +++ b/components/bootloader/src/main/component.mk @@ -8,6 +8,5 @@ # COMPONENT_ADD_LDFLAGS := -L $(abspath .) -lmain -T esp32.bootloader.ld -T $(IDF_PATH)/components/esp32/ld/esp32.rom.ld -COMPONENT_EXTRA_INCLUDES := $(IDF_PATH)/components/esp32/include include $(IDF_PATH)/make/component_common.mk diff --git a/components/bootloader/src/main/flash_encrypt.c b/components/bootloader/src/main/flash_encrypt.c index d5f105f9cc..9e774e087c 100644 --- a/components/bootloader/src/main/flash_encrypt.c +++ b/components/bootloader/src/main/flash_encrypt.c @@ -16,6 +16,7 @@ #include "esp_types.h" #include "esp_attr.h" +#include "esp_log.h" #include "rom/cache.h" #include "rom/ets_sys.h" @@ -28,13 +29,14 @@ #include "sdkconfig.h" -#include "bootloader_log.h" #include "bootloader_config.h" +static const char* TAG = "flash_encrypt"; + /** * @function : bitcount - * @description: caculate bit 1 in flash_crypt_cnt - * if it's even number ,need encrypt flash data,and burn efuse + * @description: calculate bit 1 in flash_crypt_cnt + * if it's even number, need encrypt flash data, and burn efuse * * @inputs: n flash_crypt_cnt * @return: number of 1 in flash_crypt_cnt @@ -68,19 +70,19 @@ bool flash_encrypt_write(uint32_t pos, uint32_t len) spiRet = SPIRead(pos, buf, SPI_SEC_SIZE); if (spiRet != SPI_FLASH_RESULT_OK) { Cache_Read_Enable(0); - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } spiRet = SPIEraseSector(pos/SPI_SEC_SIZE); if (spiRet != SPI_FLASH_RESULT_OK) { Cache_Read_Enable(0); - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } spiRet = SPI_Encrypt_Write(pos, buf, SPI_SEC_SIZE); if (spiRet != SPI_FLASH_RESULT_OK) { Cache_Read_Enable(0); - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } pos += SPI_SEC_SIZE; @@ -104,53 +106,53 @@ bool flash_encrypt(bootloader_state_t *bs) uint32_t flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0, EFUSE_FLASH_CRYPT_CNT); uint8_t count = bitcount(flash_crypt_cnt); int i = 0; - log_debug("flash crypt cnt %x, count %d\n", flash_crypt_cnt, count); + ESP_LOGD(TAG, "flash encrypt cnt %x, bitcount %d\n", flash_crypt_cnt, count); if ((count % 2) == 0) { boot_cache_redirect( 0, 64*1024); /* encrypt iv and abstruct */ - if (false == flash_encrypt_write(0,SPI_SEC_SIZE)) { - log_error("encrypt iv and abstruct error"); + if (false == flash_encrypt_write(0, SPI_SEC_SIZE)) { + ESP_LOGE(TAG, "encrypt iv and abstract error"); return false; } /* encrypt write boot bin*/ bin_len = get_bin_len((uint32_t)MEM_CACHE(0x1000)); if(bin_len != 0) { - if (false == flash_encrypt_write(0x1000,bin_len)) { - log_error("encrypt 2nd boot error"); + if (false == flash_encrypt_write(0x1000, bin_len)) { + ESP_LOGE(TAG, "encrypt 2nd boot error"); return false; } } else { - log_error("2nd boot len error"); + ESP_LOGE(TAG, "2nd boot len error"); return false; } /* encrypt partition table */ - if (false == flash_encrypt_write(PARTITION_ADD,SPI_SEC_SIZE)) { - log_error("encrypt partition table error"); + if (false == flash_encrypt_write(PARTITION_ADD, SPI_SEC_SIZE)) { + ESP_LOGE(TAG, "encrypt partition table error"); return false; } /* encrypt write factory bin */ if(bs->factory.offset != 0x00) { - log_debug("have factory bin\n"); - boot_cache_redirect(bs->factory.offset,bs->factory.size); + ESP_LOGD(TAG, "have factory bin\n"); + boot_cache_redirect(bs->factory.offset, bs->factory.size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->factory.offset&0xffff)); if(bin_len != 0) { - if (false == flash_encrypt_write(bs->factory.offset,bin_len)) { - log_error("encrypt factory bin error"); + if (false == flash_encrypt_write(bs->factory.offset, bin_len)) { + ESP_LOGE(TAG, "encrypt factory bin error"); return false; } } } /* encrypt write test bin */ if(bs->test.offset != 0x00) { - ets_printf("have test bin\n"); - boot_cache_redirect(bs->test.offset,bs->test.size); + ESP_LOGD(TAG, "have test bin\n"); + boot_cache_redirect(bs->test.offset, bs->test.size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->test.offset&0xffff)); if(bin_len != 0) { - if (false == flash_encrypt_write(bs->test.offset,bin_len)) { - log_error("encrypt test bin error"); + if (false == flash_encrypt_write(bs->test.offset, bin_len)) { + ESP_LOGE(TAG, "encrypt test bin error"); return false; } } @@ -158,33 +160,33 @@ bool flash_encrypt(bootloader_state_t *bs) /* encrypt write ota bin */ for (i = 0;i<16;i++) { if(bs->ota[i].offset != 0x00) { - log_debug("have ota[%d] bin\n",i); - boot_cache_redirect(bs->ota[i].offset,bs->ota[i].size); + ESP_LOGD(TAG, "have ota[%d] bin\n",i); + boot_cache_redirect(bs->ota[i].offset, bs->ota[i].size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->ota[i].offset&0xffff)); if(bin_len != 0) { - if (false == flash_encrypt_write(bs->ota[i].offset,bin_len)) { - log_error("encrypt ota bin error"); + if (false == flash_encrypt_write(bs->ota[i].offset, bin_len)) { + ESP_LOGE(TAG, "encrypt ota bin error"); return false; } } } } /* encrypt write ota info bin */ - if (false == flash_encrypt_write(bs->ota_info.offset,2*SPI_SEC_SIZE)) { - log_error("encrypt ota binfo error"); + if (false == flash_encrypt_write(bs->ota_info.offset, 2*SPI_SEC_SIZE)) { + ESP_LOGE(TAG, "encrypt ota info error"); return false; } REG_SET_FIELD(EFUSE_BLK0_WDATA0, EFUSE_FLASH_CRYPT_CNT, 0x04); REG_WRITE(EFUSE_CONF, 0x5A5A); /* efuse_pgm_op_ena, force no rd/wr disable */ REG_WRITE(EFUSE_CMD, 0x02); /* efuse_pgm_cmd */ while (REG_READ(EFUSE_CMD)); /* wait for efuse_pagm_cmd=0 */ - log_warn("burn flash_crypt_cnt\n"); + ESP_LOGW(TAG, "burn flash_crypt_cnt"); REG_WRITE(EFUSE_CONF, 0x5AA5); /* efuse_read_op_ena, release force */ REG_WRITE(EFUSE_CMD, 0x01); /* efuse_read_cmd */ while (REG_READ(EFUSE_CMD)); /* wait for efuse_read_cmd=0 */ return true; } else { - log_info("flash already encrypted.\n"); + ESP_LOGI(TAG, "flash already encrypted."); return true; } } diff --git a/components/bootloader/src/main/secure_boot.c b/components/bootloader/src/main/secure_boot.c index 97ddd1a8de..0e7d581d9f 100644 --- a/components/bootloader/src/main/secure_boot.c +++ b/components/bootloader/src/main/secure_boot.c @@ -16,6 +16,7 @@ #include "esp_attr.h" #include "esp_types.h" +#include "esp_log.h" #include "rom/cache.h" #include "rom/ets_sys.h" @@ -29,12 +30,13 @@ #include "sdkconfig.h" -#include "bootloader_log.h" #include "bootloader_config.h" +static const char* TAG = "secure_boot"; + /** * @function : secure_boot_generate - * @description: generate boot abstruct & iv + * @description: generate boot abstract & iv * * @inputs: bool */ @@ -53,17 +55,17 @@ bool secure_boot_generate(uint32_t bin_len){ spiRet = SPIEraseSector(0); if (spiRet != SPI_FLASH_RESULT_OK) { - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } /* write iv to flash, 0x0000, 128 bytes (1024 bits) */ spiRet = SPIWrite(0, buf, 128); if (spiRet != SPI_FLASH_RESULT_OK) { - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } - log_debug("write iv to flash.\n"); + ESP_LOGD(TAG, "write iv to flash."); Cache_Read_Enable(0); /* read 4K code image from flash, for test */ for (i = 0; i < bin_len; i+=128) { @@ -77,10 +79,10 @@ bool secure_boot_generate(uint32_t bin_len){ /* write abstract to flash, 0x0080, 64 bytes (512 bits) */ spiRet = SPIWrite(0x80, buf, 64); if (spiRet != SPI_FLASH_RESULT_OK) { - log_error(SPI_ERROR_LOG); + ESP_LOGE(TAG, SPI_ERROR_LOG); return false; } - log_debug("write abstract to flash.\n"); + ESP_LOGD(TAG, "write abstract to flash."); Cache_Read_Enable(0); return true; } @@ -88,7 +90,7 @@ bool secure_boot_generate(uint32_t bin_len){ /** * @function : secure_boot - * @description: protect boot code inflash + * @description: protect boot code in flash * * @inputs: bool */ @@ -96,17 +98,17 @@ bool secure_boot(void){ uint32_t bin_len = 0; if (REG_READ(EFUSE_BLK0_RDATA6) & EFUSE_RD_ABS_DONE_0) { - log_info("already secure boot !\n"); + ESP_LOGD(TAG, "already secure boot !"); return true; } else { boot_cache_redirect( 0, 64*1024); bin_len = get_bin_len((uint32_t)MEM_CACHE(0x1000)); if (bin_len == 0) { - log_error("boot len is error"); + ESP_LOGE(TAG, "boot len is error"); return false; } if (false == secure_boot_generate(bin_len)){ - log_error("secure boot generate failed"); + ESP_LOGE(TAG, "secure boot generate failed"); return false; } } @@ -115,11 +117,11 @@ bool secure_boot(void){ REG_WRITE(EFUSE_CONF, 0x5A5A); /* efuse_pgm_op_ena, force no rd/wr disable */ REG_WRITE(EFUSE_CMD, 0x02); /* efuse_pgm_cmd */ while (REG_READ(EFUSE_CMD)); /* wait for efuse_pagm_cmd=0 */ - log_warn("burn abstract_done_0\n"); + ESP_LOGI(TAG, "burn abstract_done_0"); REG_WRITE(EFUSE_CONF, 0x5AA5); /* efuse_read_op_ena, release force */ REG_WRITE(EFUSE_CMD, 0x01); /* efuse_read_cmd */ while (REG_READ(EFUSE_CMD)); /* wait for efuse_read_cmd=0 */ - log_debug("read EFUSE_BLK0_RDATA6 %x\n", REG_READ(EFUSE_BLK0_RDATA6)); + ESP_LOGD(TAG, "read EFUSE_BLK0_RDATA6 %x\n", REG_READ(EFUSE_BLK0_RDATA6)); return true; } diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index e1a5f027b7..cfc628b12b 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -39,11 +39,11 @@ #include "esp_event.h" #include "esp_spi_flash.h" #include "esp_ipc.h" +#include "esp_log.h" static void IRAM_ATTR user_start_cpu0(void); static void IRAM_ATTR call_user_start_cpu1(); static void IRAM_ATTR user_start_cpu1(void); -void Cache_Read_Enable(); extern void ets_setup_syscalls(void); @@ -57,6 +57,8 @@ extern int _iram_romjumptable_end; extern int _iram_text_start; extern int _iram_text_end; +static const char* TAG = "cpu_start"; + /* We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset. We do have a stack, so we can do the initialization in C. @@ -110,13 +112,13 @@ void IRAM_ATTR call_user_start_cpu0() { memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); - //Initialize heap allocator + // Initialize heap allocator heap_alloc_caps_init(); - ets_printf("Pro cpu up.\n"); + ESP_EARLY_LOGI(TAG, "Pro cpu up."); #ifndef CONFIG_FREERTOS_UNICORE - ets_printf("Starting app cpu, entry point is %p\n", call_user_start_cpu1); + ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_user_start_cpu1); SET_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_C, DPORT_APPCPU_RUNSTALL); @@ -128,9 +130,10 @@ void IRAM_ATTR call_user_start_cpu0() { ets_delay_us(100); } #else + ESP_EARLY_LOGI(TAG, "Single core mode"); CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); #endif - ets_printf("Pro cpu start user code\n"); + ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); user_start_cpu0(); } @@ -173,7 +176,7 @@ void IRAM_ATTR call_user_start_cpu1() { "isync\n" \ :::"a4","a5"); - ets_printf("App cpu up.\n"); + ESP_EARLY_LOGI(TAG, "App cpu up."); app_cpu_started = 1; user_start_cpu1(); } @@ -185,7 +188,7 @@ void IRAM_ATTR user_start_cpu1(void) { while (port_xSchedulerRunning[0] == 0) { ; } - ets_printf("Starting scheduler on APP CPU.\n"); + ESP_LOGI(TAG, "Starting scheduler on APP CPU."); xPortStartScheduler(); } @@ -201,7 +204,7 @@ static void do_global_ctors(void) { extern esp_err_t app_main(void *ctx); void user_start_cpu0(void) { - ets_setup_syscalls(); + ets_setup_syscalls(); do_global_ctors(); esp_ipc_init(); spi_flash_init(); @@ -209,7 +212,7 @@ void user_start_cpu0(void) { #if CONFIG_WIFI_ENABLED esp_err_t ret = nvs_flash_init(5, 3); if (ret != ESP_OK) { - printf("nvs_flash_init failed, ret=%d\n", ret); + ESP_LOGE(TAG, "nvs_flash_init failed, ret=%d", ret); } system_init(); @@ -226,7 +229,7 @@ void user_start_cpu0(void) { app_main(NULL); #endif - ets_printf("Starting scheduler on PRO CPU.\n"); + ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); vTaskStartScheduler(); } diff --git a/components/esp32/heap_alloc_caps.c b/components/esp32/heap_alloc_caps.c index e816175b94..5b3ec33dba 100644 --- a/components/esp32/heap_alloc_caps.c +++ b/components/esp32/heap_alloc_caps.c @@ -17,6 +17,9 @@ #include "heap_alloc_caps.h" #include "spiram.h" +#include "esp_log.h" + +static const char* TAG = "heap_alloc_caps"; /* This file, combined with a region allocator that supports tags, solves the problem that the ESP32 has RAM that's @@ -147,7 +150,7 @@ static void disable_mem_region(void *from, void *to) { regions[i].xSizeInBytes-=(uint8_t *)regEnd-(uint8_t *)from; } else if (regStartto) { //Range punches a hole in the region! We do not support this. - ets_printf("%s: region %d: hole punching is not supported!\n", i); + ESP_EARLY_LOGE(TAG, "region %d: hole punching is not supported!", i); regions[i].xTag=-1; //Just disable memory region. That'll teach them! } } @@ -204,12 +207,13 @@ void heap_alloc_caps_init() { } } -#if 1 //Change to 1 to show the regions the heap allocator is initialized with. - ets_printf("Initializing heap allocator:\n"); + ESP_EARLY_LOGI(TAG, "Initializing heap allocator:"); for (i=0; regions[i].xSizeInBytes!=0; i++) { - if ( regions[i].xTag != -1 ) ets_printf("Region %02d: %08X len %08X tag %d\n", i, (int)regions[i].pucStartAddress, regions[i].xSizeInBytes, regions[i].xTag); + if (regions[i].xTag != -1) { + ESP_EARLY_LOGI(TAG, "Region %02d: %08X len %08X tag %d", i, + (int)regions[i].pucStartAddress, regions[i].xSizeInBytes, regions[i].xTag); + } } -#endif //Initialize the malloc implementation. vPortDefineHeapRegionsTagged( regions ); } diff --git a/components/log/Kconfig b/components/log/Kconfig new file mode 100644 index 0000000000..1627ea1830 --- /dev/null +++ b/components/log/Kconfig @@ -0,0 +1,48 @@ +menu "Log output" + +choice LOG_DEFAULT_LEVEL + bool "Default log verbosity" + default LOG_DEFAULT_LEVEL_INFO + help + Specify how much output to see in logs by default. + You can set lower verbosity level at runtime using + esp_log_level_set function. + + Note that this setting limits which log statements + are compiled into the program. So setting this to, say, + "Warning" would mean that changing log level to "Debug" + at runtime will not be possible. + +config LOG_DEFAULT_LEVEL_NONE + bool "No output" +config LOG_DEFAULT_LEVEL_ERROR + bool "Error" +config LOG_DEFAULT_LEVEL_WARN + bool "Warning" +config LOG_DEFAULT_LEVEL_INFO + bool "Info" +config LOG_DEFAULT_LEVEL_DEBUG + bool "Debug" +config LOG_DEFAULT_LEVEL_VERBOSE + bool "Verbose" +endchoice + +config LOG_DEFAULT_LEVEL + int + default 0 if LOG_DEFAULT_LEVEL_NONE + default 1 if LOG_DEFAULT_LEVEL_ERROR + default 2 if LOG_DEFAULT_LEVEL_WARN + default 3 if LOG_DEFAULT_LEVEL_INFO + default 4 if LOG_DEFAULT_LEVEL_DEBUG + default 5 if LOG_DEFAULT_LEVEL_VERBOSE + +config LOG_COLORS + bool "Use ANSI terminal colors in log output" + default "y" + help + Enable ANSI terminal color codes in bootloader output. + + In order to view these, your terminal program must support ANSI color codes. + + +endmenu diff --git a/components/log/component.mk b/components/log/component.mk new file mode 100755 index 0000000000..ef497a7ecb --- /dev/null +++ b/components/log/component.mk @@ -0,0 +1,3 @@ +COMPONENT_ADD_INCLUDEDIRS := include + +include $(IDF_PATH)/make/component_common.mk diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index e8ecf875b3..32f6d0bb30 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -16,6 +16,8 @@ #define __ESP_LOG_H__ #include +#include +#include "sdkconfig.h" #ifdef __cplusplus extern "C" { @@ -24,6 +26,20 @@ extern "C" { /** * @brief Logging library * + * Log library has two ways of managing log verbosity: compile time, set via + * menuconfig, and runtime, using esp_log_set_level function. + * + * At compile time, filtering is done using CONFIG_LOG_DEFAULT_LEVEL macro, set via + * menuconfig. All logging statments for levels higher than CONFIG_LOG_DEFAULT_LEVEL + * will be removed by the preprocessor. + * + * At run time, all logs below CONFIG_LOG_DEFAULT_LEVEL are enabled by default. + * esp_log_set_level function may be used to set logging level per module. + * Modules are identified by their tags, which are human-readable ASCII + * zero-terminated strings. + * + * How to use this library: + * * In each C file which uses logging functionality, define TAG variable like this: * * static const char* TAG = "MyModule"; @@ -32,31 +48,46 @@ extern "C" { * * ESP_LOGW(TAG, "Baud rate error %.1f%%. Requested: %d baud, actual: %d baud", error * 100, baud_req, baud_real); * - * Log filtering happens both at compile time and at runtime. + * Several macros are available for different verbosity levels: * - * At compile time, filtering is done using CONFIG_ESP_LOG_LEVEL macro, set via menuconfig. - * All logging statments for levels higher than CONFIG_ESP_LOG_LEVEL will be removed by the preprocessor. + * ESP_LOGE — error + * ESP_LOGW — warning + * ESP_LOGI — info + * ESP_LOGD - debug + * ESP_LOGV - verbose * - * At run time, all logs below CONFIG_ESP_LOG_LEVEL are enabled by default. - * esp_log_set function may be used to set logging level per tag. + * Additionally there is an _EARLY_ variant for each of these macros (e.g. ESP_EARLY_LOGE). + * These variants can run in startup code, before heap allocator and syscalls + * have been initialized. + * When compiling bootloader, normal ESP_LOGx macros fall back to the same implementation + * as ESP_EARLY_LOGx macros. So the only place where ESP_EARLY_LOGx have to be used explicitly + * is the early startup code, such as heap allocator initialization code. * - * esp_log_set("*", ESP_LOG_ERROR); // set all components to ERROR level - * esp_log_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack - * esp_log_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client + * (Note that such distinction would not have been necessary if we would have an + * ets_vprintf function in the ROM. Then it would be possible to switch implementation + * from _EARLY version to normal version on the fly. Unfortunately, ets_vprintf in ROM + * has been inlined by the compiler into ets_printf, so it is not accessible outside.) * * + * To configure logging output per module, add calls to esp_log_set_level function: + * + * esp_log_set_level("*", ESP_LOG_ERROR); // set all components to ERROR level + * esp_log_set_level("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack + * esp_log_set_level("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client + * */ typedef enum { - ESP_LOG_NONE, - ESP_LOG_ERROR, - ESP_LOG_WARN, - ESP_LOG_INFO, - ESP_LOG_DEBUG, - ESP_LOG_VERBOSE + ESP_LOG_NONE, // No log output + ESP_LOG_ERROR, // Critical errors, software module can not recover on its own + ESP_LOG_WARN, // Error conditions from which recovery measures have been taken + ESP_LOG_INFO, // Information messages which describe normal flow of events + ESP_LOG_DEBUG, // Extra information which is not necessary for normal use (values, pointers, sizes, etc). + ESP_LOG_VERBOSE // Bigger chunks of debugging information, or frequent messages which can potentially flood the output. } esp_log_level_t; +typedef int (*vprintf_like_t)(const char *, va_list); /** * @brief Set log level for given tag @@ -64,52 +95,134 @@ typedef enum { * If logging for given component has already been enabled, changes previous setting. * * @param tag Tag of the log entries to enable. Must be a non-NULL zero terminated string. - * Value "*" means that all tags are affected. + * Value "*" resets log level for all tags to the given value. * * @param level Selects log level to enable. Only logs at this and lower levels will be shown. */ -void esp_log_set(const char* tag, esp_log_level_t level); +void esp_log_level_set(const char* tag, esp_log_level_t level); + +/** + * @brief Set function used to output log entries + * + * By default, log output goes to UART0. This function can be used to redirect log + * output to some other destination, such as file or network. + * + * @param func Function used for output. Must have same signature as vprintf. + */ +void esp_log_set_vprintf(vprintf_like_t func); /** * @brief Write message into the log * * This function is not intended to be used directly. Instead, use one of * ESP_LOGE, ESP_LOGW, ESP_LOGI, ESP_LOGD, ESP_LOGV macros. + * + * This function or these macros should not be used from an interrupt. */ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4))); -#ifndef CONFIG_ESP_LOG_LEVEL -#define CONFIG_ESP_LOG_LEVEL ESP_LOG_NONE -#endif -#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_ERROR) -#define ESP_LOGE( tag, format, ... ) esp_log_write(ESP_LOG_ERROR, tag, format, ##__VA_ARGS__) + +/** + * @brief Function which returns timestamp to be used in log output + * + * This function is used in expansion of ESP_LOGx macros. + * In the 2nd stage bootloader, and at early application startup stage + * this function uses CPU cycle counter as time source. Later when + * FreeRTOS scheduler start running, it switches to FreeRTOS tick count. + * + * For now, we ignore millisecond counter overflow. + * + * @return timestamp, in milliseconds + */ +uint32_t esp_log_timestamp(); + + +#if CONFIG_LOG_COLORS +#define LOG_COLOR_BLACK "30" +#define LOG_COLOR_RED "31" +#define LOG_COLOR_GREEN "32" +#define LOG_COLOR_BROWN "33" +#define LOG_COLOR_BLUE "34" +#define LOG_COLOR_PURPLE "35" +#define LOG_COLOR_CYAN "36" +#define LOG_COLOR(COLOR) "\033[0;"COLOR"m" +#define LOG_BOLD(COLOR) "\033[1;"COLOR"m" +#define LOG_RESET_COLOR "\033[0m" +#define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED) +#define LOG_COLOR_W LOG_COLOR(LOG_COLOR_BROWN) +#define LOG_COLOR_I LOG_COLOR(LOG_COLOR_GREEN) +#define LOG_COLOR_D +#define LOG_COLOR_V +#else //CONFIG_LOG_COLORS +#define LOG_COLOR_E +#define LOG_COLOR_W +#define LOG_COLOR_I +#define LOG_COLOR_D +#define LOG_COLOR_V +#define LOG_RESET_COLOR +#endif //CONFIG_LOG_COLORS + +#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" + +#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_ERROR) +#define ESP_EARLY_LOGE( tag, format, ... ) ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#ifndef BOOTLOADER_BUILD +#define ESP_LOGE( tag, format, ... ) esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#else +#define ESP_LOGE( tag, format, ... ) ESP_EARLY_LOGE( tag, format, ##__VA_ARGS__) +#endif // BOOTLOADER_BUILD #else #define ESP_LOGE( tag, format, ... ) +#define ESP_EARLY_LOGE( tag, format, ... ) #endif -#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_WARN) -#define ESP_LOGW( tag, format, ... ) esp_log_write(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) +#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_WARN) +#define ESP_EARLY_LOGW( tag, format, ... ) ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#ifndef BOOTLOADER_BUILD +#define ESP_LOGW( tag, format, ... ) esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#else +#define ESP_LOGW( tag, format, ... ) ESP_EARLY_LOGW( tag, format, ##__VA_ARGS__) +#endif // BOOTLOADER_BUILD #else #define ESP_LOGW( tag, format, ... ) +#define ESP_EARLY_LOGW( tag, format, ... ) #endif -#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_INFO) -#define ESP_LOGI( tag, format, ... ) esp_log_write(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) +#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_INFO) +#define ESP_EARLY_LOGI( tag, format, ... ) ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#ifndef BOOTLOADER_BUILD +#define ESP_LOGI( tag, format, ... ) esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#else +#define ESP_LOGI( tag, format, ... ) ESP_EARLY_LOGI( tag, format, ##__VA_ARGS__) +#endif //BOOTLOADER_BUILD #else #define ESP_LOGI( tag, format, ... ) +#define ESP_EARLY_LOGI( tag, format, ... ) #endif -#if (CONFIG_ESP_LOG_LEVEL < ESP_LOG_DEBUG) -#define ESP_LOGD( tag, format, ... ) esp_log_write(ESP_LOG_DEBUG, tag, format, ##__VA_ARGS__) +#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_DEBUG) +#define ESP_EARLY_LOGD( tag, format, ... ) ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#ifndef BOOTLOADER_BUILD +#define ESP_LOGD( tag, format, ... ) esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#else +#define ESP_LOGD( tag, format, ... ) ESP_EARLY_LOGD(tag, format, ##__VA_ARGS__) +#endif // BOOTLOADER_BUILD #else #define ESP_LOGD( tag, format, ... ) +#define ESP_EARLY_LOGD( tag, format, ... ) #endif -#if (CONFIG_ESP_LOG_VERBOSE < ESP_LOG_ERROR) -#define ESP_LOGV( tag, format, ... ) esp_log_write(ESP_LOG_VERBOSE, tag, format, ##__VA_ARGS__) +#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_VERBOSE) +#define ESP_EARLY_LOGV( tag, format, ... ) ets_printf(LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#ifndef BOOTLOADER_BUILD +#define ESP_LOGV( tag, format, ... ) esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#else +#define ESP_LOGV( tag, format, ... ) ESP_EARLY_LOGV(tag, format, ##__VA_ARGS__) +#endif // BOOTLOADER_BUILD #else #define ESP_LOGV( tag, format, ... ) +#define ESP_EARLY_LOGV( tag, format, ... ) #endif #ifdef __cplusplus diff --git a/components/log/log.c b/components/log/log.c new file mode 100644 index 0000000000..bd6df01b28 --- /dev/null +++ b/components/log/log.c @@ -0,0 +1,283 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +/* + * Log library — implementation notes. + * + * Log library stores all tags provided to esp_log_set_level as a linked + * list. See uncached_tag_entry_t structure. + * + * To avoid looking up log level for given tag each time message is + * printed, this library caches pointers to tags. Because the suggested + * way of creating tags uses one 'TAG' constant per file, this caching + * should be effective. Cache is a binary min-heap of cached_tag_entry_t + * items, ordering is done on 'generation' member. In this context, + * generation is an integer which is incremented each time an operation + * with cache is performed. When cache is full, new item is inserted in + * place of an oldest item (that is, with smallest 'generation' value). + * After that, bubble-down operation is performed to fix ordering in the + * min-heap. + * + * The potential problem with wrap-around of cache generation counter is + * ignored for now. This will happen if someone happens to output more + * than 4 billion log entries, at which point wrap-around will not be + * the biggest problem. + * + */ + +#ifndef BOOTLOADER_BUILD +#include +#include +#include +#include +#endif + +#include "esp_attr.h" +#include "xtensa/hal.h" +#include "soc/soc.h" +#include +#include +#include +#include +#include +#include "esp_log.h" + + +#ifndef BOOTLOADER_BUILD + +#define TAG_CACHE_SIZE 32 +#define MAX_MUTEX_WAIT_TICKS ((10 + portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS) + +typedef struct { + const char* tag; + uint32_t level : 3; + uint32_t generation : 29; +} cached_tag_entry_t; + +typedef struct uncached_tag_entry_{ + struct uncached_tag_entry_* next; + uint8_t level; // esp_log_level_t as uint8_t + char tag[0]; // beginning of a zero-terminated string +} uncached_tag_entry_t; + +static esp_log_level_t s_default_level = (esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL; +static uncached_tag_entry_t* s_head = NULL; +static uncached_tag_entry_t* s_tail = NULL; +static cached_tag_entry_t s_cache[TAG_CACHE_SIZE]; +static uint32_t s_cache_max_generation = 0; +static uint32_t s_cache_entry_count = 0; +static vprintf_like_t s_print_func = &vprintf; +static SemaphoreHandle_t s_mutex = NULL; + +static inline bool get_cached_log_level(const char* tag, esp_log_level_t* level); +static inline bool get_uncached_log_level(const char* tag, esp_log_level_t* level); +static inline void add_to_cache(const char* tag, esp_log_level_t level); +static void heap_bubble_down(int index); +static inline void heap_swap(int i, int j); +static inline bool should_output(esp_log_level_t level_for_message, esp_log_level_t level_for_tag); +static inline void clear_log_level_list(); + +void esp_log_set_vprintf(vprintf_like_t func) +{ + s_print_func = func; +} + +void esp_log_level_set(const char* tag, esp_log_level_t level) +{ + if (!s_mutex) { + s_mutex = xSemaphoreCreateMutex(); + } + xSemaphoreTake(&s_mutex, portMAX_DELAY); + + // for wildcard tag, remove all linked list items and clear the cache + if (strcmp(tag, "*") == 0) { + s_default_level = level; + clear_log_level_list(); + xSemaphoreGive(&s_mutex); + return; + } + + // allocate new linked list entry and append it to the endo of the list + size_t entry_size = offsetof(uncached_tag_entry_t, tag) + strlen(tag) + 1; + uncached_tag_entry_t* new_entry = (uncached_tag_entry_t*) malloc(entry_size); + if (!new_entry) { + xSemaphoreGive(&s_mutex); + return; + } + new_entry->next = NULL; + new_entry->level = (uint8_t) level; + strcpy(new_entry->tag, tag); + if (s_tail) { + s_tail->next = new_entry; + } + s_tail = new_entry; + if (!s_head) { + s_head = new_entry; + } + xSemaphoreGive(&s_mutex); +} + +void clear_log_level_list() +{ + for (uncached_tag_entry_t* it = s_head; it != NULL; ) { + uncached_tag_entry_t* next = it->next; + free(it); + it = next; + } + + s_cache_entry_count = 0; + s_cache_max_generation = 0; +} + +void IRAM_ATTR esp_log_write(esp_log_level_t level, + const char* tag, + const char* format, ...) +{ + if (!s_mutex) { + s_mutex = xSemaphoreCreateMutex(); + } + if (xSemaphoreTake(&s_mutex, MAX_MUTEX_WAIT_TICKS) == pdFALSE) { + return; + } + esp_log_level_t level_for_tag; + // Look for the tag in cache first, then in the linked list of all tags + if (!get_cached_log_level(tag, &level_for_tag)) { + if (!get_uncached_log_level(tag, &level_for_tag)) { + level_for_tag = s_default_level; + } + add_to_cache(tag, level_for_tag); + } + xSemaphoreGive(&s_mutex); + if (!should_output(level, level_for_tag)) { + return; + } + + va_list list; + va_start(list, format); + (*s_print_func)(format, list); + va_end(list); +} + +static inline bool get_cached_log_level(const char* tag, esp_log_level_t* level) +{ + // Look for `tag` in cache + int i; + for (i = 0; i < s_cache_entry_count; ++i) { + if (s_cache[i].tag == tag) { + break; + } + } + if (i == s_cache_entry_count) { // Not found in cache + return false; + } + // Return level from cache + *level = (esp_log_level_t) s_cache[i].level; + // Update item generation + s_cache[i].generation = s_cache_max_generation++; + // Restore heap ordering + heap_bubble_down(i); + return true; +} + +static inline void add_to_cache(const char* tag, esp_log_level_t level) +{ + uint32_t generation = s_cache_max_generation++; + // First consider the case when cache is not filled yet. + // In this case, just add new entry at the end. + // This happens to satisfy binary min-heap ordering. + if (s_cache_entry_count < TAG_CACHE_SIZE) { + s_cache[s_cache_entry_count] = (cached_tag_entry_t) { + .generation = generation, + .level = level, + .tag = tag + }; + ++s_cache_entry_count; + return; + } + + // Cache is full, so we replace the oldest entry (which is at index 0 + // because this is a min-heap) with the new one, and do bubble-down + // operation to restore min-heap ordering. + s_cache[0] = (cached_tag_entry_t) { + .tag = tag, + .level = level, + .generation = generation + }; + heap_bubble_down(0); +} + +static inline bool get_uncached_log_level(const char* tag, esp_log_level_t* level) +{ + // Walk the linked list of all tags and see if given tag is present in the list. + // This is slow because tags are compared as strings. + for (uncached_tag_entry_t* it = s_head; it != NULL; ++it) { + if (strcmp(tag, it->tag) == 0) { + *level = it->level; + return true; + } + } + return false; +} + +static inline bool should_output(esp_log_level_t level_for_message, esp_log_level_t level_for_tag) +{ + return level_for_message <= level_for_tag; +} + +static void heap_bubble_down(int index) +{ + while (index < TAG_CACHE_SIZE / 2) { + int left_index = index * 2 + 1; + int right_index = left_index + 1; + int next = (s_cache[left_index].generation < s_cache[right_index].generation) ? left_index : right_index; + heap_swap(index, next); + index = next; + } +} + +static inline void heap_swap(int i, int j) +{ + cached_tag_entry_t tmp = s_cache[i]; + s_cache[i] = s_cache[j]; + s_cache[j] = tmp; +} +#endif //BOOTLOADER_BUILD + +inline uint32_t esp_log_early_timestamp() +{ + return xthal_get_ccount() / (CPU_CLK_FREQ_ROM / 1000); +} + +#ifndef BOOTLOADER_BUILD + +uint32_t IRAM_ATTR esp_log_timestamp() +{ + if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) { + return esp_log_early_timestamp(); + } + static uint32_t base = 0; + if (base == 0) { + base = esp_log_early_timestamp(); + } + return base + xTaskGetTickCount() * configTICK_RATE_HZ; +} + +#else + +uint32_t esp_log_timestamp() +{ + return esp_log_early_timestamp(); +} + +#endif //BOOTLOADER_BUILD From 0290a34b55328ffe9a82a2d8cf5507a5ef2c0d4e Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Sep 2016 01:59:42 +0800 Subject: [PATCH 007/179] components/esp32: clean up cpu_start Move CPU region protection setup into soc/cpu.h change tabs to spaces remove unused extern declarations use RTC_WDTCONFIG0 instead of numeric address (still need to fix BB reg) --- .../bootloader/src/main/bootloader_start.c | 32 +-- components/esp32/cpu_start.c | 251 +++++++----------- components/esp32/include/soc/cpu.h | 35 +++ 3 files changed, 130 insertions(+), 188 deletions(-) diff --git a/components/bootloader/src/main/bootloader_start.c b/components/bootloader/src/main/bootloader_start.c index f56bc5e6b5..116c7a98d3 100644 --- a/components/bootloader/src/main/bootloader_start.c +++ b/components/bootloader/src/main/bootloader_start.c @@ -24,6 +24,7 @@ #include "rom/crc.h" #include "soc/soc.h" +#include "soc/cpu.h" #include "soc/dport_reg.h" #include "soc/io_mux_reg.h" #include "soc/efuse_reg.h" @@ -60,36 +61,7 @@ void IRAM_ATTR set_cache_and_start_app(uint32_t drom_addr, void IRAM_ATTR call_start_cpu0() { - //Make page 0 access raise an exception - //Also some other unused pages so we can catch weirdness - //ToDo: this but nicer. - asm volatile (\ - "movi a4,0x00000000\n" \ - "movi a5,0xf\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x80000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xa0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xc0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xe0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x20000000\n" \ - "movi a5,0x0\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x40000000\n" \ - "movi a5,0x2\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "isync\n" \ - :::"a4","a5"); + cpu_configure_region_protection(); //Clear bss memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index cfc628b12b..20c6d379c3 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -20,8 +20,10 @@ #include "rom/ets_sys.h" #include "rom/uart.h" +#include "soc/cpu.h" #include "soc/dport_reg.h" #include "soc/io_mux_reg.h" +#include "soc/rtc_cntl_reg.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -45,169 +47,104 @@ static void IRAM_ATTR user_start_cpu0(void); static void IRAM_ATTR call_user_start_cpu1(); static void IRAM_ATTR user_start_cpu1(void); extern void ets_setup_syscalls(void); +extern esp_err_t app_main(void *ctx); - -extern int __cpu1_entry_point; extern int _bss_start; extern int _bss_end; extern int _init_start; -extern int _init_end; -extern int _iram_romjumptable_start; -extern int _iram_romjumptable_end; -extern int _iram_text_start; -extern int _iram_text_end; - -static const char* TAG = "cpu_start"; - -/* -We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, -flash cache is down and the app CPU is in reset. We do have a stack, so we can do the initialization in C. -*/ - -static bool app_cpu_started = false; - -void IRAM_ATTR call_user_start_cpu0() { - //Kill wdt - REG_CLR_BIT(0x3ff4808c, BIT(10)); //RTCCNTL+8C RTC_WDTCONFIG0 RTC_ - REG_CLR_BIT(0x6001f048, BIT(14)); //DR_REG_BB_BASE+48 - - //Move exception vectors to IRAM - asm volatile (\ - "wsr %0, vecbase\n" \ - ::"r"(&_init_start)); - - uartAttach(); - ets_install_uart_printf(); - - //Make page 0 access raise an exception - //Also some other unused pages so we can catch weirdness - //ToDo: this but nicer. - asm volatile (\ - "movi a4,0x00000000\n" \ - "movi a5,0xf\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x80000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xa0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xc0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xe0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x20000000\n" \ - "movi a5,0x0\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x40000000\n" \ - "movi a5,0x2\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "isync\n" \ - :::"a4","a5"); - - memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); - - // Initialize heap allocator - heap_alloc_caps_init(); - - ESP_EARLY_LOGI(TAG, "Pro cpu up."); - -#ifndef CONFIG_FREERTOS_UNICORE - ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_user_start_cpu1); - - SET_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); - CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_C, DPORT_APPCPU_RUNSTALL); - SET_PERI_REG_MASK(APPCPU_CTRL_REG_A, DPORT_APPCPU_RESETTING); - CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_A, DPORT_APPCPU_RESETTING); - ets_set_appcpu_boot_addr((uint32_t)call_user_start_cpu1); - - while (!app_cpu_started) { - ets_delay_us(100); - } -#else - ESP_EARLY_LOGI(TAG, "Single core mode"); - CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); -#endif - ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); - user_start_cpu0(); -} - - -extern int _init_start; - -void IRAM_ATTR call_user_start_cpu1() { - asm volatile (\ - "wsr %0, vecbase\n" \ - ::"r"(&_init_start)); - - //Make page 0 access raise an exception - //Also some other unused pages so we can catch weirdness - //ToDo: this but nicer. - asm volatile (\ - "movi a4,0x00000000\n" \ - "movi a5,0xf\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x80000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xa0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xc0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0xe0000000\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x20000000\n" \ - "movi a5,0x0\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "movi a4,0x40000000\n" \ - "movi a5,0x2\n" \ - "wdtlb a5,a4\n" \ - "witlb a5,a4\n" \ - "isync\n" \ - :::"a4","a5"); - - ESP_EARLY_LOGI(TAG, "App cpu up."); - app_cpu_started = 1; - user_start_cpu1(); -} - -extern volatile int port_xSchedulerRunning[2]; - -void IRAM_ATTR user_start_cpu1(void) { - // Wait for FreeRTOS initialization to finish on PRO CPU - while (port_xSchedulerRunning[0] == 0) { - ; - } - ESP_LOGI(TAG, "Starting scheduler on APP CPU."); - xPortStartScheduler(); -} - extern void (*__init_array_start)(void); extern void (*__init_array_end)(void); +extern volatile int port_xSchedulerRunning[2]; -static void do_global_ctors(void) { - void (**p)(void); - for(p = &__init_array_start; p != &__init_array_end; ++p) - (*p)(); +static const char* TAG = "cpu_start"; +static bool app_cpu_started = false; + +/* + * We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, + * and the app CPU is in reset. We do have a stack, so we can do the initialization in C. + */ + +void IRAM_ATTR call_user_start_cpu0() +{ + //Kill wdt + REG_CLR_BIT(RTC_WDTCONFIG0, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); + REG_CLR_BIT(0x6001f048, BIT(14)); //DR_REG_BB_BASE+48 + + cpu_configure_region_protection(); + + //Move exception vectors to IRAM + asm volatile (\ + "wsr %0, vecbase\n" \ + ::"r"(&_init_start)); + + uartAttach(); + ets_install_uart_printf(); + + memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); + + // Initialize heap allocator + heap_alloc_caps_init(); + + ESP_EARLY_LOGI(TAG, "Pro cpu up."); + +#ifndef CONFIG_FREERTOS_UNICORE + ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_user_start_cpu1); + + SET_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); + CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_C, DPORT_APPCPU_RUNSTALL); + SET_PERI_REG_MASK(APPCPU_CTRL_REG_A, DPORT_APPCPU_RESETTING); + CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_A, DPORT_APPCPU_RESETTING); + ets_set_appcpu_boot_addr((uint32_t)call_user_start_cpu1); + + while (!app_cpu_started) { + ets_delay_us(100); + } +#else + ESP_EARLY_LOGI(TAG, "Single core mode"); + CLEAR_PERI_REG_MASK(APPCPU_CTRL_REG_B, DPORT_APPCPU_CLKGATE_EN); +#endif + ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); + user_start_cpu0(); } -extern esp_err_t app_main(void *ctx); -void user_start_cpu0(void) { +void IRAM_ATTR call_user_start_cpu1() +{ + asm volatile (\ + "wsr %0, vecbase\n" \ + ::"r"(&_init_start)); + + cpu_configure_region_protection(); + + ESP_EARLY_LOGI(TAG, "App cpu up."); + app_cpu_started = 1; + user_start_cpu1(); +} + +void IRAM_ATTR user_start_cpu1(void) +{ + // Wait for FreeRTOS initialization to finish on PRO CPU + while (port_xSchedulerRunning[0] == 0) { + ; + } + ESP_LOGI(TAG, "Starting scheduler on APP CPU."); + xPortStartScheduler(); +} + +static void do_global_ctors(void) +{ + void (**p)(void); + for (p = &__init_array_start; p != &__init_array_end; ++p) { + (*p)(); + } +} + +void user_start_cpu0(void) +{ ets_setup_syscalls(); - do_global_ctors(); - esp_ipc_init(); - spi_flash_init(); + do_global_ctors(); + esp_ipc_init(); + spi_flash_init(); #if CONFIG_WIFI_ENABLED esp_err_t ret = nvs_flash_init(5, 3); @@ -216,20 +153,18 @@ void user_start_cpu0(void) { } system_init(); - esp_event_init(NULL, NULL); - tcpip_adapter_init(); #endif #if CONFIG_WIFI_ENABLED && CONFIG_WIFI_AUTO_STARTUP #include "esp_wifi.h" - esp_wifi_startup(app_main, NULL); + esp_wifi_startup(app_main, NULL); #else - app_main(NULL); + app_main(NULL); #endif - ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); - vTaskStartScheduler(); + ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); + vTaskStartScheduler(); } diff --git a/components/esp32/include/soc/cpu.h b/components/esp32/include/soc/cpu.h index fdcf62190e..b45f742ce2 100644 --- a/components/esp32/include/soc/cpu.h +++ b/components/esp32/include/soc/cpu.h @@ -33,4 +33,39 @@ static inline bool cpu_in_interrupt_context(void) return (ps & PS_UM) == 0; } +/* Functions to set page attributes for Region Protection option in the CPU. + * See Xtensa ISA Reference manual for explanation of arguments (section 4.6.3.2). + */ + +static inline void cpu_write_dtlb(uint32_t vpn, unsigned attr) +{ + asm volatile ("wdtlb %1, %0; dsync\n" :: "r" (vpn), "r" (attr)); +} + + +static inline void cpu_write_itlb(unsigned vpn, unsigned attr) +{ + asm volatile ("witlb %1, %0; isync\n" :: "r" (vpn), "r" (attr)); +} + +/* Make page 0 access raise an exception. + * Also protect some other unused pages so we can catch weirdness. + * Useful attribute values: + * 0 — cached, RW + * 2 — bypass cache, RWX (default value after CPU reset) + * 15 — no access, raise exception + */ + +static inline void cpu_configure_region_protection() +{ + const uint32_t pages_to_protect[] = {0x00000000, 0x80000000, 0xa0000000, 0xc0000000, 0xe0000000}; + for (int i = 0; i < sizeof(pages_to_protect)/sizeof(pages_to_protect[0]); ++i) { + cpu_write_dtlb(pages_to_protect[i], 0xf); + cpu_write_itlb(pages_to_protect[i], 0xf); + } + cpu_write_dtlb(0x20000000, 0); + cpu_write_itlb(0x20000000, 0); +} + + #endif From 90e37d9eda0a56be49c5f0d1ffc795f3192a5167 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Sep 2016 02:17:08 +0800 Subject: [PATCH 008/179] fix whitespace after merge --- components/esp32/cpu_start.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 764a62c22c..4bf812238a 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -90,18 +90,18 @@ void IRAM_ATTR call_user_start_cpu0() #ifndef CONFIG_FREERTOS_UNICORE ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_user_start_cpu1); - SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); - CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_C_REG, DPORT_APPCPU_RUNSTALL); - SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); - CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); - ets_set_appcpu_boot_addr((uint32_t)call_user_start_cpu1); + SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); + CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_C_REG, DPORT_APPCPU_RUNSTALL); + SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); + CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); + ets_set_appcpu_boot_addr((uint32_t)call_user_start_cpu1); while (!app_cpu_started) { ets_delay_us(100); } #else ESP_EARLY_LOGI(TAG, "Single core mode"); - CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); + CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); #endif ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); user_start_cpu0(); From b0683b0bb4c22bd98aa4805ed933773fa7d8dae8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Sep 2016 02:37:54 +0800 Subject: [PATCH 009/179] components/esp32,bootloader: fix build esp32: use new register name in cpu_start bootloader: EXTRA_CFLAGS don't work any more, set global CFLAGS in Makefile.projbuild --- components/bootloader/Makefile.projbuild | 3 +++ components/bootloader/src/Makefile | 4 ++-- components/esp32/cpu_start.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/bootloader/Makefile.projbuild b/components/bootloader/Makefile.projbuild index cf8b05673f..d45cf144e7 100644 --- a/components/bootloader/Makefile.projbuild +++ b/components/bootloader/Makefile.projbuild @@ -45,4 +45,7 @@ $(COMPONENT_PATH)/src/sdkconfig: $(PROJECT_PATH)/sdkconfig bootloader-flash: $(BOOTLOADER_BIN) $(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src flash MAKEFLAGS= V=$(V) +else +CFLAGS += -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include + endif diff --git a/components/bootloader/src/Makefile b/components/bootloader/src/Makefile index 065593ccbf..f30e314a5f 100644 --- a/components/bootloader/src/Makefile +++ b/components/bootloader/src/Makefile @@ -11,7 +11,7 @@ COMPONENTS := esptool_py bootloader log # IS_BOOTLOADER_BUILD tells the component Makefile.projbuild to be a no-op IS_BOOTLOADER_BUILD := 1 -#We cannot include the esp32 component directly but we need its includes. This is fixed by -EXTRA_CFLAGS := -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include +#We cannot include the esp32 component directly but we need its includes. +#This is fixed by adding CFLAGS from Makefile.projbuild include $(IDF_PATH)/make/project.mk diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 4bf812238a..cb31fbd462 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -67,7 +67,7 @@ static bool app_cpu_started = false; void IRAM_ATTR call_user_start_cpu0() { //Kill wdt - REG_CLR_BIT(RTC_WDTCONFIG0, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); + REG_CLR_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); REG_CLR_BIT(0x6001f048, BIT(14)); //DR_REG_BB_BASE+48 cpu_configure_region_protection(); From 6cffb5d8b4b3b84daa0744021356be066f7ca698 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Sep 2016 09:43:52 +1000 Subject: [PATCH 010/179] rom/gpio.h: Use new GPIO_PIN0_REG register name Closes github #12 --- components/esp32/include/rom/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/include/rom/gpio.h b/components/esp32/include/rom/gpio.h index a6ca66f1de..b740a020b6 100644 --- a/components/esp32/include/rom/gpio.h +++ b/components/esp32/include/rom/gpio.h @@ -38,7 +38,7 @@ extern "C" { #define GPIO_PIN_COUNT 40 #define GPIO_ID_PIN0 0 #define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n)) -#define GPIO_PIN_ADDR(i) (GPIO_PIN0 + i*4) +#define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i*4) #define GPIO_ID_IS_PIN_REGISTER(reg_id) \ ((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1))) From 567cabb3f5c926828d70bb7f12aabcfd338ac9d0 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Sep 2016 14:31:46 +1000 Subject: [PATCH 011/179] docs: Add note about esp-idf not supporting spaces in paths Ref Github #10 --- docs/linux-setup.rst | 1 + docs/macos-setup.rst | 1 + docs/windows-setup.rst | 2 ++ 3 files changed, 4 insertions(+) diff --git a/docs/linux-setup.rst b/docs/linux-setup.rst index ee97651568..13e1b3a9c0 100644 --- a/docs/linux-setup.rst +++ b/docs/linux-setup.rst @@ -108,6 +108,7 @@ Note the ``--recursive`` option! If you have already cloned ESP-IDF without this cd ~/esp/esp-idf git submodule update --init +**IMPORTANT:** The esp-idf build system does not support spaces in paths to esp-idf or to projects. Step 3: Starting a project ========================== diff --git a/docs/macos-setup.rst b/docs/macos-setup.rst index d3869f4264..8178a17ada 100644 --- a/docs/macos-setup.rst +++ b/docs/macos-setup.rst @@ -122,6 +122,7 @@ The easiest way to start a project is to download the template project from GitH This will download ``esp-idf-template`` project into ``~/esp/myapp`` directory. +**IMPORTANT:** The esp-idf build system does not support spaces in paths to esp-idf or to projects. Step 4: Building and flashing the application ============================================= diff --git a/docs/windows-setup.rst b/docs/windows-setup.rst index 89b1341814..a368e3305c 100644 --- a/docs/windows-setup.rst +++ b/docs/windows-setup.rst @@ -59,6 +59,8 @@ The easiest way to start a project is to download the Getting Started project fr The process is the same as for checking out the ESP-IDF from github. Change to the parent directory and run ``git clone https://github.com/espressif/esp-idf-template.git``. +**IMPORTANT:** The esp-idf build system does not support spaces in paths to esp-idf or to projects. + Step 4: Configuring the project =============================== From cdd1b95b6e509d97ba5b89c8f45eb9eb45fb4b73 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Sep 2016 17:56:50 +1000 Subject: [PATCH 012/179] config system: Support Windows when CRLFs used for eol markers Includes a test in test_build_system.sh to prevent regressions w/ CRLFs in text files. Fixes Github #10 --- make/test_build_system.sh | 16 ++++++++++++++++ tools/kconfig/Makefile | 3 ++- tools/kconfig/zconf.l | 14 +++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/make/test_build_system.sh b/make/test_build_system.sh index cb42356f05..5be1504e3d 100755 --- a/make/test_build_system.sh +++ b/make/test_build_system.sh @@ -80,6 +80,22 @@ function run_tests() failure "Files weren't cleaned: ${ALL_BUILD_FILES}" fi + print_status "Can still clean build if all text files are CRLFs" + make clean + find . -exec unix2dos {} \; # CRLFify template dir + # make a copy of esp-idf and CRLFify it + CRLF_ESPIDF=${TESTDIR}/esp-idf-crlf + mkdir -p ${CRLF_ESPIDF} + cp -rv ${IDF_PATH}/* ${CRLF_ESPIDF} + # don't CRLFify executable files, as Linux will fail to execute them + find ${CRLF_ESPIDF} -type f ! -perm 755 -exec unix2dos {} \; + make IDF_PATH=${CRLF_ESPIDF} + # do the same checks we do for the clean build + assert_built ${APP_BINS} ${BOOTLOADER_BINS} partitions_singleapp.bin + [ -f ${BUILD}/partition*.bin ] || failure "A partition table should have been built in CRLF mode" + + # NOTE: If adding new tests, add them above this CRLF test... + print_status "All tests completed" if [ -n "${FAILURES}" ]; then echo "Some failures were detected:" diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 2df04f3f27..65b236d34a 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -301,7 +301,8 @@ zconf.lex.c: zconf.l flex -L -P zconf -o zconf.lex.c zconf.l zconf.hash.c: zconf.gperf - gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.gperf +# strip CRs on Windows systems where gperf will otherwise barf on them + sed -E "s/\r//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.tab.c: zconf.y bison -t -l -p zconf -o zconf.tab.c zconf.y diff --git a/tools/kconfig/zconf.l b/tools/kconfig/zconf.l index 8c787b5095..f0b65608f0 100644 --- a/tools/kconfig/zconf.l +++ b/tools/kconfig/zconf.l @@ -114,8 +114,8 @@ n [A-Za-z0-9_-] zconflval.string = text; return T_WORD; } - . warn_ignored_character(*yytext); - \n { + [^\r\n] warn_ignored_character(*yytext); + \r?\n { BEGIN(INITIAL); current_file->lineno++; return T_EOL; @@ -139,7 +139,7 @@ n [A-Za-z0-9_-] new_string(); BEGIN(STRING); } - \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; + \r?\n BEGIN(INITIAL); current_file->lineno++; return T_EOL; ({n}|[/.])+ { const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); if (id && id->flags & TF_PARAM) { @@ -184,7 +184,7 @@ n [A-Za-z0-9_-] } else append_string(yytext, 1); } - \n { + \r?\n { printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); current_file->lineno++; BEGIN(INITIAL); @@ -218,16 +218,16 @@ n [A-Za-z0-9_-] append_string(" ", ts); } } - [ \t]*\n/[^ \t\n] { + [ \t]*\r?\n/[^ \t\r\n] { current_file->lineno++; zconf_endhelp(); return T_HELPTEXT; } - [ \t]*\n { + [ \t]*\r?\n { current_file->lineno++; append_string("\n", 1); } - [^ \t\n].* { + [^ \t\r?\n].* { while (yyleng) { if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) break; From 90017397e517be09b77b07cbe0a0ca690f756979 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Sep 2016 18:05:52 +1000 Subject: [PATCH 013/179] Docs: Add note about unusual submodule messages when cloning on Windows Related to github #11 --- docs/windows-setup.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/windows-setup.rst b/docs/windows-setup.rst index a368e3305c..baea1ac40b 100644 --- a/docs/windows-setup.rst +++ b/docs/windows-setup.rst @@ -50,6 +50,8 @@ Change to the directory you want to clone the SDK into by typing a command like If you'd rather use a Windows UI tool to manage your git repositories, this is also possible. A wide range are available. +*NOTE*: While cloning submodules, the ``git clone`` command may print some output starting ``': not a valid identifier...``. This is a `known issue`_ but the git clone still succeeds without any problems. + Step 3: Starting a project ========================== @@ -76,3 +78,4 @@ If you'd like to use the Eclipse IDE instead of running ``make``, check out the .. _Eclipse: eclipse-setup.rst .. _MSYS2: https://msys2.github.io/ .. _github: https://github.com/espressif/esp-idf-template +.. _known issue: https://github.com/espressif/esp-idf/issues/11 From 6cf5d44b31789beafcacd5f74e337bea09206e04 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Sep 2016 18:22:16 +1000 Subject: [PATCH 014/179] build system docs: Add note about no spaces in component names --- docs/build_system.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/build_system.rst b/docs/build_system.rst index 43055a4787..4df65b1b5c 100644 --- a/docs/build_system.rst +++ b/docs/build_system.rst @@ -193,10 +193,13 @@ Because components usually live under the project directory (although they can also reside in an other folder), the path to this may be something like /home/myuser/projects/myprojects/components/httpd . +Components can have any name (unique to the project) but the name +cannot contain spaces (esp-idf does not support spaces in paths). + One of the things that most components will have is a component.mk makefile, containing instructions on how to build the component. Because the build environment tries to set reasonable defaults that will work most -of the time, component.mk can be very small. +of the time, component.mk can be very small. Simplest component.mk ===================== From 489b4f31a90cfcdd6056106dedf51c4057f7d6d1 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Sun, 18 Sep 2016 03:14:18 +0800 Subject: [PATCH 015/179] add peripheral module struct headers --- components/esp32/include/soc/gpio_sd_struct.h | 48 ++ components/esp32/include/soc/gpio_struct.h | 204 ++++++ components/esp32/include/soc/i2c_struct.h | 289 ++++++++ components/esp32/include/soc/i2s_struct.h | 461 ++++++++++++ components/esp32/include/soc/ledc_struct.h | 300 ++++++++ components/esp32/include/soc/pcnt_struct.h | 161 +++++ components/esp32/include/soc/rmt_struct.h | 228 ++++++ components/esp32/include/soc/spi_struct.h | 677 ++++++++++++++++++ .../esp32/include/soc/timer_group_struct.h | 195 +++++ components/esp32/include/soc/uart_struct.h | 365 ++++++++++ components/esp32/include/soc/uhci_struct.h | 337 +++++++++ components/esp32/ld/esp32.rom.ld | 23 +- 12 files changed, 3287 insertions(+), 1 deletion(-) create mode 100644 components/esp32/include/soc/gpio_sd_struct.h create mode 100644 components/esp32/include/soc/gpio_struct.h create mode 100644 components/esp32/include/soc/i2c_struct.h create mode 100644 components/esp32/include/soc/i2s_struct.h create mode 100644 components/esp32/include/soc/ledc_struct.h create mode 100644 components/esp32/include/soc/pcnt_struct.h create mode 100644 components/esp32/include/soc/rmt_struct.h create mode 100644 components/esp32/include/soc/spi_struct.h create mode 100644 components/esp32/include/soc/timer_group_struct.h create mode 100644 components/esp32/include/soc/uart_struct.h create mode 100644 components/esp32/include/soc/uhci_struct.h diff --git a/components/esp32/include/soc/gpio_sd_struct.h b/components/esp32/include/soc/gpio_sd_struct.h new file mode 100644 index 0000000000..a1b17bfc5a --- /dev/null +++ b/components/esp32/include/soc/gpio_sd_struct.h @@ -0,0 +1,48 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_GPIO_SD_STRUCT_H_ +#define _SOC_GPIO_SD_STRUCT_H_ +typedef struct { + union { + struct { + volatile uint32_t sd_in: 8; + volatile uint32_t prescale: 8; + volatile uint32_t reserved16: 16; + }; + volatile uint32_t val; + }sigmadelta[8]; + union { + struct { + volatile uint32_t reserved0: 31; + volatile uint32_t clk_en: 1; + }; + volatile uint32_t val; + }sigmadelta_cg; + union { + struct { + volatile uint32_t reserved0: 31; + volatile uint32_t spi_swap: 1; + }; + volatile uint32_t val; + }sigmadelta_misc; + union { + struct { + volatile uint32_t date: 28; + volatile uint32_t reserved28: 4; + }; + volatile uint32_t val; + }sigmadelta_version; +} gpio_sd_dev_t; +extern volatile gpio_sd_dev_t SIGMADELTA; +#endif /* _SOC_GPIO_SD_STRUCT_H_ */ diff --git a/components/esp32/include/soc/gpio_struct.h b/components/esp32/include/soc/gpio_struct.h new file mode 100644 index 0000000000..f42de7a294 --- /dev/null +++ b/components/esp32/include/soc/gpio_struct.h @@ -0,0 +1,204 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_GPIO_STRUCT_H_ +#define _SOC_GPIO_STRUCT_H_ +typedef struct { + volatile uint32_t bt_select; /*NA*/ + volatile uint32_t out; /*GPIO0~31 output value*/ + volatile uint32_t out_w1ts; /*GPIO0~31 output value write 1 to set*/ + volatile uint32_t out_w1tc; /*GPIO0~31 output value write 1 to clear*/ + union { + struct { + volatile uint32_t out_data: 8; /*GPIO32~39 output value*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }out1; + union { + struct { + volatile uint32_t out_data: 8; /*GPIO32~39 output value write 1 to set*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }out1_w1ts; + union { + struct { + volatile uint32_t out_data: 8; /*GPIO32~39 output value write 1 to clear*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }out1_w1tc; + union { + struct { + volatile uint32_t sdio_sel: 8; /*SDIO PADS on/off control from outside*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }sdio_select; + volatile uint32_t enable; /*GPIO0~31 output enable*/ + volatile uint32_t enable_w1ts; /*GPIO0~31 output enable write 1 to set*/ + volatile uint32_t enable_w1tc; /*GPIO0~31 output enable write 1 to clear*/ + union { + struct { + volatile uint32_t enable_data: 8; /*GPIO32~39 output enable*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }enable1; + union { + struct { + volatile uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to set*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }enable1_w1ts; + union { + struct { + volatile uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to clear*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }enable1_w1tc; + union { + struct { + volatile uint32_t strapping: 16; /*GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel boot_sel_chip[5:0]}. Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3}. vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5}*/ + volatile uint32_t reserved16:16; + }; + volatile uint32_t val; + }strap; + volatile uint32_t in; /*GPIO0~31 input value*/ + union { + struct { + volatile uint32_t in_data: 8; /*GPIO32~39 input value*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }in1; + volatile uint32_t status; /*GPIO0~31 interrupt status*/ + volatile uint32_t status_w1ts; /*GPIO0~31 interrupt status write 1 to set*/ + volatile uint32_t status_w1tc; /*GPIO0~31 interrupt status write 1 to clear*/ + union { + struct { + volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }status1; + union { + struct { + volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to set*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }status1_w1ts; + union { + struct { + volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to clear*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }status1_w1tc; + volatile uint32_t reserved_5c; + volatile uint32_t acpu_int; /*GPIO0~31 APP CPU interrupt status*/ + volatile uint32_t acpu_nmi_int; /*GPIO0~31 APP CPU non-maskable interrupt status*/ + volatile uint32_t pcpu_int; /*GPIO0~31 PRO CPU interrupt status*/ + volatile uint32_t pcpu_nmi_int; /*GPIO0~31 PRO CPU non-maskable interrupt status*/ + volatile uint32_t cpusdio_int; /*SDIO's extent GPIO0~31 interrupt*/ + union { + struct { + volatile uint32_t appcpu_int: 8; /*GPIO32~39 APP CPU interrupt status*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }acpu_int1; + union { + struct { + volatile uint32_t appcpu_nmi_int: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }acpu_nmi_int1; + union { + struct { + volatile uint32_t procpu_int: 8; /*GPIO32~39 PRO CPU interrupt status*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }pcpu_int1; + union { + struct { + volatile uint32_t procpu_nmi_int: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }pcpu_nmi_int1; + union { + struct { + volatile uint32_t sdio_int: 8; /*SDIO's extent GPIO32~39 interrupt*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }cpusdio_int1; + union { + struct { + volatile uint32_t reserved0: 2; + volatile uint32_t pin_pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ + volatile uint32_t reserved3: 4; + volatile uint32_t pin_int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ + volatile uint32_t pin_wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ + volatile uint32_t pin_config: 2; /*NA*/ + volatile uint32_t pin_int_ena: 5; /*bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt enable bit3: PRO CPU interrupt enable bit4: PRO CPU non-maskable interrupt enable bit5: SDIO's extent interrupt enable*/ + volatile uint32_t reserved18: 14; + }; + volatile uint32_t val; + }pin[40]; + union { + struct { + volatile uint32_t cali_rtc_max:10; + volatile uint32_t reserved10: 21; + volatile uint32_t cali_start: 1; + }; + volatile uint32_t val; + }cali_conf; + union { + struct { + volatile uint32_t cali_value_sync2:20; + volatile uint32_t reserved20: 10; + volatile uint32_t cali_rdy_real: 1; + volatile uint32_t cali_rdy_sync2: 1; + }; + volatile uint32_t val; + }cali_data; + union { + struct { + volatile uint32_t func_in_sel: 6; /*select one of the 256 inputs*/ + volatile uint32_t func_in_inv_sel: 1; /*revert the value of the input if you want to revert please set the value to 1*/ + volatile uint32_t sig_in_sel: 1; /*if the slow signal bypass the io matrix or not if you want setting the value to 1*/ + volatile uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ + }; + volatile uint32_t val; + }func_in_sel_cfg[256]; + union { + struct { + volatile uint32_t func_out_sel: 9; /*select one of the 256 output to 40 GPIO*/ + volatile uint32_t func_out_inv_sel: 1; /*invert the output value if you want to revert the output value setting the value to 1*/ + volatile uint32_t func_oen_sel: 1; /*weather using the logical oen signal or not using the value setting by the register*/ + volatile uint32_t func_oen_inv_sel: 1; /*invert the output enable value if you want to revert the output enable value setting the value to 1*/ + volatile uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ + }; + volatile uint32_t val; + }func_out_sel_cfg[40]; +} gpio_dev_t; +extern volatile gpio_dev_t GPIO; +#endif /* _SOC_GPIO_STRUCT_H_ */ diff --git a/components/esp32/include/soc/i2c_struct.h b/components/esp32/include/soc/i2c_struct.h new file mode 100644 index 0000000000..78f895c029 --- /dev/null +++ b/components/esp32/include/soc/i2c_struct.h @@ -0,0 +1,289 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_I2C_STRUCT_H_ +#define _SOC_I2C_STRUCT_H_ +typedef struct { + union { + struct { + volatile uint32_t scl_low_period:14; /*This register is used to configure the low level width of SCL clock.*/ + volatile uint32_t reserved14: 18; + }; + volatile uint32_t val; + }scl_low_period; + union { + struct { + volatile uint32_t sda_force_out: 1; /*1:normally output sda data 0: exchange the function of sda_o and sda_oe (sda_o is the original internal output sda signal sda_oe is the enable bit for the internal output sda signal)*/ + volatile uint32_t scl_force_out: 1; /*1:normally output scl clock 0: exchange the function of scl_o and scl_oe (scl_o is the original internal output scl signal scl_oe is the enable bit for the internal output scl signal)*/ + volatile uint32_t sample_scl_level: 1; /*Set this bit to sample data in SCL low level. clear this bit to sample data in SCL high level.*/ + volatile uint32_t reserved3: 1; + volatile uint32_t ms_mode: 1; /*Set this bit to configure the module as i2c master clear this bit to configure the module as i2c slave.*/ + volatile uint32_t trans_start: 1; /*Set this bit to start sending data in tx_fifo.*/ + volatile uint32_t tx_lsb_first: 1; /*This bit is used to control the sending mode for data need to be send. 1:receive data from most significant bit 0:receive data from least significant bit*/ + volatile uint32_t rx_lsb_first: 1; /*This bit is used to control the storage mode for received data. 1:receive data from most significant bit 0:receive data from least significant bit*/ + volatile uint32_t clk_en: 1; /*This is the clock gating control bit for reading or writing registers.*/ + volatile uint32_t reserved9: 23; + }; + volatile uint32_t val; + }ctr; + union { + struct { + volatile uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/ + volatile uint32_t slave_rw: 1; /*when in slave mode 1:master read slave 0: master write slave.*/ + volatile uint32_t time_out: 1; /*when I2C takes more than time_out_reg clocks to receive a data then this register changes to high level.*/ + volatile uint32_t arb_lost: 1; /*when I2C lost control of SDA line this register changes to high level.*/ + volatile uint32_t bus_busy: 1; /*1:I2C bus is busy transferring data. 0:I2C bus is in idle state.*/ + volatile uint32_t slave_addressed: 1; /*when configured as i2c slave and the address send by master is equal to slave's address then this bit will be high level.*/ + volatile uint32_t byte_trans: 1; /*This register changes to high level when one byte is transferred.*/ + volatile uint32_t reserved7: 1; + volatile uint32_t rx_fifo_cnt: 6; /*This register represent the amount of data need to send.*/ + volatile uint32_t reserved14: 4; + volatile uint32_t tx_fifo_cnt: 6; /*This register stores the amount of received data in ram.*/ + volatile uint32_t scl_main_state_last: 3; /*This register stores the value of state machine for i2c module. 3'h0: SCL_MAIN_IDLE 3'h1: SCL_ADDRESS_SHIFT 3'h2: SCL_ACK_ADDRESS 3'h3: SCL_RX_DATA 3'h4 SCL_TX_DATA 3'h5:SCL_SEND_ACK 3'h6:SCL_WAIT_ACK*/ + volatile uint32_t reserved27: 1; + volatile uint32_t scl_state_last: 3; /*This register stores the value of state machine to produce SCL. 3'h0: SCL_IDLE 3'h1:SCL_START 3'h2:SCL_LOW_EDGE 3'h3: SCL_LOW 3'h4:SCL_HIGH_EDGE 3'h5:SCL_HIGH 3'h6:SCL_STOP*/ + volatile uint32_t reserved31: 1; + }; + volatile uint32_t val; + }status_reg; + union { + struct { + volatile uint32_t time_out: 20; /*This register is used to configure the max clock number of receiving a data.*/ + volatile uint32_t reserved20:12; + }; + volatile uint32_t val; + }timeout; + union { + struct { + volatile uint32_t slave_addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ + volatile uint32_t reserved15: 16; + volatile uint32_t addr_10bit_en: 1; /*This register is used to enable slave 10bit address mode.*/ + }; + volatile uint32_t val; + }slave_addr; + union { + struct { + volatile uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ + volatile uint32_t rx_fifo_end_addr: 5; /*This is the offset address of the first receiving data as described in nonfifo_rx_thres_register.*/ + volatile uint32_t tx_fifo_start_addr: 5; /*This is the offset address of the first sending data as described in nonfifo_tx_thres register.*/ + volatile uint32_t tx_fifo_end_addr: 5; /*This is the offset address of the last sending data as described in nonfifo_tx_thres register.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }rx_fifo_st; + union { + struct { + volatile uint32_t rx_fifo_full_thrhd: 5; + volatile uint32_t tx_fifo_empty_thrhd:5; /*Config tx_fifo empty threhd value when using apb fifo access*/ + volatile uint32_t nonfifo_en: 1; /*Set this bit to enble apb nonfifo access.*/ + volatile uint32_t fifo_addr_cfg_en: 1; /*When this bit is set to 1 then the byte after address represent the offset address of I2C Slave's ram.*/ + volatile uint32_t rx_fifo_rst: 1; /*Set this bit to reset rx fifo when using apb fifo access.*/ + volatile uint32_t tx_fifo_rst: 1; /*Set this bit to reset tx fifo when using apb fifo access.*/ + volatile uint32_t nonfifo_rx_thres: 6; /*when I2C receives more than nonfifo_rx_thres data it will produce rx_send_full_int_raw interrupt and update the current offset address of the receiving data.*/ + volatile uint32_t nonfifo_tx_thres: 6; /*when I2C sends more than nonfifo_tx_thres data it will produce tx_send_empty_int_raw interrupt and update the current offset address of the sending data.*/ + volatile uint32_t reserved26: 6; + }; + volatile uint32_t val; + }fifo_conf; + union { + struct { + volatile uint32_t fifo_rdata: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }fifo_data; + union { + struct { + volatile uint32_t rx_fifo_full_int_raw: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ + volatile uint32_t tx_fifo_empty_int_raw: 1; /*The raw interrupt status bit for tx_fifo empty when use apb fifo access.*/ + volatile uint32_t rx_fifo_ovf_int_raw: 1; /*The raw interrupt status bit for receiving data overflow when use apb fifo access.*/ + volatile uint32_t end_detect_int_raw: 1; /*The raw interrupt status bit for end_detect_int interrupt. when I2C deals with the END command it will produce end_detect_int interrupt.*/ + volatile uint32_t slave_tran_comp_int_raw: 1; /*The raw interrupt status bit for slave_tran_comp_int interrupt. when I2C Slave detects the STOP bit it will produce slave_tran_comp_int interrupt.*/ + volatile uint32_t arbitration_lost_int_raw: 1; /*The raw interrupt status bit for arbitration_lost_int interrupt.when I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ + volatile uint32_t master_tran_comp_int_raw: 1; /*The raw interrupt status bit for master_tra_comp_int interrupt. when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ + volatile uint32_t trans_complete_int_raw: 1; /*The raw interrupt status bit for trans_complete_int interrupt. when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ + volatile uint32_t time_out_int_raw: 1; /*The raw interrupt status bit for time_out_int interrupt. when I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ + volatile uint32_t trans_start_int_raw: 1; /*The raw interrupt status bit for trans_start_int interrupt. when I2C sends the START bit it will produce trans_start_int interrupt.*/ + volatile uint32_t ack_err_int_raw: 1; /*The raw interrupt status bit for ack_err_int interrupt. when I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ + volatile uint32_t rx_rec_full_int_raw: 1; /*The raw interrupt status bit for rx_rec_full_int interrupt. when I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ + volatile uint32_t tx_send_empty_int_raw: 1; /*The raw interrupt status bit for tx_send_empty_int interrupt.when I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ + volatile uint32_t reserved13: 19; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t rx_fifo_full_int_clr: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ + volatile uint32_t tx_fifo_empty_int_clr: 1; /*Set this bit to clear the tx_fifo_empty_int interrupt.*/ + volatile uint32_t rx_fifo_ovf_int_clr: 1; /*Set this bit to clear the rx_fifo_ovf_int interrupt.*/ + volatile uint32_t end_detect_int_clr: 1; /*Set this bit to clear the end_detect_int interrupt.*/ + volatile uint32_t slave_tran_comp_int_clr: 1; /*Set this bit to clear the slave_tran_comp_int interrupt.*/ + volatile uint32_t arbitration_lost_int_clr: 1; /*Set this bit to clear the arbitration_lost_int interrupt.*/ + volatile uint32_t master_tran_comp_int_clr: 1; /*Set this bit to clear the master_tran_comp interrupt.*/ + volatile uint32_t trans_complete_int_clr: 1; /*Set this bit to clear the trans_complete_int interrupt.*/ + volatile uint32_t time_out_int_clr: 1; /*Set this bit to clear the time_out_int interrupt.*/ + volatile uint32_t trans_start_int_clr: 1; /*Set this bit to clear the trans_start_int interrupt.*/ + volatile uint32_t ack_err_int_clr: 1; /*Set this bit to clear the ack_err_int interrupt.*/ + volatile uint32_t rx_rec_full_int_clr: 1; /*Set this bit to clear the rx_rec_full_int interrupt.*/ + volatile uint32_t tx_send_empty_int_clr: 1; /*Set this bit to clear the tx_send_empty_int interrupt.*/ + volatile uint32_t reserved13: 19; + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t rx_fifo_full_int_ena: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ + volatile uint32_t tx_fifo_empty_int_ena: 1; /*The enable bit for tx_fifo_empty_int interrupt.*/ + volatile uint32_t rx_fifo_ovf_int_ena: 1; /*The enable bit for rx_fifo_ovf_int interrupt.*/ + volatile uint32_t end_detect_int_ena: 1; /*The enable bit for end_detect_int interrupt.*/ + volatile uint32_t slave_tran_comp_int_ena: 1; /*The enable bit for slave_tran_comp_int interrupt.*/ + volatile uint32_t arbitration_lost_int_ena: 1; /*The enable bit for arbitration_lost_int interrupt.*/ + volatile uint32_t master_tran_comp_int_ena: 1; /*The enable bit for master_tran_comp_int interrupt.*/ + volatile uint32_t trans_complete_int_ena: 1; /*The enable bit for trans_complete_int interrupt.*/ + volatile uint32_t time_out_int_ena: 1; /*The enable bit for time_out_int interrupt.*/ + volatile uint32_t trans_start_int_ena: 1; /*The enable bit for trans_start_int interrupt.*/ + volatile uint32_t ack_err_int_ena: 1; /*The enable bit for ack_err_int interrupt.*/ + volatile uint32_t rx_rec_full_int_ena: 1; /*The enable bit for rx_rec_full_int interrupt.*/ + volatile uint32_t tx_send_empty_int_ena: 1; /*The enable bit for tx_send_empty_int interrupt.*/ + volatile uint32_t reserved13: 19; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t rx_fifo_full_int_st: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ + volatile uint32_t tx_fifo_empty_int_st: 1; /*The masked interrupt status for tx_fifo_empty_int interrupt.*/ + volatile uint32_t rx_fifo_ovf_int_st: 1; /*The masked interrupt status for rx_fifo_ovf_int interrupt.*/ + volatile uint32_t end_detect_int_st: 1; /*The masked interrupt status for end_detect_int interrupt.*/ + volatile uint32_t slave_tran_comp_int_st: 1; /*The masked interrupt status for slave_tran_comp_int interrupt.*/ + volatile uint32_t arbitration_lost_int_st: 1; /*The masked interrupt status for arbitration_lost_int interrupt.*/ + volatile uint32_t master_tran_comp_int_st: 1; /*The masked interrupt status for master_tran_comp_int interrupt.*/ + volatile uint32_t trans_complete_int_st: 1; /*The masked interrupt status for trans_complete_int interrupt.*/ + volatile uint32_t time_out_int_st: 1; /*The masked interrupt status for time_out_int interrupt.*/ + volatile uint32_t trans_start_int_st: 1; /*The masked interrupt status for trans_start_int interrupt.*/ + volatile uint32_t ack_err_int_st: 1; /*The masked interrupt status for ack_err_int interrupt.*/ + volatile uint32_t rx_rec_full_int_st: 1; /*The masked interrupt status for rx_rec_full_int interrupt.*/ + volatile uint32_t tx_send_empty_int_st: 1; /*The masked interrupt status for tx_send_empty_int interrupt.*/ + volatile uint32_t reserved13: 19; + }; + volatile uint32_t val; + }int_status; + union { + struct { + volatile uint32_t sda_hold_time:10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }sda_hold; + union { + struct { + volatile uint32_t sda_sample_time:10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }sda_sample; + union { + struct { + volatile uint32_t scl_high_period:14; /*This register is used to configure the clock num during SCL is low level.*/ + volatile uint32_t reserved14: 18; + }; + volatile uint32_t val; + }scl_high_period; + volatile uint32_t reserved_3c; + union { + struct { + volatile uint32_t scl_start_hold_time:10; /*This register is used to configure the clock num between the negedge of SDA and negedge of SCL for start mark.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }scl_start_hold; + union { + struct { + volatile uint32_t scl_rstart_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }scl_rstart_setup; + union { + struct { + volatile uint32_t scl_stop_hold_time:14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ + volatile uint32_t reserved14: 18; + }; + volatile uint32_t val; + }scl_stop_hold; + union { + struct { + volatile uint32_t scl_stop_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }scl_stop_setup; + union { + struct { + volatile uint32_t scl_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + volatile uint32_t scl_filter_en: 1; /*This is the filter enable bit for SCL.*/ + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }scl_filter_cfg; + union { + struct { + volatile uint32_t sda_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + volatile uint32_t sda_filter_en: 1; /*This is the filter enable bit for SDA.*/ + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }sda_filter_cfg; + union { + struct { + volatile uint32_t byte_num: 8; /*Byte_num represent the number of data need to be send or data need to be received.*/ + volatile uint32_t ack_en: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + volatile uint32_t ack_exp: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + volatile uint32_t ack_val: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + volatile uint32_t op_code: 3; /*op_code is the command 0:RSTART 1:WRITE 2:READ 3:STOP . 4:END.*/ + volatile uint32_t reserved14: 17; + volatile uint32_t command_done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ + }; + volatile uint32_t val; + }command[16]; + volatile uint32_t reserved_98; + volatile uint32_t reserved_9c; + volatile uint32_t reserved_a0; + volatile uint32_t reserved_a4; + volatile uint32_t reserved_a8; + volatile uint32_t reserved_ac; + volatile uint32_t reserved_b0; + volatile uint32_t reserved_b4; + volatile uint32_t reserved_b8; + volatile uint32_t reserved_bc; + volatile uint32_t reserved_c0; + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + volatile uint32_t reserved_f0; + volatile uint32_t reserved_f4; + volatile uint32_t date; /**/ + volatile uint32_t reserved_fc; + volatile uint32_t fifo_start_addr; /*This the start address for ram when use apb nonfifo access.*/ +} i2c_dev_t; +extern volatile i2c_dev_t I2C0; +extern volatile i2c_dev_t I2C1; +#endif /* _SOC_I2C_STRUCT_H_ */ diff --git a/components/esp32/include/soc/i2s_struct.h b/components/esp32/include/soc/i2s_struct.h new file mode 100644 index 0000000000..beea328a35 --- /dev/null +++ b/components/esp32/include/soc/i2s_struct.h @@ -0,0 +1,461 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_I2S_STRUCT_H_ +#define _SOC_I2S_STRUCT_H_ +typedef struct { + volatile uint32_t reserved_0; + volatile uint32_t reserved_4; + union { + struct { + volatile uint32_t tx_reset: 1; + volatile uint32_t rx_reset: 1; + volatile uint32_t tx_fifo_reset: 1; + volatile uint32_t rx_fifo_reset: 1; + volatile uint32_t tx_start: 1; + volatile uint32_t rx_start: 1; + volatile uint32_t tx_slave_mod: 1; + volatile uint32_t rx_slave_mod: 1; + volatile uint32_t tx_right_first: 1; + volatile uint32_t rx_right_first: 1; + volatile uint32_t tx_msb_shift: 1; + volatile uint32_t rx_msb_shift: 1; + volatile uint32_t tx_short_sync: 1; + volatile uint32_t rx_short_sync: 1; + volatile uint32_t tx_mono: 1; + volatile uint32_t rx_mono: 1; + volatile uint32_t tx_msb_right: 1; + volatile uint32_t rx_msb_right: 1; + volatile uint32_t sig_loopback: 1; + volatile uint32_t reserved19: 13; + }; + volatile uint32_t val; + }conf; + union { + struct { + volatile uint32_t rx_take_data_int_raw: 1; + volatile uint32_t tx_put_data_int_raw: 1; + volatile uint32_t rx_wfull_int_raw: 1; + volatile uint32_t rx_rempty_int_raw: 1; + volatile uint32_t tx_wfull_int_raw: 1; + volatile uint32_t tx_rempty_int_raw: 1; + volatile uint32_t rx_hung_int_raw: 1; + volatile uint32_t tx_hung_int_raw: 1; + volatile uint32_t in_done_int_raw: 1; + volatile uint32_t in_suc_eof_int_raw: 1; + volatile uint32_t in_err_eof_int_raw: 1; + volatile uint32_t out_done_int_raw: 1; + volatile uint32_t out_eof_int_raw: 1; + volatile uint32_t in_dscr_err_int_raw: 1; + volatile uint32_t out_dscr_err_int_raw: 1; + volatile uint32_t in_dscr_empty_int_raw: 1; + volatile uint32_t out_total_eof_int_raw: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t rx_take_data_int_st: 1; + volatile uint32_t tx_put_data_int_st: 1; + volatile uint32_t rx_wfull_int_st: 1; + volatile uint32_t rx_rempty_int_st: 1; + volatile uint32_t tx_wfull_int_st: 1; + volatile uint32_t tx_rempty_int_st: 1; + volatile uint32_t rx_hung_int_st: 1; + volatile uint32_t tx_hung_int_st: 1; + volatile uint32_t in_done_int_st: 1; + volatile uint32_t in_suc_eof_int_st: 1; + volatile uint32_t in_err_eof_int_st: 1; + volatile uint32_t out_done_int_st: 1; + volatile uint32_t out_eof_int_st: 1; + volatile uint32_t in_dscr_err_int_st: 1; + volatile uint32_t out_dscr_err_int_st: 1; + volatile uint32_t in_dscr_empty_int_st: 1; + volatile uint32_t out_total_eof_int_st: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t rx_take_data_int_ena: 1; + volatile uint32_t tx_put_data_int_ena: 1; + volatile uint32_t rx_wfull_int_ena: 1; + volatile uint32_t rx_rempty_int_ena: 1; + volatile uint32_t tx_wfull_int_ena: 1; + volatile uint32_t tx_rempty_int_ena: 1; + volatile uint32_t rx_hung_int_ena: 1; + volatile uint32_t tx_hung_int_ena: 1; + volatile uint32_t in_done_int_ena: 1; + volatile uint32_t in_suc_eof_int_ena: 1; + volatile uint32_t in_err_eof_int_ena: 1; + volatile uint32_t out_done_int_ena: 1; + volatile uint32_t out_eof_int_ena: 1; + volatile uint32_t in_dscr_err_int_ena: 1; + volatile uint32_t out_dscr_err_int_ena: 1; + volatile uint32_t in_dscr_empty_int_ena: 1; + volatile uint32_t out_total_eof_int_ena: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t take_data_int_clr: 1; + volatile uint32_t put_data_int_clr: 1; + volatile uint32_t rx_wfull_int_clr: 1; + volatile uint32_t rx_rempty_int_clr: 1; + volatile uint32_t tx_wfull_int_clr: 1; + volatile uint32_t tx_rempty_int_clr: 1; + volatile uint32_t rx_hung_int_clr: 1; + volatile uint32_t tx_hung_int_clr: 1; + volatile uint32_t in_done_int_clr: 1; + volatile uint32_t in_suc_eof_int_clr: 1; + volatile uint32_t in_err_eof_int_clr: 1; + volatile uint32_t out_done_int_clr: 1; + volatile uint32_t out_eof_int_clr: 1; + volatile uint32_t in_dscr_err_int_clr: 1; + volatile uint32_t out_dscr_err_int_clr: 1; + volatile uint32_t in_dscr_empty_int_clr: 1; + volatile uint32_t out_total_eof_int_clr: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t tx_bck_in_delay: 2; + volatile uint32_t tx_ws_in_delay: 2; + volatile uint32_t rx_bck_in_delay: 2; + volatile uint32_t rx_ws_in_delay: 2; + volatile uint32_t rx_sd_in_delay: 2; + volatile uint32_t tx_bck_out_delay: 2; + volatile uint32_t tx_ws_out_delay: 2; + volatile uint32_t tx_sd_out_delay: 2; + volatile uint32_t rx_ws_out_delay: 2; + volatile uint32_t rx_bck_out_delay: 2; + volatile uint32_t tx_dsync_sw: 1; + volatile uint32_t rx_dsync_sw: 1; + volatile uint32_t data_enable_delay: 2; + volatile uint32_t tx_bck_in_inv: 1; + volatile uint32_t reserved25: 7; + }; + volatile uint32_t val; + }timing; + union { + struct { + volatile uint32_t rx_data_num: 6; + volatile uint32_t tx_data_num: 6; + volatile uint32_t dscr_en: 1; + volatile uint32_t tx_fifo_mod: 3; + volatile uint32_t rx_fifo_mod: 3; + volatile uint32_t tx_fifo_mod_force_en: 1; + volatile uint32_t rx_fifo_mod_force_en: 1; + volatile uint32_t reserved21: 11; + }; + volatile uint32_t val; + }fifo_conf; + volatile uint32_t rx_eof_num; + volatile uint32_t conf_single_data; + union { + struct { + volatile uint32_t tx_chan_mod: 3; + volatile uint32_t rx_chan_mod: 2; + volatile uint32_t reserved5: 27; + }; + volatile uint32_t val; + }conf_chan; + union { + struct { + volatile uint32_t outlink_addr: 20; + volatile uint32_t reserved20: 8; + volatile uint32_t outlink_stop: 1; + volatile uint32_t outlink_start: 1; + volatile uint32_t outlink_restart: 1; + volatile uint32_t outlink_park: 1; + }; + volatile uint32_t val; + }out_link; + union { + struct { + volatile uint32_t inlink_addr: 20; + volatile uint32_t reserved20: 8; + volatile uint32_t inlink_stop: 1; + volatile uint32_t inlink_start: 1; + volatile uint32_t inlink_restart: 1; + volatile uint32_t inlink_park: 1; + }; + volatile uint32_t val; + }in_link; + volatile uint32_t out_eof_des_addr; + volatile uint32_t in_eof_des_addr; + volatile uint32_t out_eof_bfr_des_addr; + union { + struct { + volatile uint32_t ahb_testmode: 3; + volatile uint32_t reserved3: 1; + volatile uint32_t ahb_testaddr: 2; + volatile uint32_t reserved6: 26; + }; + volatile uint32_t val; + }ahb_test; + volatile uint32_t in_link_dscr; + volatile uint32_t in_link_dscr_bf0; + volatile uint32_t in_link_dscr_bf1; + volatile uint32_t out_link_dscr; + volatile uint32_t out_link_dscr_bf0; + volatile uint32_t out_link_dscr_bf1; + union { + struct { + volatile uint32_t in_rst: 1; + volatile uint32_t out_rst: 1; + volatile uint32_t ahbm_fifo_rst: 1; + volatile uint32_t ahbm_rst: 1; + volatile uint32_t out_loop_test: 1; + volatile uint32_t in_loop_test: 1; + volatile uint32_t out_auto_wrback: 1; + volatile uint32_t out_no_restart_clr: 1; + volatile uint32_t out_eof_mode: 1; + volatile uint32_t outdscr_burst_en: 1; + volatile uint32_t indscr_burst_en: 1; + volatile uint32_t out_data_burst_en: 1; + volatile uint32_t check_owner: 1; + volatile uint32_t mem_trans_en: 1; + volatile uint32_t reserved14: 18; + }; + volatile uint32_t val; + }lc_conf; + union { + struct { + volatile uint32_t out_fifo_wdata: 9; + volatile uint32_t reserved9: 7; + volatile uint32_t out_fifo_push: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }out_fifo_push; + union { + struct { + volatile uint32_t in_fifo_rdata:12; + volatile uint32_t reserved12: 4; + volatile uint32_t in_fifo_pop: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }in_fifo_pop; + volatile uint32_t lc_state0; + volatile uint32_t lc_state1; + union { + struct { + volatile uint32_t lc_fifo_timeout: 8; + volatile uint32_t lc_fifo_timeout_shift: 3; + volatile uint32_t lc_fifo_timeout_ena: 1; + volatile uint32_t reserved12: 20; + }; + volatile uint32_t val; + }lc_hung_conf; + volatile uint32_t reserved_78; + volatile uint32_t reserved_7c; + union { + struct { + volatile uint32_t cvsd_y_max:16; + volatile uint32_t cvsd_y_min:16; + }; + volatile uint32_t val; + }cvsd_conf0; + union { + struct { + volatile uint32_t cvsd_sigma_max:16; + volatile uint32_t cvsd_sigma_min:16; + }; + volatile uint32_t val; + }cvsd_conf1; + union { + struct { + volatile uint32_t cvsd_k: 3; + volatile uint32_t cvsd_j: 3; + volatile uint32_t cvsd_beta: 10; + volatile uint32_t cvsd_h: 3; + volatile uint32_t reserved19:13; + }; + volatile uint32_t val; + }cvsd_conf2; + union { + struct { + volatile uint32_t good_pack_max: 6; + volatile uint32_t n_err_seg: 3; + volatile uint32_t shift_rate: 3; + volatile uint32_t max_slide_sample: 8; + volatile uint32_t pack_len_8k: 5; + volatile uint32_t n_min_err: 3; + volatile uint32_t reserved28: 4; + }; + volatile uint32_t val; + }plc_conf0; + union { + struct { + volatile uint32_t bad_cef_atten_para: 8; + volatile uint32_t bad_cef_atten_para_shift: 4; + volatile uint32_t bad_ola_win2_para_shift: 4; + volatile uint32_t bad_ola_win2_para: 8; + volatile uint32_t slide_win_len: 8; + }; + volatile uint32_t val; + }plc_conf1; + union { + struct { + volatile uint32_t cvsd_seg_mod: 2; + volatile uint32_t min_period: 5; + volatile uint32_t reserved7: 25; + }; + volatile uint32_t val; + }plc_conf2; + union { + struct { + volatile uint32_t esco_en: 1; + volatile uint32_t esco_chan_mod: 1; + volatile uint32_t esco_cvsd_dec_pack_err: 1; + volatile uint32_t esco_cvsd_pack_len_8k: 5; + volatile uint32_t esco_cvsd_inf_en: 1; + volatile uint32_t cvsd_dec_start: 1; + volatile uint32_t cvsd_dec_reset: 1; + volatile uint32_t plc_en: 1; + volatile uint32_t plc2dma_en: 1; + volatile uint32_t reserved13: 19; + }; + volatile uint32_t val; + }esco_conf0; + union { + struct { + volatile uint32_t sco_with_en: 1; + volatile uint32_t sco_no_en: 1; + volatile uint32_t cvsd_enc_start: 1; + volatile uint32_t cvsd_enc_reset: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }sco_conf0; + union { + struct { + volatile uint32_t tx_pcm_conf: 3; + volatile uint32_t tx_pcm_bypass: 1; + volatile uint32_t rx_pcm_conf: 3; + volatile uint32_t rx_pcm_bypass: 1; + volatile uint32_t tx_stop_en: 1; + volatile uint32_t tx_zeros_rm_en: 1; + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }conf1; + union { + struct { + volatile uint32_t fifo_force_pd: 1; + volatile uint32_t fifo_force_pu: 1; + volatile uint32_t plc_mem_force_pd: 1; + volatile uint32_t plc_mem_force_pu: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }pd_conf; + union { + struct { + volatile uint32_t camera_en: 1; + volatile uint32_t lcd_tx_wrx2_en: 1; + volatile uint32_t lcd_tx_sdx2_en: 1; + volatile uint32_t data_enable_test_en: 1; + volatile uint32_t data_enable: 1; + volatile uint32_t lcd_en: 1; + volatile uint32_t ext_adc_start_en: 1; + volatile uint32_t inter_valid_en: 1; + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }conf2; + union { + struct { + volatile uint32_t clkm_div_num: 8; + volatile uint32_t clkm_div_b: 6; + volatile uint32_t clkm_div_a: 6; + volatile uint32_t clk_en: 1; + volatile uint32_t clka_ena: 1; + volatile uint32_t reserved22: 10; + }; + volatile uint32_t val; + }clkm_conf; + union { + struct { + volatile uint32_t tx_bck_div_num: 6; + volatile uint32_t rx_bck_div_num: 6; + volatile uint32_t tx_bits_mod: 6; + volatile uint32_t rx_bits_mod: 6; + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }sample_rate_conf; + union { + struct { + volatile uint32_t tx_pdm_en: 1; + volatile uint32_t rx_pdm_en: 1; + volatile uint32_t pcm2pdm_conv_en: 1; + volatile uint32_t pdm2pcm_conv_en: 1; + volatile uint32_t tx_pdm_sinc_osr2: 4; + volatile uint32_t tx_pdm_prescale: 8; + volatile uint32_t tx_pdm_hp_in_shift: 2; + volatile uint32_t tx_pdm_lp_in_shift: 2; + volatile uint32_t tx_pdm_sinc_in_shift: 2; + volatile uint32_t tx_pdm_sigmadelta_in_shift: 2; + volatile uint32_t rx_pdm_sinc_dsr_16_en: 1; + volatile uint32_t tx_pdm_hp_bypass: 1; + volatile uint32_t reserved26: 6; + }; + volatile uint32_t val; + }pdm_conf; + union { + struct { + volatile uint32_t tx_pdm_fs: 10; + volatile uint32_t tx_pdm_fp: 10; + volatile uint32_t reserved20:12; + }; + volatile uint32_t val; + }pdm_freq_conf; + union { + struct { + volatile uint32_t tx_idle: 1; + volatile uint32_t tx_fifo_reset_back: 1; + volatile uint32_t rx_fifo_reset_back: 1; + volatile uint32_t reserved3: 29; + }; + volatile uint32_t val; + }state; + volatile uint32_t reserved_c0; + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + volatile uint32_t reserved_f0; + volatile uint32_t reserved_f4; + volatile uint32_t reserved_f8; + volatile uint32_t date; /**/ +} i2s_dev_t; +extern volatile i2s_dev_t I2S0; +extern volatile i2s_dev_t I2S1; + +#endif /* _SOC_I2S_STRUCT_H_ */ diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h new file mode 100644 index 0000000000..302a9e4bc6 --- /dev/null +++ b/components/esp32/include/soc/ledc_struct.h @@ -0,0 +1,300 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_LEDC_STRUCT_H_ +#define _SOC_LEDC_STRUCT_H_ +typedef struct { + struct{ + union { + struct { + volatile uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ + volatile uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ + volatile uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ + volatile uint32_t reserved4: 27; + volatile uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }hpoint; + union { + struct { + volatile uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + volatile uint32_t reserved25: 7; + }; + volatile uint32_t val; + }duty; + union { + struct { + volatile uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ + volatile uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ + volatile uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ + volatile uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ + volatile uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ + }; + volatile uint32_t val; + }conf1; + union { + struct { + volatile uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ + volatile uint32_t reserved25: 7; + }; + volatile uint32_t val; + }duty_rd; + }high_speed_channel[8]; + struct{ + union { + struct { + volatile uint32_t timer_sel: 2; /*There are four low speed timers the two bits are used to select one of them for low speed channel. 2'b00: seletc lstimer0. 2'b01: select lstimer1. 2'b10: select lstimer2. 2'b11: select lstimer3.*/ + volatile uint32_t sig_out_en: 1; /*This is the output enable control bit for low speed channel.*/ + volatile uint32_t idle_lv: 1; /*This bit is used to control the output value when low speed channel is off.*/ + volatile uint32_t para_up: 1; /*This bit is used to update register LEDC_LSCH0_HPOINT and LEDC_LSCH0_DUTY for low speed channel.*/ + volatile uint32_t reserved5: 27; + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t hpoint: 20; /*The output value changes to high when lstimerx(x=[0 3]) selected by low speed channel has reached reg_hpoint_lsch0[19:0]*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }hpoint; + union { + struct { + volatile uint32_t duty: 25; /*The register is used to control output duty. When lstimerx(x=[0 3]) choosed by low speed channel has reached reg_lpoint_lsch0 the output signal changes to low. reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4]) (1) reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + volatile uint32_t reserved25: 7; + }; + volatile uint32_t val; + }duty; + union { + struct { + volatile uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for low speed channel.*/ + volatile uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_lsch0 cycles for low speed channel.*/ + volatile uint32_t duty_num: 10; /*This register is used to control the num of increased or decreased times for low speed channel6.*/ + volatile uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for low speed channel6.*/ + volatile uint32_t duty_start: 1; /*When reg_duty_num_hsch1 reg_duty_cycle_hsch1 and reg_duty_scale_hsch1 has been configured. these register won't take effect until set reg_duty_start_hsch1. this bit is automatically cleared by hardware.*/ + }; + volatile uint32_t val; + }conf1; + union { + struct { + volatile uint32_t duty_read: 25; /*This register represents the current duty of the output signal for low speed channel.*/ + volatile uint32_t reserved25: 7; + }; + volatile uint32_t val; + }duty_r; + }low_speed_channel[8]; + struct{ + union { + struct { + volatile uint32_t timer_lim: 5; /*This register controls the range of the counter in high speed timer. the counter range is [0 2**reg_hstimer0_lim] the max bit width for counter is 20.*/ + volatile uint32_t div_num: 18; /*This register is used to configure parameter for divider in high speed timer the least significant eight bits represent the decimal part.*/ + volatile uint32_t pause: 1; /*This bit is used to pause the counter in high speed timer*/ + volatile uint32_t rst: 1; /*This bit is used to reset high speed timer the counter will be 0 after reset.*/ + volatile uint32_t tick_sel: 1; /*This bit is used to choose apb_clk or ref_tick for high speed timer. 1'b1:apb_clk 0:ref_tick*/ + volatile uint32_t reserved26: 6; + }; + volatile uint32_t val; + }conf; + union { + struct { + volatile uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }value; + }high_speed_timer[4]; + struct{ + union { + struct { + volatile uint32_t timer_lim: 5; /*This register controls the range of the counter in low speed timer. the counter range is [0 2**reg_lstimer0_lim] the max bit width for counter is 20.*/ + volatile uint32_t div_num: 18; /*This register is used to configure parameter for divider in low speed timer the least significant eight bits represent the decimal part.*/ + volatile uint32_t pause: 1; /*This bit is used to pause the counter in low speed timer.*/ + volatile uint32_t rst: 1; /*This bit is used to reset low speed timer the counter will be 0 after reset.*/ + volatile uint32_t tick_sel: 1; /*This bit is used to choose slow_clk or ref_tick for low speed timer. 1'b1:slow_clk 0:ref_tick*/ + volatile uint32_t param_update: 1; /*Set this bit to update reg_div_num_lstime0 and reg_lstimer0_lim.*/ + volatile uint32_t reserved27: 5; + }; + volatile uint32_t val; + }conf; + union { + struct { + volatile uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in low speed timer.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }value; + }low_speed_timer[4]; + union { + struct { + volatile uint32_t hstimer0_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ + volatile uint32_t hstimer1_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel1 counter overflow.*/ + volatile uint32_t hstimer2_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel2 counter overflow.*/ + volatile uint32_t hstimer3_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel3 counter overflow.*/ + volatile uint32_t lstimer0_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ + volatile uint32_t lstimer1_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ + volatile uint32_t lstimer2_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ + volatile uint32_t lstimer3_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ + volatile uint32_t duty_chng_end_hsch0_int_raw: 1; /*The interrupt raw bit for high speed channel 0 duty change done.*/ + volatile uint32_t duty_chng_end_hsch1_int_raw: 1; /*The interrupt raw bit for high speed channel 1 duty change done.*/ + volatile uint32_t duty_chng_end_hsch2_int_raw: 1; /*The interrupt raw bit for high speed channel 2 duty change done.*/ + volatile uint32_t duty_chng_end_hsch3_int_raw: 1; /*The interrupt raw bit for high speed channel 3 duty change done.*/ + volatile uint32_t duty_chng_end_hsch4_int_raw: 1; /*The interrupt raw bit for high speed channel 4 duty change done.*/ + volatile uint32_t duty_chng_end_hsch5_int_raw: 1; /*The interrupt raw bit for high speed channel 5 duty change done.*/ + volatile uint32_t duty_chng_end_hsch6_int_raw: 1; /*The interrupt raw bit for high speed channel 6 duty change done.*/ + volatile uint32_t duty_chng_end_hsch7_int_raw: 1; /*The interrupt raw bit for high speed channel 7 duty change done.*/ + volatile uint32_t duty_chng_end_lsch0_int_raw: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ + volatile uint32_t duty_chng_end_lsch1_int_raw: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ + volatile uint32_t duty_chng_end_lsch2_int_raw: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ + volatile uint32_t duty_chng_end_lsch3_int_raw: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ + volatile uint32_t duty_chng_end_lsch4_int_raw: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ + volatile uint32_t duty_chng_end_lsch5_int_raw: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ + volatile uint32_t duty_chng_end_lsch6_int_raw: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ + volatile uint32_t duty_chng_end_lsch7_int_raw: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t hstimer0_ovf_int_st: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ + volatile uint32_t hstimer1_ovf_int_st: 1; /*The interrupt status bit for high speed channel1 counter overflow event.*/ + volatile uint32_t hstimer2_ovf_int_st: 1; /*The interrupt status bit for high speed channel2 counter overflow event.*/ + volatile uint32_t hstimer3_ovf_int_st: 1; /*The interrupt status bit for high speed channel3 counter overflow event.*/ + volatile uint32_t lstimer0_ovf_int_st: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ + volatile uint32_t lstimer1_ovf_int_st: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ + volatile uint32_t lstimer2_ovf_int_st: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ + volatile uint32_t lstimer3_ovf_int_st: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ + volatile uint32_t duty_chng_end_hsch0_int_st: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch1_int_st: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch2_int_st: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch3_int_st: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch4_int_st: 1; /*The interrupt status bit for high speed channel 4 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch5_int_st: 1; /*The interrupt status bit for high speed channel 5 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch6_int_st: 1; /*The interrupt status bit for high speed channel 6 duty change done event.*/ + volatile uint32_t duty_chng_end_hsch7_int_st: 1; /*The interrupt status bit for high speed channel 7 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch0_int_st: 1; /*The interrupt status bit for low speed channel 0 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch1_int_st: 1; /*The interrupt status bit for low speed channel 1 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch2_int_st: 1; /*The interrupt status bit for low speed channel 2 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch3_int_st: 1; /*The interrupt status bit for low speed channel 3 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch4_int_st: 1; /*The interrupt status bit for low speed channel 4 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch5_int_st: 1; /*The interrupt status bit for low speed channel 5 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch6_int_st: 1; /*The interrupt status bit for low speed channel 6 duty change done event.*/ + volatile uint32_t duty_chng_end_lsch7_int_st: 1; /*The interrupt status bit for low speed channel 7 duty change done event*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t hstimer0_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ + volatile uint32_t hstimer1_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel1 counter overflow interrupt.*/ + volatile uint32_t hstimer2_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel2 counter overflow interrupt.*/ + volatile uint32_t hstimer3_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel3 counter overflow interrupt.*/ + volatile uint32_t lstimer0_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel0 counter overflow interrupt.*/ + volatile uint32_t lstimer1_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel1 counter overflow interrupt.*/ + volatile uint32_t lstimer2_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel2 counter overflow interrupt.*/ + volatile uint32_t lstimer3_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel3 counter overflow interrupt.*/ + volatile uint32_t duty_chng_end_hsch0_int_ena: 1; /*The interrupt enable bit for high speed channel 0 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch1_int_ena: 1; /*The interrupt enable bit for high speed channel 1 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch2_int_ena: 1; /*The interrupt enable bit for high speed channel 2 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch3_int_ena: 1; /*The interrupt enable bit for high speed channel 3 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch4_int_ena: 1; /*The interrupt enable bit for high speed channel 4 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch5_int_ena: 1; /*The interrupt enable bit for high speed channel 5 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch6_int_ena: 1; /*The interrupt enable bit for high speed channel 6 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch7_int_ena: 1; /*The interrupt enable bit for high speed channel 7 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch0_int_ena: 1; /*The interrupt enable bit for low speed channel 0 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch1_int_ena: 1; /*The interrupt enable bit for low speed channel 1 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch2_int_ena: 1; /*The interrupt enable bit for low speed channel 2 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch3_int_ena: 1; /*The interrupt enable bit for low speed channel 3 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch4_int_ena: 1; /*The interrupt enable bit for low speed channel 4 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch5_int_ena: 1; /*The interrupt enable bit for low speed channel 5 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch6_int_ena: 1; /*The interrupt enable bit for low speed channel 6 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch7_int_ena: 1; /*The interrupt enable bit for low speed channel 7 duty change done interrupt.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t hstimer0_ovf_int_clr: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ + volatile uint32_t hstimer1_ovf_int_clr: 1; /*Set this bit to clear high speed channel1 counter overflow interrupt.*/ + volatile uint32_t hstimer2_ovf_int_clr: 1; /*Set this bit to clear high speed channel2 counter overflow interrupt.*/ + volatile uint32_t hstimer3_ovf_int_clr: 1; /*Set this bit to clear high speed channel3 counter overflow interrupt.*/ + volatile uint32_t lstimer0_ovf_int_clr: 1; /*Set this bit to clear low speed channel0 counter overflow interrupt.*/ + volatile uint32_t lstimer1_ovf_int_clr: 1; /*Set this bit to clear low speed channel1 counter overflow interrupt.*/ + volatile uint32_t lstimer2_ovf_int_clr: 1; /*Set this bit to clear low speed channel2 counter overflow interrupt.*/ + volatile uint32_t lstimer3_ovf_int_clr: 1; /*Set this bit to clear low speed channel3 counter overflow interrupt.*/ + volatile uint32_t duty_chng_end_hsch0_int_clr: 1; /*Set this bit to clear high speed channel 0 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch1_int_clr: 1; /*Set this bit to clear high speed channel 1 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch2_int_clr: 1; /*Set this bit to clear high speed channel 2 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch3_int_clr: 1; /*Set this bit to clear high speed channel 3 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch4_int_clr: 1; /*Set this bit to clear high speed channel 4 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch5_int_clr: 1; /*Set this bit to clear high speed channel 5 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch6_int_clr: 1; /*Set this bit to clear high speed channel 6 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_hsch7_int_clr: 1; /*Set this bit to clear high speed channel 7 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch0_int_clr: 1; /*Set this bit to clear low speed channel 0 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch1_int_clr: 1; /*Set this bit to clear low speed channel 1 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch2_int_clr: 1; /*Set this bit to clear low speed channel 2 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch3_int_clr: 1; /*Set this bit to clear low speed channel 3 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch4_int_clr: 1; /*Set this bit to clear low speed channel 4 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch5_int_clr: 1; /*Set this bit to clear low speed channel 5 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch6_int_clr: 1; /*Set this bit to clear low speed channel 6 duty change done interrupt.*/ + volatile uint32_t duty_chng_end_lsch7_int_clr: 1; /*Set this bit to clear low speed channel 7 duty change done interrupt.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t apb_clk_sel: 1; /*This bit is used to set the frequency of slow_clk. 1'b1:80mhz 1'b0:8mhz*/ + volatile uint32_t reserved1: 31; + }; + volatile uint32_t val; + }conf; + volatile uint32_t reserved_194; + volatile uint32_t reserved_198; + volatile uint32_t reserved_19c; + volatile uint32_t reserved_1a0; + volatile uint32_t reserved_1a4; + volatile uint32_t reserved_1a8; + volatile uint32_t reserved_1ac; + volatile uint32_t reserved_1b0; + volatile uint32_t reserved_1b4; + volatile uint32_t reserved_1b8; + volatile uint32_t reserved_1bc; + volatile uint32_t reserved_1c0; + volatile uint32_t reserved_1c4; + volatile uint32_t reserved_1c8; + volatile uint32_t reserved_1cc; + volatile uint32_t reserved_1d0; + volatile uint32_t reserved_1d4; + volatile uint32_t reserved_1d8; + volatile uint32_t reserved_1dc; + volatile uint32_t reserved_1e0; + volatile uint32_t reserved_1e4; + volatile uint32_t reserved_1e8; + volatile uint32_t reserved_1ec; + volatile uint32_t reserved_1f0; + volatile uint32_t reserved_1f4; + volatile uint32_t reserved_1f8; + volatile uint32_t date; /*This register represents the version .*/ +} ledc_dev_t; +extern volatile ledc_dev_t LEDC; +#endif /* _SOC_LEDC_STRUCT_H_ */ diff --git a/components/esp32/include/soc/pcnt_struct.h b/components/esp32/include/soc/pcnt_struct.h new file mode 100644 index 0000000000..bf96793994 --- /dev/null +++ b/components/esp32/include/soc/pcnt_struct.h @@ -0,0 +1,161 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_PCNT_STRUCT_H_ +#define _SOC_PCNT_STRUCT_H_ +typedef struct { + struct{ + union { + struct { + volatile uint32_t filter_thres: 10; /*This register is used to filter pulse whose width is smaller than this value for unit0.*/ + volatile uint32_t filter_en: 1; /*This is the enable bit for filtering input signals for unit0.*/ + volatile uint32_t thr_zero_en: 1; /*This is the enable bit for comparing unit0's count with 0 value.*/ + volatile uint32_t thr_h_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_h_lim value.*/ + volatile uint32_t thr_l_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_l_lim value.*/ + volatile uint32_t thr_thres0_en: 1; /*This is the enable bit for comparing unit0's count with thres0 value.*/ + volatile uint32_t thr_thres1_en: 1; /*This is the enable bit for comparing unit0's count with thres1 value .*/ + volatile uint32_t ch0_neg_mode: 2; /*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + volatile uint32_t ch0_pos_mode: 2; /*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + volatile uint32_t ch0_hctrl_mode: 2; /*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + volatile uint32_t ch0_lctrl_mode: 2; /*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + volatile uint32_t ch1_neg_mode: 2; /*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + volatile uint32_t ch1_pos_mode: 2; /*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + volatile uint32_t ch1_hctrl_mode: 2; /*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + volatile uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/ + volatile uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/ + }; + volatile uint32_t val; + }conf1; + union { + struct { + volatile uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/ + volatile uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/ + }; + volatile uint32_t val; + }conf2; + }conf_unit[8]; + union { + struct { + volatile uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/ + volatile uint32_t reserved16: 16; + }; + volatile uint32_t val; + }cnt_unit[8]; + union { + struct { + volatile uint32_t cnt_thr_event_u0_int_raw: 1; /*This is the interrupt raw bit for channel0 event.*/ + volatile uint32_t cnt_thr_event_u1_int_raw: 1; /*This is the interrupt raw bit for channel1 event.*/ + volatile uint32_t cnt_thr_event_u2_int_raw: 1; /*This is the interrupt raw bit for channel2 event.*/ + volatile uint32_t cnt_thr_event_u3_int_raw: 1; /*This is the interrupt raw bit for channel3 event.*/ + volatile uint32_t cnt_thr_event_u4_int_raw: 1; /*This is the interrupt raw bit for channel4 event.*/ + volatile uint32_t cnt_thr_event_u5_int_raw: 1; /*This is the interrupt raw bit for channel5 event.*/ + volatile uint32_t cnt_thr_event_u6_int_raw: 1; /*This is the interrupt raw bit for channel6 event.*/ + volatile uint32_t cnt_thr_event_u7_int_raw: 1; /*This is the interrupt raw bit for channel7 event.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t cnt_thr_event_u0_int_st: 1; /*This is the interrupt status bit for channel0 event.*/ + volatile uint32_t cnt_thr_event_u1_int_st: 1; /*This is the interrupt status bit for channel1 event.*/ + volatile uint32_t cnt_thr_event_u2_int_st: 1; /*This is the interrupt status bit for channel2 event.*/ + volatile uint32_t cnt_thr_event_u3_int_st: 1; /*This is the interrupt status bit for channel3 event.*/ + volatile uint32_t cnt_thr_event_u4_int_st: 1; /*This is the interrupt status bit for channel4 event.*/ + volatile uint32_t cnt_thr_event_u5_int_st: 1; /*This is the interrupt status bit for channel5 event.*/ + volatile uint32_t cnt_thr_event_u6_int_st: 1; /*This is the interrupt status bit for channel6 event.*/ + volatile uint32_t cnt_thr_event_u7_int_st: 1; /*This is the interrupt status bit for channel7 event.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t cnt_thr_event_u0_int_ena: 1; /*This is the interrupt enable bit for channel0 event.*/ + volatile uint32_t cnt_thr_event_u1_int_ena: 1; /*This is the interrupt enable bit for channel1 event.*/ + volatile uint32_t cnt_thr_event_u2_int_ena: 1; /*This is the interrupt enable bit for channel2 event.*/ + volatile uint32_t cnt_thr_event_u3_int_ena: 1; /*This is the interrupt enable bit for channel3 event.*/ + volatile uint32_t cnt_thr_event_u4_int_ena: 1; /*This is the interrupt enable bit for channel4 event.*/ + volatile uint32_t cnt_thr_event_u5_int_ena: 1; /*This is the interrupt enable bit for channel5 event.*/ + volatile uint32_t cnt_thr_event_u6_int_ena: 1; /*This is the interrupt enable bit for channel6 event.*/ + volatile uint32_t cnt_thr_event_u7_int_ena: 1; /*This is the interrupt enable bit for channel7 event.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t cnt_thr_event_u0_int_clr: 1; /*Set this bit to clear channel0 event interrupt.*/ + volatile uint32_t cnt_thr_event_u1_int_clr: 1; /*Set this bit to clear channel1 event interrupt.*/ + volatile uint32_t cnt_thr_event_u2_int_clr: 1; /*Set this bit to clear channel2 event interrupt.*/ + volatile uint32_t cnt_thr_event_u3_int_clr: 1; /*Set this bit to clear channel3 event interrupt.*/ + volatile uint32_t cnt_thr_event_u4_int_clr: 1; /*Set this bit to clear channel4 event interrupt.*/ + volatile uint32_t cnt_thr_event_u5_int_clr: 1; /*Set this bit to clear channel5 event interrupt.*/ + volatile uint32_t cnt_thr_event_u6_int_clr: 1; /*Set this bit to clear channel6 event interrupt.*/ + volatile uint32_t cnt_thr_event_u7_int_clr: 1; /*Set this bit to clear channel7 event interrupt.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }int_clr; + volatile uint32_t status_unit[8]; + union { + struct { + volatile uint32_t cnt_rst_u0: 1; /*Set this bit to clear unit0's counter.*/ + volatile uint32_t cnt_pause_u0: 1; /*Set this bit to pause unit0's counter.*/ + volatile uint32_t cnt_rst_u1: 1; /*Set this bit to clear unit1's counter.*/ + volatile uint32_t cnt_pause_u1: 1; /*Set this bit to pause unit1's counter.*/ + volatile uint32_t cnt_rst_u2: 1; /*Set this bit to clear unit2's counter.*/ + volatile uint32_t cnt_pause_u2: 1; /*Set this bit to pause unit2's counter.*/ + volatile uint32_t cnt_rst_u3: 1; /*Set this bit to clear unit3's counter.*/ + volatile uint32_t cnt_pause_u3: 1; /*Set this bit to pause unit3's counter.*/ + volatile uint32_t cnt_rst_u4: 1; /*Set this bit to clear unit4's counter.*/ + volatile uint32_t cnt_pause_u4: 1; /*Set this bit to pause unit4's counter.*/ + volatile uint32_t cnt_rst_u5: 1; /*Set this bit to clear unit5's counter.*/ + volatile uint32_t cnt_pause_u5: 1; /*Set this bit to pause unit5's counter.*/ + volatile uint32_t cnt_rst_u6: 1; /*Set this bit to clear unit6's counter.*/ + volatile uint32_t cnt_pause_u6: 1; /*Set this bit to pause unit6's counter.*/ + volatile uint32_t cnt_rst_u7: 1; /*Set this bit to clear unit7's counter.*/ + volatile uint32_t cnt_pause_u7: 1; /*Set this bit to pause unit7's counter.*/ + volatile uint32_t clk_en: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }ctrl; + volatile uint32_t reserved_b4; + volatile uint32_t reserved_b8; + volatile uint32_t reserved_bc; + volatile uint32_t reserved_c0; + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + volatile uint32_t reserved_f0; + volatile uint32_t reserved_f4; + volatile uint32_t reserved_f8; + volatile uint32_t date; /**/ +} pcnt_dev_t; +extern volatile pcnt_dev_t PCNT; +#endif /* _SOC_PCNT_STRUCT_H_ */ diff --git a/components/esp32/include/soc/rmt_struct.h b/components/esp32/include/soc/rmt_struct.h new file mode 100644 index 0000000000..7310e18d56 --- /dev/null +++ b/components/esp32/include/soc/rmt_struct.h @@ -0,0 +1,228 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_RMT_STRUCT_H_ +#define _SOC_RMT_STRUCT_H_ +typedef struct { + volatile uint32_t data_ch[8]; /*The R/W ram address for channel0-7 by apb fifo access.*/ + struct{ + union { + struct { + volatile uint32_t div_cnt: 8; /*This register is used to configure the frequency divider's factor in channel0-7.*/ + volatile uint32_t idle_thres: 16; /*In receive mode when no edge is detected on the input signal for longer than reg_idle_thres_ch0 then the receive process is done.*/ + volatile uint32_t mem_size: 4; /*This register is used to configure the the amount of memory blocks allocated to channel0-7.*/ + volatile uint32_t carrier_en: 1; /*This is the carrier modulation enable control bit for channel0-7.*/ + volatile uint32_t carrier_out_lv: 1; /*This bit is used to configure the way carrier wave is modulated for channel0-7.1'b1:transmit on low output level 1'b0:transmit on high output level.*/ + volatile uint32_t mem_pd: 1; /*This bit is used to reduce power consumed by memory. 1:memory is in low power state.*/ + volatile uint32_t clk_en: 1; /*This bit is used to control clock.when software configure RMT internal registers it controls the register clock.*/ + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t tx_start: 1; /*Set this bit to start sending data for channel0-7.*/ + volatile uint32_t rx_en: 1; /*Set this bit to enable receiving data for channel0-7.*/ + volatile uint32_t mem_wr_rst: 1; /*Set this bit to reset write ram address for channel0-7 by receiver access.*/ + volatile uint32_t mem_rd_rst: 1; /*Set this bit to reset read ram address for channel0-7 by transmitter access.*/ + volatile uint32_t apb_mem_rst: 1; /*Set this bit to reset W/R ram address for channel0-7 by apb fifo access*/ + volatile uint32_t mem_owner: 1; /*This is the mark of channel0-7's ram usage right.1'b1:receiver uses the ram 0:transmitter uses the ram*/ + volatile uint32_t tx_conti_mode: 1; /*Set this bit to continue sending from the first data to the last data in channel0-7 again and again.*/ + volatile uint32_t rx_filter_en: 1; /*This is the receive filter enable bit for channel0-7.*/ + volatile uint32_t rx_filter_thres: 8; /*in receive mode channel0-7 ignore input pulse when the pulse width is smaller then this value.*/ + volatile uint32_t ref_cnt_rst: 1; /*This bit is used to reset divider in channel0-7.*/ + volatile uint32_t ref_always_on: 1; /*This bit is used to select base clock. 1'b1:clk_apb 1'b0:clk_ref*/ + volatile uint32_t idle_out_lv: 1; /*This bit configures the output signal's level for channel0-7 in IDLE state.*/ + volatile uint32_t idle_out_en: 1; /*This is the output enable control bit for channel0-7 in IDLE state.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }conf1; + }conf_ch[8]; + volatile uint32_t status_ch[8]; /*The status for channel0-7*/ + volatile uint32_t apb_mem_addr_ch[8]; /*The ram relative address in channel0-7 by apb fifo access*/ + union { + struct { + volatile uint32_t ch0_tx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the transmit process is done.*/ + volatile uint32_t ch0_rx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the receive process is done.*/ + volatile uint32_t ch0_err_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when channel 0 detects some errors.*/ + volatile uint32_t ch1_tx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the transmit process is done.*/ + volatile uint32_t ch1_rx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the receive process is done.*/ + volatile uint32_t ch1_err_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when channel 1 detects some errors.*/ + volatile uint32_t ch2_tx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the transmit process is done.*/ + volatile uint32_t ch2_rx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the receive process is done.*/ + volatile uint32_t ch2_err_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when channel 2 detects some errors.*/ + volatile uint32_t ch3_tx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the transmit process is done.*/ + volatile uint32_t ch3_rx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the receive process is done.*/ + volatile uint32_t ch3_err_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when channel 3 detects some errors.*/ + volatile uint32_t ch4_tx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the transmit process is done.*/ + volatile uint32_t ch4_rx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the receive process is done.*/ + volatile uint32_t ch4_err_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when channel 4 detects some errors.*/ + volatile uint32_t ch5_tx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the transmit process is done.*/ + volatile uint32_t ch5_rx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the receive process is done.*/ + volatile uint32_t ch5_err_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when channel 5 detects some errors.*/ + volatile uint32_t ch6_tx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the transmit process is done.*/ + volatile uint32_t ch6_rx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the receive process is done.*/ + volatile uint32_t ch6_err_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when channel 6 detects some errors.*/ + volatile uint32_t ch7_tx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the transmit process is done.*/ + volatile uint32_t ch7_rx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the receive process is done.*/ + volatile uint32_t ch7_err_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when channel 7 detects some errors.*/ + volatile uint32_t ch0_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when transmitter in channel0 have send data more than reg_rmt_tx_lim_ch0 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch1_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when transmitter in channel1 have send data more than reg_rmt_tx_lim_ch1 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch2_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when transmitter in channel2 have send data more than reg_rmt_tx_lim_ch2 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch3_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when transmitter in channel3 have send data more than reg_rmt_tx_lim_ch3 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch4_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when transmitter in channel4 have send data more than reg_rmt_tx_lim_ch4 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch5_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when transmitter in channel5 have send data more than reg_rmt_tx_lim_ch5 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch6_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when transmitter in channel6 have send data more than reg_rmt_tx_lim_ch6 after detecting this interrupt software can updata the old data with new data.*/ + volatile uint32_t ch7_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t ch0_tx_end_int_st: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ + volatile uint32_t ch0_rx_end_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_rx_end_int_raw when rmt_ch0_rx_end_int_ena is set to 0.*/ + volatile uint32_t ch0_err_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_err_int_raw when rmt_ch0_err_int_ena is set to 0.*/ + volatile uint32_t ch1_tx_end_int_st: 1; /*The interrupt state bit for channel 1's mt_ch1_tx_end_int_raw when mt_ch1_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch1_rx_end_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_rx_end_int_raw when rmt_ch1_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch1_err_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_err_int_raw when rmt_ch1_err_int_ena is set to 1.*/ + volatile uint32_t ch2_tx_end_int_st: 1; /*The interrupt state bit for channel 2's mt_ch2_tx_end_int_raw when mt_ch2_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch2_rx_end_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_rx_end_int_raw when rmt_ch2_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch2_err_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_err_int_raw when rmt_ch2_err_int_ena is set to 1.*/ + volatile uint32_t ch3_tx_end_int_st: 1; /*The interrupt state bit for channel 3's mt_ch3_tx_end_int_raw when mt_ch3_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch3_rx_end_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_rx_end_int_raw when rmt_ch3_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch3_err_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_err_int_raw when rmt_ch3_err_int_ena is set to 1.*/ + volatile uint32_t ch4_tx_end_int_st: 1; /*The interrupt state bit for channel 4's mt_ch4_tx_end_int_raw when mt_ch4_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch4_rx_end_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_rx_end_int_raw when rmt_ch4_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch4_err_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_err_int_raw when rmt_ch4_err_int_ena is set to 1.*/ + volatile uint32_t ch5_tx_end_int_st: 1; /*The interrupt state bit for channel 5's mt_ch5_tx_end_int_raw when mt_ch5_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch5_rx_end_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_rx_end_int_raw when rmt_ch5_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch5_err_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_err_int_raw when rmt_ch5_err_int_ena is set to 1.*/ + volatile uint32_t ch6_tx_end_int_st: 1; /*The interrupt state bit for channel 6's mt_ch6_tx_end_int_raw when mt_ch6_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch6_rx_end_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_rx_end_int_raw when rmt_ch6_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch6_err_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_err_int_raw when rmt_ch6_err_int_ena is set to 1.*/ + volatile uint32_t ch7_tx_end_int_st: 1; /*The interrupt state bit for channel 7's mt_ch7_tx_end_int_raw when mt_ch7_tx_end_int_ena is set to 1.*/ + volatile uint32_t ch7_rx_end_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_rx_end_int_raw when rmt_ch7_rx_end_int_ena is set to 1.*/ + volatile uint32_t ch7_err_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_err_int_raw when rmt_ch7_err_int_ena is set to 1.*/ + volatile uint32_t ch0_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_tx_thr_event_int_raw when mt_ch0_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch1_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_tx_thr_event_int_raw when mt_ch1_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch2_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_tx_thr_event_int_raw when mt_ch2_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch3_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_tx_thr_event_int_raw when mt_ch3_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch4_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_tx_thr_event_int_raw when mt_ch4_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch5_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_tx_thr_event_int_raw when mt_ch5_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch6_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_tx_thr_event_int_raw when mt_ch6_tx_thr_event_int_ena is set to 1.*/ + volatile uint32_t ch7_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t ch0_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ + volatile uint32_t ch0_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_rx_end_int_st.*/ + volatile uint32_t ch0_err_int_ena: 1; /*Set this bit to enable rmt_ch0_err_int_st.*/ + volatile uint32_t ch1_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_end_int_st.*/ + volatile uint32_t ch1_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_rx_end_int_st.*/ + volatile uint32_t ch1_err_int_ena: 1; /*Set this bit to enable rmt_ch1_err_int_st.*/ + volatile uint32_t ch2_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_end_int_st.*/ + volatile uint32_t ch2_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_rx_end_int_st.*/ + volatile uint32_t ch2_err_int_ena: 1; /*Set this bit to enable rmt_ch2_err_int_st.*/ + volatile uint32_t ch3_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_end_int_st.*/ + volatile uint32_t ch3_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_rx_end_int_st.*/ + volatile uint32_t ch3_err_int_ena: 1; /*Set this bit to enable rmt_ch3_err_int_st.*/ + volatile uint32_t ch4_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_end_int_st.*/ + volatile uint32_t ch4_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_rx_end_int_st.*/ + volatile uint32_t ch4_err_int_ena: 1; /*Set this bit to enable rmt_ch4_err_int_st.*/ + volatile uint32_t ch5_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_end_int_st.*/ + volatile uint32_t ch5_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_rx_end_int_st.*/ + volatile uint32_t ch5_err_int_ena: 1; /*Set this bit to enable rmt_ch5_err_int_st.*/ + volatile uint32_t ch6_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_end_int_st.*/ + volatile uint32_t ch6_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_rx_end_int_st.*/ + volatile uint32_t ch6_err_int_ena: 1; /*Set this bit to enable rmt_ch6_err_int_st.*/ + volatile uint32_t ch7_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_end_int_st.*/ + volatile uint32_t ch7_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_rx_end_int_st.*/ + volatile uint32_t ch7_err_int_ena: 1; /*Set this bit to enable rmt_ch7_err_int_st.*/ + volatile uint32_t ch0_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_thr_event_int_st.*/ + volatile uint32_t ch1_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_thr_event_int_st.*/ + volatile uint32_t ch2_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_thr_event_int_st.*/ + volatile uint32_t ch3_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_thr_event_int_st.*/ + volatile uint32_t ch4_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_thr_event_int_st.*/ + volatile uint32_t ch5_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_thr_event_int_st.*/ + volatile uint32_t ch6_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_thr_event_int_st.*/ + volatile uint32_t ch7_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t ch0_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ + volatile uint32_t ch0_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_end_int_raw.*/ + volatile uint32_t ch0_err_int_clr: 1; /*Set this bit to clear the rmt_ch0_err_int_raw.*/ + volatile uint32_t ch1_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_rx_end_int_raw..*/ + volatile uint32_t ch1_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_end_int_raw.*/ + volatile uint32_t ch1_err_int_clr: 1; /*Set this bit to clear the rmt_ch1_err_int_raw.*/ + volatile uint32_t ch2_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_rx_end_int_raw..*/ + volatile uint32_t ch2_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_end_int_raw.*/ + volatile uint32_t ch2_err_int_clr: 1; /*Set this bit to clear the rmt_ch2_err_int_raw.*/ + volatile uint32_t ch3_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_rx_end_int_raw..*/ + volatile uint32_t ch3_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_end_int_raw.*/ + volatile uint32_t ch3_err_int_clr: 1; /*Set this bit to clear the rmt_ch3_err_int_raw.*/ + volatile uint32_t ch4_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_rx_end_int_raw..*/ + volatile uint32_t ch4_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_end_int_raw.*/ + volatile uint32_t ch4_err_int_clr: 1; /*Set this bit to clear the rmt_ch4_err_int_raw.*/ + volatile uint32_t ch5_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_rx_end_int_raw..*/ + volatile uint32_t ch5_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_end_int_raw.*/ + volatile uint32_t ch5_err_int_clr: 1; /*Set this bit to clear the rmt_ch5_err_int_raw.*/ + volatile uint32_t ch6_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_rx_end_int_raw..*/ + volatile uint32_t ch6_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_end_int_raw.*/ + volatile uint32_t ch6_err_int_clr: 1; /*Set this bit to clear the rmt_ch6_err_int_raw.*/ + volatile uint32_t ch7_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_rx_end_int_raw..*/ + volatile uint32_t ch7_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_end_int_raw.*/ + volatile uint32_t ch7_err_int_clr: 1; /*Set this bit to clear the rmt_ch7_err_int_raw.*/ + volatile uint32_t ch0_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch1_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch2_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch3_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch4_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch5_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch6_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_thr_event_int_raw interrupt.*/ + volatile uint32_t ch7_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t carrier_low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ + volatile uint32_t carrier_high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ + }; + volatile uint32_t val; + }carrier_duty_ch[8]; + union { + struct { + volatile uint32_t tx_lim: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ + volatile uint32_t reserved9: 23; + }; + volatile uint32_t val; + }tx_lim_ch[8]; + union { + struct { + volatile uint32_t apb_fifo_mask: 1; /*Set this bit to disable apb fifo access*/ + volatile uint32_t mem_tx_wrap_en: 1; /*when data need to be send is more than channel's mem can store then set this bit to enable reuse of mem this bit is used together with reg_rmt_tx_lim_chn.*/ + volatile uint32_t reserved2: 30; + }; + volatile uint32_t val; + }apb_conf; + volatile uint32_t reserved_f4; + volatile uint32_t reserved_f8; + volatile uint32_t date; /*This is the version register.*/ +} rmt_dev_t; +extern volatile rmt_dev_t RMT; +#endif /* _SOC_RMT_STRUCT_H_ */ diff --git a/components/esp32/include/soc/spi_struct.h b/components/esp32/include/soc/spi_struct.h new file mode 100644 index 0000000000..e76590537c --- /dev/null +++ b/components/esp32/include/soc/spi_struct.h @@ -0,0 +1,677 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_SPI_STRUCT_H_ +#define _SOC_SPI_STRUCT_H_ +typedef struct { + union { + struct { + volatile uint32_t reserved0: 16; /*reserved*/ + volatile uint32_t flash_per: 1; /*program erase resume bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_pes: 1; /*program erase suspend bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t usr: 1; /*User define command enable. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_hpm: 1; /*Drive Flash into high performance mode. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_res: 1; /*This bit combined with reg_resandres bit releases Flash from the power-down state or high performance mode and obtains the devices ID. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_dp: 1; /*Drive Flash into power down. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_ce: 1; /*Chip erase enable. Chip erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_be: 1; /*Block erase enable(32KB) . Block erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_se: 1; /*Sector erase enable(4KB). Sector erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_pp: 1; /*Page program enable(1 byte ~256 bytes data to be programmed). Page program operation will be triggered when the bit is set. The bit will be cleared once the operation done .1: enable 0: disable.*/ + volatile uint32_t flash_wrsr: 1; /*Write status register enable. Write status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_rdsr: 1; /*Read status register-1. Read status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + volatile uint32_t flash_rdid: 1; /*Read JEDEC ID . Read ID command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + volatile uint32_t flash_wrdi: 1; /*Write flash disable. Write disable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + volatile uint32_t flash_wren: 1; /*Write flash enable. Write enable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + volatile uint32_t flash_read: 1; /*Read flash enable. Read flash operation will be triggered when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + }; + volatile uint32_t val; + }cmd; + union { + struct { + volatile uint32_t reserved : 8; + volatile uint32_t usr_addr_value:24; /*[31:8]:address to slave [7:0]:Reserved.*/ + }; + volatile uint32_t val; + }addr; + union { + struct { + volatile uint32_t reserved0: 10; /*reserved*/ + volatile uint32_t fcs_crc_en: 1; /*For SPI1 initialize crc32 module before writing encrypted data to flash. Active low.*/ + volatile uint32_t tx_crc_en: 1; /*For SPI1 enable crc32 when writing encrypted data to flash. 1: enable 0:disable*/ + volatile uint32_t wait_flash_idle_en: 1; /*wait flash idle when program flash or erase flash. 1: enable 0: disable.*/ + volatile uint32_t fastrd_mode: 1; /*This bit enable the bits: spi_fread_qio spi_fread_dio spi_fread_qout and spi_fread_dout. 1: enable 0: disable.*/ + volatile uint32_t fread_dual: 1; /*In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ + volatile uint32_t resandres: 1; /*The Device ID is read out to SPI_RD_STATUS register, this bit combine with spi_flash_res bit. 1: enable 0: disable.*/ + volatile uint32_t reserved16: 4; /*reserved*/ + volatile uint32_t fread_quad: 1; /*In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ + volatile uint32_t wp: 1; /*Write protect signal output when SPI is idle. 1: output high 0: output low.*/ + volatile uint32_t wrsr_2b: 1; /*two bytes data will be written to status register when it is set. 1: enable 0: disable.*/ + volatile uint32_t fread_dio: 1; /*In the read operations address phase and read-data phase apply 2 signals. 1: enable 0: disable.*/ + volatile uint32_t fread_qio: 1; /*In the read operations address phase and read-data phase apply 4 signals. 1: enable 0: disable.*/ + volatile uint32_t rd_bit_order: 1; /*In read-data (MISO) phase 1: LSB first 0: MSB first*/ + volatile uint32_t wr_bit_order: 1; /*In command address write-data (MOSI) phases 1: LSB firs 0: MSB first*/ + volatile uint32_t reserved27: 5; /*reserved*/ + }; + volatile uint32_t val; + }ctrl; + union { + struct { + volatile uint32_t reserved0: 16; /*reserved*/ + volatile uint32_t cs_hold_delay_res:12; /*Delay cycles of resume Flash when resume Flash is enable by spi clock.*/ + volatile uint32_t cs_hold_delay: 4; /*SPI cs signal is delayed by spi clock cycles*/ + }; + volatile uint32_t val; + }ctrl1; + union { + struct { + volatile uint32_t status: 16; /*In the slave mode, it is the status for master to read out.*/ + volatile uint32_t wb_mode: 8; /*Mode bits in the flash fast read mode, it is combined with spi_fastrd_mode bit.*/ + volatile uint32_t status_ext: 8; /*In the slave mode,it is the status for master to read out.*/ + }; + volatile uint32_t val; + }rd_status; + union { + struct { + volatile uint32_t setup_time: 4; /*(cycles-1) of ,prepare, phase by spi clock, this bits combined with spi_cs_setup bit.*/ + volatile uint32_t hold_time: 4; /*delay cycles of cs pin by spi clock, this bits combined with spi_cs_hold bit.*/ + volatile uint32_t ck_out_low_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_L bits.*/ + volatile uint32_t ck_out_high_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_H bits.*/ + volatile uint32_t miso_delay_mode: 2; /*MISO signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + volatile uint32_t miso_delay_num: 3; /*MISO signals are delayed by system clock cycles*/ + volatile uint32_t mosi_delay_mode: 2; /*MOSI signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + volatile uint32_t mosi_delay_num: 3; /*MOSI signals are delayed by system clock cycles*/ + volatile uint32_t cs_delay_mode: 2; /*spi_cs signal is delayed by spi_clk . 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + volatile uint32_t cs_delay_num: 4; /*spi_cs signal is delayed by system clock cycles*/ + }; + volatile uint32_t val; + }ctrl2; + union { + struct { + volatile uint32_t clkcnt_l: 6; /*In the master mode it must be equal to spi_clkcnt_N. In the slave mode it must be 0.*/ + volatile uint32_t clkcnt_h: 6; /*In the master mode it must be floor((spi_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ + volatile uint32_t clkcnt_n: 6; /*In the master mode it is the divider of spi_clk. So spi_clk frequency is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ + volatile uint32_t clkdiv_pre: 13; /*In the master mode it is pre-divider of spi_clk.*/ + volatile uint32_t clk_equ_sysclk: 1; /*In the master mode 1: spi_clk is eqaul to system 0: spi_clk is divided from system clock.*/ + }; + volatile uint32_t val; + }clock; + union { + struct { + volatile uint32_t doutdin: 1; /*Set the bit to enable full duplex communication. 1: enable 0: disable.*/ + volatile uint32_t reserved1: 3; /*reserved*/ + volatile uint32_t cs_hold: 1; /*spi cs keep low when spi is in ,done, phase. 1: enable 0: disable.*/ + volatile uint32_t cs_setup: 1; /*spi cs is enable when spi is in ,prepare, phase. 1: enable 0: disable.*/ + volatile uint32_t ck_i_edge: 1; /*In the slave mode the bit is same as spi_ck_out_edge in master mode. It is combined with spi_miso_delay_mode bits.*/ + volatile uint32_t ck_out_edge: 1; /*the bit combined with spi_mosi_delay_mode bits to set mosi signal delay mode.*/ + volatile uint32_t reserved8: 2; /*reserved*/ + volatile uint32_t rd_byte_order: 1; /*In read-data (MISO) phase 1: big-endian 0: little_endian*/ + volatile uint32_t wr_byte_order: 1; /*In command address write-data (MOSI) phases 1: big-endian 0: litte_endian*/ + volatile uint32_t fwrite_dual: 1; /*In the write operations read-data phase apply 2 signals*/ + volatile uint32_t fwrite_quad: 1; /*In the write operations read-data phase apply 4 signals*/ + volatile uint32_t fwrite_dio: 1; /*In the write operations address phase and read-data phase apply 2 signals.*/ + volatile uint32_t fwrite_qio: 1; /*In the write operations address phase and read-data phase apply 4 signals.*/ + volatile uint32_t sio: 1; /*Set the bit to enable 3-line half duplex communication mosi and miso signals share the same pin. 1: enable 0: disable.*/ + volatile uint32_t usr_hold_pol: 1; /*It is combined with hold bits to set the polarity of spi hold line 1: spi will be held when spi hold line is high 0: spi will be held when spi hold line is low*/ + volatile uint32_t usr_dout_hold: 1; /*spi is hold at data out state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_din_hold: 1; /*spi is hold at data in state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_dummy_hold: 1; /*spi is hold at dummy state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_addr_hold: 1; /*spi is hold at address state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_cmd_hold: 1; /*spi is hold at command state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_prep_hold: 1; /*spi is hold at prepare state the bit combined with spi_usr_hold_pol bit.*/ + volatile uint32_t usr_miso_highpart: 1; /*read-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + volatile uint32_t usr_mosi_highpart: 1; /*write-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + volatile uint32_t usr_dummy_idle: 1; /*spi clock is disable in dummy phase when the bit is enable.*/ + volatile uint32_t usr_mosi: 1; /*This bit enable the write-data phase of an operation.*/ + volatile uint32_t usr_miso: 1; /*This bit enable the read-data phase of an operation.*/ + volatile uint32_t usr_dummy: 1; /*This bit enable the dummy phase of an operation.*/ + volatile uint32_t usr_addr: 1; /*This bit enable the address phase of an operation.*/ + volatile uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ + }; + volatile uint32_t val; + }user; + union { + struct { + volatile uint32_t usr_dummy_cyclelen: 8; /*The length in spi_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ + volatile uint32_t reserved8: 18; /*reserved*/ + volatile uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ + }; + volatile uint32_t val; + }user1; + union { + struct { + volatile uint32_t usr_command_value: 16; /*The value of command.*/ + volatile uint32_t reserved16: 12; /*reserved*/ + volatile uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ + }; + volatile uint32_t val; + }user2; + union { + struct { + volatile uint32_t usr_mosi_dbitlen:24; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ + volatile uint32_t reserved24: 8; /*reserved*/ + }; + volatile uint32_t val; + }mosi_dlen; + union { + struct { + volatile uint32_t usr_miso_dbitlen:24; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ + volatile uint32_t reserved24: 8; /*reserved*/ + }; + volatile uint32_t val; + }miso_dlen; + volatile uint32_t slv_wr_status; /*In the slave mode this register are the status register for the master to write into. In the master mode this register are the higher 32bits in the 64 bits address condition.*/ + union { + struct { + volatile uint32_t cs0_dis: 1; /*SPI CS0 pin enable, 1: disable CS0, 0: spi_cs0 signal is from/to CS0 pin*/ + volatile uint32_t cs1_dis: 1; /*SPI CS1 pin enable, 1: disable CS1, 0: spi_cs1 signal is from/to CS1 pin*/ + volatile uint32_t cs2_dis: 1; /*SPI CS2 pin enable, 1: disable CS2, 0: spi_cs2 signal is from/to CS2 pin*/ + volatile uint32_t reserved3: 2; /*reserved*/ + volatile uint32_t ck_dis: 1; /*1: spi clk out disable 0: spi clk out enable*/ + volatile uint32_t master_cs_pol: 5; /*In the master mode the bits are the polarity of spi cs line the value is equivalent to spi_cs ^ spi_master_cs_pol.*/ + volatile uint32_t master_ck_sel: 5; /*In the master mode spi cs line is enable as spi clk it is combined with spi_cs0_dis spi_cs1_dis spi_cs2_dis.*/ + volatile uint32_t reserved16: 13; /*reserved*/ + volatile uint32_t ck_idle_edge: 1; /*1: spi clk line is high when idle 0: spi clk line is low when idle*/ + volatile uint32_t cs_keep_active: 1; /*spi cs line keep low when the bit is set.*/ + volatile uint32_t reserved31: 1; /*reserved*/ + }; + volatile uint32_t val; + }pin; + union { + struct { + volatile uint32_t slv_rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ + volatile uint32_t slv_wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ + volatile uint32_t slv_rd_sta_done: 1; /*The interrupt raw bit for the completion of read-status operation in the slave mode.*/ + volatile uint32_t slv_wr_sta_done: 1; /*The interrupt raw bit for the completion of write-status operation in the slave mode.*/ + volatile uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ + volatile uint32_t int_en: 5; /*Interrupt enable bits for the below 5 sources*/ + volatile uint32_t cs_i_mode: 2; /*In the slave mode this bits used to synchronize the input spi cs signal and eliminate spi cs jitter.*/ + volatile uint32_t reserved12: 5; /*reserved*/ + volatile uint32_t slv_last_command: 3; /*In the slave mode it is the value of command.*/ + volatile uint32_t slv_last_state: 3; /*In the slave mode it is the state of spi state machine.*/ + volatile uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode. 4: read-status*/ + volatile uint32_t slv_cmd_define: 1; /*1: slave mode commands are defined in SPI_SLAVE3. 0: slave mode commands are fixed as: 1: write-status 2: write-buffer and 3: read-buffer.*/ + volatile uint32_t slv_wr_rd_sta_en: 1; /*write and read status enable in the slave mode*/ + volatile uint32_t slv_wr_rd_buf_en: 1; /*write and read buffer enable in the slave mode*/ + volatile uint32_t slave_mode: 1; /*1: slave mode 0: master mode.*/ + volatile uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ + }; + volatile uint32_t val; + }slave; + union { + struct { + volatile uint32_t slv_rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ + volatile uint32_t slv_wrbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-buffer operations.*/ + volatile uint32_t slv_rdsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-status operations.*/ + volatile uint32_t slv_wrsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-status operations.*/ + volatile uint32_t slv_wr_addr_bitlen: 6; /*In the slave mode it is the address length in bits for write-buffer operation. The register value shall be (bit_num-1).*/ + volatile uint32_t slv_rd_addr_bitlen: 6; /*In the slave mode it is the address length in bits for read-buffer operation. The register value shall be (bit_num-1).*/ + volatile uint32_t reserved16: 9; /*reserved*/ + volatile uint32_t slv_status_readback: 1; /*In the slave mode 1:read register of SPI_SLV_WR_STATUS 0: read register of SPI_RD_STATUS.*/ + volatile uint32_t slv_status_fast_en: 1; /*In the slave mode enable fast read status.*/ + volatile uint32_t slv_status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ + }; + volatile uint32_t val; + }slave1; + union { + struct { + volatile uint32_t slv_rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ + volatile uint32_t slv_wrsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-status operations. The register value shall be (cycle_num-1).*/ + volatile uint32_t slv_rdbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-buffer operations. The register value shall be (cycle_num-1).*/ + volatile uint32_t slv_wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ + }; + volatile uint32_t val; + }slave2; + union { + struct { + volatile uint32_t slv_rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ + volatile uint32_t slv_wrbuf_cmd_value: 8; /*In the slave mode it is the value of write-buffer command.*/ + volatile uint32_t slv_rdsta_cmd_value: 8; /*In the slave mode it is the value of read-status command.*/ + volatile uint32_t slv_wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ + }; + volatile uint32_t val; + }slave3; + union { + struct { + volatile uint32_t slv_wrbuf_dbitlen:24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ + volatile uint32_t reserved24: 8; /*reserved*/ + }; + volatile uint32_t val; + }slv_wrbuf_dlen; + union { + struct { + volatile uint32_t slv_rdbuf_dbitlen:24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ + volatile uint32_t reserved24: 8; /*reserved*/ + }; + volatile uint32_t val; + }slv_rdbuf_dlen; + union { + struct { + volatile uint32_t cache_req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ + volatile uint32_t cache_usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ + volatile uint32_t cache_flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ + volatile uint32_t cache_flash_pes_en: 1; /*For SPI0 spi1 send suspend command before cache read flash 1: enable 0:disable.*/ + volatile uint32_t reserved4: 28; /*reserved*/ + }; + volatile uint32_t val; + }cache_fctrl; + union { + struct { + volatile uint32_t reserved0: 1; /*reserved*/ + volatile uint32_t usr_sram_dio: 1; /*For SPI0 In the spi sram mode spi dual I/O mode enable 1: enable 0:disable*/ + volatile uint32_t usr_sram_qio: 1; /*For SPI0 In the spi sram mode spi quad I/O mode enable 1: enable 0:disable*/ + volatile uint32_t usr_wr_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for write operations.*/ + volatile uint32_t usr_rd_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for read operations.*/ + volatile uint32_t cache_sram_usr_rcmd: 1; /*For SPI0 In the spi sram mode cache read sram for user define command.*/ + volatile uint32_t sram_bytes_len: 8; /*For SPI0 In the sram mode it is the byte length of spi read sram data.*/ + volatile uint32_t sram_dummy_cyclelen: 8; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ + volatile uint32_t sram_addr_bitlen: 6; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ + volatile uint32_t cache_sram_usr_wcmd: 1; /*For SPI0 In the spi sram mode cache write sram for user define command*/ + volatile uint32_t reserved29: 3; /*reserved*/ + }; + volatile uint32_t val; + }cache_sctrl; + union { + struct { + volatile uint32_t sram_dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + volatile uint32_t sram_qio: 1; /*For SPI0 SRAM QIO mode enable . SRAM QIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + volatile uint32_t reserved2: 2; /*For SPI0 SRAM write enable . SRAM write operation will be triggered when the bit is set. The bit will be cleared once the operation done.*/ + volatile uint32_t sram_rstio: 1; /*For SPI0 SRAM IO mode reset enable. SRAM IO mode reset operation will be triggered when the bit is set. The bit will be cleared once the operation done*/ + volatile uint32_t reserved5: 27; /*reserved*/ + }; + volatile uint32_t val; + }sram_cmd; + union { + struct { + volatile uint32_t cache_sram_usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ + volatile uint32_t reserved16: 12; /*reserved*/ + volatile uint32_t cache_sram_usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + }; + volatile uint32_t val; + }sram_drd_cmd; + union { + struct { + volatile uint32_t cache_sram_usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ + volatile uint32_t reserved16: 12; /*reserved*/ + volatile uint32_t cache_sram_usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + }; + volatile uint32_t val; + }sram_dwr_cmd; + union { + struct { + volatile uint32_t slv_rdata_bit:24; /*In the slave mode it is the bit length of read data. The value is the length - 1.*/ + volatile uint32_t reserved24: 8; /*reserved*/ + }; + volatile uint32_t val; + }slv_rd_bit; + volatile uint32_t reserved_68; + volatile uint32_t reserved_6c; + volatile uint32_t reserved_70; + volatile uint32_t reserved_74; + volatile uint32_t reserved_78; + volatile uint32_t reserved_7c; + volatile uint32_t data_buf[16]; /*data buffer*/ + volatile uint32_t tx_crc; /*For SPI1 the value of crc32 for 256 bits data.*/ + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + union { + struct { + volatile uint32_t t_pp_time: 12; /*page program delay time by system clock.*/ + volatile uint32_t reserved12: 4; /*reserved*/ + volatile uint32_t t_pp_shift: 4; /*page program delay time shift .*/ + volatile uint32_t reserved20:11; /*reserved*/ + volatile uint32_t t_pp_ena: 1; /*page program delay enable.*/ + }; + volatile uint32_t val; + }ext0; + union { + struct { + volatile uint32_t t_erase_time: 12; /*erase flash delay time by system clock.*/ + volatile uint32_t reserved12: 4; /*reserved*/ + volatile uint32_t t_erase_shift: 4; /*erase flash delay time shift.*/ + volatile uint32_t reserved20: 11; /*reserved*/ + volatile uint32_t t_erase_ena: 1; /*erase flash delay enable.*/ + }; + volatile uint32_t val; + }ext1; + union { + struct { + volatile uint32_t st: 3; /*The status of spi state machine .*/ + volatile uint32_t reserved3: 29; /*reserved*/ + }; + volatile uint32_t val; + }ext2; + union { + struct { + volatile uint32_t int_hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at ,idle, phase 2: hold at ,prepare, phase.*/ + volatile uint32_t reserved2: 30; /*reserved*/ + }; + volatile uint32_t val; + }ext3; + union { + struct { + volatile uint32_t reserved0: 2; /*reserved*/ + volatile uint32_t in_rst: 1; /*The bit is used to reset in dma fsm and in data fifo pointer.*/ + volatile uint32_t out_rst: 1; /*The bit is used to reset out dma fsm and out data fifo pointer.*/ + volatile uint32_t ahbm_fifo_rst: 1; /*reset spi dma ahb master fifo pointer.*/ + volatile uint32_t ahbm_rst: 1; /*reset spi dma ahb master.*/ + volatile uint32_t in_loop_test: 1; /*Set bit to test in link.*/ + volatile uint32_t out_loop_test: 1; /*Set bit to test out link.*/ + volatile uint32_t out_auto_wrback: 1; /*when the link is empty jump to next automatically.*/ + volatile uint32_t out_eof_mode: 1; /*out eof flag generation mode . 1: when dma pop all data from fifo 0:when ahb push all data to fifo.*/ + volatile uint32_t outdscr_burst_en: 1; /*read descriptor use burst mode when read data for memory.*/ + volatile uint32_t indscr_burst_en: 1; /*read descriptor use burst mode when write data to memory.*/ + volatile uint32_t out_data_burst_en: 1; /*spi dma read data from memory in burst mode.*/ + volatile uint32_t reserved13: 1; /*reserved*/ + volatile uint32_t dma_rx_stop: 1; /*spi dma read data stop when in continue tx/rx mode.*/ + volatile uint32_t dma_tx_stop: 1; /*spi dma write data stop when in continue tx/rx mode.*/ + volatile uint32_t dma_continue: 1; /*spi dma continue tx/rx data.*/ + volatile uint32_t reserved17: 15; /*reserved*/ + }; + volatile uint32_t val; + }dma_conf; + union { + struct { + volatile uint32_t outlink_addr: 20; /*The address of the first outlink descriptor.*/ + volatile uint32_t reserved20: 8; /*reserved*/ + volatile uint32_t outlink_stop: 1; /*Set the bit to stop to use outlink descriptor.*/ + volatile uint32_t outlink_start: 1; /*Set the bit to start to use outlink descriptor.*/ + volatile uint32_t outlink_restart: 1; /*Set the bit to mount on new outlink descriptors.*/ + volatile uint32_t reserved31: 1; /*reserved*/ + }; + volatile uint32_t val; + }dma_out_link; + union { + struct { + volatile uint32_t inlink_addr: 20; /*The address of the first inlink descriptor.*/ + volatile uint32_t inlink_auto_ret: 1; /*when the bit is set inlink descriptor returns to the next descriptor while a packet is wrong*/ + volatile uint32_t reserved21: 7; /*reserved*/ + volatile uint32_t inlink_stop: 1; /*Set the bit to stop to use inlink descriptor.*/ + volatile uint32_t inlink_start: 1; /*Set the bit to start to use inlink descriptor.*/ + volatile uint32_t inlink_restart: 1; /*Set the bit to mount on new inlink descriptors.*/ + volatile uint32_t reserved31: 1; /*reserved*/ + }; + volatile uint32_t val; + }dma_in_link; + union { + struct { + volatile uint32_t dma_rx_en: 1; /*spi dma read data status bit.*/ + volatile uint32_t dma_tx_en: 1; /*spi dma write data status bit.*/ + volatile uint32_t reserved2: 30; /*spi dma read data from memory count.*/ + }; + volatile uint32_t val; + }dma_status; + union { + struct { + volatile uint32_t inlink_dscr_empty_int_ena: 1; /*The enable bit for lack of enough inlink descriptors.*/ + volatile uint32_t outlink_dscr_error_int_ena: 1; /*The enable bit for outlink descriptor error.*/ + volatile uint32_t inlink_dscr_error_int_ena: 1; /*The enable bit for inlink descriptor error.*/ + volatile uint32_t in_done_int_ena: 1; /*The enable bit for completing usage of a inlink descriptor.*/ + volatile uint32_t in_err_eof_int_ena: 1; /*The enable bit for receiving error.*/ + volatile uint32_t in_suc_eof_int_ena: 1; /*The enable bit for completing receiving all the packets from host.*/ + volatile uint32_t out_done_int_ena: 1; /*The enable bit for completing usage of a outlink descriptor .*/ + volatile uint32_t out_eof_int_ena: 1; /*The enable bit for sending a packet to host done.*/ + volatile uint32_t out_total_eof_int_ena: 1; /*The enable bit for sending all the packets to host done.*/ + volatile uint32_t reserved9: 23; /*reserved*/ + }; + volatile uint32_t val; + }dma_int_ena; + union { + struct { + volatile uint32_t inlink_dscr_empty_int_raw: 1; /*The raw bit for lack of enough inlink descriptors.*/ + volatile uint32_t outlink_dscr_error_int_raw: 1; /*The raw bit for outlink descriptor error.*/ + volatile uint32_t inlink_dscr_error_int_raw: 1; /*The raw bit for inlink descriptor error.*/ + volatile uint32_t in_done_int_raw: 1; /*The raw bit for completing usage of a inlink descriptor.*/ + volatile uint32_t in_err_eof_int_raw: 1; /*The raw bit for receiving error.*/ + volatile uint32_t in_suc_eof_int_raw: 1; /*The raw bit for completing receiving all the packets from host.*/ + volatile uint32_t out_done_int_raw: 1; /*The raw bit for completing usage of a outlink descriptor.*/ + volatile uint32_t out_eof_int_raw: 1; /*The raw bit for sending a packet to host done.*/ + volatile uint32_t out_total_eof_int_raw: 1; /*The raw bit for sending all the packets to host done.*/ + volatile uint32_t reserved9: 23; /*reserved*/ + }; + volatile uint32_t val; + }dma_int_raw; + union { + struct { + volatile uint32_t inlink_dscr_empty_int_st: 1; /*The status bit for lack of enough inlink descriptors.*/ + volatile uint32_t outlink_dscr_error_int_st: 1; /*The status bit for outlink descriptor error.*/ + volatile uint32_t inlink_dscr_error_int_st: 1; /*The status bit for inlink descriptor error.*/ + volatile uint32_t in_done_int_st: 1; /*The status bit for completing usage of a inlink descriptor.*/ + volatile uint32_t in_err_eof_int_st: 1; /*The status bit for receiving error.*/ + volatile uint32_t in_suc_eof_int_st: 1; /*The status bit for completing receiving all the packets from host.*/ + volatile uint32_t out_done_int_st: 1; /*The status bit for completing usage of a outlink descriptor.*/ + volatile uint32_t out_eof_int_st: 1; /*The status bit for sending a packet to host done.*/ + volatile uint32_t out_total_eof_int_st: 1; /*The status bit for sending all the packets to host done.*/ + volatile uint32_t reserved9: 23; /*reserved*/ + }; + volatile uint32_t val; + }dma_int_st; + union { + struct { + volatile uint32_t inlink_dscr_empty_int_clr: 1; /*The clear bit for lack of enough inlink descriptors.*/ + volatile uint32_t outlink_dscr_error_int_clr: 1; /*The clear bit for outlink descriptor error.*/ + volatile uint32_t inlink_dscr_error_int_clr: 1; /*The clear bit for inlink descriptor error.*/ + volatile uint32_t in_done_int_clr: 1; /*The clear bit for completing usage of a inlink descriptor.*/ + volatile uint32_t in_err_eof_int_clr: 1; /*The clear bit for receiving error.*/ + volatile uint32_t in_suc_eof_int_clr: 1; /*The clear bit for completing receiving all the packets from host.*/ + volatile uint32_t out_done_int_clr: 1; /*The clear bit for completing usage of a outlink descriptor.*/ + volatile uint32_t out_eof_int_clr: 1; /*The clear bit for sending a packet to host done.*/ + volatile uint32_t out_total_eof_int_clr: 1; /*The clear bit for sending all the packets to host done.*/ + volatile uint32_t reserved9: 23; /*reserved*/ + }; + volatile uint32_t val; + }dma_int_clr; + volatile uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ + volatile uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ + volatile uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ + volatile uint32_t dma_inlink_dscr_bf0; /*The content of next in descriptor pointer.*/ + volatile uint32_t dma_inlink_dscr_bf1; /*The content of current in descriptor data buffer pointer.*/ + volatile uint32_t dma_out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produce eof.*/ + volatile uint32_t dma_out_eof_des_addr; /*The last outlink descriptor address when spi dma produce to_eof.*/ + volatile uint32_t dma_outlink_dscr; /*The content of current out descriptor pointer.*/ + volatile uint32_t dma_outlink_dscr_bf0; /*The content of next out descriptor pointer.*/ + volatile uint32_t dma_outlink_dscr_bf1; /*The content of current out descriptor data buffer pointer.*/ + volatile uint32_t dma_rx_status; /*spi dma read data from memory status.*/ + volatile uint32_t dma_tx_status; /*spi dma write data to memory status.*/ + volatile uint32_t reserved_150; + volatile uint32_t reserved_154; + volatile uint32_t reserved_158; + volatile uint32_t reserved_15c; + volatile uint32_t reserved_160; + volatile uint32_t reserved_164; + volatile uint32_t reserved_168; + volatile uint32_t reserved_16c; + volatile uint32_t reserved_170; + volatile uint32_t reserved_174; + volatile uint32_t reserved_178; + volatile uint32_t reserved_17c; + volatile uint32_t reserved_180; + volatile uint32_t reserved_184; + volatile uint32_t reserved_188; + volatile uint32_t reserved_18c; + volatile uint32_t reserved_190; + volatile uint32_t reserved_194; + volatile uint32_t reserved_198; + volatile uint32_t reserved_19c; + volatile uint32_t reserved_1a0; + volatile uint32_t reserved_1a4; + volatile uint32_t reserved_1a8; + volatile uint32_t reserved_1ac; + volatile uint32_t reserved_1b0; + volatile uint32_t reserved_1b4; + volatile uint32_t reserved_1b8; + volatile uint32_t reserved_1bc; + volatile uint32_t reserved_1c0; + volatile uint32_t reserved_1c4; + volatile uint32_t reserved_1c8; + volatile uint32_t reserved_1cc; + volatile uint32_t reserved_1d0; + volatile uint32_t reserved_1d4; + volatile uint32_t reserved_1d8; + volatile uint32_t reserved_1dc; + volatile uint32_t reserved_1e0; + volatile uint32_t reserved_1e4; + volatile uint32_t reserved_1e8; + volatile uint32_t reserved_1ec; + volatile uint32_t reserved_1f0; + volatile uint32_t reserved_1f4; + volatile uint32_t reserved_1f8; + volatile uint32_t reserved_1fc; + volatile uint32_t reserved_200; + volatile uint32_t reserved_204; + volatile uint32_t reserved_208; + volatile uint32_t reserved_20c; + volatile uint32_t reserved_210; + volatile uint32_t reserved_214; + volatile uint32_t reserved_218; + volatile uint32_t reserved_21c; + volatile uint32_t reserved_220; + volatile uint32_t reserved_224; + volatile uint32_t reserved_228; + volatile uint32_t reserved_22c; + volatile uint32_t reserved_230; + volatile uint32_t reserved_234; + volatile uint32_t reserved_238; + volatile uint32_t reserved_23c; + volatile uint32_t reserved_240; + volatile uint32_t reserved_244; + volatile uint32_t reserved_248; + volatile uint32_t reserved_24c; + volatile uint32_t reserved_250; + volatile uint32_t reserved_254; + volatile uint32_t reserved_258; + volatile uint32_t reserved_25c; + volatile uint32_t reserved_260; + volatile uint32_t reserved_264; + volatile uint32_t reserved_268; + volatile uint32_t reserved_26c; + volatile uint32_t reserved_270; + volatile uint32_t reserved_274; + volatile uint32_t reserved_278; + volatile uint32_t reserved_27c; + volatile uint32_t reserved_280; + volatile uint32_t reserved_284; + volatile uint32_t reserved_288; + volatile uint32_t reserved_28c; + volatile uint32_t reserved_290; + volatile uint32_t reserved_294; + volatile uint32_t reserved_298; + volatile uint32_t reserved_29c; + volatile uint32_t reserved_2a0; + volatile uint32_t reserved_2a4; + volatile uint32_t reserved_2a8; + volatile uint32_t reserved_2ac; + volatile uint32_t reserved_2b0; + volatile uint32_t reserved_2b4; + volatile uint32_t reserved_2b8; + volatile uint32_t reserved_2bc; + volatile uint32_t reserved_2c0; + volatile uint32_t reserved_2c4; + volatile uint32_t reserved_2c8; + volatile uint32_t reserved_2cc; + volatile uint32_t reserved_2d0; + volatile uint32_t reserved_2d4; + volatile uint32_t reserved_2d8; + volatile uint32_t reserved_2dc; + volatile uint32_t reserved_2e0; + volatile uint32_t reserved_2e4; + volatile uint32_t reserved_2e8; + volatile uint32_t reserved_2ec; + volatile uint32_t reserved_2f0; + volatile uint32_t reserved_2f4; + volatile uint32_t reserved_2f8; + volatile uint32_t reserved_2fc; + volatile uint32_t reserved_300; + volatile uint32_t reserved_304; + volatile uint32_t reserved_308; + volatile uint32_t reserved_30c; + volatile uint32_t reserved_310; + volatile uint32_t reserved_314; + volatile uint32_t reserved_318; + volatile uint32_t reserved_31c; + volatile uint32_t reserved_320; + volatile uint32_t reserved_324; + volatile uint32_t reserved_328; + volatile uint32_t reserved_32c; + volatile uint32_t reserved_330; + volatile uint32_t reserved_334; + volatile uint32_t reserved_338; + volatile uint32_t reserved_33c; + volatile uint32_t reserved_340; + volatile uint32_t reserved_344; + volatile uint32_t reserved_348; + volatile uint32_t reserved_34c; + volatile uint32_t reserved_350; + volatile uint32_t reserved_354; + volatile uint32_t reserved_358; + volatile uint32_t reserved_35c; + volatile uint32_t reserved_360; + volatile uint32_t reserved_364; + volatile uint32_t reserved_368; + volatile uint32_t reserved_36c; + volatile uint32_t reserved_370; + volatile uint32_t reserved_374; + volatile uint32_t reserved_378; + volatile uint32_t reserved_37c; + volatile uint32_t reserved_380; + volatile uint32_t reserved_384; + volatile uint32_t reserved_388; + volatile uint32_t reserved_38c; + volatile uint32_t reserved_390; + volatile uint32_t reserved_394; + volatile uint32_t reserved_398; + volatile uint32_t reserved_39c; + volatile uint32_t reserved_3a0; + volatile uint32_t reserved_3a4; + volatile uint32_t reserved_3a8; + volatile uint32_t reserved_3ac; + volatile uint32_t reserved_3b0; + volatile uint32_t reserved_3b4; + volatile uint32_t reserved_3b8; + volatile uint32_t reserved_3bc; + volatile uint32_t reserved_3c0; + volatile uint32_t reserved_3c4; + volatile uint32_t reserved_3c8; + volatile uint32_t reserved_3cc; + volatile uint32_t reserved_3d0; + volatile uint32_t reserved_3d4; + volatile uint32_t reserved_3d8; + volatile uint32_t reserved_3dc; + volatile uint32_t reserved_3e0; + volatile uint32_t reserved_3e4; + volatile uint32_t reserved_3e8; + volatile uint32_t reserved_3ec; + volatile uint32_t reserved_3f0; + volatile uint32_t reserved_3f4; + volatile uint32_t reserved_3f8; + union { + struct { + volatile uint32_t date: 28; /*SPI register version.*/ + volatile uint32_t reserved28: 4; /*reserved*/ + }; + volatile uint32_t val; + }date; +} spi_dev_t; +extern volatile spi_dev_t SPI0; /* SPI0 IS FOR INTERNAL USE*/ +extern volatile spi_dev_t SPI1; +extern volatile spi_dev_t SPI2; +extern volatile spi_dev_t SPI3; +#endif /* _SOC_SPI_STRUCT_H_ */ diff --git a/components/esp32/include/soc/timer_group_struct.h b/components/esp32/include/soc/timer_group_struct.h new file mode 100644 index 0000000000..b385f04f77 --- /dev/null +++ b/components/esp32/include/soc/timer_group_struct.h @@ -0,0 +1,195 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_TIMG_STRUCT_H_ +#define _SOC_TIMG_STRUCT_H_ +typedef struct { + struct{ + union { + struct { + volatile uint32_t reserved0: 10; + volatile uint32_t alarm_en: 1; /*When set alarm is enabled*/ + volatile uint32_t level_int_en: 1; /*When set level type interrupt will be generated during alarm*/ + volatile uint32_t edge_int_en: 1; /*When set edge type interrupt will be generated during alarm*/ + volatile uint32_t divider: 16; /*Timer clock (T0/1_clk) pre-scale value.*/ + volatile uint32_t autoreload: 1; /*When set timer 0/1 auto-reload at alarming is enabled*/ + volatile uint32_t increase: 1; /*When set timer 0/1 time-base counter increment. When cleared timer 0 time-base counter decrement.*/ + volatile uint32_t enable: 1; /*When set timer 0/1 time-base counter is enabled*/ + }; + volatile uint32_t val; + }config; + volatile uint32_t timer_cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ + volatile uint32_t timer_cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ + volatile uint32_t timer_update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ + volatile uint32_t timer_alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/ + volatile uint32_t timer_alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/ + volatile uint32_t timer_load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ + volatile uint32_t timer_load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ + volatile uint32_t timer_reload; /*Write any value will trigger timer 0 time-base counter reload*/ + }hw_timer[2]; + union { + struct { + volatile uint32_t reserved0: 14; + volatile uint32_t wdt_flashboot_mod_en: 1; /*When set flash boot protection is enabled*/ + volatile uint32_t wdt_sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + volatile uint32_t wdt_cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + volatile uint32_t wdt_level_int_en: 1; /*When set level type interrupt generation is enabled*/ + volatile uint32_t wdt_edge_int_en: 1; /*When set edge type interrupt generation is enabled*/ + volatile uint32_t wdt_stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + volatile uint32_t wdt_stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + volatile uint32_t wdt_stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + volatile uint32_t wdt_stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + volatile uint32_t wdt_en: 1; /*When set SWDT is enabled*/ + }; + volatile uint32_t val; + }wdt_config0; + union { + struct { + volatile uint32_t reserved0: 16; + volatile uint32_t wdt_clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ + }; + volatile uint32_t val; + }wdt_config1; + volatile uint32_t wdt_config2; /*Stage 0 timeout value in SWDT clock cycles*/ + volatile uint32_t wdt_config3; /*Stage 1 timeout value in SWDT clock cycles*/ + volatile uint32_t wdt_config4; /*Stage 2 timeout value in SWDT clock cycles*/ + volatile uint32_t wdt_config5; /*Stage 3 timeout value in SWDT clock cycles*/ + volatile uint32_t wdt_feed; /*Write any value will feed SWDT*/ + volatile uint32_t wdt_wprotect; /*If change its value from default then write protection is on.*/ + union { + struct { + volatile uint32_t reserved0: 12; + volatile uint32_t rtc_cali_start_cycling: 1; + volatile uint32_t rtc_cali_clk_sel: 2; + volatile uint32_t rtc_cali_rdy: 1; + volatile uint32_t rtc_cali_max: 15; + volatile uint32_t rtc_cali_start: 1; + }; + volatile uint32_t val; + }rtc_cali_cfg; + union { + struct { + volatile uint32_t reserved0: 7; + volatile uint32_t rtc_cali_value:25; + }; + volatile uint32_t val; + }rtc_cali_cfg1; + union { + struct { + volatile uint32_t reserved0: 7; + volatile uint32_t lact_rtc_only: 1; + volatile uint32_t lact_cpst_en: 1; + volatile uint32_t lact_lac_en: 1; + volatile uint32_t lact_alarm_en: 1; + volatile uint32_t lact_level_int_en: 1; + volatile uint32_t lact_edge_int_en: 1; + volatile uint32_t lact_divider: 16; + volatile uint32_t lact_autoreload: 1; + volatile uint32_t lact_increase: 1; + volatile uint32_t lact_en: 1; + }; + volatile uint32_t val; + }lactconfig; + union { + struct { + volatile uint32_t reserved0: 6; + volatile uint32_t lact_rtc_step_len:26; + }; + volatile uint32_t val; + }lactrtc; + volatile uint32_t lactlo; /**/ + volatile uint32_t lacthi; /**/ + volatile uint32_t lactupdate; /**/ + volatile uint32_t lactalarmlo; /**/ + volatile uint32_t lactalarmhi; /**/ + volatile uint32_t lactloadlo; /**/ + volatile uint32_t lactloadhi; /**/ + volatile uint32_t lactload; /**/ + union { + struct { + volatile uint32_t t0_int_ena: 1; /*interrupt when timer0 alarm*/ + volatile uint32_t t1_int_ena: 1; /*interrupt when timer1 alarm*/ + volatile uint32_t wdt_int_ena: 1; /*Interrupt when an interrupt stage timeout*/ + volatile uint32_t lact_int_ena: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }int_ena_timers; + union { + struct { + volatile uint32_t t0_int_raw: 1; /*interrupt when timer0 alarm*/ + volatile uint32_t t1_int_raw: 1; /*interrupt when timer1 alarm*/ + volatile uint32_t wdt_int_raw: 1; /*Interrupt when an interrupt stage timeout*/ + volatile uint32_t lact_int_raw: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }int_raw_timers; + union { + struct { + volatile uint32_t t0_int_st: 1; /*interrupt when timer0 alarm*/ + volatile uint32_t t1_int_st: 1; /*interrupt when timer1 alarm*/ + volatile uint32_t wdt_int_st: 1; /*Interrupt when an interrupt stage timeout*/ + volatile uint32_t lact_int_st: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }int_st_timers; + union { + struct { + volatile uint32_t t0_int_clr: 1; /*interrupt when timer0 alarm*/ + volatile uint32_t t1_int_clr: 1; /*interrupt when timer1 alarm*/ + volatile uint32_t wdt_int_clr: 1; /*Interrupt when an interrupt stage timeout*/ + volatile uint32_t lact_int_clr: 1; + volatile uint32_t reserved4: 28; + }; + volatile uint32_t val; + }int_clr_timers; + volatile uint32_t reserved_a8; + volatile uint32_t reserved_ac; + volatile uint32_t reserved_b0; + volatile uint32_t reserved_b4; + volatile uint32_t reserved_b8; + volatile uint32_t reserved_bc; + volatile uint32_t reserved_c0; + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + volatile uint32_t reserved_f0; + volatile uint32_t reserved_f4; + union { + struct { + volatile uint32_t date:28; /*Version of this regfile*/ + volatile uint32_t reserved28: 4; + }; + volatile uint32_t val; + }timg_date; + union { + struct { + volatile uint32_t reserved0: 31; + volatile uint32_t clk_en: 1; /*Force clock enable for this regfile*/ + }; + volatile uint32_t val; + }clk; +} timg_dev_t; +extern volatile timg_dev_t TIMERG0; +extern volatile timg_dev_t TIMERG1; +#endif /* _SOC_TIMG_STRUCT_H_ */ diff --git a/components/esp32/include/soc/uart_struct.h b/components/esp32/include/soc/uart_struct.h new file mode 100644 index 0000000000..cd756bec3d --- /dev/null +++ b/components/esp32/include/soc/uart_struct.h @@ -0,0 +1,365 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_UART_STRUCT_H_ +#define _SOC_UART_STRUCT_H_ +typedef struct { + union { + struct { + volatile uint32_t fifo_rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }fifo; + union { + struct { + volatile uint32_t rxfifo_full_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ + volatile uint32_t txfifo_empty_int_raw: 1; /*This interrupt raw bit turns to high level when the amount of data in transmitter's fifo is less than ((tx_mem_cnttxfifo_cnt) .*/ + volatile uint32_t parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the parity error of data.*/ + volatile uint32_t frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects data's frame error .*/ + volatile uint32_t rxfifo_ovf_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than the fifo can store.*/ + volatile uint32_t dsr_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of dsrn signal.*/ + volatile uint32_t cts_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of ctsn signal.*/ + volatile uint32_t brk_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the 0 after the stop bit.*/ + volatile uint32_t rxfifo_tout_int_raw: 1; /*This interrupt raw bit turns to high level when receiver takes more time than rx_tout_thrhd to receive a byte.*/ + volatile uint32_t sw_xon_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xoff char with uart_sw_flow_con_en is set to 1.*/ + volatile uint32_t sw_xoff_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xon char with uart_sw_flow_con_en is set to 1.*/ + volatile uint32_t glitch_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the start bit.*/ + volatile uint32_t tx_brk_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter completes sending 0 after all the data in transmitter's fifo are send.*/ + volatile uint32_t tx_brk_idle_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has kept the shortest duration after the last data has been send.*/ + volatile uint32_t tx_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has send all the data in fifo.*/ + volatile uint32_t rs485_parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the parity error.*/ + volatile uint32_t rs485_frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the data frame error.*/ + volatile uint32_t rs485_clash_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the clash between transmitter and receiver.*/ + volatile uint32_t at_cmd_char_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the configured at_cmd chars.*/ + volatile uint32_t reserved19: 13; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t rxfifo_full_int_st: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ + volatile uint32_t txfifo_empty_int_st: 1; /*This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set to 1.*/ + volatile uint32_t parity_err_int_st: 1; /*This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.*/ + volatile uint32_t frm_err_int_st: 1; /*This is the status bit for frm_err_int_raw when fm_err_int_ena is set to 1.*/ + volatile uint32_t rxfifo_ovf_int_st: 1; /*This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.*/ + volatile uint32_t dsr_chg_int_st: 1; /*This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.*/ + volatile uint32_t cts_chg_int_st: 1; /*This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.*/ + volatile uint32_t brk_det_int_st: 1; /*This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.*/ + volatile uint32_t rxfifo_tout_int_st: 1; /*This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.*/ + volatile uint32_t sw_xon_int_st: 1; /*This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.*/ + volatile uint32_t sw_xoff_int_st: 1; /*This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.*/ + volatile uint32_t glitch_det_int_st: 1; /*This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.*/ + volatile uint32_t tx_brk_done_int_st: 1; /*This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.*/ + volatile uint32_t tx_brk_idle_done_int_st: 1; /*This is the status bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena is set to 1.*/ + volatile uint32_t tx_done_int_st: 1; /*This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.*/ + volatile uint32_t rs485_parity_err_int_st: 1; /*This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is set to 1.*/ + volatile uint32_t rs485_frm_err_int_st: 1; /*This is the status bit for rs485_fm_err_int_raw when rs485_fm_err_int_ena is set to 1.*/ + volatile uint32_t rs485_clash_int_st: 1; /*This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.*/ + volatile uint32_t at_cmd_char_det_int_st: 1; /*This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set to 1.*/ + volatile uint32_t reserved19: 13; + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t rxfifo_full_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + volatile uint32_t txfifo_empty_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + volatile uint32_t parity_err_int_ena: 1; /*This is the enable bit for parity_err_int_st register.*/ + volatile uint32_t frm_err_int_ena: 1; /*This is the enable bit for frm_err_int_st register.*/ + volatile uint32_t rxfifo_ovf_int_ena: 1; /*This is the enable bit for rxfifo_ovf_int_st register.*/ + volatile uint32_t dsr_chg_int_ena: 1; /*This is the enable bit for dsr_chg_int_st register.*/ + volatile uint32_t cts_chg_int_ena: 1; /*This is the enable bit for cts_chg_int_st register.*/ + volatile uint32_t brk_det_int_ena: 1; /*This is the enable bit for brk_det_int_st register.*/ + volatile uint32_t rxfifo_tout_int_ena: 1; /*This is the enable bit for rxfifo_tout_int_st register.*/ + volatile uint32_t sw_xon_int_ena: 1; /*This is the enable bit for sw_xon_int_st register.*/ + volatile uint32_t sw_xoff_int_ena: 1; /*This is the enable bit for sw_xoff_int_st register.*/ + volatile uint32_t glitch_det_int_ena: 1; /*This is the enable bit for glitch_det_int_st register.*/ + volatile uint32_t tx_brk_done_int_ena: 1; /*This is the enable bit for tx_brk_done_int_st register.*/ + volatile uint32_t tx_brk_idle_done_int_ena: 1; /*This is the enable bit for tx_brk_idle_done_int_st register.*/ + volatile uint32_t tx_done_int_ena: 1; /*This is the enable bit for tx_done_int_st register.*/ + volatile uint32_t rs485_parity_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + volatile uint32_t rs485_frm_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + volatile uint32_t rs485_clash_int_ena: 1; /*This is the enable bit for rs485_clash_int_st register.*/ + volatile uint32_t at_cmd_char_det_int_ena: 1; /*This is the enable bit for at_cmd_char_det_int_st register.*/ + volatile uint32_t reserved19: 13; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t rxfifo_full_int_clr: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ + volatile uint32_t txfifo_empty_int_clr: 1; /*Set this bit to clear txfifo_empty_int_raw interrupt.*/ + volatile uint32_t parity_err_int_clr: 1; /*Set this bit to clear parity_err_int_raw interrupt.*/ + volatile uint32_t frm_err_int_clr: 1; /*Set this bit to clear frm_err_int_raw interrupt.*/ + volatile uint32_t rxfifo_ovf_int_clr: 1; /*Set this bit to clear rxfifo_ovf_int_raw interrupt.*/ + volatile uint32_t dsr_chg_int_clr: 1; /*Set this bit to clear the dsr_chg_int_raw interrupt.*/ + volatile uint32_t cts_chg_int_clr: 1; /*Set this bit to clear the cts_chg_int_raw interrupt.*/ + volatile uint32_t brk_det_int_clr: 1; /*Set this bit to clear the brk_det_int_raw interrupt.*/ + volatile uint32_t rxfifo_tout_int_clr: 1; /*Set this bit to clear the rxfifo_tout_int_raw interrupt.*/ + volatile uint32_t sw_xon_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + volatile uint32_t sw_xoff_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + volatile uint32_t glitch_det_int_clr: 1; /*Set this bit to clear the glitch_det_int_raw interrupt.*/ + volatile uint32_t tx_brk_done_int_clr: 1; /*Set this bit to clear the tx_brk_done_int_raw interrupt..*/ + volatile uint32_t tx_brk_idle_done_int_clr: 1; /*Set this bit to clear the tx_brk_idle_done_int_raw interrupt.*/ + volatile uint32_t tx_done_int_clr: 1; /*Set this bit to clear the tx_done_int_raw interrupt.*/ + volatile uint32_t rs485_parity_err_int_clr: 1; /*Set this bit to clear the rs485_parity_err_int_raw interrupt.*/ + volatile uint32_t rs485_frm_err_int_clr: 1; /*Set this bit to clear the rs485_frm_err_int_raw interrupt.*/ + volatile uint32_t rs485_clash_int_clr: 1; /*Set this bit to clear the rs485_clash_int_raw interrupt.*/ + volatile uint32_t at_cmd_char_det_int_clr: 1; /*Set this bit to clear the at_cmd_char_det_int_raw interrupt.*/ + volatile uint32_t reserved19: 13; + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t clkdiv: 20; /*The register value is the integer part of the frequency divider's factor.*/ + volatile uint32_t clkdiv_frag: 4; /*The register value is the decimal part of the frequency divider's factor.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }clk_div; + union { + struct { + volatile uint32_t auto_baud_en: 1; /*This is the enable bit for detecting baudrate.*/ + volatile uint32_t reserved1: 7; + volatile uint32_t glitch_filt: 8; /*when input pulse width is lower then this value ignore this pulse.this register is used in auto-baud detect process.*/ + volatile uint32_t reserved16: 16; + }; + volatile uint32_t val; + }auto_baud; + union { + struct { + volatile uint32_t rxfifo_cnt: 8; /*(rx_mem_cnt rxfifo_cnt) stores the byte number of valid data in receiver's fifo. rx_mem_cnt register stores the 3 most significant bits rxfifo_cnt stores the 8 least significant bits.*/ + volatile uint32_t st_urx_out: 4; /*This register stores the value of receiver's finite state machine. 0:RX_IDLE 1:RX_STRT 2:RX_DAT0 3:RX_DAT1 4:RX_DAT2 5:RX_DAT3 6:RX_DAT4 7:RX_DAT5 8:RX_DAT6 9:RX_DAT7 10:RX_PRTY 11:RX_STP1 12:RX_STP2 13:RX_DL1*/ + volatile uint32_t reserved12: 1; + volatile uint32_t dsrn: 1; /*This register stores the level value of the internal uart dsr signal.*/ + volatile uint32_t ctsn: 1; /*This register stores the level value of the internal uart cts signal.*/ + volatile uint32_t rxd: 1; /*This register stores the level value of the internal uart rxd signal.*/ + volatile uint32_t txfifo_cnt: 8; /*(tx_mem_cnt txfifo_cnt) stores the byte number of valid data in transmitter's fifo.tx_mem_cnt stores the 3 most significant bits txfifo_cnt stores the 8 least significant bits.*/ + volatile uint32_t st_utx_out: 4; /*This register stores the value of transmitter's finite state machine. 0:TX_IDLE 1:TX_STRT 2:TX_DAT0 3:TX_DAT1 4:TX_DAT2 5:TX_DAT3 6:TX_DAT4 7:TX_DAT5 8:TX_DAT6 9:TX_DAT7 10:TX_PRTY 11:TX_STP1 12:TX_STP2 13:TX_DL0 14:TX_DL1*/ + volatile uint32_t reserved28: 1; + volatile uint32_t dtrn: 1; /*The register represent the level value of the internal uart dsr signal.*/ + volatile uint32_t rtsn: 1; /*This register represent the level value of the internal uart cts signal.*/ + volatile uint32_t txd: 1; /*This register represent the level value of the internal uart rxd signal.*/ + }; + volatile uint32_t val; + }status; + union { + struct { + volatile uint32_t parity: 1; /*This register is used to configure the parity check mode. 0:even 1:odd*/ + volatile uint32_t parity_en: 1; /*Set this bit to enable uart parity check.*/ + volatile uint32_t bit_num: 2; /*This register is used to set the length of data: 0:5bits 1:6bits 2:7bits 3:8bits*/ + volatile uint32_t stop_bit_num: 2; /*This register is used to set the length of stop bit. 1:1bit 2:1.5bits 3:2bits*/ + volatile uint32_t sw_rts: 1; /*This register is used to configure the software rts signal which is used in software flow control.*/ + volatile uint32_t sw_dtr: 1; /*This register is used to configure the software dtr signal which is used in software flow control..*/ + volatile uint32_t txd_brk: 1; /*Set this bit to enable transmitter to send 0 when the process of sending data is done.*/ + volatile uint32_t irda_dplx: 1; /*Set this bit to enable irda loopback mode.*/ + volatile uint32_t irda_tx_en: 1; /*This is the start enable bit for irda transmitter.*/ + volatile uint32_t irda_wctl: 1; /*1:the irda transmitter's 11th bit is the same to the 10th bit. 0:set irda transmitter's 11th bit to 0.*/ + volatile uint32_t irda_tx_inv: 1; /*Set this bit to inverse the level value of irda transmitter's level.*/ + volatile uint32_t irda_rx_inv: 1; /*Set this bit to inverse the level value of irda receiver's level.*/ + volatile uint32_t loopback: 1; /*Set this bit to enable uart loop-back test mode.*/ + volatile uint32_t tx_flow_en: 1; /*Set this bit to enable transmitter's flow control function.*/ + volatile uint32_t irda_en: 1; /*Set this bit to enable irda protocol.*/ + volatile uint32_t rxfifo_rst: 1; /*Set this bit to reset uart receiver's fifo.*/ + volatile uint32_t txfifo_rst: 1; /*Set this bit to reset uart transmitter's fifo.*/ + volatile uint32_t rxd_inv: 1; /*Set this bit to inverse the level value of uart rxd signal.*/ + volatile uint32_t cts_inv: 1; /*Set this bit to inverse the level value of uart cts signal.*/ + volatile uint32_t dsr_inv: 1; /*Set this bit to inverse the level value of uart dsr signal.*/ + volatile uint32_t txd_inv: 1; /*Set this bit to inverse the level value of uart txd signal.*/ + volatile uint32_t rts_inv: 1; /*Set this bit to inverse the level value of uart rts signal.*/ + volatile uint32_t dtr_inv: 1; /*Set this bit to inverse the level value of uart dtr signal.*/ + volatile uint32_t clk_en: 1; /*1:force clock on for registers:support clock only when write registers*/ + volatile uint32_t err_wr_mask: 1; /*1:receiver stops storing data int fifo when data is wrong. 0:receiver stores the data even if the received data is wrong.*/ + volatile uint32_t tick_ref_always_on: 1; /*This register is used to select the clock.1:apb clock:ref_tick*/ + volatile uint32_t reserved28: 4; + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t rxfifo_full_thrhd: 7; /*When receiver receives more data than its threshold value,receiver will produce rxfifo_full_int_raw interrupt.the threshold value is (rx_flow_thrhd_h3 rxfifo_full_thrhd).*/ + volatile uint32_t reserved7: 1; + volatile uint32_t txfifo_empty_thrhd: 7; /*when the data amount in transmitter fifo is less than its threshold value, it will produce txfifo_empty_int_raw interrupt. the threshold value is (tx_mem_empty_thrhd txfifo_empty_thrhd)*/ + volatile uint32_t reserved15: 1; + volatile uint32_t rx_flow_thrhd: 7; /*when receiver receives more data than its threshold value, receiver produce signal to tell the transmitter stop transferring data. the threshold value is (rx_flow_thrhd_h3 rx_flow_thrhd).*/ + volatile uint32_t rx_flow_en: 1; /*This is the flow enable bit for uart receiver. 1:choose software flow control with configuring sw_rts signal*/ + volatile uint32_t rx_tout_thrhd: 7; /*This register is used to configure the timeout value for uart receiver receiving a byte.*/ + volatile uint32_t rx_tout_en: 1; /*This is the enable bit for uart receiver's timeout function.*/ + }; + volatile uint32_t val; + }conf1; + union { + struct { + volatile uint32_t lowpulse_min_cnt:20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }lowpulse; + union { + struct { + volatile uint32_t highpulse_min_cnt:20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }highpulse; + union { + struct { + volatile uint32_t rxd_edge_cnt:10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }rxd_cnt; + union { + struct { + volatile uint32_t sw_flow_con_en: 1; /*Set this bit to enable software flow control. it is used with register sw_xon or sw_xoff .*/ + volatile uint32_t xonoff_del: 1; /*Set this bit to remove flow control char from the received data.*/ + volatile uint32_t force_xon: 1; /*Set this bit to clear ctsn to stop the transmitter from sending data.*/ + volatile uint32_t force_xoff: 1; /*Set this bit to set ctsn to enable the transmitter to go on sending data.*/ + volatile uint32_t send_xon: 1; /*Set this bit to send xon char, it is cleared by hardware automatically.*/ + volatile uint32_t send_xoff: 1; /*Set this bit to send xoff char, it is cleared by hardware automatically.*/ + volatile uint32_t reserved6: 26; + }; + volatile uint32_t val; + }flow_conf; + union { + struct { + volatile uint32_t active_threshold:10; /*When the input rxd edge changes more than this register value, the uart is active from light sleeping mode.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }sleep_conf; + union { + struct { + volatile uint32_t xon_threshold: 8; /*when the data amount in receiver's fifo is more than this register value, it will send a xoff char with uart_sw_flow_con_en set to 1.*/ + volatile uint32_t xoff_threshold: 8; /*When the data amount in receiver's fifo is less than this register value, it will send a xon char with uart_sw_flow_con_en set to 1.*/ + volatile uint32_t xon_char: 8; /*This register stores the xon flow control char.*/ + volatile uint32_t xoff_char: 8; /*This register stores the xoff flow control char.*/ + }; + volatile uint32_t val; + }swfc_conf; + union { + struct { + volatile uint32_t rx_idle_thrhd:10; /*when receiver takes more time than this register value to receive a byte data, it will produce frame end signal for uhci to stop receiving data.*/ + volatile uint32_t tx_idle_num: 10; /*This register is used to configure the duration time between transfers.*/ + volatile uint32_t tx_brk_num: 8; /*This register is used to configure the number of 0 send after the process of sending data is done. it is active when txd_brk is set to 1.*/ + volatile uint32_t reserved28: 4; + }; + volatile uint32_t val; + }idle_conf; + union { + struct { + volatile uint32_t rs485_en: 1; /*Set this bit to choose rs485 mode.*/ + volatile uint32_t dl0_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ + volatile uint32_t dl1_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ + volatile uint32_t rs485tx_rx_en: 1; /*Set this bit to enable loop-back transmitter's output data signal to receiver's input data signal.*/ + volatile uint32_t rs485rxby_tx_en: 1; /*1: enable rs485's transmitter to send data when rs485's receiver is busy. 0:rs485's transmitter should not send data when its receiver is busy.*/ + volatile uint32_t rs485_rx_dly_num: 1; /*This register is used to delay the receiver's internal data signal.*/ + volatile uint32_t rs485_tx_dly_num: 4; /*This register is used to delay the transmitter's internal data signal.*/ + volatile uint32_t reserved10: 22; + }; + volatile uint32_t val; + }rs485_conf; + union { + struct { + volatile uint32_t pre_idle_num:24; /*This register is used to configure the idle duration time before the first at_cmd is received by receiver, when the the duration is less than this register value it will not take the next data received as at_cmd char.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }at_cmd_precnt; + union { + struct { + volatile uint32_t post_idle_num:24; /*This register is used to configure the duration time between the last at_cmd and the next data, when the duration is less than this register value it will not take the previous data as at_cmd char.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }at_cmd_postcnt; + union { + struct { + volatile uint32_t rx_gap_tout:24; /*This register is used to configure the duration time between the at_cmd chars, when the duration time is less than this register value it will not take the data as continous at_cmd chars.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }at_cmd_gaptout; + union { + struct { + volatile uint32_t at_cmd_char: 8; /*This register is used to configure the content of at_cmd char.*/ + volatile uint32_t char_num: 8; /*This register is used to configure the number of continuous at_cmd chars received by receiver.*/ + volatile uint32_t reserved16: 16; + }; + volatile uint32_t val; + }at_cmd_char; + union { + struct { + volatile uint32_t mem_pd: 1; /*Set this bit to power down memory,when reg_mem_pd registers in the 3 uarts are all set to 1 memory will enter low power mode.*/ + volatile uint32_t reserved1: 1; + volatile uint32_t reserved2: 1; + volatile uint32_t rx_size: 4; /*This register is used to configure the amount of mem allocated to receiver's fifo. the default byte num is 128.*/ + volatile uint32_t tx_size: 4; /*This register is used to configure the amount of mem allocated to transmitter's fifo.the default byte num is 128.*/ + volatile uint32_t reserved11: 4; + volatile uint32_t rx_flow_thrhd_h3: 3; /*refer to the rx_flow_thrhd's description.*/ + volatile uint32_t rx_tout_thrhd_h3: 3; /*refer to the rx_tout_thrhd's description.*/ + volatile uint32_t xon_threshold_h2: 2; /*refer to the uart_xon_threshold's description.*/ + volatile uint32_t xoff_threshold_h2: 2; /*refer to the uart_xoff_threshold's description.*/ + volatile uint32_t rx_mem_full_thrhd: 3; /*refer to the rxfifo_full_thrhd's description.*/ + volatile uint32_t tx_mem_empty_thrhd: 3; /*refer to txfifo_empty_thrhd 's description.*/ + volatile uint32_t reserved31: 1; + }; + volatile uint32_t val; + }mem_conf; + union { + struct { + volatile uint32_t mem_tx_status:24; + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }mem_tx_status; + union { + struct { + volatile uint32_t mem_rx_status:24; + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }mem_rx_status; + union { + struct { + volatile uint32_t rx_mem_cnt: 3; /*refer to the rxfifo_cnt's description.*/ + volatile uint32_t tx_mem_cnt: 3; /*refer to the txfifo_cnt's description.*/ + volatile uint32_t reserved6: 26; + }; + volatile uint32_t val; + }mem_cnt_status; + union { + struct { + volatile uint32_t posedge_min_cnt:20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }pospulse; + union { + struct { + volatile uint32_t negedge_min_cnt:20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ + volatile uint32_t reserved20: 12; + }; + volatile uint32_t val; + }negpulse; + volatile uint32_t reserved_70; + volatile uint32_t reserved_74; + volatile uint32_t date; /**/ + volatile uint32_t id; /**/ +} uart_dev_t; +extern volatile uart_dev_t UART0; +extern volatile uart_dev_t UART1; +extern volatile uart_dev_t UART2; +#endif /* _SOC_UART_STRUCT_H_ */ diff --git a/components/esp32/include/soc/uhci_struct.h b/components/esp32/include/soc/uhci_struct.h new file mode 100644 index 0000000000..323d3beacc --- /dev/null +++ b/components/esp32/include/soc/uhci_struct.h @@ -0,0 +1,337 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _SOC_UHCI_STRUCT_H_ +#define _SOC_UHCI_STRUCT_H_ +typedef struct { + union { + struct { + volatile uint32_t in_rst: 1; /*Set this bit to reset in link operations.*/ + volatile uint32_t out_rst: 1; /*Set this bit to reset out link operations.*/ + volatile uint32_t ahbm_fifo_rst: 1; /*Set this bit to reset dma ahb fifo.*/ + volatile uint32_t ahbm_rst: 1; /*Set this bit to reset dma ahb interface.*/ + volatile uint32_t in_loop_test: 1; /*Set this bit to enable loop test for in links.*/ + volatile uint32_t out_loop_test: 1; /*Set this bit to enable loop test for out links.*/ + volatile uint32_t out_auto_wrback: 1; /*when in link's length is 0 go on to use the next in link automatically.*/ + volatile uint32_t out_no_restart_clr: 1; /*don't use*/ + volatile uint32_t out_eof_mode: 1; /*Set this bit to produce eof after DMA pops all data clear this bit to produce eof after DMA pushes all data*/ + volatile uint32_t uart0_ce: 1; /*Set this bit to use UART to transmit or receive data.*/ + volatile uint32_t uart1_ce: 1; /*Set this bit to use UART1 to transmit or receive data.*/ + volatile uint32_t uart2_ce: 1; /*Set this bit to use UART2 to transmit or receive data.*/ + volatile uint32_t outdscr_burst_en: 1; /*Set this bit to enable DMA in links to use burst mode.*/ + volatile uint32_t indscr_burst_en: 1; /*Set this bit to enable DMA out links to use burst mode.*/ + volatile uint32_t out_data_burst_en: 1; /*Set this bit to enable DMA burst MODE*/ + volatile uint32_t mem_trans_en: 1; + volatile uint32_t seper_en: 1; /*Set this bit to use special char to separate the data frame.*/ + volatile uint32_t head_en: 1; /*Set this bit to enable to use head packet before the data frame.*/ + volatile uint32_t crc_rec_en: 1; /*Set this bit to enable receiver''s ability of crc calculation when crc_en bit in head packet is 1 then there will be crc bytes after data_frame*/ + volatile uint32_t uart_idle_eof_en: 1; /*Set this bit to enable to use idle time when the idle time after data frame is satisfied this means the end of a data frame.*/ + volatile uint32_t len_eof_en: 1; /*Set this bit to enable to use packet_len in packet head when the received data is equal to packet_len this means the end of a data frame.*/ + volatile uint32_t encode_crc_en: 1; /*Set this bit to enable crc calculation for data frame when bit6 in the head packet is 1.*/ + volatile uint32_t clk_en: 1; /*Set this bit to enable clock-gating for read or write registers.*/ + volatile uint32_t uart_rx_brk_eof_en: 1; /*Set this bit to enable to use brk char as the end of a data frame.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }conf0; + union { + struct { + volatile uint32_t rx_start_int_raw: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ + volatile uint32_t tx_start_int_raw: 1; /*when DMA detects a separator char it will produce uhci_tx_start_int interrupt.*/ + volatile uint32_t rx_hung_int_raw: 1; /*when DMA takes a lot of time to receive a data it will produce uhci_rx_hung_int interrupt.*/ + volatile uint32_t tx_hung_int_raw: 1; /*when DMA takes a lot of time to read a data from RAM it will produce uhci_tx_hung_int interrupt.*/ + volatile uint32_t in_done_int_raw: 1; /*when a in link descriptor has been completed it will produce uhci_in_done_int interrupt.*/ + volatile uint32_t in_suc_eof_int_raw: 1; /*when a data packet has been received it will produce uhci_in_suc_eof_int interrupt.*/ + volatile uint32_t in_err_eof_int_raw: 1; /*when there are some errors about eof in in link descriptor it will produce uhci_in_err_eof_int interrupt.*/ + volatile uint32_t out_done_int_raw: 1; /*when a out link descriptor is completed it will produce uhci_out_done_int interrupt.*/ + volatile uint32_t out_eof_int_raw: 1; /*when the current descriptor's eof bit is 1 it will produce uhci_out_eof_int interrupt.*/ + volatile uint32_t in_dscr_err_int_raw: 1; /*when there are some errors about the out link descriptor it will produce uhci_in_dscr_err_int interrupt.*/ + volatile uint32_t out_dscr_err_int_raw: 1; /*when there are some errors about the in link descriptor it will produce uhci_out_dscr_err_int interrupt.*/ + volatile uint32_t in_dscr_empty_int_raw: 1; /*when there are not enough in links for DMA it will produce uhci_in_dscr_err_int interrupt.*/ + volatile uint32_t outlink_eof_err_int_raw: 1; /*when there are some errors about eof in outlink descriptor it will produce uhci_outlink_eof_err_int interrupt.*/ + volatile uint32_t out_total_eof_int_raw: 1; /*When all data have been send it will produce uhci_out_total_eof_int interrupt.*/ + volatile uint32_t send_s_q_int_raw: 1; /*When use single send registers to send a short packets it will produce this interrupt when dma has send the short packet.*/ + volatile uint32_t send_a_q_int_raw: 1; /*When use always_send registers to send a series of short packets it will produce this interrupt when dma has send the short packet.*/ + volatile uint32_t dma_infifo_full_wm_int_raw: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_raw; + union { + struct { + volatile uint32_t rx_start_int_st: 1; + volatile uint32_t tx_start_int_st: 1; + volatile uint32_t rx_hung_int_st: 1; + volatile uint32_t tx_hung_int_st: 1; + volatile uint32_t in_done_int_st: 1; + volatile uint32_t in_suc_eof_int_st: 1; + volatile uint32_t in_err_eof_int_st: 1; + volatile uint32_t out_done_int_st: 1; + volatile uint32_t out_eof_int_st: 1; + volatile uint32_t in_dscr_err_int_st: 1; + volatile uint32_t out_dscr_err_int_st: 1; + volatile uint32_t in_dscr_empty_int_st: 1; + volatile uint32_t outlink_eof_err_int_st: 1; + volatile uint32_t out_total_eof_int_st: 1; + volatile uint32_t send_s_q_int_st: 1; + volatile uint32_t send_a_q_int_st: 1; + volatile uint32_t dma_infifo_full_wm_int_st: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_st; + union { + struct { + volatile uint32_t rx_start_int_ena: 1; + volatile uint32_t tx_start_int_ena: 1; + volatile uint32_t rx_hung_int_ena: 1; + volatile uint32_t tx_hung_int_ena: 1; + volatile uint32_t in_done_int_ena: 1; + volatile uint32_t in_suc_eof_int_ena: 1; + volatile uint32_t in_err_eof_int_ena: 1; + volatile uint32_t out_done_int_ena: 1; + volatile uint32_t out_eof_int_ena: 1; + volatile uint32_t in_dscr_err_int_ena: 1; + volatile uint32_t out_dscr_err_int_ena: 1; + volatile uint32_t in_dscr_empty_int_ena: 1; + volatile uint32_t outlink_eof_err_int_ena: 1; + volatile uint32_t out_total_eof_int_ena: 1; + volatile uint32_t send_s_q_int_ena: 1; + volatile uint32_t send_a_q_int_ena: 1; + volatile uint32_t dma_infifo_full_wm_int_ena: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_ena; + union { + struct { + volatile uint32_t rx_start_int_clr: 1; + volatile uint32_t tx_start_int_clr: 1; + volatile uint32_t rx_hung_int_clr: 1; + volatile uint32_t tx_hung_int_clr: 1; + volatile uint32_t in_done_int_clr: 1; + volatile uint32_t in_suc_eof_int_clr: 1; + volatile uint32_t in_err_eof_int_clr: 1; + volatile uint32_t out_done_int_clr: 1; + volatile uint32_t out_eof_int_clr: 1; + volatile uint32_t in_dscr_err_int_clr: 1; + volatile uint32_t out_dscr_err_int_clr: 1; + volatile uint32_t in_dscr_empty_int_clr: 1; + volatile uint32_t outlink_eof_err_int_clr: 1; + volatile uint32_t out_total_eof_int_clr: 1; + volatile uint32_t send_s_q_int_clr: 1; + volatile uint32_t send_a_q_int_clr: 1; + volatile uint32_t dma_infifo_full_wm_int_clr: 1; + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }int_clr; + union { + struct { + volatile uint32_t out_full: 1; /*1:DMA out link descriptor's fifo is full.*/ + volatile uint32_t out_empty: 1; /*1:DMA in link descriptor's fifo is empty.*/ + volatile uint32_t reserved2: 30; + }; + volatile uint32_t val; + }dma_out_status; + union { + struct { + volatile uint32_t outfifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ + volatile uint32_t reserved9: 7; + volatile uint32_t outfifo_push: 1; /*Set this bit to push data in out link descriptor's fifo.*/ + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }dma_out_push; + union { + struct { + volatile uint32_t in_full: 1; + volatile uint32_t in_empty: 1; + volatile uint32_t reserved2: 2; + volatile uint32_t rx_err_cause: 3; /*This register stores the errors caused in out link descriptor's data packet.*/ + volatile uint32_t reserved7: 25; + }; + volatile uint32_t val; + }dma_in_status; + union { + struct { + volatile uint32_t infifo_rdata:12; /*This register stores the data pop from in link descriptor's fifo.*/ + volatile uint32_t reserved12: 4; + volatile uint32_t infifo_pop: 1; /*Set this bit to pop data in in link descriptor's fifo.*/ + volatile uint32_t reserved17: 15; + }; + volatile uint32_t val; + }dma_in_pop; + union { + struct { + volatile uint32_t outlink_addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ + volatile uint32_t reserved20: 8; + volatile uint32_t outlink_stop: 1; /*Set this bit to stop dealing with the out link descriptors.*/ + volatile uint32_t outlink_start: 1; /*Set this bit to start dealing with the out link descriptors.*/ + volatile uint32_t outlink_restart: 1; /*Set this bit to mount on new out link descriptors*/ + volatile uint32_t outlink_park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ + }; + volatile uint32_t val; + }dma_out_link; + union { + struct { + volatile uint32_t inlink_addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ + volatile uint32_t inlink_auto_ret: 1; /*1:when a packet is wrong in link descriptor returns to the descriptor which is lately used.*/ + volatile uint32_t reserved21: 7; + volatile uint32_t inlink_stop: 1; /*Set this bit to stop dealing with the in link descriptors.*/ + volatile uint32_t inlink_start: 1; /*Set this bit to start dealing with the in link descriptors.*/ + volatile uint32_t inlink_restart: 1; /*Set this bit to mount on new in link descriptors*/ + volatile uint32_t inlink_park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ + }; + volatile uint32_t val; + }dma_in_link; + union { + struct { + volatile uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ + volatile uint32_t check_seq_en: 1; /*Set this bit to enable decoder to check seq num in packet header.*/ + volatile uint32_t crc_disable: 1; /*Set this bit to disable crc calculation.*/ + volatile uint32_t save_head: 1; /*Set this bit to save packet header .*/ + volatile uint32_t tx_check_sum_re: 1; /*Set this bit to enable hardware replace check_sum in packet header automatically.*/ + volatile uint32_t tx_ack_num_re: 1; /*Set this bit to enable hardware replace ack num in packet header automatically.*/ + volatile uint32_t check_owner: 1; /*Set this bit to check the owner bit in link descriptor.*/ + volatile uint32_t wait_sw_start: 1; /*Set this bit to enable software way to add packet header.*/ + volatile uint32_t sw_start: 1; /*Set this bit to start inserting the packet header.*/ + volatile uint32_t dma_infifo_full_thrs:12; /*when data amount in link descriptor's fifo is more than this register value it will produce uhci_dma_infifo_full_wm_int interrupt.*/ + volatile uint32_t reserved21: 11; + }; + volatile uint32_t val; + }conf1; + volatile uint32_t state0; /**/ + volatile uint32_t state1; /**/ + volatile uint32_t dma_out_eof_des_addr; /*This register stores the address of out link description when eof bit in this descriptor is 1.*/ + volatile uint32_t dma_in_suc_eof_des_addr; /*This register stores the address of in link descriptor when eof bit in this descriptor is 1.*/ + volatile uint32_t dma_in_err_eof_des_addr; /*This register stores the address of in link descriptor when there are some errors in this descriptor.*/ + volatile uint32_t dma_out_eof_bfr_des_addr; /*This register stores the address of out link descriptor when there are some errors in this descriptor.*/ + union { + struct { + volatile uint32_t ahb_testmode: 3; /*bit2 is ahb bus test enable ,bit1 is used to choose write(1) or read(0) mode. bit0 is used to choose test only once(1) or continue(0)*/ + volatile uint32_t reserved3: 1; + volatile uint32_t ahb_testaddr: 2; /*The two bits represent ahb bus address bit[20:19]*/ + volatile uint32_t reserved6: 26; + }; + volatile uint32_t val; + }ahb_test; + volatile uint32_t dma_in_dscr; /*The content of current in link descriptor's third dword*/ + volatile uint32_t dma_in_dscr_bf0; /*The content of current in link descriptor's first dword*/ + volatile uint32_t dma_in_dscr_bf1; /*The content of current in link descriptor's second dword*/ + volatile uint32_t dma_out_dscr; /*The content of current out link descriptor's third dword*/ + volatile uint32_t dma_out_dscr_bf0; /*The content of current out link descriptor's first dword*/ + volatile uint32_t dma_out_dscr_bf1; /*The content of current out link descriptor's second dword*/ + union { + struct { + volatile uint32_t tx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char decode when DMA receives data.*/ + volatile uint32_t tx_db_esc_en: 1; /*Set this bit to enable 0xdb char decode when DMA receives data.*/ + volatile uint32_t tx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 decode when DMA receives data.*/ + volatile uint32_t tx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 decode when DMA receives data.*/ + volatile uint32_t rx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char replace when DMA sends data.*/ + volatile uint32_t rx_db_esc_en: 1; /*Set this bit to enable 0xdb char replace when DMA sends data.*/ + volatile uint32_t rx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 replace when DMA sends data.*/ + volatile uint32_t rx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 replace when DMA sends data.*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }escape_conf; + union { + struct { + volatile uint32_t txfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to receive a data it will produce uhci_tx_hung_int interrupt.*/ + volatile uint32_t txfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_txfifo_timeout_shift)*/ + volatile uint32_t txfifo_timeout_ena: 1; /*The enable bit for tx fifo receive data timeout*/ + volatile uint32_t rxfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to read a data from RAM it will produce uhci_rx_hung_int interrupt.*/ + volatile uint32_t rxfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_rxfifo_timeout_shift)*/ + volatile uint32_t rxfifo_timeout_ena: 1; /*This is the enable bit for DMA send data timeout*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }hung_conf; + volatile uint32_t ack_num; /**/ + volatile uint32_t rx_head; /*This register stores the packet header received by DMA*/ + union { + struct { + volatile uint32_t single_send_num: 3; /*The bits are used to choose which short packet*/ + volatile uint32_t single_send_en: 1; /*Set this bit to enable send a short packet*/ + volatile uint32_t always_send_num: 3; /*The bits are used to choose which short packet*/ + volatile uint32_t always_send_en: 1; /*Set this bit to enable continuously send the same short packet*/ + volatile uint32_t reserved8: 24; + }; + volatile uint32_t val; + }quick_sent; + struct{ + volatile uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ + }q_data[7]; + union { + struct { + volatile uint32_t seper_char: 8; /*This register stores the separator char separator char is used to separate the data frame.*/ + volatile uint32_t seper_esc_char0: 8; /*This register stores the first char used to replace separator char in data.*/ + volatile uint32_t seper_esc_char1: 8; /*This register stores the second char used to replace separator char in data . 0xdc 0xdb replace 0xc0 by default.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }esc_conf0; + union { + struct { + volatile uint32_t esc_seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ + volatile uint32_t esc_seq0_char0: 8; /*This register stores the first char used to replace reg_esc_seq0 in data.*/ + volatile uint32_t esc_seq0_char1: 8; /*This register stores the second char used to replace the reg_esc_seq0 in data*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }esc_conf1; + union { + struct { + volatile uint32_t esc_seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ + volatile uint32_t esc_seq1_char0: 8; /*This register stores the first char used to replace the reg_esc_seq1 in data.*/ + volatile uint32_t esc_seq1_char1: 8; /*This register stores the second char used to replace the reg_esc_seq1 in data.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }esc_conf2; + union { + struct { + volatile uint32_t esc_seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ + volatile uint32_t esc_seq2_char0: 8; /*This register stores the first char used to replace the reg_esc_seq2 in data.*/ + volatile uint32_t esc_seq2_char1: 8; /*This register stores the second char used to replace the reg_esc_seq2 in data.*/ + volatile uint32_t reserved24: 8; + }; + volatile uint32_t val; + }esc_conf3; + union { + struct { + volatile uint32_t pkt_thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ + volatile uint32_t reserved13:19; + }; + volatile uint32_t val; + }pkt_thres; + volatile uint32_t reserved_c4; + volatile uint32_t reserved_c8; + volatile uint32_t reserved_cc; + volatile uint32_t reserved_d0; + volatile uint32_t reserved_d4; + volatile uint32_t reserved_d8; + volatile uint32_t reserved_dc; + volatile uint32_t reserved_e0; + volatile uint32_t reserved_e4; + volatile uint32_t reserved_e8; + volatile uint32_t reserved_ec; + volatile uint32_t reserved_f0; + volatile uint32_t reserved_f4; + volatile uint32_t reserved_f8; + volatile uint32_t date; /*version information*/ +} uhci_dev_t; +extern volatile uhci_dev_t UHCI0; +extern volatile uhci_dev_t UHCI1; +#endif /* _SOC_UHCI_STRUCT_H_ */ diff --git a/components/esp32/ld/esp32.rom.ld b/components/esp32/ld/esp32.rom.ld index 823ca4c6e8..f8aa70631a 100644 --- a/components/esp32/ld/esp32.rom.ld +++ b/components/esp32/ld/esp32.rom.ld @@ -1836,4 +1836,25 @@ PROVIDE ( _xtos_unhandled_exception = 0x4000c024 ); PROVIDE ( _xtos_unhandled_interrupt = 0x4000c01c ); PROVIDE ( _xtos_vpri_enabled = 0x3ffe0654 ); -PROVIDE ( I2S0 = 0x6000F000 ); +PROVIDE ( I2S0 = 0x3ff4F000 ); +PROVIDE ( I2S1 = 0x3ff6D000 ); +PROVIDE ( GPIO = 0x3ff44000 ); +PROVIDE ( SIGMADELTA = 0x3ff44f00 ); +PROVIDE ( I2C0 = 0x3ff53000 ); +PROVIDE ( I2C1 = 0x3ff67000 ); +PROVIDE ( LEDC = 0x3ff59000 ); +PROVIDE ( PCNT = 0x3ff57000 ); +PROVIDE ( RMT = 0x3ff56000 ); +PROVIDE ( SPI0 = 0x3ff43000 ); +PROVIDE ( SPI1 = 0x3ff42000 ); +PROVIDE ( SPI2 = 0x3ff64000 ); +PROVIDE ( SPI3 = 0x3ff65000 ); +PROVIDE ( TIMERG0 = 0x3ff5F000 ); +PROVIDE ( TIMERG1 = 0x3ff60000 ); +PROVIDE ( UART0 = 0x3ff40000 ); +PROVIDE ( UART1 = 0x3ff50000 ); +PROVIDE ( UART2 = 0x3ff6E000 ); +PROVIDE ( UHCI0 = 0x3ff54000 ); +PROVIDE ( UHCI1 = 0x3ff4C000 ); + + From f703acd34464b2ca3e27c16bd3540b55f54d5393 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sun, 18 Sep 2016 12:10:01 +0800 Subject: [PATCH 016/179] Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers. --- make/project.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/make/project.mk b/make/project.mk index b86470bf62..35dccaf248 100644 --- a/make/project.mk +++ b/make/project.mk @@ -158,13 +158,14 @@ LDFLAGS ?= -nostdlib \ # files, set CFLAGS += in your component's Makefile.projbuild # CPPFLAGS used by an compile pass that uses the C preprocessor -CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wall -ffunction-sections -fdata-sections -mlongcalls -nostdlib -MMD -MP +CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable \ + -Wno-error=unused-variable -Wall -ffunction-sections -fdata-sections -mlongcalls -nostdlib -MMD -MP # C flags use by C only -CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fno-inline-functions +CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fstrict-volatile-bitfields # CXXFLAGS uses by C++ only -CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions +CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields export CFLAGS CPPFLAGS CXXFLAGS From 9938f512f33f2daeca38dee36f2feef2da3fd42c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 12:36:33 +0800 Subject: [PATCH 017/179] peripheral structure headers: move volatile keyword from members to typedef --- components/esp32/include/soc/gpio_sd_struct.h | 30 +- components/esp32/include/soc/gpio_struct.h | 198 ++-- components/esp32/include/soc/i2c_struct.h | 368 +++--- components/esp32/include/soc/i2s_struct.h | 638 +++++------ components/esp32/include/soc/ledc_struct.h | 398 +++---- components/esp32/include/soc/pcnt_struct.h | 212 ++-- components/esp32/include/soc/rmt_struct.h | 346 +++--- components/esp32/include/soc/spi_struct.h | 1016 ++++++++--------- .../esp32/include/soc/timer_group_struct.h | 248 ++-- components/esp32/include/soc/uart_struct.h | 472 ++++---- components/esp32/include/soc/uhci_struct.h | 468 ++++---- 11 files changed, 2197 insertions(+), 2197 deletions(-) diff --git a/components/esp32/include/soc/gpio_sd_struct.h b/components/esp32/include/soc/gpio_sd_struct.h index a1b17bfc5a..d06ad2e9a4 100644 --- a/components/esp32/include/soc/gpio_sd_struct.h +++ b/components/esp32/include/soc/gpio_sd_struct.h @@ -13,36 +13,36 @@ // limitations under the License. #ifndef _SOC_GPIO_SD_STRUCT_H_ #define _SOC_GPIO_SD_STRUCT_H_ -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t sd_in: 8; - volatile uint32_t prescale: 8; - volatile uint32_t reserved16: 16; + uint32_t sd_in: 8; + uint32_t prescale: 8; + uint32_t reserved16: 16; }; - volatile uint32_t val; + uint32_t val; }sigmadelta[8]; union { struct { - volatile uint32_t reserved0: 31; - volatile uint32_t clk_en: 1; + uint32_t reserved0: 31; + uint32_t clk_en: 1; }; - volatile uint32_t val; + uint32_t val; }sigmadelta_cg; union { struct { - volatile uint32_t reserved0: 31; - volatile uint32_t spi_swap: 1; + uint32_t reserved0: 31; + uint32_t spi_swap: 1; }; - volatile uint32_t val; + uint32_t val; }sigmadelta_misc; union { struct { - volatile uint32_t date: 28; - volatile uint32_t reserved28: 4; + uint32_t date: 28; + uint32_t reserved28: 4; }; - volatile uint32_t val; + uint32_t val; }sigmadelta_version; } gpio_sd_dev_t; -extern volatile gpio_sd_dev_t SIGMADELTA; +extern gpio_sd_dev_t SIGMADELTA; #endif /* _SOC_GPIO_SD_STRUCT_H_ */ diff --git a/components/esp32/include/soc/gpio_struct.h b/components/esp32/include/soc/gpio_struct.h index f42de7a294..080d638e92 100644 --- a/components/esp32/include/soc/gpio_struct.h +++ b/components/esp32/include/soc/gpio_struct.h @@ -13,192 +13,192 @@ // limitations under the License. #ifndef _SOC_GPIO_STRUCT_H_ #define _SOC_GPIO_STRUCT_H_ -typedef struct { - volatile uint32_t bt_select; /*NA*/ - volatile uint32_t out; /*GPIO0~31 output value*/ - volatile uint32_t out_w1ts; /*GPIO0~31 output value write 1 to set*/ - volatile uint32_t out_w1tc; /*GPIO0~31 output value write 1 to clear*/ +typedef volatile struct { + uint32_t bt_select; /*NA*/ + uint32_t out; /*GPIO0~31 output value*/ + uint32_t out_w1ts; /*GPIO0~31 output value write 1 to set*/ + uint32_t out_w1tc; /*GPIO0~31 output value write 1 to clear*/ union { struct { - volatile uint32_t out_data: 8; /*GPIO32~39 output value*/ - volatile uint32_t reserved8: 24; + uint32_t out_data: 8; /*GPIO32~39 output value*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }out1; union { struct { - volatile uint32_t out_data: 8; /*GPIO32~39 output value write 1 to set*/ - volatile uint32_t reserved8: 24; + uint32_t out_data: 8; /*GPIO32~39 output value write 1 to set*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }out1_w1ts; union { struct { - volatile uint32_t out_data: 8; /*GPIO32~39 output value write 1 to clear*/ - volatile uint32_t reserved8: 24; + uint32_t out_data: 8; /*GPIO32~39 output value write 1 to clear*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }out1_w1tc; union { struct { - volatile uint32_t sdio_sel: 8; /*SDIO PADS on/off control from outside*/ - volatile uint32_t reserved8: 24; + uint32_t sdio_sel: 8; /*SDIO PADS on/off control from outside*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }sdio_select; - volatile uint32_t enable; /*GPIO0~31 output enable*/ - volatile uint32_t enable_w1ts; /*GPIO0~31 output enable write 1 to set*/ - volatile uint32_t enable_w1tc; /*GPIO0~31 output enable write 1 to clear*/ + uint32_t enable; /*GPIO0~31 output enable*/ + uint32_t enable_w1ts; /*GPIO0~31 output enable write 1 to set*/ + uint32_t enable_w1tc; /*GPIO0~31 output enable write 1 to clear*/ union { struct { - volatile uint32_t enable_data: 8; /*GPIO32~39 output enable*/ - volatile uint32_t reserved8: 24; + uint32_t enable_data: 8; /*GPIO32~39 output enable*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }enable1; union { struct { - volatile uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to set*/ - volatile uint32_t reserved8: 24; + uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to set*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }enable1_w1ts; union { struct { - volatile uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to clear*/ - volatile uint32_t reserved8: 24; + uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to clear*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }enable1_w1tc; union { struct { - volatile uint32_t strapping: 16; /*GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel boot_sel_chip[5:0]}. Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3}. vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5}*/ - volatile uint32_t reserved16:16; + uint32_t strapping: 16; /*GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel boot_sel_chip[5:0]}. Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3}. vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5}*/ + uint32_t reserved16:16; }; - volatile uint32_t val; + uint32_t val; }strap; - volatile uint32_t in; /*GPIO0~31 input value*/ + uint32_t in; /*GPIO0~31 input value*/ union { struct { - volatile uint32_t in_data: 8; /*GPIO32~39 input value*/ - volatile uint32_t reserved8: 24; + uint32_t in_data: 8; /*GPIO32~39 input value*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }in1; - volatile uint32_t status; /*GPIO0~31 interrupt status*/ - volatile uint32_t status_w1ts; /*GPIO0~31 interrupt status write 1 to set*/ - volatile uint32_t status_w1tc; /*GPIO0~31 interrupt status write 1 to clear*/ + uint32_t status; /*GPIO0~31 interrupt status*/ + uint32_t status_w1ts; /*GPIO0~31 interrupt status write 1 to set*/ + uint32_t status_w1tc; /*GPIO0~31 interrupt status write 1 to clear*/ union { struct { - volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status*/ - volatile uint32_t reserved8: 24; + uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }status1; union { struct { - volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to set*/ - volatile uint32_t reserved8: 24; + uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to set*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }status1_w1ts; union { struct { - volatile uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to clear*/ - volatile uint32_t reserved8: 24; + uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to clear*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }status1_w1tc; - volatile uint32_t reserved_5c; - volatile uint32_t acpu_int; /*GPIO0~31 APP CPU interrupt status*/ - volatile uint32_t acpu_nmi_int; /*GPIO0~31 APP CPU non-maskable interrupt status*/ - volatile uint32_t pcpu_int; /*GPIO0~31 PRO CPU interrupt status*/ - volatile uint32_t pcpu_nmi_int; /*GPIO0~31 PRO CPU non-maskable interrupt status*/ - volatile uint32_t cpusdio_int; /*SDIO's extent GPIO0~31 interrupt*/ + uint32_t reserved_5c; + uint32_t acpu_int; /*GPIO0~31 APP CPU interrupt status*/ + uint32_t acpu_nmi_int; /*GPIO0~31 APP CPU non-maskable interrupt status*/ + uint32_t pcpu_int; /*GPIO0~31 PRO CPU interrupt status*/ + uint32_t pcpu_nmi_int; /*GPIO0~31 PRO CPU non-maskable interrupt status*/ + uint32_t cpusdio_int; /*SDIO's extent GPIO0~31 interrupt*/ union { struct { - volatile uint32_t appcpu_int: 8; /*GPIO32~39 APP CPU interrupt status*/ - volatile uint32_t reserved8: 24; + uint32_t appcpu_int: 8; /*GPIO32~39 APP CPU interrupt status*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }acpu_int1; union { struct { - volatile uint32_t appcpu_nmi_int: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ - volatile uint32_t reserved8: 24; + uint32_t appcpu_nmi_int: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }acpu_nmi_int1; union { struct { - volatile uint32_t procpu_int: 8; /*GPIO32~39 PRO CPU interrupt status*/ - volatile uint32_t reserved8: 24; + uint32_t procpu_int: 8; /*GPIO32~39 PRO CPU interrupt status*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }pcpu_int1; union { struct { - volatile uint32_t procpu_nmi_int: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ - volatile uint32_t reserved8: 24; + uint32_t procpu_nmi_int: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }pcpu_nmi_int1; union { struct { - volatile uint32_t sdio_int: 8; /*SDIO's extent GPIO32~39 interrupt*/ - volatile uint32_t reserved8: 24; + uint32_t sdio_int: 8; /*SDIO's extent GPIO32~39 interrupt*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }cpusdio_int1; union { struct { - volatile uint32_t reserved0: 2; - volatile uint32_t pin_pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ - volatile uint32_t reserved3: 4; - volatile uint32_t pin_int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ - volatile uint32_t pin_wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ - volatile uint32_t pin_config: 2; /*NA*/ - volatile uint32_t pin_int_ena: 5; /*bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt enable bit3: PRO CPU interrupt enable bit4: PRO CPU non-maskable interrupt enable bit5: SDIO's extent interrupt enable*/ - volatile uint32_t reserved18: 14; + uint32_t reserved0: 2; + uint32_t pin_pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ + uint32_t reserved3: 4; + uint32_t pin_int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ + uint32_t pin_wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ + uint32_t pin_config: 2; /*NA*/ + uint32_t pin_int_ena: 5; /*bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt enable bit3: PRO CPU interrupt enable bit4: PRO CPU non-maskable interrupt enable bit5: SDIO's extent interrupt enable*/ + uint32_t reserved18: 14; }; - volatile uint32_t val; + uint32_t val; }pin[40]; union { struct { - volatile uint32_t cali_rtc_max:10; - volatile uint32_t reserved10: 21; - volatile uint32_t cali_start: 1; + uint32_t cali_rtc_max:10; + uint32_t reserved10: 21; + uint32_t cali_start: 1; }; - volatile uint32_t val; + uint32_t val; }cali_conf; union { struct { - volatile uint32_t cali_value_sync2:20; - volatile uint32_t reserved20: 10; - volatile uint32_t cali_rdy_real: 1; - volatile uint32_t cali_rdy_sync2: 1; + uint32_t cali_value_sync2:20; + uint32_t reserved20: 10; + uint32_t cali_rdy_real: 1; + uint32_t cali_rdy_sync2: 1; }; - volatile uint32_t val; + uint32_t val; }cali_data; union { struct { - volatile uint32_t func_in_sel: 6; /*select one of the 256 inputs*/ - volatile uint32_t func_in_inv_sel: 1; /*revert the value of the input if you want to revert please set the value to 1*/ - volatile uint32_t sig_in_sel: 1; /*if the slow signal bypass the io matrix or not if you want setting the value to 1*/ - volatile uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ + uint32_t func_in_sel: 6; /*select one of the 256 inputs*/ + uint32_t func_in_inv_sel: 1; /*revert the value of the input if you want to revert please set the value to 1*/ + uint32_t sig_in_sel: 1; /*if the slow signal bypass the io matrix or not if you want setting the value to 1*/ + uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ }; - volatile uint32_t val; + uint32_t val; }func_in_sel_cfg[256]; union { struct { - volatile uint32_t func_out_sel: 9; /*select one of the 256 output to 40 GPIO*/ - volatile uint32_t func_out_inv_sel: 1; /*invert the output value if you want to revert the output value setting the value to 1*/ - volatile uint32_t func_oen_sel: 1; /*weather using the logical oen signal or not using the value setting by the register*/ - volatile uint32_t func_oen_inv_sel: 1; /*invert the output enable value if you want to revert the output enable value setting the value to 1*/ - volatile uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ + uint32_t func_out_sel: 9; /*select one of the 256 output to 40 GPIO*/ + uint32_t func_out_inv_sel: 1; /*invert the output value if you want to revert the output value setting the value to 1*/ + uint32_t func_oen_sel: 1; /*weather using the logical oen signal or not using the value setting by the register*/ + uint32_t func_oen_inv_sel: 1; /*invert the output enable value if you want to revert the output enable value setting the value to 1*/ + uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ }; - volatile uint32_t val; + uint32_t val; }func_out_sel_cfg[40]; } gpio_dev_t; -extern volatile gpio_dev_t GPIO; +extern gpio_dev_t GPIO; #endif /* _SOC_GPIO_STRUCT_H_ */ diff --git a/components/esp32/include/soc/i2c_struct.h b/components/esp32/include/soc/i2c_struct.h index 78f895c029..99c0e9743d 100644 --- a/components/esp32/include/soc/i2c_struct.h +++ b/components/esp32/include/soc/i2c_struct.h @@ -13,277 +13,277 @@ // limitations under the License. #ifndef _SOC_I2C_STRUCT_H_ #define _SOC_I2C_STRUCT_H_ -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t scl_low_period:14; /*This register is used to configure the low level width of SCL clock.*/ - volatile uint32_t reserved14: 18; + uint32_t scl_low_period:14; /*This register is used to configure the low level width of SCL clock.*/ + uint32_t reserved14: 18; }; - volatile uint32_t val; + uint32_t val; }scl_low_period; union { struct { - volatile uint32_t sda_force_out: 1; /*1:normally output sda data 0: exchange the function of sda_o and sda_oe (sda_o is the original internal output sda signal sda_oe is the enable bit for the internal output sda signal)*/ - volatile uint32_t scl_force_out: 1; /*1:normally output scl clock 0: exchange the function of scl_o and scl_oe (scl_o is the original internal output scl signal scl_oe is the enable bit for the internal output scl signal)*/ - volatile uint32_t sample_scl_level: 1; /*Set this bit to sample data in SCL low level. clear this bit to sample data in SCL high level.*/ - volatile uint32_t reserved3: 1; - volatile uint32_t ms_mode: 1; /*Set this bit to configure the module as i2c master clear this bit to configure the module as i2c slave.*/ - volatile uint32_t trans_start: 1; /*Set this bit to start sending data in tx_fifo.*/ - volatile uint32_t tx_lsb_first: 1; /*This bit is used to control the sending mode for data need to be send. 1:receive data from most significant bit 0:receive data from least significant bit*/ - volatile uint32_t rx_lsb_first: 1; /*This bit is used to control the storage mode for received data. 1:receive data from most significant bit 0:receive data from least significant bit*/ - volatile uint32_t clk_en: 1; /*This is the clock gating control bit for reading or writing registers.*/ - volatile uint32_t reserved9: 23; + uint32_t sda_force_out: 1; /*1:normally output sda data 0: exchange the function of sda_o and sda_oe (sda_o is the original internal output sda signal sda_oe is the enable bit for the internal output sda signal)*/ + uint32_t scl_force_out: 1; /*1:normally output scl clock 0: exchange the function of scl_o and scl_oe (scl_o is the original internal output scl signal scl_oe is the enable bit for the internal output scl signal)*/ + uint32_t sample_scl_level: 1; /*Set this bit to sample data in SCL low level. clear this bit to sample data in SCL high level.*/ + uint32_t reserved3: 1; + uint32_t ms_mode: 1; /*Set this bit to configure the module as i2c master clear this bit to configure the module as i2c slave.*/ + uint32_t trans_start: 1; /*Set this bit to start sending data in tx_fifo.*/ + uint32_t tx_lsb_first: 1; /*This bit is used to control the sending mode for data need to be send. 1:receive data from most significant bit 0:receive data from least significant bit*/ + uint32_t rx_lsb_first: 1; /*This bit is used to control the storage mode for received data. 1:receive data from most significant bit 0:receive data from least significant bit*/ + uint32_t clk_en: 1; /*This is the clock gating control bit for reading or writing registers.*/ + uint32_t reserved9: 23; }; - volatile uint32_t val; + uint32_t val; }ctr; union { struct { - volatile uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/ - volatile uint32_t slave_rw: 1; /*when in slave mode 1:master read slave 0: master write slave.*/ - volatile uint32_t time_out: 1; /*when I2C takes more than time_out_reg clocks to receive a data then this register changes to high level.*/ - volatile uint32_t arb_lost: 1; /*when I2C lost control of SDA line this register changes to high level.*/ - volatile uint32_t bus_busy: 1; /*1:I2C bus is busy transferring data. 0:I2C bus is in idle state.*/ - volatile uint32_t slave_addressed: 1; /*when configured as i2c slave and the address send by master is equal to slave's address then this bit will be high level.*/ - volatile uint32_t byte_trans: 1; /*This register changes to high level when one byte is transferred.*/ - volatile uint32_t reserved7: 1; - volatile uint32_t rx_fifo_cnt: 6; /*This register represent the amount of data need to send.*/ - volatile uint32_t reserved14: 4; - volatile uint32_t tx_fifo_cnt: 6; /*This register stores the amount of received data in ram.*/ - volatile uint32_t scl_main_state_last: 3; /*This register stores the value of state machine for i2c module. 3'h0: SCL_MAIN_IDLE 3'h1: SCL_ADDRESS_SHIFT 3'h2: SCL_ACK_ADDRESS 3'h3: SCL_RX_DATA 3'h4 SCL_TX_DATA 3'h5:SCL_SEND_ACK 3'h6:SCL_WAIT_ACK*/ - volatile uint32_t reserved27: 1; - volatile uint32_t scl_state_last: 3; /*This register stores the value of state machine to produce SCL. 3'h0: SCL_IDLE 3'h1:SCL_START 3'h2:SCL_LOW_EDGE 3'h3: SCL_LOW 3'h4:SCL_HIGH_EDGE 3'h5:SCL_HIGH 3'h6:SCL_STOP*/ - volatile uint32_t reserved31: 1; + uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/ + uint32_t slave_rw: 1; /*when in slave mode 1:master read slave 0: master write slave.*/ + uint32_t time_out: 1; /*when I2C takes more than time_out_reg clocks to receive a data then this register changes to high level.*/ + uint32_t arb_lost: 1; /*when I2C lost control of SDA line this register changes to high level.*/ + uint32_t bus_busy: 1; /*1:I2C bus is busy transferring data. 0:I2C bus is in idle state.*/ + uint32_t slave_addressed: 1; /*when configured as i2c slave and the address send by master is equal to slave's address then this bit will be high level.*/ + uint32_t byte_trans: 1; /*This register changes to high level when one byte is transferred.*/ + uint32_t reserved7: 1; + uint32_t rx_fifo_cnt: 6; /*This register represent the amount of data need to send.*/ + uint32_t reserved14: 4; + uint32_t tx_fifo_cnt: 6; /*This register stores the amount of received data in ram.*/ + uint32_t scl_main_state_last: 3; /*This register stores the value of state machine for i2c module. 3'h0: SCL_MAIN_IDLE 3'h1: SCL_ADDRESS_SHIFT 3'h2: SCL_ACK_ADDRESS 3'h3: SCL_RX_DATA 3'h4 SCL_TX_DATA 3'h5:SCL_SEND_ACK 3'h6:SCL_WAIT_ACK*/ + uint32_t reserved27: 1; + uint32_t scl_state_last: 3; /*This register stores the value of state machine to produce SCL. 3'h0: SCL_IDLE 3'h1:SCL_START 3'h2:SCL_LOW_EDGE 3'h3: SCL_LOW 3'h4:SCL_HIGH_EDGE 3'h5:SCL_HIGH 3'h6:SCL_STOP*/ + uint32_t reserved31: 1; }; - volatile uint32_t val; + uint32_t val; }status_reg; union { struct { - volatile uint32_t time_out: 20; /*This register is used to configure the max clock number of receiving a data.*/ - volatile uint32_t reserved20:12; + uint32_t time_out: 20; /*This register is used to configure the max clock number of receiving a data.*/ + uint32_t reserved20:12; }; - volatile uint32_t val; + uint32_t val; }timeout; union { struct { - volatile uint32_t slave_addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ - volatile uint32_t reserved15: 16; - volatile uint32_t addr_10bit_en: 1; /*This register is used to enable slave 10bit address mode.*/ + uint32_t slave_addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ + uint32_t reserved15: 16; + uint32_t addr_10bit_en: 1; /*This register is used to enable slave 10bit address mode.*/ }; - volatile uint32_t val; + uint32_t val; }slave_addr; union { struct { - volatile uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ - volatile uint32_t rx_fifo_end_addr: 5; /*This is the offset address of the first receiving data as described in nonfifo_rx_thres_register.*/ - volatile uint32_t tx_fifo_start_addr: 5; /*This is the offset address of the first sending data as described in nonfifo_tx_thres register.*/ - volatile uint32_t tx_fifo_end_addr: 5; /*This is the offset address of the last sending data as described in nonfifo_tx_thres register.*/ - volatile uint32_t reserved20: 12; + uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ + uint32_t rx_fifo_end_addr: 5; /*This is the offset address of the first receiving data as described in nonfifo_rx_thres_register.*/ + uint32_t tx_fifo_start_addr: 5; /*This is the offset address of the first sending data as described in nonfifo_tx_thres register.*/ + uint32_t tx_fifo_end_addr: 5; /*This is the offset address of the last sending data as described in nonfifo_tx_thres register.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }rx_fifo_st; union { struct { - volatile uint32_t rx_fifo_full_thrhd: 5; - volatile uint32_t tx_fifo_empty_thrhd:5; /*Config tx_fifo empty threhd value when using apb fifo access*/ - volatile uint32_t nonfifo_en: 1; /*Set this bit to enble apb nonfifo access.*/ - volatile uint32_t fifo_addr_cfg_en: 1; /*When this bit is set to 1 then the byte after address represent the offset address of I2C Slave's ram.*/ - volatile uint32_t rx_fifo_rst: 1; /*Set this bit to reset rx fifo when using apb fifo access.*/ - volatile uint32_t tx_fifo_rst: 1; /*Set this bit to reset tx fifo when using apb fifo access.*/ - volatile uint32_t nonfifo_rx_thres: 6; /*when I2C receives more than nonfifo_rx_thres data it will produce rx_send_full_int_raw interrupt and update the current offset address of the receiving data.*/ - volatile uint32_t nonfifo_tx_thres: 6; /*when I2C sends more than nonfifo_tx_thres data it will produce tx_send_empty_int_raw interrupt and update the current offset address of the sending data.*/ - volatile uint32_t reserved26: 6; + uint32_t rx_fifo_full_thrhd: 5; + uint32_t tx_fifo_empty_thrhd:5; /*Config tx_fifo empty threhd value when using apb fifo access*/ + uint32_t nonfifo_en: 1; /*Set this bit to enble apb nonfifo access.*/ + uint32_t fifo_addr_cfg_en: 1; /*When this bit is set to 1 then the byte after address represent the offset address of I2C Slave's ram.*/ + uint32_t rx_fifo_rst: 1; /*Set this bit to reset rx fifo when using apb fifo access.*/ + uint32_t tx_fifo_rst: 1; /*Set this bit to reset tx fifo when using apb fifo access.*/ + uint32_t nonfifo_rx_thres: 6; /*when I2C receives more than nonfifo_rx_thres data it will produce rx_send_full_int_raw interrupt and update the current offset address of the receiving data.*/ + uint32_t nonfifo_tx_thres: 6; /*when I2C sends more than nonfifo_tx_thres data it will produce tx_send_empty_int_raw interrupt and update the current offset address of the sending data.*/ + uint32_t reserved26: 6; }; - volatile uint32_t val; + uint32_t val; }fifo_conf; union { struct { - volatile uint32_t fifo_rdata: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ - volatile uint32_t reserved8: 24; + uint32_t fifo_rdata: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }fifo_data; union { struct { - volatile uint32_t rx_fifo_full_int_raw: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ - volatile uint32_t tx_fifo_empty_int_raw: 1; /*The raw interrupt status bit for tx_fifo empty when use apb fifo access.*/ - volatile uint32_t rx_fifo_ovf_int_raw: 1; /*The raw interrupt status bit for receiving data overflow when use apb fifo access.*/ - volatile uint32_t end_detect_int_raw: 1; /*The raw interrupt status bit for end_detect_int interrupt. when I2C deals with the END command it will produce end_detect_int interrupt.*/ - volatile uint32_t slave_tran_comp_int_raw: 1; /*The raw interrupt status bit for slave_tran_comp_int interrupt. when I2C Slave detects the STOP bit it will produce slave_tran_comp_int interrupt.*/ - volatile uint32_t arbitration_lost_int_raw: 1; /*The raw interrupt status bit for arbitration_lost_int interrupt.when I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ - volatile uint32_t master_tran_comp_int_raw: 1; /*The raw interrupt status bit for master_tra_comp_int interrupt. when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ - volatile uint32_t trans_complete_int_raw: 1; /*The raw interrupt status bit for trans_complete_int interrupt. when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ - volatile uint32_t time_out_int_raw: 1; /*The raw interrupt status bit for time_out_int interrupt. when I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ - volatile uint32_t trans_start_int_raw: 1; /*The raw interrupt status bit for trans_start_int interrupt. when I2C sends the START bit it will produce trans_start_int interrupt.*/ - volatile uint32_t ack_err_int_raw: 1; /*The raw interrupt status bit for ack_err_int interrupt. when I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ - volatile uint32_t rx_rec_full_int_raw: 1; /*The raw interrupt status bit for rx_rec_full_int interrupt. when I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ - volatile uint32_t tx_send_empty_int_raw: 1; /*The raw interrupt status bit for tx_send_empty_int interrupt.when I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ - volatile uint32_t reserved13: 19; + uint32_t rx_fifo_full_int_raw: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ + uint32_t tx_fifo_empty_int_raw: 1; /*The raw interrupt status bit for tx_fifo empty when use apb fifo access.*/ + uint32_t rx_fifo_ovf_int_raw: 1; /*The raw interrupt status bit for receiving data overflow when use apb fifo access.*/ + uint32_t end_detect_int_raw: 1; /*The raw interrupt status bit for end_detect_int interrupt. when I2C deals with the END command it will produce end_detect_int interrupt.*/ + uint32_t slave_tran_comp_int_raw: 1; /*The raw interrupt status bit for slave_tran_comp_int interrupt. when I2C Slave detects the STOP bit it will produce slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost_int_raw: 1; /*The raw interrupt status bit for arbitration_lost_int interrupt.when I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp_int_raw: 1; /*The raw interrupt status bit for master_tra_comp_int interrupt. when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ + uint32_t trans_complete_int_raw: 1; /*The raw interrupt status bit for trans_complete_int interrupt. when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ + uint32_t time_out_int_raw: 1; /*The raw interrupt status bit for time_out_int interrupt. when I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ + uint32_t trans_start_int_raw: 1; /*The raw interrupt status bit for trans_start_int interrupt. when I2C sends the START bit it will produce trans_start_int interrupt.*/ + uint32_t ack_err_int_raw: 1; /*The raw interrupt status bit for ack_err_int interrupt. when I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ + uint32_t rx_rec_full_int_raw: 1; /*The raw interrupt status bit for rx_rec_full_int interrupt. when I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty_int_raw: 1; /*The raw interrupt status bit for tx_send_empty_int interrupt.when I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ + uint32_t reserved13: 19; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t rx_fifo_full_int_clr: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ - volatile uint32_t tx_fifo_empty_int_clr: 1; /*Set this bit to clear the tx_fifo_empty_int interrupt.*/ - volatile uint32_t rx_fifo_ovf_int_clr: 1; /*Set this bit to clear the rx_fifo_ovf_int interrupt.*/ - volatile uint32_t end_detect_int_clr: 1; /*Set this bit to clear the end_detect_int interrupt.*/ - volatile uint32_t slave_tran_comp_int_clr: 1; /*Set this bit to clear the slave_tran_comp_int interrupt.*/ - volatile uint32_t arbitration_lost_int_clr: 1; /*Set this bit to clear the arbitration_lost_int interrupt.*/ - volatile uint32_t master_tran_comp_int_clr: 1; /*Set this bit to clear the master_tran_comp interrupt.*/ - volatile uint32_t trans_complete_int_clr: 1; /*Set this bit to clear the trans_complete_int interrupt.*/ - volatile uint32_t time_out_int_clr: 1; /*Set this bit to clear the time_out_int interrupt.*/ - volatile uint32_t trans_start_int_clr: 1; /*Set this bit to clear the trans_start_int interrupt.*/ - volatile uint32_t ack_err_int_clr: 1; /*Set this bit to clear the ack_err_int interrupt.*/ - volatile uint32_t rx_rec_full_int_clr: 1; /*Set this bit to clear the rx_rec_full_int interrupt.*/ - volatile uint32_t tx_send_empty_int_clr: 1; /*Set this bit to clear the tx_send_empty_int interrupt.*/ - volatile uint32_t reserved13: 19; + uint32_t rx_fifo_full_int_clr: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty_int_clr: 1; /*Set this bit to clear the tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf_int_clr: 1; /*Set this bit to clear the rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect_int_clr: 1; /*Set this bit to clear the end_detect_int interrupt.*/ + uint32_t slave_tran_comp_int_clr: 1; /*Set this bit to clear the slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost_int_clr: 1; /*Set this bit to clear the arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp_int_clr: 1; /*Set this bit to clear the master_tran_comp interrupt.*/ + uint32_t trans_complete_int_clr: 1; /*Set this bit to clear the trans_complete_int interrupt.*/ + uint32_t time_out_int_clr: 1; /*Set this bit to clear the time_out_int interrupt.*/ + uint32_t trans_start_int_clr: 1; /*Set this bit to clear the trans_start_int interrupt.*/ + uint32_t ack_err_int_clr: 1; /*Set this bit to clear the ack_err_int interrupt.*/ + uint32_t rx_rec_full_int_clr: 1; /*Set this bit to clear the rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty_int_clr: 1; /*Set this bit to clear the tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t rx_fifo_full_int_ena: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ - volatile uint32_t tx_fifo_empty_int_ena: 1; /*The enable bit for tx_fifo_empty_int interrupt.*/ - volatile uint32_t rx_fifo_ovf_int_ena: 1; /*The enable bit for rx_fifo_ovf_int interrupt.*/ - volatile uint32_t end_detect_int_ena: 1; /*The enable bit for end_detect_int interrupt.*/ - volatile uint32_t slave_tran_comp_int_ena: 1; /*The enable bit for slave_tran_comp_int interrupt.*/ - volatile uint32_t arbitration_lost_int_ena: 1; /*The enable bit for arbitration_lost_int interrupt.*/ - volatile uint32_t master_tran_comp_int_ena: 1; /*The enable bit for master_tran_comp_int interrupt.*/ - volatile uint32_t trans_complete_int_ena: 1; /*The enable bit for trans_complete_int interrupt.*/ - volatile uint32_t time_out_int_ena: 1; /*The enable bit for time_out_int interrupt.*/ - volatile uint32_t trans_start_int_ena: 1; /*The enable bit for trans_start_int interrupt.*/ - volatile uint32_t ack_err_int_ena: 1; /*The enable bit for ack_err_int interrupt.*/ - volatile uint32_t rx_rec_full_int_ena: 1; /*The enable bit for rx_rec_full_int interrupt.*/ - volatile uint32_t tx_send_empty_int_ena: 1; /*The enable bit for tx_send_empty_int interrupt.*/ - volatile uint32_t reserved13: 19; + uint32_t rx_fifo_full_int_ena: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty_int_ena: 1; /*The enable bit for tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf_int_ena: 1; /*The enable bit for rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect_int_ena: 1; /*The enable bit for end_detect_int interrupt.*/ + uint32_t slave_tran_comp_int_ena: 1; /*The enable bit for slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost_int_ena: 1; /*The enable bit for arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp_int_ena: 1; /*The enable bit for master_tran_comp_int interrupt.*/ + uint32_t trans_complete_int_ena: 1; /*The enable bit for trans_complete_int interrupt.*/ + uint32_t time_out_int_ena: 1; /*The enable bit for time_out_int interrupt.*/ + uint32_t trans_start_int_ena: 1; /*The enable bit for trans_start_int interrupt.*/ + uint32_t ack_err_int_ena: 1; /*The enable bit for ack_err_int interrupt.*/ + uint32_t rx_rec_full_int_ena: 1; /*The enable bit for rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty_int_ena: 1; /*The enable bit for tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t rx_fifo_full_int_st: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ - volatile uint32_t tx_fifo_empty_int_st: 1; /*The masked interrupt status for tx_fifo_empty_int interrupt.*/ - volatile uint32_t rx_fifo_ovf_int_st: 1; /*The masked interrupt status for rx_fifo_ovf_int interrupt.*/ - volatile uint32_t end_detect_int_st: 1; /*The masked interrupt status for end_detect_int interrupt.*/ - volatile uint32_t slave_tran_comp_int_st: 1; /*The masked interrupt status for slave_tran_comp_int interrupt.*/ - volatile uint32_t arbitration_lost_int_st: 1; /*The masked interrupt status for arbitration_lost_int interrupt.*/ - volatile uint32_t master_tran_comp_int_st: 1; /*The masked interrupt status for master_tran_comp_int interrupt.*/ - volatile uint32_t trans_complete_int_st: 1; /*The masked interrupt status for trans_complete_int interrupt.*/ - volatile uint32_t time_out_int_st: 1; /*The masked interrupt status for time_out_int interrupt.*/ - volatile uint32_t trans_start_int_st: 1; /*The masked interrupt status for trans_start_int interrupt.*/ - volatile uint32_t ack_err_int_st: 1; /*The masked interrupt status for ack_err_int interrupt.*/ - volatile uint32_t rx_rec_full_int_st: 1; /*The masked interrupt status for rx_rec_full_int interrupt.*/ - volatile uint32_t tx_send_empty_int_st: 1; /*The masked interrupt status for tx_send_empty_int interrupt.*/ - volatile uint32_t reserved13: 19; + uint32_t rx_fifo_full_int_st: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty_int_st: 1; /*The masked interrupt status for tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf_int_st: 1; /*The masked interrupt status for rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect_int_st: 1; /*The masked interrupt status for end_detect_int interrupt.*/ + uint32_t slave_tran_comp_int_st: 1; /*The masked interrupt status for slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost_int_st: 1; /*The masked interrupt status for arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp_int_st: 1; /*The masked interrupt status for master_tran_comp_int interrupt.*/ + uint32_t trans_complete_int_st: 1; /*The masked interrupt status for trans_complete_int interrupt.*/ + uint32_t time_out_int_st: 1; /*The masked interrupt status for time_out_int interrupt.*/ + uint32_t trans_start_int_st: 1; /*The masked interrupt status for trans_start_int interrupt.*/ + uint32_t ack_err_int_st: 1; /*The masked interrupt status for ack_err_int interrupt.*/ + uint32_t rx_rec_full_int_st: 1; /*The masked interrupt status for rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty_int_st: 1; /*The masked interrupt status for tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; - volatile uint32_t val; + uint32_t val; }int_status; union { struct { - volatile uint32_t sda_hold_time:10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ - volatile uint32_t reserved10: 22; + uint32_t sda_hold_time:10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }sda_hold; union { struct { - volatile uint32_t sda_sample_time:10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ - volatile uint32_t reserved10: 22; + uint32_t sda_sample_time:10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }sda_sample; union { struct { - volatile uint32_t scl_high_period:14; /*This register is used to configure the clock num during SCL is low level.*/ - volatile uint32_t reserved14: 18; + uint32_t scl_high_period:14; /*This register is used to configure the clock num during SCL is low level.*/ + uint32_t reserved14: 18; }; - volatile uint32_t val; + uint32_t val; }scl_high_period; - volatile uint32_t reserved_3c; + uint32_t reserved_3c; union { struct { - volatile uint32_t scl_start_hold_time:10; /*This register is used to configure the clock num between the negedge of SDA and negedge of SCL for start mark.*/ - volatile uint32_t reserved10: 22; + uint32_t scl_start_hold_time:10; /*This register is used to configure the clock num between the negedge of SDA and negedge of SCL for start mark.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }scl_start_hold; union { struct { - volatile uint32_t scl_rstart_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ - volatile uint32_t reserved10: 22; + uint32_t scl_rstart_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }scl_rstart_setup; union { struct { - volatile uint32_t scl_stop_hold_time:14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ - volatile uint32_t reserved14: 18; + uint32_t scl_stop_hold_time:14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ + uint32_t reserved14: 18; }; - volatile uint32_t val; + uint32_t val; }scl_stop_hold; union { struct { - volatile uint32_t scl_stop_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ - volatile uint32_t reserved10: 22; + uint32_t scl_stop_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }scl_stop_setup; union { struct { - volatile uint32_t scl_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ - volatile uint32_t scl_filter_en: 1; /*This is the filter enable bit for SCL.*/ - volatile uint32_t reserved4: 28; + uint32_t scl_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + uint32_t scl_filter_en: 1; /*This is the filter enable bit for SCL.*/ + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }scl_filter_cfg; union { struct { - volatile uint32_t sda_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ - volatile uint32_t sda_filter_en: 1; /*This is the filter enable bit for SDA.*/ - volatile uint32_t reserved4: 28; + uint32_t sda_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + uint32_t sda_filter_en: 1; /*This is the filter enable bit for SDA.*/ + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }sda_filter_cfg; union { struct { - volatile uint32_t byte_num: 8; /*Byte_num represent the number of data need to be send or data need to be received.*/ - volatile uint32_t ack_en: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ - volatile uint32_t ack_exp: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ - volatile uint32_t ack_val: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ - volatile uint32_t op_code: 3; /*op_code is the command 0:RSTART 1:WRITE 2:READ 3:STOP . 4:END.*/ - volatile uint32_t reserved14: 17; - volatile uint32_t command_done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ + uint32_t byte_num: 8; /*Byte_num represent the number of data need to be send or data need to be received.*/ + uint32_t ack_en: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t ack_exp: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t ack_val: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t op_code: 3; /*op_code is the command 0:RSTART 1:WRITE 2:READ 3:STOP . 4:END.*/ + uint32_t reserved14: 17; + uint32_t command_done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ }; - volatile uint32_t val; + uint32_t val; }command[16]; - volatile uint32_t reserved_98; - volatile uint32_t reserved_9c; - volatile uint32_t reserved_a0; - volatile uint32_t reserved_a4; - volatile uint32_t reserved_a8; - volatile uint32_t reserved_ac; - volatile uint32_t reserved_b0; - volatile uint32_t reserved_b4; - volatile uint32_t reserved_b8; - volatile uint32_t reserved_bc; - volatile uint32_t reserved_c0; - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; - volatile uint32_t reserved_f0; - volatile uint32_t reserved_f4; - volatile uint32_t date; /**/ - volatile uint32_t reserved_fc; - volatile uint32_t fifo_start_addr; /*This the start address for ram when use apb nonfifo access.*/ + uint32_t reserved_98; + uint32_t reserved_9c; + uint32_t reserved_a0; + uint32_t reserved_a4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t date; /**/ + uint32_t reserved_fc; + uint32_t fifo_start_addr; /*This the start address for ram when use apb nonfifo access.*/ } i2c_dev_t; -extern volatile i2c_dev_t I2C0; -extern volatile i2c_dev_t I2C1; +extern i2c_dev_t I2C0; +extern i2c_dev_t I2C1; #endif /* _SOC_I2C_STRUCT_H_ */ diff --git a/components/esp32/include/soc/i2s_struct.h b/components/esp32/include/soc/i2s_struct.h index beea328a35..0bf990cd68 100644 --- a/components/esp32/include/soc/i2s_struct.h +++ b/components/esp32/include/soc/i2s_struct.h @@ -13,449 +13,449 @@ // limitations under the License. #ifndef _SOC_I2S_STRUCT_H_ #define _SOC_I2S_STRUCT_H_ -typedef struct { - volatile uint32_t reserved_0; - volatile uint32_t reserved_4; +typedef volatile struct { + uint32_t reserved_0; + uint32_t reserved_4; union { struct { - volatile uint32_t tx_reset: 1; - volatile uint32_t rx_reset: 1; - volatile uint32_t tx_fifo_reset: 1; - volatile uint32_t rx_fifo_reset: 1; - volatile uint32_t tx_start: 1; - volatile uint32_t rx_start: 1; - volatile uint32_t tx_slave_mod: 1; - volatile uint32_t rx_slave_mod: 1; - volatile uint32_t tx_right_first: 1; - volatile uint32_t rx_right_first: 1; - volatile uint32_t tx_msb_shift: 1; - volatile uint32_t rx_msb_shift: 1; - volatile uint32_t tx_short_sync: 1; - volatile uint32_t rx_short_sync: 1; - volatile uint32_t tx_mono: 1; - volatile uint32_t rx_mono: 1; - volatile uint32_t tx_msb_right: 1; - volatile uint32_t rx_msb_right: 1; - volatile uint32_t sig_loopback: 1; - volatile uint32_t reserved19: 13; + uint32_t tx_reset: 1; + uint32_t rx_reset: 1; + uint32_t tx_fifo_reset: 1; + uint32_t rx_fifo_reset: 1; + uint32_t tx_start: 1; + uint32_t rx_start: 1; + uint32_t tx_slave_mod: 1; + uint32_t rx_slave_mod: 1; + uint32_t tx_right_first: 1; + uint32_t rx_right_first: 1; + uint32_t tx_msb_shift: 1; + uint32_t rx_msb_shift: 1; + uint32_t tx_short_sync: 1; + uint32_t rx_short_sync: 1; + uint32_t tx_mono: 1; + uint32_t rx_mono: 1; + uint32_t tx_msb_right: 1; + uint32_t rx_msb_right: 1; + uint32_t sig_loopback: 1; + uint32_t reserved19: 13; }; - volatile uint32_t val; + uint32_t val; }conf; union { struct { - volatile uint32_t rx_take_data_int_raw: 1; - volatile uint32_t tx_put_data_int_raw: 1; - volatile uint32_t rx_wfull_int_raw: 1; - volatile uint32_t rx_rempty_int_raw: 1; - volatile uint32_t tx_wfull_int_raw: 1; - volatile uint32_t tx_rempty_int_raw: 1; - volatile uint32_t rx_hung_int_raw: 1; - volatile uint32_t tx_hung_int_raw: 1; - volatile uint32_t in_done_int_raw: 1; - volatile uint32_t in_suc_eof_int_raw: 1; - volatile uint32_t in_err_eof_int_raw: 1; - volatile uint32_t out_done_int_raw: 1; - volatile uint32_t out_eof_int_raw: 1; - volatile uint32_t in_dscr_err_int_raw: 1; - volatile uint32_t out_dscr_err_int_raw: 1; - volatile uint32_t in_dscr_empty_int_raw: 1; - volatile uint32_t out_total_eof_int_raw: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_take_data_int_raw: 1; + uint32_t tx_put_data_int_raw: 1; + uint32_t rx_wfull_int_raw: 1; + uint32_t rx_rempty_int_raw: 1; + uint32_t tx_wfull_int_raw: 1; + uint32_t tx_rempty_int_raw: 1; + uint32_t rx_hung_int_raw: 1; + uint32_t tx_hung_int_raw: 1; + uint32_t in_done_int_raw: 1; + uint32_t in_suc_eof_int_raw: 1; + uint32_t in_err_eof_int_raw: 1; + uint32_t out_done_int_raw: 1; + uint32_t out_eof_int_raw: 1; + uint32_t in_dscr_err_int_raw: 1; + uint32_t out_dscr_err_int_raw: 1; + uint32_t in_dscr_empty_int_raw: 1; + uint32_t out_total_eof_int_raw: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t rx_take_data_int_st: 1; - volatile uint32_t tx_put_data_int_st: 1; - volatile uint32_t rx_wfull_int_st: 1; - volatile uint32_t rx_rempty_int_st: 1; - volatile uint32_t tx_wfull_int_st: 1; - volatile uint32_t tx_rempty_int_st: 1; - volatile uint32_t rx_hung_int_st: 1; - volatile uint32_t tx_hung_int_st: 1; - volatile uint32_t in_done_int_st: 1; - volatile uint32_t in_suc_eof_int_st: 1; - volatile uint32_t in_err_eof_int_st: 1; - volatile uint32_t out_done_int_st: 1; - volatile uint32_t out_eof_int_st: 1; - volatile uint32_t in_dscr_err_int_st: 1; - volatile uint32_t out_dscr_err_int_st: 1; - volatile uint32_t in_dscr_empty_int_st: 1; - volatile uint32_t out_total_eof_int_st: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_take_data_int_st: 1; + uint32_t tx_put_data_int_st: 1; + uint32_t rx_wfull_int_st: 1; + uint32_t rx_rempty_int_st: 1; + uint32_t tx_wfull_int_st: 1; + uint32_t tx_rempty_int_st: 1; + uint32_t rx_hung_int_st: 1; + uint32_t tx_hung_int_st: 1; + uint32_t in_done_int_st: 1; + uint32_t in_suc_eof_int_st: 1; + uint32_t in_err_eof_int_st: 1; + uint32_t out_done_int_st: 1; + uint32_t out_eof_int_st: 1; + uint32_t in_dscr_err_int_st: 1; + uint32_t out_dscr_err_int_st: 1; + uint32_t in_dscr_empty_int_st: 1; + uint32_t out_total_eof_int_st: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t rx_take_data_int_ena: 1; - volatile uint32_t tx_put_data_int_ena: 1; - volatile uint32_t rx_wfull_int_ena: 1; - volatile uint32_t rx_rempty_int_ena: 1; - volatile uint32_t tx_wfull_int_ena: 1; - volatile uint32_t tx_rempty_int_ena: 1; - volatile uint32_t rx_hung_int_ena: 1; - volatile uint32_t tx_hung_int_ena: 1; - volatile uint32_t in_done_int_ena: 1; - volatile uint32_t in_suc_eof_int_ena: 1; - volatile uint32_t in_err_eof_int_ena: 1; - volatile uint32_t out_done_int_ena: 1; - volatile uint32_t out_eof_int_ena: 1; - volatile uint32_t in_dscr_err_int_ena: 1; - volatile uint32_t out_dscr_err_int_ena: 1; - volatile uint32_t in_dscr_empty_int_ena: 1; - volatile uint32_t out_total_eof_int_ena: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_take_data_int_ena: 1; + uint32_t tx_put_data_int_ena: 1; + uint32_t rx_wfull_int_ena: 1; + uint32_t rx_rempty_int_ena: 1; + uint32_t tx_wfull_int_ena: 1; + uint32_t tx_rempty_int_ena: 1; + uint32_t rx_hung_int_ena: 1; + uint32_t tx_hung_int_ena: 1; + uint32_t in_done_int_ena: 1; + uint32_t in_suc_eof_int_ena: 1; + uint32_t in_err_eof_int_ena: 1; + uint32_t out_done_int_ena: 1; + uint32_t out_eof_int_ena: 1; + uint32_t in_dscr_err_int_ena: 1; + uint32_t out_dscr_err_int_ena: 1; + uint32_t in_dscr_empty_int_ena: 1; + uint32_t out_total_eof_int_ena: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t take_data_int_clr: 1; - volatile uint32_t put_data_int_clr: 1; - volatile uint32_t rx_wfull_int_clr: 1; - volatile uint32_t rx_rempty_int_clr: 1; - volatile uint32_t tx_wfull_int_clr: 1; - volatile uint32_t tx_rempty_int_clr: 1; - volatile uint32_t rx_hung_int_clr: 1; - volatile uint32_t tx_hung_int_clr: 1; - volatile uint32_t in_done_int_clr: 1; - volatile uint32_t in_suc_eof_int_clr: 1; - volatile uint32_t in_err_eof_int_clr: 1; - volatile uint32_t out_done_int_clr: 1; - volatile uint32_t out_eof_int_clr: 1; - volatile uint32_t in_dscr_err_int_clr: 1; - volatile uint32_t out_dscr_err_int_clr: 1; - volatile uint32_t in_dscr_empty_int_clr: 1; - volatile uint32_t out_total_eof_int_clr: 1; - volatile uint32_t reserved17: 15; + uint32_t take_data_int_clr: 1; + uint32_t put_data_int_clr: 1; + uint32_t rx_wfull_int_clr: 1; + uint32_t rx_rempty_int_clr: 1; + uint32_t tx_wfull_int_clr: 1; + uint32_t tx_rempty_int_clr: 1; + uint32_t rx_hung_int_clr: 1; + uint32_t tx_hung_int_clr: 1; + uint32_t in_done_int_clr: 1; + uint32_t in_suc_eof_int_clr: 1; + uint32_t in_err_eof_int_clr: 1; + uint32_t out_done_int_clr: 1; + uint32_t out_eof_int_clr: 1; + uint32_t in_dscr_err_int_clr: 1; + uint32_t out_dscr_err_int_clr: 1; + uint32_t in_dscr_empty_int_clr: 1; + uint32_t out_total_eof_int_clr: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t tx_bck_in_delay: 2; - volatile uint32_t tx_ws_in_delay: 2; - volatile uint32_t rx_bck_in_delay: 2; - volatile uint32_t rx_ws_in_delay: 2; - volatile uint32_t rx_sd_in_delay: 2; - volatile uint32_t tx_bck_out_delay: 2; - volatile uint32_t tx_ws_out_delay: 2; - volatile uint32_t tx_sd_out_delay: 2; - volatile uint32_t rx_ws_out_delay: 2; - volatile uint32_t rx_bck_out_delay: 2; - volatile uint32_t tx_dsync_sw: 1; - volatile uint32_t rx_dsync_sw: 1; - volatile uint32_t data_enable_delay: 2; - volatile uint32_t tx_bck_in_inv: 1; - volatile uint32_t reserved25: 7; + uint32_t tx_bck_in_delay: 2; + uint32_t tx_ws_in_delay: 2; + uint32_t rx_bck_in_delay: 2; + uint32_t rx_ws_in_delay: 2; + uint32_t rx_sd_in_delay: 2; + uint32_t tx_bck_out_delay: 2; + uint32_t tx_ws_out_delay: 2; + uint32_t tx_sd_out_delay: 2; + uint32_t rx_ws_out_delay: 2; + uint32_t rx_bck_out_delay: 2; + uint32_t tx_dsync_sw: 1; + uint32_t rx_dsync_sw: 1; + uint32_t data_enable_delay: 2; + uint32_t tx_bck_in_inv: 1; + uint32_t reserved25: 7; }; - volatile uint32_t val; + uint32_t val; }timing; union { struct { - volatile uint32_t rx_data_num: 6; - volatile uint32_t tx_data_num: 6; - volatile uint32_t dscr_en: 1; - volatile uint32_t tx_fifo_mod: 3; - volatile uint32_t rx_fifo_mod: 3; - volatile uint32_t tx_fifo_mod_force_en: 1; - volatile uint32_t rx_fifo_mod_force_en: 1; - volatile uint32_t reserved21: 11; + uint32_t rx_data_num: 6; + uint32_t tx_data_num: 6; + uint32_t dscr_en: 1; + uint32_t tx_fifo_mod: 3; + uint32_t rx_fifo_mod: 3; + uint32_t tx_fifo_mod_force_en: 1; + uint32_t rx_fifo_mod_force_en: 1; + uint32_t reserved21: 11; }; - volatile uint32_t val; + uint32_t val; }fifo_conf; - volatile uint32_t rx_eof_num; - volatile uint32_t conf_single_data; + uint32_t rx_eof_num; + uint32_t conf_single_data; union { struct { - volatile uint32_t tx_chan_mod: 3; - volatile uint32_t rx_chan_mod: 2; - volatile uint32_t reserved5: 27; + uint32_t tx_chan_mod: 3; + uint32_t rx_chan_mod: 2; + uint32_t reserved5: 27; }; - volatile uint32_t val; + uint32_t val; }conf_chan; union { struct { - volatile uint32_t outlink_addr: 20; - volatile uint32_t reserved20: 8; - volatile uint32_t outlink_stop: 1; - volatile uint32_t outlink_start: 1; - volatile uint32_t outlink_restart: 1; - volatile uint32_t outlink_park: 1; + uint32_t outlink_addr: 20; + uint32_t reserved20: 8; + uint32_t outlink_stop: 1; + uint32_t outlink_start: 1; + uint32_t outlink_restart: 1; + uint32_t outlink_park: 1; }; - volatile uint32_t val; + uint32_t val; }out_link; union { struct { - volatile uint32_t inlink_addr: 20; - volatile uint32_t reserved20: 8; - volatile uint32_t inlink_stop: 1; - volatile uint32_t inlink_start: 1; - volatile uint32_t inlink_restart: 1; - volatile uint32_t inlink_park: 1; + uint32_t inlink_addr: 20; + uint32_t reserved20: 8; + uint32_t inlink_stop: 1; + uint32_t inlink_start: 1; + uint32_t inlink_restart: 1; + uint32_t inlink_park: 1; }; - volatile uint32_t val; + uint32_t val; }in_link; - volatile uint32_t out_eof_des_addr; - volatile uint32_t in_eof_des_addr; - volatile uint32_t out_eof_bfr_des_addr; + uint32_t out_eof_des_addr; + uint32_t in_eof_des_addr; + uint32_t out_eof_bfr_des_addr; union { struct { - volatile uint32_t ahb_testmode: 3; - volatile uint32_t reserved3: 1; - volatile uint32_t ahb_testaddr: 2; - volatile uint32_t reserved6: 26; + uint32_t ahb_testmode: 3; + uint32_t reserved3: 1; + uint32_t ahb_testaddr: 2; + uint32_t reserved6: 26; }; - volatile uint32_t val; + uint32_t val; }ahb_test; - volatile uint32_t in_link_dscr; - volatile uint32_t in_link_dscr_bf0; - volatile uint32_t in_link_dscr_bf1; - volatile uint32_t out_link_dscr; - volatile uint32_t out_link_dscr_bf0; - volatile uint32_t out_link_dscr_bf1; + uint32_t in_link_dscr; + uint32_t in_link_dscr_bf0; + uint32_t in_link_dscr_bf1; + uint32_t out_link_dscr; + uint32_t out_link_dscr_bf0; + uint32_t out_link_dscr_bf1; union { struct { - volatile uint32_t in_rst: 1; - volatile uint32_t out_rst: 1; - volatile uint32_t ahbm_fifo_rst: 1; - volatile uint32_t ahbm_rst: 1; - volatile uint32_t out_loop_test: 1; - volatile uint32_t in_loop_test: 1; - volatile uint32_t out_auto_wrback: 1; - volatile uint32_t out_no_restart_clr: 1; - volatile uint32_t out_eof_mode: 1; - volatile uint32_t outdscr_burst_en: 1; - volatile uint32_t indscr_burst_en: 1; - volatile uint32_t out_data_burst_en: 1; - volatile uint32_t check_owner: 1; - volatile uint32_t mem_trans_en: 1; - volatile uint32_t reserved14: 18; + uint32_t in_rst: 1; + uint32_t out_rst: 1; + uint32_t ahbm_fifo_rst: 1; + uint32_t ahbm_rst: 1; + uint32_t out_loop_test: 1; + uint32_t in_loop_test: 1; + uint32_t out_auto_wrback: 1; + uint32_t out_no_restart_clr: 1; + uint32_t out_eof_mode: 1; + uint32_t outdscr_burst_en: 1; + uint32_t indscr_burst_en: 1; + uint32_t out_data_burst_en: 1; + uint32_t check_owner: 1; + uint32_t mem_trans_en: 1; + uint32_t reserved14: 18; }; - volatile uint32_t val; + uint32_t val; }lc_conf; union { struct { - volatile uint32_t out_fifo_wdata: 9; - volatile uint32_t reserved9: 7; - volatile uint32_t out_fifo_push: 1; - volatile uint32_t reserved17: 15; + uint32_t out_fifo_wdata: 9; + uint32_t reserved9: 7; + uint32_t out_fifo_push: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }out_fifo_push; union { struct { - volatile uint32_t in_fifo_rdata:12; - volatile uint32_t reserved12: 4; - volatile uint32_t in_fifo_pop: 1; - volatile uint32_t reserved17: 15; + uint32_t in_fifo_rdata:12; + uint32_t reserved12: 4; + uint32_t in_fifo_pop: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }in_fifo_pop; - volatile uint32_t lc_state0; - volatile uint32_t lc_state1; + uint32_t lc_state0; + uint32_t lc_state1; union { struct { - volatile uint32_t lc_fifo_timeout: 8; - volatile uint32_t lc_fifo_timeout_shift: 3; - volatile uint32_t lc_fifo_timeout_ena: 1; - volatile uint32_t reserved12: 20; + uint32_t lc_fifo_timeout: 8; + uint32_t lc_fifo_timeout_shift: 3; + uint32_t lc_fifo_timeout_ena: 1; + uint32_t reserved12: 20; }; - volatile uint32_t val; + uint32_t val; }lc_hung_conf; - volatile uint32_t reserved_78; - volatile uint32_t reserved_7c; + uint32_t reserved_78; + uint32_t reserved_7c; union { struct { - volatile uint32_t cvsd_y_max:16; - volatile uint32_t cvsd_y_min:16; + uint32_t cvsd_y_max:16; + uint32_t cvsd_y_min:16; }; - volatile uint32_t val; + uint32_t val; }cvsd_conf0; union { struct { - volatile uint32_t cvsd_sigma_max:16; - volatile uint32_t cvsd_sigma_min:16; + uint32_t cvsd_sigma_max:16; + uint32_t cvsd_sigma_min:16; }; - volatile uint32_t val; + uint32_t val; }cvsd_conf1; union { struct { - volatile uint32_t cvsd_k: 3; - volatile uint32_t cvsd_j: 3; - volatile uint32_t cvsd_beta: 10; - volatile uint32_t cvsd_h: 3; - volatile uint32_t reserved19:13; + uint32_t cvsd_k: 3; + uint32_t cvsd_j: 3; + uint32_t cvsd_beta: 10; + uint32_t cvsd_h: 3; + uint32_t reserved19:13; }; - volatile uint32_t val; + uint32_t val; }cvsd_conf2; union { struct { - volatile uint32_t good_pack_max: 6; - volatile uint32_t n_err_seg: 3; - volatile uint32_t shift_rate: 3; - volatile uint32_t max_slide_sample: 8; - volatile uint32_t pack_len_8k: 5; - volatile uint32_t n_min_err: 3; - volatile uint32_t reserved28: 4; + uint32_t good_pack_max: 6; + uint32_t n_err_seg: 3; + uint32_t shift_rate: 3; + uint32_t max_slide_sample: 8; + uint32_t pack_len_8k: 5; + uint32_t n_min_err: 3; + uint32_t reserved28: 4; }; - volatile uint32_t val; + uint32_t val; }plc_conf0; union { struct { - volatile uint32_t bad_cef_atten_para: 8; - volatile uint32_t bad_cef_atten_para_shift: 4; - volatile uint32_t bad_ola_win2_para_shift: 4; - volatile uint32_t bad_ola_win2_para: 8; - volatile uint32_t slide_win_len: 8; + uint32_t bad_cef_atten_para: 8; + uint32_t bad_cef_atten_para_shift: 4; + uint32_t bad_ola_win2_para_shift: 4; + uint32_t bad_ola_win2_para: 8; + uint32_t slide_win_len: 8; }; - volatile uint32_t val; + uint32_t val; }plc_conf1; union { struct { - volatile uint32_t cvsd_seg_mod: 2; - volatile uint32_t min_period: 5; - volatile uint32_t reserved7: 25; + uint32_t cvsd_seg_mod: 2; + uint32_t min_period: 5; + uint32_t reserved7: 25; }; - volatile uint32_t val; + uint32_t val; }plc_conf2; union { struct { - volatile uint32_t esco_en: 1; - volatile uint32_t esco_chan_mod: 1; - volatile uint32_t esco_cvsd_dec_pack_err: 1; - volatile uint32_t esco_cvsd_pack_len_8k: 5; - volatile uint32_t esco_cvsd_inf_en: 1; - volatile uint32_t cvsd_dec_start: 1; - volatile uint32_t cvsd_dec_reset: 1; - volatile uint32_t plc_en: 1; - volatile uint32_t plc2dma_en: 1; - volatile uint32_t reserved13: 19; + uint32_t esco_en: 1; + uint32_t esco_chan_mod: 1; + uint32_t esco_cvsd_dec_pack_err: 1; + uint32_t esco_cvsd_pack_len_8k: 5; + uint32_t esco_cvsd_inf_en: 1; + uint32_t cvsd_dec_start: 1; + uint32_t cvsd_dec_reset: 1; + uint32_t plc_en: 1; + uint32_t plc2dma_en: 1; + uint32_t reserved13: 19; }; - volatile uint32_t val; + uint32_t val; }esco_conf0; union { struct { - volatile uint32_t sco_with_en: 1; - volatile uint32_t sco_no_en: 1; - volatile uint32_t cvsd_enc_start: 1; - volatile uint32_t cvsd_enc_reset: 1; - volatile uint32_t reserved4: 28; + uint32_t sco_with_en: 1; + uint32_t sco_no_en: 1; + uint32_t cvsd_enc_start: 1; + uint32_t cvsd_enc_reset: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }sco_conf0; union { struct { - volatile uint32_t tx_pcm_conf: 3; - volatile uint32_t tx_pcm_bypass: 1; - volatile uint32_t rx_pcm_conf: 3; - volatile uint32_t rx_pcm_bypass: 1; - volatile uint32_t tx_stop_en: 1; - volatile uint32_t tx_zeros_rm_en: 1; - volatile uint32_t reserved10: 22; + uint32_t tx_pcm_conf: 3; + uint32_t tx_pcm_bypass: 1; + uint32_t rx_pcm_conf: 3; + uint32_t rx_pcm_bypass: 1; + uint32_t tx_stop_en: 1; + uint32_t tx_zeros_rm_en: 1; + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }conf1; union { struct { - volatile uint32_t fifo_force_pd: 1; - volatile uint32_t fifo_force_pu: 1; - volatile uint32_t plc_mem_force_pd: 1; - volatile uint32_t plc_mem_force_pu: 1; - volatile uint32_t reserved4: 28; + uint32_t fifo_force_pd: 1; + uint32_t fifo_force_pu: 1; + uint32_t plc_mem_force_pd: 1; + uint32_t plc_mem_force_pu: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }pd_conf; union { struct { - volatile uint32_t camera_en: 1; - volatile uint32_t lcd_tx_wrx2_en: 1; - volatile uint32_t lcd_tx_sdx2_en: 1; - volatile uint32_t data_enable_test_en: 1; - volatile uint32_t data_enable: 1; - volatile uint32_t lcd_en: 1; - volatile uint32_t ext_adc_start_en: 1; - volatile uint32_t inter_valid_en: 1; - volatile uint32_t reserved8: 24; + uint32_t camera_en: 1; + uint32_t lcd_tx_wrx2_en: 1; + uint32_t lcd_tx_sdx2_en: 1; + uint32_t data_enable_test_en: 1; + uint32_t data_enable: 1; + uint32_t lcd_en: 1; + uint32_t ext_adc_start_en: 1; + uint32_t inter_valid_en: 1; + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }conf2; union { struct { - volatile uint32_t clkm_div_num: 8; - volatile uint32_t clkm_div_b: 6; - volatile uint32_t clkm_div_a: 6; - volatile uint32_t clk_en: 1; - volatile uint32_t clka_ena: 1; - volatile uint32_t reserved22: 10; + uint32_t clkm_div_num: 8; + uint32_t clkm_div_b: 6; + uint32_t clkm_div_a: 6; + uint32_t clk_en: 1; + uint32_t clka_ena: 1; + uint32_t reserved22: 10; }; - volatile uint32_t val; + uint32_t val; }clkm_conf; union { struct { - volatile uint32_t tx_bck_div_num: 6; - volatile uint32_t rx_bck_div_num: 6; - volatile uint32_t tx_bits_mod: 6; - volatile uint32_t rx_bits_mod: 6; - volatile uint32_t reserved24: 8; + uint32_t tx_bck_div_num: 6; + uint32_t rx_bck_div_num: 6; + uint32_t tx_bits_mod: 6; + uint32_t rx_bits_mod: 6; + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }sample_rate_conf; union { struct { - volatile uint32_t tx_pdm_en: 1; - volatile uint32_t rx_pdm_en: 1; - volatile uint32_t pcm2pdm_conv_en: 1; - volatile uint32_t pdm2pcm_conv_en: 1; - volatile uint32_t tx_pdm_sinc_osr2: 4; - volatile uint32_t tx_pdm_prescale: 8; - volatile uint32_t tx_pdm_hp_in_shift: 2; - volatile uint32_t tx_pdm_lp_in_shift: 2; - volatile uint32_t tx_pdm_sinc_in_shift: 2; - volatile uint32_t tx_pdm_sigmadelta_in_shift: 2; - volatile uint32_t rx_pdm_sinc_dsr_16_en: 1; - volatile uint32_t tx_pdm_hp_bypass: 1; - volatile uint32_t reserved26: 6; + uint32_t tx_pdm_en: 1; + uint32_t rx_pdm_en: 1; + uint32_t pcm2pdm_conv_en: 1; + uint32_t pdm2pcm_conv_en: 1; + uint32_t tx_pdm_sinc_osr2: 4; + uint32_t tx_pdm_prescale: 8; + uint32_t tx_pdm_hp_in_shift: 2; + uint32_t tx_pdm_lp_in_shift: 2; + uint32_t tx_pdm_sinc_in_shift: 2; + uint32_t tx_pdm_sigmadelta_in_shift: 2; + uint32_t rx_pdm_sinc_dsr_16_en: 1; + uint32_t tx_pdm_hp_bypass: 1; + uint32_t reserved26: 6; }; - volatile uint32_t val; + uint32_t val; }pdm_conf; union { struct { - volatile uint32_t tx_pdm_fs: 10; - volatile uint32_t tx_pdm_fp: 10; - volatile uint32_t reserved20:12; + uint32_t tx_pdm_fs: 10; + uint32_t tx_pdm_fp: 10; + uint32_t reserved20:12; }; - volatile uint32_t val; + uint32_t val; }pdm_freq_conf; union { struct { - volatile uint32_t tx_idle: 1; - volatile uint32_t tx_fifo_reset_back: 1; - volatile uint32_t rx_fifo_reset_back: 1; - volatile uint32_t reserved3: 29; + uint32_t tx_idle: 1; + uint32_t tx_fifo_reset_back: 1; + uint32_t rx_fifo_reset_back: 1; + uint32_t reserved3: 29; }; - volatile uint32_t val; + uint32_t val; }state; - volatile uint32_t reserved_c0; - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; - volatile uint32_t reserved_f0; - volatile uint32_t reserved_f4; - volatile uint32_t reserved_f8; - volatile uint32_t date; /**/ + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ } i2s_dev_t; -extern volatile i2s_dev_t I2S0; -extern volatile i2s_dev_t I2S1; +extern i2s_dev_t I2S0; +extern i2s_dev_t I2S1; #endif /* _SOC_I2S_STRUCT_H_ */ diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index 302a9e4bc6..2eb316b953 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -13,288 +13,288 @@ // limitations under the License. #ifndef _SOC_LEDC_STRUCT_H_ #define _SOC_LEDC_STRUCT_H_ -typedef struct { +typedef volatile struct { struct{ union { struct { - volatile uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ - volatile uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ - volatile uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ - volatile uint32_t reserved4: 27; - volatile uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ + uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ + uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ + uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ + uint32_t reserved4: 27; + uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ - volatile uint32_t reserved20: 12; + uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }hpoint; union { struct { - volatile uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ - volatile uint32_t reserved25: 7; + uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + uint32_t reserved25: 7; }; - volatile uint32_t val; + uint32_t val; }duty; union { struct { - volatile uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ - volatile uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ - volatile uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ - volatile uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ - volatile uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ + uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ + uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ + uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ + uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ + uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ }; - volatile uint32_t val; + uint32_t val; }conf1; union { struct { - volatile uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ - volatile uint32_t reserved25: 7; + uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ + uint32_t reserved25: 7; }; - volatile uint32_t val; + uint32_t val; }duty_rd; }high_speed_channel[8]; struct{ union { struct { - volatile uint32_t timer_sel: 2; /*There are four low speed timers the two bits are used to select one of them for low speed channel. 2'b00: seletc lstimer0. 2'b01: select lstimer1. 2'b10: select lstimer2. 2'b11: select lstimer3.*/ - volatile uint32_t sig_out_en: 1; /*This is the output enable control bit for low speed channel.*/ - volatile uint32_t idle_lv: 1; /*This bit is used to control the output value when low speed channel is off.*/ - volatile uint32_t para_up: 1; /*This bit is used to update register LEDC_LSCH0_HPOINT and LEDC_LSCH0_DUTY for low speed channel.*/ - volatile uint32_t reserved5: 27; + uint32_t timer_sel: 2; /*There are four low speed timers the two bits are used to select one of them for low speed channel. 2'b00: seletc lstimer0. 2'b01: select lstimer1. 2'b10: select lstimer2. 2'b11: select lstimer3.*/ + uint32_t sig_out_en: 1; /*This is the output enable control bit for low speed channel.*/ + uint32_t idle_lv: 1; /*This bit is used to control the output value when low speed channel is off.*/ + uint32_t para_up: 1; /*This bit is used to update register LEDC_LSCH0_HPOINT and LEDC_LSCH0_DUTY for low speed channel.*/ + uint32_t reserved5: 27; }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t hpoint: 20; /*The output value changes to high when lstimerx(x=[0 3]) selected by low speed channel has reached reg_hpoint_lsch0[19:0]*/ - volatile uint32_t reserved20: 12; + uint32_t hpoint: 20; /*The output value changes to high when lstimerx(x=[0 3]) selected by low speed channel has reached reg_hpoint_lsch0[19:0]*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }hpoint; union { struct { - volatile uint32_t duty: 25; /*The register is used to control output duty. When lstimerx(x=[0 3]) choosed by low speed channel has reached reg_lpoint_lsch0 the output signal changes to low. reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4]) (1) reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ - volatile uint32_t reserved25: 7; + uint32_t duty: 25; /*The register is used to control output duty. When lstimerx(x=[0 3]) choosed by low speed channel has reached reg_lpoint_lsch0 the output signal changes to low. reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4]) (1) reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + uint32_t reserved25: 7; }; - volatile uint32_t val; + uint32_t val; }duty; union { struct { - volatile uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for low speed channel.*/ - volatile uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_lsch0 cycles for low speed channel.*/ - volatile uint32_t duty_num: 10; /*This register is used to control the num of increased or decreased times for low speed channel6.*/ - volatile uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for low speed channel6.*/ - volatile uint32_t duty_start: 1; /*When reg_duty_num_hsch1 reg_duty_cycle_hsch1 and reg_duty_scale_hsch1 has been configured. these register won't take effect until set reg_duty_start_hsch1. this bit is automatically cleared by hardware.*/ + uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for low speed channel.*/ + uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_lsch0 cycles for low speed channel.*/ + uint32_t duty_num: 10; /*This register is used to control the num of increased or decreased times for low speed channel6.*/ + uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for low speed channel6.*/ + uint32_t duty_start: 1; /*When reg_duty_num_hsch1 reg_duty_cycle_hsch1 and reg_duty_scale_hsch1 has been configured. these register won't take effect until set reg_duty_start_hsch1. this bit is automatically cleared by hardware.*/ }; - volatile uint32_t val; + uint32_t val; }conf1; union { struct { - volatile uint32_t duty_read: 25; /*This register represents the current duty of the output signal for low speed channel.*/ - volatile uint32_t reserved25: 7; + uint32_t duty_read: 25; /*This register represents the current duty of the output signal for low speed channel.*/ + uint32_t reserved25: 7; }; - volatile uint32_t val; + uint32_t val; }duty_r; }low_speed_channel[8]; struct{ union { struct { - volatile uint32_t timer_lim: 5; /*This register controls the range of the counter in high speed timer. the counter range is [0 2**reg_hstimer0_lim] the max bit width for counter is 20.*/ - volatile uint32_t div_num: 18; /*This register is used to configure parameter for divider in high speed timer the least significant eight bits represent the decimal part.*/ - volatile uint32_t pause: 1; /*This bit is used to pause the counter in high speed timer*/ - volatile uint32_t rst: 1; /*This bit is used to reset high speed timer the counter will be 0 after reset.*/ - volatile uint32_t tick_sel: 1; /*This bit is used to choose apb_clk or ref_tick for high speed timer. 1'b1:apb_clk 0:ref_tick*/ - volatile uint32_t reserved26: 6; + uint32_t timer_lim: 5; /*This register controls the range of the counter in high speed timer. the counter range is [0 2**reg_hstimer0_lim] the max bit width for counter is 20.*/ + uint32_t div_num: 18; /*This register is used to configure parameter for divider in high speed timer the least significant eight bits represent the decimal part.*/ + uint32_t pause: 1; /*This bit is used to pause the counter in high speed timer*/ + uint32_t rst: 1; /*This bit is used to reset high speed timer the counter will be 0 after reset.*/ + uint32_t tick_sel: 1; /*This bit is used to choose apb_clk or ref_tick for high speed timer. 1'b1:apb_clk 0:ref_tick*/ + uint32_t reserved26: 6; }; - volatile uint32_t val; + uint32_t val; }conf; union { struct { - volatile uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ - volatile uint32_t reserved20: 12; + uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }value; }high_speed_timer[4]; struct{ union { struct { - volatile uint32_t timer_lim: 5; /*This register controls the range of the counter in low speed timer. the counter range is [0 2**reg_lstimer0_lim] the max bit width for counter is 20.*/ - volatile uint32_t div_num: 18; /*This register is used to configure parameter for divider in low speed timer the least significant eight bits represent the decimal part.*/ - volatile uint32_t pause: 1; /*This bit is used to pause the counter in low speed timer.*/ - volatile uint32_t rst: 1; /*This bit is used to reset low speed timer the counter will be 0 after reset.*/ - volatile uint32_t tick_sel: 1; /*This bit is used to choose slow_clk or ref_tick for low speed timer. 1'b1:slow_clk 0:ref_tick*/ - volatile uint32_t param_update: 1; /*Set this bit to update reg_div_num_lstime0 and reg_lstimer0_lim.*/ - volatile uint32_t reserved27: 5; + uint32_t timer_lim: 5; /*This register controls the range of the counter in low speed timer. the counter range is [0 2**reg_lstimer0_lim] the max bit width for counter is 20.*/ + uint32_t div_num: 18; /*This register is used to configure parameter for divider in low speed timer the least significant eight bits represent the decimal part.*/ + uint32_t pause: 1; /*This bit is used to pause the counter in low speed timer.*/ + uint32_t rst: 1; /*This bit is used to reset low speed timer the counter will be 0 after reset.*/ + uint32_t tick_sel: 1; /*This bit is used to choose slow_clk or ref_tick for low speed timer. 1'b1:slow_clk 0:ref_tick*/ + uint32_t param_update: 1; /*Set this bit to update reg_div_num_lstime0 and reg_lstimer0_lim.*/ + uint32_t reserved27: 5; }; - volatile uint32_t val; + uint32_t val; }conf; union { struct { - volatile uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in low speed timer.*/ - volatile uint32_t reserved20: 12; + uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in low speed timer.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }value; }low_speed_timer[4]; union { struct { - volatile uint32_t hstimer0_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ - volatile uint32_t hstimer1_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel1 counter overflow.*/ - volatile uint32_t hstimer2_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel2 counter overflow.*/ - volatile uint32_t hstimer3_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel3 counter overflow.*/ - volatile uint32_t lstimer0_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ - volatile uint32_t lstimer1_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ - volatile uint32_t lstimer2_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ - volatile uint32_t lstimer3_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ - volatile uint32_t duty_chng_end_hsch0_int_raw: 1; /*The interrupt raw bit for high speed channel 0 duty change done.*/ - volatile uint32_t duty_chng_end_hsch1_int_raw: 1; /*The interrupt raw bit for high speed channel 1 duty change done.*/ - volatile uint32_t duty_chng_end_hsch2_int_raw: 1; /*The interrupt raw bit for high speed channel 2 duty change done.*/ - volatile uint32_t duty_chng_end_hsch3_int_raw: 1; /*The interrupt raw bit for high speed channel 3 duty change done.*/ - volatile uint32_t duty_chng_end_hsch4_int_raw: 1; /*The interrupt raw bit for high speed channel 4 duty change done.*/ - volatile uint32_t duty_chng_end_hsch5_int_raw: 1; /*The interrupt raw bit for high speed channel 5 duty change done.*/ - volatile uint32_t duty_chng_end_hsch6_int_raw: 1; /*The interrupt raw bit for high speed channel 6 duty change done.*/ - volatile uint32_t duty_chng_end_hsch7_int_raw: 1; /*The interrupt raw bit for high speed channel 7 duty change done.*/ - volatile uint32_t duty_chng_end_lsch0_int_raw: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ - volatile uint32_t duty_chng_end_lsch1_int_raw: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ - volatile uint32_t duty_chng_end_lsch2_int_raw: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ - volatile uint32_t duty_chng_end_lsch3_int_raw: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ - volatile uint32_t duty_chng_end_lsch4_int_raw: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ - volatile uint32_t duty_chng_end_lsch5_int_raw: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ - volatile uint32_t duty_chng_end_lsch6_int_raw: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ - volatile uint32_t duty_chng_end_lsch7_int_raw: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ - volatile uint32_t reserved24: 8; + uint32_t hstimer0_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ + uint32_t hstimer1_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel1 counter overflow.*/ + uint32_t hstimer2_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel2 counter overflow.*/ + uint32_t hstimer3_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel3 counter overflow.*/ + uint32_t lstimer0_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ + uint32_t lstimer1_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ + uint32_t lstimer2_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ + uint32_t lstimer3_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ + uint32_t duty_chng_end_hsch0_int_raw: 1; /*The interrupt raw bit for high speed channel 0 duty change done.*/ + uint32_t duty_chng_end_hsch1_int_raw: 1; /*The interrupt raw bit for high speed channel 1 duty change done.*/ + uint32_t duty_chng_end_hsch2_int_raw: 1; /*The interrupt raw bit for high speed channel 2 duty change done.*/ + uint32_t duty_chng_end_hsch3_int_raw: 1; /*The interrupt raw bit for high speed channel 3 duty change done.*/ + uint32_t duty_chng_end_hsch4_int_raw: 1; /*The interrupt raw bit for high speed channel 4 duty change done.*/ + uint32_t duty_chng_end_hsch5_int_raw: 1; /*The interrupt raw bit for high speed channel 5 duty change done.*/ + uint32_t duty_chng_end_hsch6_int_raw: 1; /*The interrupt raw bit for high speed channel 6 duty change done.*/ + uint32_t duty_chng_end_hsch7_int_raw: 1; /*The interrupt raw bit for high speed channel 7 duty change done.*/ + uint32_t duty_chng_end_lsch0_int_raw: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ + uint32_t duty_chng_end_lsch1_int_raw: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ + uint32_t duty_chng_end_lsch2_int_raw: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ + uint32_t duty_chng_end_lsch3_int_raw: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ + uint32_t duty_chng_end_lsch4_int_raw: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ + uint32_t duty_chng_end_lsch5_int_raw: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ + uint32_t duty_chng_end_lsch6_int_raw: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ + uint32_t duty_chng_end_lsch7_int_raw: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t hstimer0_ovf_int_st: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ - volatile uint32_t hstimer1_ovf_int_st: 1; /*The interrupt status bit for high speed channel1 counter overflow event.*/ - volatile uint32_t hstimer2_ovf_int_st: 1; /*The interrupt status bit for high speed channel2 counter overflow event.*/ - volatile uint32_t hstimer3_ovf_int_st: 1; /*The interrupt status bit for high speed channel3 counter overflow event.*/ - volatile uint32_t lstimer0_ovf_int_st: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ - volatile uint32_t lstimer1_ovf_int_st: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ - volatile uint32_t lstimer2_ovf_int_st: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ - volatile uint32_t lstimer3_ovf_int_st: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ - volatile uint32_t duty_chng_end_hsch0_int_st: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch1_int_st: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch2_int_st: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch3_int_st: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch4_int_st: 1; /*The interrupt status bit for high speed channel 4 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch5_int_st: 1; /*The interrupt status bit for high speed channel 5 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch6_int_st: 1; /*The interrupt status bit for high speed channel 6 duty change done event.*/ - volatile uint32_t duty_chng_end_hsch7_int_st: 1; /*The interrupt status bit for high speed channel 7 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch0_int_st: 1; /*The interrupt status bit for low speed channel 0 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch1_int_st: 1; /*The interrupt status bit for low speed channel 1 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch2_int_st: 1; /*The interrupt status bit for low speed channel 2 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch3_int_st: 1; /*The interrupt status bit for low speed channel 3 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch4_int_st: 1; /*The interrupt status bit for low speed channel 4 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch5_int_st: 1; /*The interrupt status bit for low speed channel 5 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch6_int_st: 1; /*The interrupt status bit for low speed channel 6 duty change done event.*/ - volatile uint32_t duty_chng_end_lsch7_int_st: 1; /*The interrupt status bit for low speed channel 7 duty change done event*/ - volatile uint32_t reserved24: 8; + uint32_t hstimer0_ovf_int_st: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ + uint32_t hstimer1_ovf_int_st: 1; /*The interrupt status bit for high speed channel1 counter overflow event.*/ + uint32_t hstimer2_ovf_int_st: 1; /*The interrupt status bit for high speed channel2 counter overflow event.*/ + uint32_t hstimer3_ovf_int_st: 1; /*The interrupt status bit for high speed channel3 counter overflow event.*/ + uint32_t lstimer0_ovf_int_st: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ + uint32_t lstimer1_ovf_int_st: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ + uint32_t lstimer2_ovf_int_st: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ + uint32_t lstimer3_ovf_int_st: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ + uint32_t duty_chng_end_hsch0_int_st: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ + uint32_t duty_chng_end_hsch1_int_st: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ + uint32_t duty_chng_end_hsch2_int_st: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ + uint32_t duty_chng_end_hsch3_int_st: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ + uint32_t duty_chng_end_hsch4_int_st: 1; /*The interrupt status bit for high speed channel 4 duty change done event.*/ + uint32_t duty_chng_end_hsch5_int_st: 1; /*The interrupt status bit for high speed channel 5 duty change done event.*/ + uint32_t duty_chng_end_hsch6_int_st: 1; /*The interrupt status bit for high speed channel 6 duty change done event.*/ + uint32_t duty_chng_end_hsch7_int_st: 1; /*The interrupt status bit for high speed channel 7 duty change done event.*/ + uint32_t duty_chng_end_lsch0_int_st: 1; /*The interrupt status bit for low speed channel 0 duty change done event.*/ + uint32_t duty_chng_end_lsch1_int_st: 1; /*The interrupt status bit for low speed channel 1 duty change done event.*/ + uint32_t duty_chng_end_lsch2_int_st: 1; /*The interrupt status bit for low speed channel 2 duty change done event.*/ + uint32_t duty_chng_end_lsch3_int_st: 1; /*The interrupt status bit for low speed channel 3 duty change done event.*/ + uint32_t duty_chng_end_lsch4_int_st: 1; /*The interrupt status bit for low speed channel 4 duty change done event.*/ + uint32_t duty_chng_end_lsch5_int_st: 1; /*The interrupt status bit for low speed channel 5 duty change done event.*/ + uint32_t duty_chng_end_lsch6_int_st: 1; /*The interrupt status bit for low speed channel 6 duty change done event.*/ + uint32_t duty_chng_end_lsch7_int_st: 1; /*The interrupt status bit for low speed channel 7 duty change done event*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t hstimer0_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ - volatile uint32_t hstimer1_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel1 counter overflow interrupt.*/ - volatile uint32_t hstimer2_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel2 counter overflow interrupt.*/ - volatile uint32_t hstimer3_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel3 counter overflow interrupt.*/ - volatile uint32_t lstimer0_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel0 counter overflow interrupt.*/ - volatile uint32_t lstimer1_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel1 counter overflow interrupt.*/ - volatile uint32_t lstimer2_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel2 counter overflow interrupt.*/ - volatile uint32_t lstimer3_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel3 counter overflow interrupt.*/ - volatile uint32_t duty_chng_end_hsch0_int_ena: 1; /*The interrupt enable bit for high speed channel 0 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch1_int_ena: 1; /*The interrupt enable bit for high speed channel 1 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch2_int_ena: 1; /*The interrupt enable bit for high speed channel 2 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch3_int_ena: 1; /*The interrupt enable bit for high speed channel 3 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch4_int_ena: 1; /*The interrupt enable bit for high speed channel 4 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch5_int_ena: 1; /*The interrupt enable bit for high speed channel 5 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch6_int_ena: 1; /*The interrupt enable bit for high speed channel 6 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch7_int_ena: 1; /*The interrupt enable bit for high speed channel 7 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch0_int_ena: 1; /*The interrupt enable bit for low speed channel 0 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch1_int_ena: 1; /*The interrupt enable bit for low speed channel 1 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch2_int_ena: 1; /*The interrupt enable bit for low speed channel 2 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch3_int_ena: 1; /*The interrupt enable bit for low speed channel 3 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch4_int_ena: 1; /*The interrupt enable bit for low speed channel 4 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch5_int_ena: 1; /*The interrupt enable bit for low speed channel 5 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch6_int_ena: 1; /*The interrupt enable bit for low speed channel 6 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch7_int_ena: 1; /*The interrupt enable bit for low speed channel 7 duty change done interrupt.*/ - volatile uint32_t reserved24: 8; + uint32_t hstimer0_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ + uint32_t hstimer1_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel1 counter overflow interrupt.*/ + uint32_t hstimer2_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel2 counter overflow interrupt.*/ + uint32_t hstimer3_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel3 counter overflow interrupt.*/ + uint32_t lstimer0_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel0 counter overflow interrupt.*/ + uint32_t lstimer1_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel1 counter overflow interrupt.*/ + uint32_t lstimer2_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel2 counter overflow interrupt.*/ + uint32_t lstimer3_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel3 counter overflow interrupt.*/ + uint32_t duty_chng_end_hsch0_int_ena: 1; /*The interrupt enable bit for high speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch1_int_ena: 1; /*The interrupt enable bit for high speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch2_int_ena: 1; /*The interrupt enable bit for high speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch3_int_ena: 1; /*The interrupt enable bit for high speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch4_int_ena: 1; /*The interrupt enable bit for high speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch5_int_ena: 1; /*The interrupt enable bit for high speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch6_int_ena: 1; /*The interrupt enable bit for high speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch7_int_ena: 1; /*The interrupt enable bit for high speed channel 7 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch0_int_ena: 1; /*The interrupt enable bit for low speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch1_int_ena: 1; /*The interrupt enable bit for low speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch2_int_ena: 1; /*The interrupt enable bit for low speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch3_int_ena: 1; /*The interrupt enable bit for low speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch4_int_ena: 1; /*The interrupt enable bit for low speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch5_int_ena: 1; /*The interrupt enable bit for low speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch6_int_ena: 1; /*The interrupt enable bit for low speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch7_int_ena: 1; /*The interrupt enable bit for low speed channel 7 duty change done interrupt.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t hstimer0_ovf_int_clr: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ - volatile uint32_t hstimer1_ovf_int_clr: 1; /*Set this bit to clear high speed channel1 counter overflow interrupt.*/ - volatile uint32_t hstimer2_ovf_int_clr: 1; /*Set this bit to clear high speed channel2 counter overflow interrupt.*/ - volatile uint32_t hstimer3_ovf_int_clr: 1; /*Set this bit to clear high speed channel3 counter overflow interrupt.*/ - volatile uint32_t lstimer0_ovf_int_clr: 1; /*Set this bit to clear low speed channel0 counter overflow interrupt.*/ - volatile uint32_t lstimer1_ovf_int_clr: 1; /*Set this bit to clear low speed channel1 counter overflow interrupt.*/ - volatile uint32_t lstimer2_ovf_int_clr: 1; /*Set this bit to clear low speed channel2 counter overflow interrupt.*/ - volatile uint32_t lstimer3_ovf_int_clr: 1; /*Set this bit to clear low speed channel3 counter overflow interrupt.*/ - volatile uint32_t duty_chng_end_hsch0_int_clr: 1; /*Set this bit to clear high speed channel 0 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch1_int_clr: 1; /*Set this bit to clear high speed channel 1 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch2_int_clr: 1; /*Set this bit to clear high speed channel 2 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch3_int_clr: 1; /*Set this bit to clear high speed channel 3 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch4_int_clr: 1; /*Set this bit to clear high speed channel 4 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch5_int_clr: 1; /*Set this bit to clear high speed channel 5 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch6_int_clr: 1; /*Set this bit to clear high speed channel 6 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_hsch7_int_clr: 1; /*Set this bit to clear high speed channel 7 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch0_int_clr: 1; /*Set this bit to clear low speed channel 0 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch1_int_clr: 1; /*Set this bit to clear low speed channel 1 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch2_int_clr: 1; /*Set this bit to clear low speed channel 2 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch3_int_clr: 1; /*Set this bit to clear low speed channel 3 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch4_int_clr: 1; /*Set this bit to clear low speed channel 4 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch5_int_clr: 1; /*Set this bit to clear low speed channel 5 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch6_int_clr: 1; /*Set this bit to clear low speed channel 6 duty change done interrupt.*/ - volatile uint32_t duty_chng_end_lsch7_int_clr: 1; /*Set this bit to clear low speed channel 7 duty change done interrupt.*/ - volatile uint32_t reserved24: 8; + uint32_t hstimer0_ovf_int_clr: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ + uint32_t hstimer1_ovf_int_clr: 1; /*Set this bit to clear high speed channel1 counter overflow interrupt.*/ + uint32_t hstimer2_ovf_int_clr: 1; /*Set this bit to clear high speed channel2 counter overflow interrupt.*/ + uint32_t hstimer3_ovf_int_clr: 1; /*Set this bit to clear high speed channel3 counter overflow interrupt.*/ + uint32_t lstimer0_ovf_int_clr: 1; /*Set this bit to clear low speed channel0 counter overflow interrupt.*/ + uint32_t lstimer1_ovf_int_clr: 1; /*Set this bit to clear low speed channel1 counter overflow interrupt.*/ + uint32_t lstimer2_ovf_int_clr: 1; /*Set this bit to clear low speed channel2 counter overflow interrupt.*/ + uint32_t lstimer3_ovf_int_clr: 1; /*Set this bit to clear low speed channel3 counter overflow interrupt.*/ + uint32_t duty_chng_end_hsch0_int_clr: 1; /*Set this bit to clear high speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch1_int_clr: 1; /*Set this bit to clear high speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch2_int_clr: 1; /*Set this bit to clear high speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch3_int_clr: 1; /*Set this bit to clear high speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch4_int_clr: 1; /*Set this bit to clear high speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch5_int_clr: 1; /*Set this bit to clear high speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch6_int_clr: 1; /*Set this bit to clear high speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch7_int_clr: 1; /*Set this bit to clear high speed channel 7 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch0_int_clr: 1; /*Set this bit to clear low speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch1_int_clr: 1; /*Set this bit to clear low speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch2_int_clr: 1; /*Set this bit to clear low speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch3_int_clr: 1; /*Set this bit to clear low speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch4_int_clr: 1; /*Set this bit to clear low speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch5_int_clr: 1; /*Set this bit to clear low speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch6_int_clr: 1; /*Set this bit to clear low speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch7_int_clr: 1; /*Set this bit to clear low speed channel 7 duty change done interrupt.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t apb_clk_sel: 1; /*This bit is used to set the frequency of slow_clk. 1'b1:80mhz 1'b0:8mhz*/ - volatile uint32_t reserved1: 31; + uint32_t apb_clk_sel: 1; /*This bit is used to set the frequency of slow_clk. 1'b1:80mhz 1'b0:8mhz*/ + uint32_t reserved1: 31; }; - volatile uint32_t val; + uint32_t val; }conf; - volatile uint32_t reserved_194; - volatile uint32_t reserved_198; - volatile uint32_t reserved_19c; - volatile uint32_t reserved_1a0; - volatile uint32_t reserved_1a4; - volatile uint32_t reserved_1a8; - volatile uint32_t reserved_1ac; - volatile uint32_t reserved_1b0; - volatile uint32_t reserved_1b4; - volatile uint32_t reserved_1b8; - volatile uint32_t reserved_1bc; - volatile uint32_t reserved_1c0; - volatile uint32_t reserved_1c4; - volatile uint32_t reserved_1c8; - volatile uint32_t reserved_1cc; - volatile uint32_t reserved_1d0; - volatile uint32_t reserved_1d4; - volatile uint32_t reserved_1d8; - volatile uint32_t reserved_1dc; - volatile uint32_t reserved_1e0; - volatile uint32_t reserved_1e4; - volatile uint32_t reserved_1e8; - volatile uint32_t reserved_1ec; - volatile uint32_t reserved_1f0; - volatile uint32_t reserved_1f4; - volatile uint32_t reserved_1f8; - volatile uint32_t date; /*This register represents the version .*/ + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t date; /*This register represents the version .*/ } ledc_dev_t; -extern volatile ledc_dev_t LEDC; +extern ledc_dev_t LEDC; #endif /* _SOC_LEDC_STRUCT_H_ */ diff --git a/components/esp32/include/soc/pcnt_struct.h b/components/esp32/include/soc/pcnt_struct.h index bf96793994..1505cc692a 100644 --- a/components/esp32/include/soc/pcnt_struct.h +++ b/components/esp32/include/soc/pcnt_struct.h @@ -13,149 +13,149 @@ // limitations under the License. #ifndef _SOC_PCNT_STRUCT_H_ #define _SOC_PCNT_STRUCT_H_ -typedef struct { +typedef volatile struct { struct{ union { struct { - volatile uint32_t filter_thres: 10; /*This register is used to filter pulse whose width is smaller than this value for unit0.*/ - volatile uint32_t filter_en: 1; /*This is the enable bit for filtering input signals for unit0.*/ - volatile uint32_t thr_zero_en: 1; /*This is the enable bit for comparing unit0's count with 0 value.*/ - volatile uint32_t thr_h_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_h_lim value.*/ - volatile uint32_t thr_l_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_l_lim value.*/ - volatile uint32_t thr_thres0_en: 1; /*This is the enable bit for comparing unit0's count with thres0 value.*/ - volatile uint32_t thr_thres1_en: 1; /*This is the enable bit for comparing unit0's count with thres1 value .*/ - volatile uint32_t ch0_neg_mode: 2; /*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ - volatile uint32_t ch0_pos_mode: 2; /*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ - volatile uint32_t ch0_hctrl_mode: 2; /*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ - volatile uint32_t ch0_lctrl_mode: 2; /*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ - volatile uint32_t ch1_neg_mode: 2; /*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ - volatile uint32_t ch1_pos_mode: 2; /*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ - volatile uint32_t ch1_hctrl_mode: 2; /*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ - volatile uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t filter_thres: 10; /*This register is used to filter pulse whose width is smaller than this value for unit0.*/ + uint32_t filter_en: 1; /*This is the enable bit for filtering input signals for unit0.*/ + uint32_t thr_zero_en: 1; /*This is the enable bit for comparing unit0's count with 0 value.*/ + uint32_t thr_h_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_h_lim value.*/ + uint32_t thr_l_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_l_lim value.*/ + uint32_t thr_thres0_en: 1; /*This is the enable bit for comparing unit0's count with thres0 value.*/ + uint32_t thr_thres1_en: 1; /*This is the enable bit for comparing unit0's count with thres1 value .*/ + uint32_t ch0_neg_mode: 2; /*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + uint32_t ch0_pos_mode: 2; /*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + uint32_t ch0_hctrl_mode: 2; /*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch0_lctrl_mode: 2; /*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch1_neg_mode: 2; /*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + uint32_t ch1_pos_mode: 2; /*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + uint32_t ch1_hctrl_mode: 2; /*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/ - volatile uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/ + uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/ + uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/ }; - volatile uint32_t val; + uint32_t val; }conf1; union { struct { - volatile uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/ - volatile uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/ + uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/ + uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/ }; - volatile uint32_t val; + uint32_t val; }conf2; }conf_unit[8]; union { struct { - volatile uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/ - volatile uint32_t reserved16: 16; + uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/ + uint32_t reserved16: 16; }; - volatile uint32_t val; + uint32_t val; }cnt_unit[8]; union { struct { - volatile uint32_t cnt_thr_event_u0_int_raw: 1; /*This is the interrupt raw bit for channel0 event.*/ - volatile uint32_t cnt_thr_event_u1_int_raw: 1; /*This is the interrupt raw bit for channel1 event.*/ - volatile uint32_t cnt_thr_event_u2_int_raw: 1; /*This is the interrupt raw bit for channel2 event.*/ - volatile uint32_t cnt_thr_event_u3_int_raw: 1; /*This is the interrupt raw bit for channel3 event.*/ - volatile uint32_t cnt_thr_event_u4_int_raw: 1; /*This is the interrupt raw bit for channel4 event.*/ - volatile uint32_t cnt_thr_event_u5_int_raw: 1; /*This is the interrupt raw bit for channel5 event.*/ - volatile uint32_t cnt_thr_event_u6_int_raw: 1; /*This is the interrupt raw bit for channel6 event.*/ - volatile uint32_t cnt_thr_event_u7_int_raw: 1; /*This is the interrupt raw bit for channel7 event.*/ - volatile uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0_int_raw: 1; /*This is the interrupt raw bit for channel0 event.*/ + uint32_t cnt_thr_event_u1_int_raw: 1; /*This is the interrupt raw bit for channel1 event.*/ + uint32_t cnt_thr_event_u2_int_raw: 1; /*This is the interrupt raw bit for channel2 event.*/ + uint32_t cnt_thr_event_u3_int_raw: 1; /*This is the interrupt raw bit for channel3 event.*/ + uint32_t cnt_thr_event_u4_int_raw: 1; /*This is the interrupt raw bit for channel4 event.*/ + uint32_t cnt_thr_event_u5_int_raw: 1; /*This is the interrupt raw bit for channel5 event.*/ + uint32_t cnt_thr_event_u6_int_raw: 1; /*This is the interrupt raw bit for channel6 event.*/ + uint32_t cnt_thr_event_u7_int_raw: 1; /*This is the interrupt raw bit for channel7 event.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t cnt_thr_event_u0_int_st: 1; /*This is the interrupt status bit for channel0 event.*/ - volatile uint32_t cnt_thr_event_u1_int_st: 1; /*This is the interrupt status bit for channel1 event.*/ - volatile uint32_t cnt_thr_event_u2_int_st: 1; /*This is the interrupt status bit for channel2 event.*/ - volatile uint32_t cnt_thr_event_u3_int_st: 1; /*This is the interrupt status bit for channel3 event.*/ - volatile uint32_t cnt_thr_event_u4_int_st: 1; /*This is the interrupt status bit for channel4 event.*/ - volatile uint32_t cnt_thr_event_u5_int_st: 1; /*This is the interrupt status bit for channel5 event.*/ - volatile uint32_t cnt_thr_event_u6_int_st: 1; /*This is the interrupt status bit for channel6 event.*/ - volatile uint32_t cnt_thr_event_u7_int_st: 1; /*This is the interrupt status bit for channel7 event.*/ - volatile uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0_int_st: 1; /*This is the interrupt status bit for channel0 event.*/ + uint32_t cnt_thr_event_u1_int_st: 1; /*This is the interrupt status bit for channel1 event.*/ + uint32_t cnt_thr_event_u2_int_st: 1; /*This is the interrupt status bit for channel2 event.*/ + uint32_t cnt_thr_event_u3_int_st: 1; /*This is the interrupt status bit for channel3 event.*/ + uint32_t cnt_thr_event_u4_int_st: 1; /*This is the interrupt status bit for channel4 event.*/ + uint32_t cnt_thr_event_u5_int_st: 1; /*This is the interrupt status bit for channel5 event.*/ + uint32_t cnt_thr_event_u6_int_st: 1; /*This is the interrupt status bit for channel6 event.*/ + uint32_t cnt_thr_event_u7_int_st: 1; /*This is the interrupt status bit for channel7 event.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t cnt_thr_event_u0_int_ena: 1; /*This is the interrupt enable bit for channel0 event.*/ - volatile uint32_t cnt_thr_event_u1_int_ena: 1; /*This is the interrupt enable bit for channel1 event.*/ - volatile uint32_t cnt_thr_event_u2_int_ena: 1; /*This is the interrupt enable bit for channel2 event.*/ - volatile uint32_t cnt_thr_event_u3_int_ena: 1; /*This is the interrupt enable bit for channel3 event.*/ - volatile uint32_t cnt_thr_event_u4_int_ena: 1; /*This is the interrupt enable bit for channel4 event.*/ - volatile uint32_t cnt_thr_event_u5_int_ena: 1; /*This is the interrupt enable bit for channel5 event.*/ - volatile uint32_t cnt_thr_event_u6_int_ena: 1; /*This is the interrupt enable bit for channel6 event.*/ - volatile uint32_t cnt_thr_event_u7_int_ena: 1; /*This is the interrupt enable bit for channel7 event.*/ - volatile uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0_int_ena: 1; /*This is the interrupt enable bit for channel0 event.*/ + uint32_t cnt_thr_event_u1_int_ena: 1; /*This is the interrupt enable bit for channel1 event.*/ + uint32_t cnt_thr_event_u2_int_ena: 1; /*This is the interrupt enable bit for channel2 event.*/ + uint32_t cnt_thr_event_u3_int_ena: 1; /*This is the interrupt enable bit for channel3 event.*/ + uint32_t cnt_thr_event_u4_int_ena: 1; /*This is the interrupt enable bit for channel4 event.*/ + uint32_t cnt_thr_event_u5_int_ena: 1; /*This is the interrupt enable bit for channel5 event.*/ + uint32_t cnt_thr_event_u6_int_ena: 1; /*This is the interrupt enable bit for channel6 event.*/ + uint32_t cnt_thr_event_u7_int_ena: 1; /*This is the interrupt enable bit for channel7 event.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t cnt_thr_event_u0_int_clr: 1; /*Set this bit to clear channel0 event interrupt.*/ - volatile uint32_t cnt_thr_event_u1_int_clr: 1; /*Set this bit to clear channel1 event interrupt.*/ - volatile uint32_t cnt_thr_event_u2_int_clr: 1; /*Set this bit to clear channel2 event interrupt.*/ - volatile uint32_t cnt_thr_event_u3_int_clr: 1; /*Set this bit to clear channel3 event interrupt.*/ - volatile uint32_t cnt_thr_event_u4_int_clr: 1; /*Set this bit to clear channel4 event interrupt.*/ - volatile uint32_t cnt_thr_event_u5_int_clr: 1; /*Set this bit to clear channel5 event interrupt.*/ - volatile uint32_t cnt_thr_event_u6_int_clr: 1; /*Set this bit to clear channel6 event interrupt.*/ - volatile uint32_t cnt_thr_event_u7_int_clr: 1; /*Set this bit to clear channel7 event interrupt.*/ - volatile uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0_int_clr: 1; /*Set this bit to clear channel0 event interrupt.*/ + uint32_t cnt_thr_event_u1_int_clr: 1; /*Set this bit to clear channel1 event interrupt.*/ + uint32_t cnt_thr_event_u2_int_clr: 1; /*Set this bit to clear channel2 event interrupt.*/ + uint32_t cnt_thr_event_u3_int_clr: 1; /*Set this bit to clear channel3 event interrupt.*/ + uint32_t cnt_thr_event_u4_int_clr: 1; /*Set this bit to clear channel4 event interrupt.*/ + uint32_t cnt_thr_event_u5_int_clr: 1; /*Set this bit to clear channel5 event interrupt.*/ + uint32_t cnt_thr_event_u6_int_clr: 1; /*Set this bit to clear channel6 event interrupt.*/ + uint32_t cnt_thr_event_u7_int_clr: 1; /*Set this bit to clear channel7 event interrupt.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }int_clr; - volatile uint32_t status_unit[8]; + uint32_t status_unit[8]; union { struct { - volatile uint32_t cnt_rst_u0: 1; /*Set this bit to clear unit0's counter.*/ - volatile uint32_t cnt_pause_u0: 1; /*Set this bit to pause unit0's counter.*/ - volatile uint32_t cnt_rst_u1: 1; /*Set this bit to clear unit1's counter.*/ - volatile uint32_t cnt_pause_u1: 1; /*Set this bit to pause unit1's counter.*/ - volatile uint32_t cnt_rst_u2: 1; /*Set this bit to clear unit2's counter.*/ - volatile uint32_t cnt_pause_u2: 1; /*Set this bit to pause unit2's counter.*/ - volatile uint32_t cnt_rst_u3: 1; /*Set this bit to clear unit3's counter.*/ - volatile uint32_t cnt_pause_u3: 1; /*Set this bit to pause unit3's counter.*/ - volatile uint32_t cnt_rst_u4: 1; /*Set this bit to clear unit4's counter.*/ - volatile uint32_t cnt_pause_u4: 1; /*Set this bit to pause unit4's counter.*/ - volatile uint32_t cnt_rst_u5: 1; /*Set this bit to clear unit5's counter.*/ - volatile uint32_t cnt_pause_u5: 1; /*Set this bit to pause unit5's counter.*/ - volatile uint32_t cnt_rst_u6: 1; /*Set this bit to clear unit6's counter.*/ - volatile uint32_t cnt_pause_u6: 1; /*Set this bit to pause unit6's counter.*/ - volatile uint32_t cnt_rst_u7: 1; /*Set this bit to clear unit7's counter.*/ - volatile uint32_t cnt_pause_u7: 1; /*Set this bit to pause unit7's counter.*/ - volatile uint32_t clk_en: 1; - volatile uint32_t reserved17: 15; + uint32_t cnt_rst_u0: 1; /*Set this bit to clear unit0's counter.*/ + uint32_t cnt_pause_u0: 1; /*Set this bit to pause unit0's counter.*/ + uint32_t cnt_rst_u1: 1; /*Set this bit to clear unit1's counter.*/ + uint32_t cnt_pause_u1: 1; /*Set this bit to pause unit1's counter.*/ + uint32_t cnt_rst_u2: 1; /*Set this bit to clear unit2's counter.*/ + uint32_t cnt_pause_u2: 1; /*Set this bit to pause unit2's counter.*/ + uint32_t cnt_rst_u3: 1; /*Set this bit to clear unit3's counter.*/ + uint32_t cnt_pause_u3: 1; /*Set this bit to pause unit3's counter.*/ + uint32_t cnt_rst_u4: 1; /*Set this bit to clear unit4's counter.*/ + uint32_t cnt_pause_u4: 1; /*Set this bit to pause unit4's counter.*/ + uint32_t cnt_rst_u5: 1; /*Set this bit to clear unit5's counter.*/ + uint32_t cnt_pause_u5: 1; /*Set this bit to pause unit5's counter.*/ + uint32_t cnt_rst_u6: 1; /*Set this bit to clear unit6's counter.*/ + uint32_t cnt_pause_u6: 1; /*Set this bit to pause unit6's counter.*/ + uint32_t cnt_rst_u7: 1; /*Set this bit to clear unit7's counter.*/ + uint32_t cnt_pause_u7: 1; /*Set this bit to pause unit7's counter.*/ + uint32_t clk_en: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }ctrl; - volatile uint32_t reserved_b4; - volatile uint32_t reserved_b8; - volatile uint32_t reserved_bc; - volatile uint32_t reserved_c0; - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; - volatile uint32_t reserved_f0; - volatile uint32_t reserved_f4; - volatile uint32_t reserved_f8; - volatile uint32_t date; /**/ + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ } pcnt_dev_t; -extern volatile pcnt_dev_t PCNT; +extern pcnt_dev_t PCNT; #endif /* _SOC_PCNT_STRUCT_H_ */ diff --git a/components/esp32/include/soc/rmt_struct.h b/components/esp32/include/soc/rmt_struct.h index 7310e18d56..dc3148eaac 100644 --- a/components/esp32/include/soc/rmt_struct.h +++ b/components/esp32/include/soc/rmt_struct.h @@ -13,216 +13,216 @@ // limitations under the License. #ifndef _SOC_RMT_STRUCT_H_ #define _SOC_RMT_STRUCT_H_ -typedef struct { - volatile uint32_t data_ch[8]; /*The R/W ram address for channel0-7 by apb fifo access.*/ +typedef volatile struct { + uint32_t data_ch[8]; /*The R/W ram address for channel0-7 by apb fifo access.*/ struct{ union { struct { - volatile uint32_t div_cnt: 8; /*This register is used to configure the frequency divider's factor in channel0-7.*/ - volatile uint32_t idle_thres: 16; /*In receive mode when no edge is detected on the input signal for longer than reg_idle_thres_ch0 then the receive process is done.*/ - volatile uint32_t mem_size: 4; /*This register is used to configure the the amount of memory blocks allocated to channel0-7.*/ - volatile uint32_t carrier_en: 1; /*This is the carrier modulation enable control bit for channel0-7.*/ - volatile uint32_t carrier_out_lv: 1; /*This bit is used to configure the way carrier wave is modulated for channel0-7.1'b1:transmit on low output level 1'b0:transmit on high output level.*/ - volatile uint32_t mem_pd: 1; /*This bit is used to reduce power consumed by memory. 1:memory is in low power state.*/ - volatile uint32_t clk_en: 1; /*This bit is used to control clock.when software configure RMT internal registers it controls the register clock.*/ + uint32_t div_cnt: 8; /*This register is used to configure the frequency divider's factor in channel0-7.*/ + uint32_t idle_thres: 16; /*In receive mode when no edge is detected on the input signal for longer than reg_idle_thres_ch0 then the receive process is done.*/ + uint32_t mem_size: 4; /*This register is used to configure the the amount of memory blocks allocated to channel0-7.*/ + uint32_t carrier_en: 1; /*This is the carrier modulation enable control bit for channel0-7.*/ + uint32_t carrier_out_lv: 1; /*This bit is used to configure the way carrier wave is modulated for channel0-7.1'b1:transmit on low output level 1'b0:transmit on high output level.*/ + uint32_t mem_pd: 1; /*This bit is used to reduce power consumed by memory. 1:memory is in low power state.*/ + uint32_t clk_en: 1; /*This bit is used to control clock.when software configure RMT internal registers it controls the register clock.*/ }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t tx_start: 1; /*Set this bit to start sending data for channel0-7.*/ - volatile uint32_t rx_en: 1; /*Set this bit to enable receiving data for channel0-7.*/ - volatile uint32_t mem_wr_rst: 1; /*Set this bit to reset write ram address for channel0-7 by receiver access.*/ - volatile uint32_t mem_rd_rst: 1; /*Set this bit to reset read ram address for channel0-7 by transmitter access.*/ - volatile uint32_t apb_mem_rst: 1; /*Set this bit to reset W/R ram address for channel0-7 by apb fifo access*/ - volatile uint32_t mem_owner: 1; /*This is the mark of channel0-7's ram usage right.1'b1:receiver uses the ram 0:transmitter uses the ram*/ - volatile uint32_t tx_conti_mode: 1; /*Set this bit to continue sending from the first data to the last data in channel0-7 again and again.*/ - volatile uint32_t rx_filter_en: 1; /*This is the receive filter enable bit for channel0-7.*/ - volatile uint32_t rx_filter_thres: 8; /*in receive mode channel0-7 ignore input pulse when the pulse width is smaller then this value.*/ - volatile uint32_t ref_cnt_rst: 1; /*This bit is used to reset divider in channel0-7.*/ - volatile uint32_t ref_always_on: 1; /*This bit is used to select base clock. 1'b1:clk_apb 1'b0:clk_ref*/ - volatile uint32_t idle_out_lv: 1; /*This bit configures the output signal's level for channel0-7 in IDLE state.*/ - volatile uint32_t idle_out_en: 1; /*This is the output enable control bit for channel0-7 in IDLE state.*/ - volatile uint32_t reserved20: 12; + uint32_t tx_start: 1; /*Set this bit to start sending data for channel0-7.*/ + uint32_t rx_en: 1; /*Set this bit to enable receiving data for channel0-7.*/ + uint32_t mem_wr_rst: 1; /*Set this bit to reset write ram address for channel0-7 by receiver access.*/ + uint32_t mem_rd_rst: 1; /*Set this bit to reset read ram address for channel0-7 by transmitter access.*/ + uint32_t apb_mem_rst: 1; /*Set this bit to reset W/R ram address for channel0-7 by apb fifo access*/ + uint32_t mem_owner: 1; /*This is the mark of channel0-7's ram usage right.1'b1:receiver uses the ram 0:transmitter uses the ram*/ + uint32_t tx_conti_mode: 1; /*Set this bit to continue sending from the first data to the last data in channel0-7 again and again.*/ + uint32_t rx_filter_en: 1; /*This is the receive filter enable bit for channel0-7.*/ + uint32_t rx_filter_thres: 8; /*in receive mode channel0-7 ignore input pulse when the pulse width is smaller then this value.*/ + uint32_t ref_cnt_rst: 1; /*This bit is used to reset divider in channel0-7.*/ + uint32_t ref_always_on: 1; /*This bit is used to select base clock. 1'b1:clk_apb 1'b0:clk_ref*/ + uint32_t idle_out_lv: 1; /*This bit configures the output signal's level for channel0-7 in IDLE state.*/ + uint32_t idle_out_en: 1; /*This is the output enable control bit for channel0-7 in IDLE state.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }conf1; }conf_ch[8]; - volatile uint32_t status_ch[8]; /*The status for channel0-7*/ - volatile uint32_t apb_mem_addr_ch[8]; /*The ram relative address in channel0-7 by apb fifo access*/ + uint32_t status_ch[8]; /*The status for channel0-7*/ + uint32_t apb_mem_addr_ch[8]; /*The ram relative address in channel0-7 by apb fifo access*/ union { struct { - volatile uint32_t ch0_tx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the transmit process is done.*/ - volatile uint32_t ch0_rx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the receive process is done.*/ - volatile uint32_t ch0_err_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when channel 0 detects some errors.*/ - volatile uint32_t ch1_tx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the transmit process is done.*/ - volatile uint32_t ch1_rx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the receive process is done.*/ - volatile uint32_t ch1_err_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when channel 1 detects some errors.*/ - volatile uint32_t ch2_tx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the transmit process is done.*/ - volatile uint32_t ch2_rx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the receive process is done.*/ - volatile uint32_t ch2_err_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when channel 2 detects some errors.*/ - volatile uint32_t ch3_tx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the transmit process is done.*/ - volatile uint32_t ch3_rx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the receive process is done.*/ - volatile uint32_t ch3_err_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when channel 3 detects some errors.*/ - volatile uint32_t ch4_tx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the transmit process is done.*/ - volatile uint32_t ch4_rx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the receive process is done.*/ - volatile uint32_t ch4_err_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when channel 4 detects some errors.*/ - volatile uint32_t ch5_tx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the transmit process is done.*/ - volatile uint32_t ch5_rx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the receive process is done.*/ - volatile uint32_t ch5_err_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when channel 5 detects some errors.*/ - volatile uint32_t ch6_tx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the transmit process is done.*/ - volatile uint32_t ch6_rx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the receive process is done.*/ - volatile uint32_t ch6_err_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when channel 6 detects some errors.*/ - volatile uint32_t ch7_tx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the transmit process is done.*/ - volatile uint32_t ch7_rx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the receive process is done.*/ - volatile uint32_t ch7_err_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when channel 7 detects some errors.*/ - volatile uint32_t ch0_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when transmitter in channel0 have send data more than reg_rmt_tx_lim_ch0 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch1_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when transmitter in channel1 have send data more than reg_rmt_tx_lim_ch1 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch2_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when transmitter in channel2 have send data more than reg_rmt_tx_lim_ch2 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch3_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when transmitter in channel3 have send data more than reg_rmt_tx_lim_ch3 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch4_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when transmitter in channel4 have send data more than reg_rmt_tx_lim_ch4 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch5_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when transmitter in channel5 have send data more than reg_rmt_tx_lim_ch5 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch6_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when transmitter in channel6 have send data more than reg_rmt_tx_lim_ch6 after detecting this interrupt software can updata the old data with new data.*/ - volatile uint32_t ch7_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch0_tx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the transmit process is done.*/ + uint32_t ch0_rx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the receive process is done.*/ + uint32_t ch0_err_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when channel 0 detects some errors.*/ + uint32_t ch1_tx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the transmit process is done.*/ + uint32_t ch1_rx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the receive process is done.*/ + uint32_t ch1_err_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when channel 1 detects some errors.*/ + uint32_t ch2_tx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the transmit process is done.*/ + uint32_t ch2_rx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the receive process is done.*/ + uint32_t ch2_err_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when channel 2 detects some errors.*/ + uint32_t ch3_tx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the transmit process is done.*/ + uint32_t ch3_rx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the receive process is done.*/ + uint32_t ch3_err_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when channel 3 detects some errors.*/ + uint32_t ch4_tx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the transmit process is done.*/ + uint32_t ch4_rx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the receive process is done.*/ + uint32_t ch4_err_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when channel 4 detects some errors.*/ + uint32_t ch5_tx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the transmit process is done.*/ + uint32_t ch5_rx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the receive process is done.*/ + uint32_t ch5_err_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when channel 5 detects some errors.*/ + uint32_t ch6_tx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the transmit process is done.*/ + uint32_t ch6_rx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the receive process is done.*/ + uint32_t ch6_err_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when channel 6 detects some errors.*/ + uint32_t ch7_tx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the transmit process is done.*/ + uint32_t ch7_rx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the receive process is done.*/ + uint32_t ch7_err_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when channel 7 detects some errors.*/ + uint32_t ch0_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when transmitter in channel0 have send data more than reg_rmt_tx_lim_ch0 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch1_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when transmitter in channel1 have send data more than reg_rmt_tx_lim_ch1 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch2_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when transmitter in channel2 have send data more than reg_rmt_tx_lim_ch2 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch3_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when transmitter in channel3 have send data more than reg_rmt_tx_lim_ch3 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch4_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when transmitter in channel4 have send data more than reg_rmt_tx_lim_ch4 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch5_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when transmitter in channel5 have send data more than reg_rmt_tx_lim_ch5 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch6_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when transmitter in channel6 have send data more than reg_rmt_tx_lim_ch6 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch7_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t ch0_tx_end_int_st: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ - volatile uint32_t ch0_rx_end_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_rx_end_int_raw when rmt_ch0_rx_end_int_ena is set to 0.*/ - volatile uint32_t ch0_err_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_err_int_raw when rmt_ch0_err_int_ena is set to 0.*/ - volatile uint32_t ch1_tx_end_int_st: 1; /*The interrupt state bit for channel 1's mt_ch1_tx_end_int_raw when mt_ch1_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch1_rx_end_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_rx_end_int_raw when rmt_ch1_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch1_err_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_err_int_raw when rmt_ch1_err_int_ena is set to 1.*/ - volatile uint32_t ch2_tx_end_int_st: 1; /*The interrupt state bit for channel 2's mt_ch2_tx_end_int_raw when mt_ch2_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch2_rx_end_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_rx_end_int_raw when rmt_ch2_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch2_err_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_err_int_raw when rmt_ch2_err_int_ena is set to 1.*/ - volatile uint32_t ch3_tx_end_int_st: 1; /*The interrupt state bit for channel 3's mt_ch3_tx_end_int_raw when mt_ch3_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch3_rx_end_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_rx_end_int_raw when rmt_ch3_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch3_err_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_err_int_raw when rmt_ch3_err_int_ena is set to 1.*/ - volatile uint32_t ch4_tx_end_int_st: 1; /*The interrupt state bit for channel 4's mt_ch4_tx_end_int_raw when mt_ch4_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch4_rx_end_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_rx_end_int_raw when rmt_ch4_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch4_err_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_err_int_raw when rmt_ch4_err_int_ena is set to 1.*/ - volatile uint32_t ch5_tx_end_int_st: 1; /*The interrupt state bit for channel 5's mt_ch5_tx_end_int_raw when mt_ch5_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch5_rx_end_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_rx_end_int_raw when rmt_ch5_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch5_err_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_err_int_raw when rmt_ch5_err_int_ena is set to 1.*/ - volatile uint32_t ch6_tx_end_int_st: 1; /*The interrupt state bit for channel 6's mt_ch6_tx_end_int_raw when mt_ch6_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch6_rx_end_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_rx_end_int_raw when rmt_ch6_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch6_err_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_err_int_raw when rmt_ch6_err_int_ena is set to 1.*/ - volatile uint32_t ch7_tx_end_int_st: 1; /*The interrupt state bit for channel 7's mt_ch7_tx_end_int_raw when mt_ch7_tx_end_int_ena is set to 1.*/ - volatile uint32_t ch7_rx_end_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_rx_end_int_raw when rmt_ch7_rx_end_int_ena is set to 1.*/ - volatile uint32_t ch7_err_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_err_int_raw when rmt_ch7_err_int_ena is set to 1.*/ - volatile uint32_t ch0_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_tx_thr_event_int_raw when mt_ch0_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch1_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_tx_thr_event_int_raw when mt_ch1_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch2_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_tx_thr_event_int_raw when mt_ch2_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch3_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_tx_thr_event_int_raw when mt_ch3_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch4_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_tx_thr_event_int_raw when mt_ch4_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch5_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_tx_thr_event_int_raw when mt_ch5_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch6_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_tx_thr_event_int_raw when mt_ch6_tx_thr_event_int_ena is set to 1.*/ - volatile uint32_t ch7_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch0_tx_end_int_st: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ + uint32_t ch0_rx_end_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_rx_end_int_raw when rmt_ch0_rx_end_int_ena is set to 0.*/ + uint32_t ch0_err_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_err_int_raw when rmt_ch0_err_int_ena is set to 0.*/ + uint32_t ch1_tx_end_int_st: 1; /*The interrupt state bit for channel 1's mt_ch1_tx_end_int_raw when mt_ch1_tx_end_int_ena is set to 1.*/ + uint32_t ch1_rx_end_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_rx_end_int_raw when rmt_ch1_rx_end_int_ena is set to 1.*/ + uint32_t ch1_err_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_err_int_raw when rmt_ch1_err_int_ena is set to 1.*/ + uint32_t ch2_tx_end_int_st: 1; /*The interrupt state bit for channel 2's mt_ch2_tx_end_int_raw when mt_ch2_tx_end_int_ena is set to 1.*/ + uint32_t ch2_rx_end_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_rx_end_int_raw when rmt_ch2_rx_end_int_ena is set to 1.*/ + uint32_t ch2_err_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_err_int_raw when rmt_ch2_err_int_ena is set to 1.*/ + uint32_t ch3_tx_end_int_st: 1; /*The interrupt state bit for channel 3's mt_ch3_tx_end_int_raw when mt_ch3_tx_end_int_ena is set to 1.*/ + uint32_t ch3_rx_end_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_rx_end_int_raw when rmt_ch3_rx_end_int_ena is set to 1.*/ + uint32_t ch3_err_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_err_int_raw when rmt_ch3_err_int_ena is set to 1.*/ + uint32_t ch4_tx_end_int_st: 1; /*The interrupt state bit for channel 4's mt_ch4_tx_end_int_raw when mt_ch4_tx_end_int_ena is set to 1.*/ + uint32_t ch4_rx_end_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_rx_end_int_raw when rmt_ch4_rx_end_int_ena is set to 1.*/ + uint32_t ch4_err_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_err_int_raw when rmt_ch4_err_int_ena is set to 1.*/ + uint32_t ch5_tx_end_int_st: 1; /*The interrupt state bit for channel 5's mt_ch5_tx_end_int_raw when mt_ch5_tx_end_int_ena is set to 1.*/ + uint32_t ch5_rx_end_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_rx_end_int_raw when rmt_ch5_rx_end_int_ena is set to 1.*/ + uint32_t ch5_err_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_err_int_raw when rmt_ch5_err_int_ena is set to 1.*/ + uint32_t ch6_tx_end_int_st: 1; /*The interrupt state bit for channel 6's mt_ch6_tx_end_int_raw when mt_ch6_tx_end_int_ena is set to 1.*/ + uint32_t ch6_rx_end_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_rx_end_int_raw when rmt_ch6_rx_end_int_ena is set to 1.*/ + uint32_t ch6_err_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_err_int_raw when rmt_ch6_err_int_ena is set to 1.*/ + uint32_t ch7_tx_end_int_st: 1; /*The interrupt state bit for channel 7's mt_ch7_tx_end_int_raw when mt_ch7_tx_end_int_ena is set to 1.*/ + uint32_t ch7_rx_end_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_rx_end_int_raw when rmt_ch7_rx_end_int_ena is set to 1.*/ + uint32_t ch7_err_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_err_int_raw when rmt_ch7_err_int_ena is set to 1.*/ + uint32_t ch0_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_tx_thr_event_int_raw when mt_ch0_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch1_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_tx_thr_event_int_raw when mt_ch1_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch2_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_tx_thr_event_int_raw when mt_ch2_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch3_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_tx_thr_event_int_raw when mt_ch3_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch4_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_tx_thr_event_int_raw when mt_ch4_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch5_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_tx_thr_event_int_raw when mt_ch5_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch6_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_tx_thr_event_int_raw when mt_ch6_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch7_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t ch0_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ - volatile uint32_t ch0_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_rx_end_int_st.*/ - volatile uint32_t ch0_err_int_ena: 1; /*Set this bit to enable rmt_ch0_err_int_st.*/ - volatile uint32_t ch1_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_end_int_st.*/ - volatile uint32_t ch1_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_rx_end_int_st.*/ - volatile uint32_t ch1_err_int_ena: 1; /*Set this bit to enable rmt_ch1_err_int_st.*/ - volatile uint32_t ch2_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_end_int_st.*/ - volatile uint32_t ch2_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_rx_end_int_st.*/ - volatile uint32_t ch2_err_int_ena: 1; /*Set this bit to enable rmt_ch2_err_int_st.*/ - volatile uint32_t ch3_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_end_int_st.*/ - volatile uint32_t ch3_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_rx_end_int_st.*/ - volatile uint32_t ch3_err_int_ena: 1; /*Set this bit to enable rmt_ch3_err_int_st.*/ - volatile uint32_t ch4_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_end_int_st.*/ - volatile uint32_t ch4_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_rx_end_int_st.*/ - volatile uint32_t ch4_err_int_ena: 1; /*Set this bit to enable rmt_ch4_err_int_st.*/ - volatile uint32_t ch5_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_end_int_st.*/ - volatile uint32_t ch5_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_rx_end_int_st.*/ - volatile uint32_t ch5_err_int_ena: 1; /*Set this bit to enable rmt_ch5_err_int_st.*/ - volatile uint32_t ch6_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_end_int_st.*/ - volatile uint32_t ch6_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_rx_end_int_st.*/ - volatile uint32_t ch6_err_int_ena: 1; /*Set this bit to enable rmt_ch6_err_int_st.*/ - volatile uint32_t ch7_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_end_int_st.*/ - volatile uint32_t ch7_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_rx_end_int_st.*/ - volatile uint32_t ch7_err_int_ena: 1; /*Set this bit to enable rmt_ch7_err_int_st.*/ - volatile uint32_t ch0_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_thr_event_int_st.*/ - volatile uint32_t ch1_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_thr_event_int_st.*/ - volatile uint32_t ch2_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_thr_event_int_st.*/ - volatile uint32_t ch3_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_thr_event_int_st.*/ - volatile uint32_t ch4_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_thr_event_int_st.*/ - volatile uint32_t ch5_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_thr_event_int_st.*/ - volatile uint32_t ch6_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_thr_event_int_st.*/ - volatile uint32_t ch7_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ + uint32_t ch0_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ + uint32_t ch0_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_rx_end_int_st.*/ + uint32_t ch0_err_int_ena: 1; /*Set this bit to enable rmt_ch0_err_int_st.*/ + uint32_t ch1_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_end_int_st.*/ + uint32_t ch1_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_rx_end_int_st.*/ + uint32_t ch1_err_int_ena: 1; /*Set this bit to enable rmt_ch1_err_int_st.*/ + uint32_t ch2_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_end_int_st.*/ + uint32_t ch2_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_rx_end_int_st.*/ + uint32_t ch2_err_int_ena: 1; /*Set this bit to enable rmt_ch2_err_int_st.*/ + uint32_t ch3_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_end_int_st.*/ + uint32_t ch3_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_rx_end_int_st.*/ + uint32_t ch3_err_int_ena: 1; /*Set this bit to enable rmt_ch3_err_int_st.*/ + uint32_t ch4_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_end_int_st.*/ + uint32_t ch4_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_rx_end_int_st.*/ + uint32_t ch4_err_int_ena: 1; /*Set this bit to enable rmt_ch4_err_int_st.*/ + uint32_t ch5_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_end_int_st.*/ + uint32_t ch5_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_rx_end_int_st.*/ + uint32_t ch5_err_int_ena: 1; /*Set this bit to enable rmt_ch5_err_int_st.*/ + uint32_t ch6_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_end_int_st.*/ + uint32_t ch6_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_rx_end_int_st.*/ + uint32_t ch6_err_int_ena: 1; /*Set this bit to enable rmt_ch6_err_int_st.*/ + uint32_t ch7_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_end_int_st.*/ + uint32_t ch7_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_rx_end_int_st.*/ + uint32_t ch7_err_int_ena: 1; /*Set this bit to enable rmt_ch7_err_int_st.*/ + uint32_t ch0_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_thr_event_int_st.*/ + uint32_t ch1_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_thr_event_int_st.*/ + uint32_t ch2_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_thr_event_int_st.*/ + uint32_t ch3_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_thr_event_int_st.*/ + uint32_t ch4_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_thr_event_int_st.*/ + uint32_t ch5_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_thr_event_int_st.*/ + uint32_t ch6_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_thr_event_int_st.*/ + uint32_t ch7_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t ch0_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ - volatile uint32_t ch0_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_end_int_raw.*/ - volatile uint32_t ch0_err_int_clr: 1; /*Set this bit to clear the rmt_ch0_err_int_raw.*/ - volatile uint32_t ch1_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_rx_end_int_raw..*/ - volatile uint32_t ch1_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_end_int_raw.*/ - volatile uint32_t ch1_err_int_clr: 1; /*Set this bit to clear the rmt_ch1_err_int_raw.*/ - volatile uint32_t ch2_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_rx_end_int_raw..*/ - volatile uint32_t ch2_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_end_int_raw.*/ - volatile uint32_t ch2_err_int_clr: 1; /*Set this bit to clear the rmt_ch2_err_int_raw.*/ - volatile uint32_t ch3_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_rx_end_int_raw..*/ - volatile uint32_t ch3_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_end_int_raw.*/ - volatile uint32_t ch3_err_int_clr: 1; /*Set this bit to clear the rmt_ch3_err_int_raw.*/ - volatile uint32_t ch4_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_rx_end_int_raw..*/ - volatile uint32_t ch4_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_end_int_raw.*/ - volatile uint32_t ch4_err_int_clr: 1; /*Set this bit to clear the rmt_ch4_err_int_raw.*/ - volatile uint32_t ch5_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_rx_end_int_raw..*/ - volatile uint32_t ch5_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_end_int_raw.*/ - volatile uint32_t ch5_err_int_clr: 1; /*Set this bit to clear the rmt_ch5_err_int_raw.*/ - volatile uint32_t ch6_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_rx_end_int_raw..*/ - volatile uint32_t ch6_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_end_int_raw.*/ - volatile uint32_t ch6_err_int_clr: 1; /*Set this bit to clear the rmt_ch6_err_int_raw.*/ - volatile uint32_t ch7_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_rx_end_int_raw..*/ - volatile uint32_t ch7_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_end_int_raw.*/ - volatile uint32_t ch7_err_int_clr: 1; /*Set this bit to clear the rmt_ch7_err_int_raw.*/ - volatile uint32_t ch0_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch1_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch2_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch3_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch4_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch5_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch6_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_thr_event_int_raw interrupt.*/ - volatile uint32_t ch7_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ + uint32_t ch0_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ + uint32_t ch0_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_end_int_raw.*/ + uint32_t ch0_err_int_clr: 1; /*Set this bit to clear the rmt_ch0_err_int_raw.*/ + uint32_t ch1_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_rx_end_int_raw..*/ + uint32_t ch1_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_end_int_raw.*/ + uint32_t ch1_err_int_clr: 1; /*Set this bit to clear the rmt_ch1_err_int_raw.*/ + uint32_t ch2_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_rx_end_int_raw..*/ + uint32_t ch2_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_end_int_raw.*/ + uint32_t ch2_err_int_clr: 1; /*Set this bit to clear the rmt_ch2_err_int_raw.*/ + uint32_t ch3_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_rx_end_int_raw..*/ + uint32_t ch3_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_end_int_raw.*/ + uint32_t ch3_err_int_clr: 1; /*Set this bit to clear the rmt_ch3_err_int_raw.*/ + uint32_t ch4_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_rx_end_int_raw..*/ + uint32_t ch4_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_end_int_raw.*/ + uint32_t ch4_err_int_clr: 1; /*Set this bit to clear the rmt_ch4_err_int_raw.*/ + uint32_t ch5_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_rx_end_int_raw..*/ + uint32_t ch5_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_end_int_raw.*/ + uint32_t ch5_err_int_clr: 1; /*Set this bit to clear the rmt_ch5_err_int_raw.*/ + uint32_t ch6_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_rx_end_int_raw..*/ + uint32_t ch6_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_end_int_raw.*/ + uint32_t ch6_err_int_clr: 1; /*Set this bit to clear the rmt_ch6_err_int_raw.*/ + uint32_t ch7_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_rx_end_int_raw..*/ + uint32_t ch7_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_end_int_raw.*/ + uint32_t ch7_err_int_clr: 1; /*Set this bit to clear the rmt_ch7_err_int_raw.*/ + uint32_t ch0_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_thr_event_int_raw interrupt.*/ + uint32_t ch1_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_thr_event_int_raw interrupt.*/ + uint32_t ch2_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_thr_event_int_raw interrupt.*/ + uint32_t ch3_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_thr_event_int_raw interrupt.*/ + uint32_t ch4_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_thr_event_int_raw interrupt.*/ + uint32_t ch5_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_thr_event_int_raw interrupt.*/ + uint32_t ch6_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_thr_event_int_raw interrupt.*/ + uint32_t ch7_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t carrier_low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ - volatile uint32_t carrier_high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ + uint32_t carrier_low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ + uint32_t carrier_high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ }; - volatile uint32_t val; + uint32_t val; }carrier_duty_ch[8]; union { struct { - volatile uint32_t tx_lim: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ - volatile uint32_t reserved9: 23; + uint32_t tx_lim: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ + uint32_t reserved9: 23; }; - volatile uint32_t val; + uint32_t val; }tx_lim_ch[8]; union { struct { - volatile uint32_t apb_fifo_mask: 1; /*Set this bit to disable apb fifo access*/ - volatile uint32_t mem_tx_wrap_en: 1; /*when data need to be send is more than channel's mem can store then set this bit to enable reuse of mem this bit is used together with reg_rmt_tx_lim_chn.*/ - volatile uint32_t reserved2: 30; + uint32_t apb_fifo_mask: 1; /*Set this bit to disable apb fifo access*/ + uint32_t mem_tx_wrap_en: 1; /*when data need to be send is more than channel's mem can store then set this bit to enable reuse of mem this bit is used together with reg_rmt_tx_lim_chn.*/ + uint32_t reserved2: 30; }; - volatile uint32_t val; + uint32_t val; }apb_conf; - volatile uint32_t reserved_f4; - volatile uint32_t reserved_f8; - volatile uint32_t date; /*This is the version register.*/ + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /*This is the version register.*/ } rmt_dev_t; -extern volatile rmt_dev_t RMT; +extern rmt_dev_t RMT; #endif /* _SOC_RMT_STRUCT_H_ */ diff --git a/components/esp32/include/soc/spi_struct.h b/components/esp32/include/soc/spi_struct.h index e76590537c..0eb64e91d3 100644 --- a/components/esp32/include/soc/spi_struct.h +++ b/components/esp32/include/soc/spi_struct.h @@ -13,665 +13,665 @@ // limitations under the License. #ifndef _SOC_SPI_STRUCT_H_ #define _SOC_SPI_STRUCT_H_ -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t reserved0: 16; /*reserved*/ - volatile uint32_t flash_per: 1; /*program erase resume bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_pes: 1; /*program erase suspend bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t usr: 1; /*User define command enable. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_hpm: 1; /*Drive Flash into high performance mode. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_res: 1; /*This bit combined with reg_resandres bit releases Flash from the power-down state or high performance mode and obtains the devices ID. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_dp: 1; /*Drive Flash into power down. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_ce: 1; /*Chip erase enable. Chip erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_be: 1; /*Block erase enable(32KB) . Block erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_se: 1; /*Sector erase enable(4KB). Sector erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_pp: 1; /*Page program enable(1 byte ~256 bytes data to be programmed). Page program operation will be triggered when the bit is set. The bit will be cleared once the operation done .1: enable 0: disable.*/ - volatile uint32_t flash_wrsr: 1; /*Write status register enable. Write status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_rdsr: 1; /*Read status register-1. Read status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ - volatile uint32_t flash_rdid: 1; /*Read JEDEC ID . Read ID command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ - volatile uint32_t flash_wrdi: 1; /*Write flash disable. Write disable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ - volatile uint32_t flash_wren: 1; /*Write flash enable. Write enable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ - volatile uint32_t flash_read: 1; /*Read flash enable. Read flash operation will be triggered when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t reserved0: 16; /*reserved*/ + uint32_t flash_per: 1; /*program erase resume bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_pes: 1; /*program erase suspend bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t usr: 1; /*User define command enable. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_hpm: 1; /*Drive Flash into high performance mode. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_res: 1; /*This bit combined with reg_resandres bit releases Flash from the power-down state or high performance mode and obtains the devices ID. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_dp: 1; /*Drive Flash into power down. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_ce: 1; /*Chip erase enable. Chip erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_be: 1; /*Block erase enable(32KB) . Block erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_se: 1; /*Sector erase enable(4KB). Sector erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_pp: 1; /*Page program enable(1 byte ~256 bytes data to be programmed). Page program operation will be triggered when the bit is set. The bit will be cleared once the operation done .1: enable 0: disable.*/ + uint32_t flash_wrsr: 1; /*Write status register enable. Write status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_rdsr: 1; /*Read status register-1. Read status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_rdid: 1; /*Read JEDEC ID . Read ID command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_wrdi: 1; /*Write flash disable. Write disable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_wren: 1; /*Write flash enable. Write enable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_read: 1; /*Read flash enable. Read flash operation will be triggered when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ }; - volatile uint32_t val; + uint32_t val; }cmd; union { struct { - volatile uint32_t reserved : 8; - volatile uint32_t usr_addr_value:24; /*[31:8]:address to slave [7:0]:Reserved.*/ + uint32_t reserved : 8; + uint32_t usr_addr_value:24; /*[31:8]:address to slave [7:0]:Reserved.*/ }; - volatile uint32_t val; + uint32_t val; }addr; union { struct { - volatile uint32_t reserved0: 10; /*reserved*/ - volatile uint32_t fcs_crc_en: 1; /*For SPI1 initialize crc32 module before writing encrypted data to flash. Active low.*/ - volatile uint32_t tx_crc_en: 1; /*For SPI1 enable crc32 when writing encrypted data to flash. 1: enable 0:disable*/ - volatile uint32_t wait_flash_idle_en: 1; /*wait flash idle when program flash or erase flash. 1: enable 0: disable.*/ - volatile uint32_t fastrd_mode: 1; /*This bit enable the bits: spi_fread_qio spi_fread_dio spi_fread_qout and spi_fread_dout. 1: enable 0: disable.*/ - volatile uint32_t fread_dual: 1; /*In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ - volatile uint32_t resandres: 1; /*The Device ID is read out to SPI_RD_STATUS register, this bit combine with spi_flash_res bit. 1: enable 0: disable.*/ - volatile uint32_t reserved16: 4; /*reserved*/ - volatile uint32_t fread_quad: 1; /*In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ - volatile uint32_t wp: 1; /*Write protect signal output when SPI is idle. 1: output high 0: output low.*/ - volatile uint32_t wrsr_2b: 1; /*two bytes data will be written to status register when it is set. 1: enable 0: disable.*/ - volatile uint32_t fread_dio: 1; /*In the read operations address phase and read-data phase apply 2 signals. 1: enable 0: disable.*/ - volatile uint32_t fread_qio: 1; /*In the read operations address phase and read-data phase apply 4 signals. 1: enable 0: disable.*/ - volatile uint32_t rd_bit_order: 1; /*In read-data (MISO) phase 1: LSB first 0: MSB first*/ - volatile uint32_t wr_bit_order: 1; /*In command address write-data (MOSI) phases 1: LSB firs 0: MSB first*/ - volatile uint32_t reserved27: 5; /*reserved*/ + uint32_t reserved0: 10; /*reserved*/ + uint32_t fcs_crc_en: 1; /*For SPI1 initialize crc32 module before writing encrypted data to flash. Active low.*/ + uint32_t tx_crc_en: 1; /*For SPI1 enable crc32 when writing encrypted data to flash. 1: enable 0:disable*/ + uint32_t wait_flash_idle_en: 1; /*wait flash idle when program flash or erase flash. 1: enable 0: disable.*/ + uint32_t fastrd_mode: 1; /*This bit enable the bits: spi_fread_qio spi_fread_dio spi_fread_qout and spi_fread_dout. 1: enable 0: disable.*/ + uint32_t fread_dual: 1; /*In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ + uint32_t resandres: 1; /*The Device ID is read out to SPI_RD_STATUS register, this bit combine with spi_flash_res bit. 1: enable 0: disable.*/ + uint32_t reserved16: 4; /*reserved*/ + uint32_t fread_quad: 1; /*In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ + uint32_t wp: 1; /*Write protect signal output when SPI is idle. 1: output high 0: output low.*/ + uint32_t wrsr_2b: 1; /*two bytes data will be written to status register when it is set. 1: enable 0: disable.*/ + uint32_t fread_dio: 1; /*In the read operations address phase and read-data phase apply 2 signals. 1: enable 0: disable.*/ + uint32_t fread_qio: 1; /*In the read operations address phase and read-data phase apply 4 signals. 1: enable 0: disable.*/ + uint32_t rd_bit_order: 1; /*In read-data (MISO) phase 1: LSB first 0: MSB first*/ + uint32_t wr_bit_order: 1; /*In command address write-data (MOSI) phases 1: LSB firs 0: MSB first*/ + uint32_t reserved27: 5; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }ctrl; union { struct { - volatile uint32_t reserved0: 16; /*reserved*/ - volatile uint32_t cs_hold_delay_res:12; /*Delay cycles of resume Flash when resume Flash is enable by spi clock.*/ - volatile uint32_t cs_hold_delay: 4; /*SPI cs signal is delayed by spi clock cycles*/ + uint32_t reserved0: 16; /*reserved*/ + uint32_t cs_hold_delay_res:12; /*Delay cycles of resume Flash when resume Flash is enable by spi clock.*/ + uint32_t cs_hold_delay: 4; /*SPI cs signal is delayed by spi clock cycles*/ }; - volatile uint32_t val; + uint32_t val; }ctrl1; union { struct { - volatile uint32_t status: 16; /*In the slave mode, it is the status for master to read out.*/ - volatile uint32_t wb_mode: 8; /*Mode bits in the flash fast read mode, it is combined with spi_fastrd_mode bit.*/ - volatile uint32_t status_ext: 8; /*In the slave mode,it is the status for master to read out.*/ + uint32_t status: 16; /*In the slave mode, it is the status for master to read out.*/ + uint32_t wb_mode: 8; /*Mode bits in the flash fast read mode, it is combined with spi_fastrd_mode bit.*/ + uint32_t status_ext: 8; /*In the slave mode,it is the status for master to read out.*/ }; - volatile uint32_t val; + uint32_t val; }rd_status; union { struct { - volatile uint32_t setup_time: 4; /*(cycles-1) of ,prepare, phase by spi clock, this bits combined with spi_cs_setup bit.*/ - volatile uint32_t hold_time: 4; /*delay cycles of cs pin by spi clock, this bits combined with spi_cs_hold bit.*/ - volatile uint32_t ck_out_low_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_L bits.*/ - volatile uint32_t ck_out_high_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_H bits.*/ - volatile uint32_t miso_delay_mode: 2; /*MISO signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ - volatile uint32_t miso_delay_num: 3; /*MISO signals are delayed by system clock cycles*/ - volatile uint32_t mosi_delay_mode: 2; /*MOSI signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ - volatile uint32_t mosi_delay_num: 3; /*MOSI signals are delayed by system clock cycles*/ - volatile uint32_t cs_delay_mode: 2; /*spi_cs signal is delayed by spi_clk . 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ - volatile uint32_t cs_delay_num: 4; /*spi_cs signal is delayed by system clock cycles*/ + uint32_t setup_time: 4; /*(cycles-1) of ,prepare, phase by spi clock, this bits combined with spi_cs_setup bit.*/ + uint32_t hold_time: 4; /*delay cycles of cs pin by spi clock, this bits combined with spi_cs_hold bit.*/ + uint32_t ck_out_low_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_L bits.*/ + uint32_t ck_out_high_mode: 4; /*modify spi clock duty ratio when the value is lager than 8, the bits are combined with spi_clkcnt_N bits and spi_clkcnt_H bits.*/ + uint32_t miso_delay_mode: 2; /*MISO signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + uint32_t miso_delay_num: 3; /*MISO signals are delayed by system clock cycles*/ + uint32_t mosi_delay_mode: 2; /*MOSI signals are delayed by spi_clk. 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + uint32_t mosi_delay_num: 3; /*MOSI signals are delayed by system clock cycles*/ + uint32_t cs_delay_mode: 2; /*spi_cs signal is delayed by spi_clk . 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + uint32_t cs_delay_num: 4; /*spi_cs signal is delayed by system clock cycles*/ }; - volatile uint32_t val; + uint32_t val; }ctrl2; union { struct { - volatile uint32_t clkcnt_l: 6; /*In the master mode it must be equal to spi_clkcnt_N. In the slave mode it must be 0.*/ - volatile uint32_t clkcnt_h: 6; /*In the master mode it must be floor((spi_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ - volatile uint32_t clkcnt_n: 6; /*In the master mode it is the divider of spi_clk. So spi_clk frequency is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ - volatile uint32_t clkdiv_pre: 13; /*In the master mode it is pre-divider of spi_clk.*/ - volatile uint32_t clk_equ_sysclk: 1; /*In the master mode 1: spi_clk is eqaul to system 0: spi_clk is divided from system clock.*/ + uint32_t clkcnt_l: 6; /*In the master mode it must be equal to spi_clkcnt_N. In the slave mode it must be 0.*/ + uint32_t clkcnt_h: 6; /*In the master mode it must be floor((spi_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ + uint32_t clkcnt_n: 6; /*In the master mode it is the divider of spi_clk. So spi_clk frequency is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ + uint32_t clkdiv_pre: 13; /*In the master mode it is pre-divider of spi_clk.*/ + uint32_t clk_equ_sysclk: 1; /*In the master mode 1: spi_clk is eqaul to system 0: spi_clk is divided from system clock.*/ }; - volatile uint32_t val; + uint32_t val; }clock; union { struct { - volatile uint32_t doutdin: 1; /*Set the bit to enable full duplex communication. 1: enable 0: disable.*/ - volatile uint32_t reserved1: 3; /*reserved*/ - volatile uint32_t cs_hold: 1; /*spi cs keep low when spi is in ,done, phase. 1: enable 0: disable.*/ - volatile uint32_t cs_setup: 1; /*spi cs is enable when spi is in ,prepare, phase. 1: enable 0: disable.*/ - volatile uint32_t ck_i_edge: 1; /*In the slave mode the bit is same as spi_ck_out_edge in master mode. It is combined with spi_miso_delay_mode bits.*/ - volatile uint32_t ck_out_edge: 1; /*the bit combined with spi_mosi_delay_mode bits to set mosi signal delay mode.*/ - volatile uint32_t reserved8: 2; /*reserved*/ - volatile uint32_t rd_byte_order: 1; /*In read-data (MISO) phase 1: big-endian 0: little_endian*/ - volatile uint32_t wr_byte_order: 1; /*In command address write-data (MOSI) phases 1: big-endian 0: litte_endian*/ - volatile uint32_t fwrite_dual: 1; /*In the write operations read-data phase apply 2 signals*/ - volatile uint32_t fwrite_quad: 1; /*In the write operations read-data phase apply 4 signals*/ - volatile uint32_t fwrite_dio: 1; /*In the write operations address phase and read-data phase apply 2 signals.*/ - volatile uint32_t fwrite_qio: 1; /*In the write operations address phase and read-data phase apply 4 signals.*/ - volatile uint32_t sio: 1; /*Set the bit to enable 3-line half duplex communication mosi and miso signals share the same pin. 1: enable 0: disable.*/ - volatile uint32_t usr_hold_pol: 1; /*It is combined with hold bits to set the polarity of spi hold line 1: spi will be held when spi hold line is high 0: spi will be held when spi hold line is low*/ - volatile uint32_t usr_dout_hold: 1; /*spi is hold at data out state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_din_hold: 1; /*spi is hold at data in state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_dummy_hold: 1; /*spi is hold at dummy state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_addr_hold: 1; /*spi is hold at address state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_cmd_hold: 1; /*spi is hold at command state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_prep_hold: 1; /*spi is hold at prepare state the bit combined with spi_usr_hold_pol bit.*/ - volatile uint32_t usr_miso_highpart: 1; /*read-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ - volatile uint32_t usr_mosi_highpart: 1; /*write-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ - volatile uint32_t usr_dummy_idle: 1; /*spi clock is disable in dummy phase when the bit is enable.*/ - volatile uint32_t usr_mosi: 1; /*This bit enable the write-data phase of an operation.*/ - volatile uint32_t usr_miso: 1; /*This bit enable the read-data phase of an operation.*/ - volatile uint32_t usr_dummy: 1; /*This bit enable the dummy phase of an operation.*/ - volatile uint32_t usr_addr: 1; /*This bit enable the address phase of an operation.*/ - volatile uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ + uint32_t doutdin: 1; /*Set the bit to enable full duplex communication. 1: enable 0: disable.*/ + uint32_t reserved1: 3; /*reserved*/ + uint32_t cs_hold: 1; /*spi cs keep low when spi is in ,done, phase. 1: enable 0: disable.*/ + uint32_t cs_setup: 1; /*spi cs is enable when spi is in ,prepare, phase. 1: enable 0: disable.*/ + uint32_t ck_i_edge: 1; /*In the slave mode the bit is same as spi_ck_out_edge in master mode. It is combined with spi_miso_delay_mode bits.*/ + uint32_t ck_out_edge: 1; /*the bit combined with spi_mosi_delay_mode bits to set mosi signal delay mode.*/ + uint32_t reserved8: 2; /*reserved*/ + uint32_t rd_byte_order: 1; /*In read-data (MISO) phase 1: big-endian 0: little_endian*/ + uint32_t wr_byte_order: 1; /*In command address write-data (MOSI) phases 1: big-endian 0: litte_endian*/ + uint32_t fwrite_dual: 1; /*In the write operations read-data phase apply 2 signals*/ + uint32_t fwrite_quad: 1; /*In the write operations read-data phase apply 4 signals*/ + uint32_t fwrite_dio: 1; /*In the write operations address phase and read-data phase apply 2 signals.*/ + uint32_t fwrite_qio: 1; /*In the write operations address phase and read-data phase apply 4 signals.*/ + uint32_t sio: 1; /*Set the bit to enable 3-line half duplex communication mosi and miso signals share the same pin. 1: enable 0: disable.*/ + uint32_t usr_hold_pol: 1; /*It is combined with hold bits to set the polarity of spi hold line 1: spi will be held when spi hold line is high 0: spi will be held when spi hold line is low*/ + uint32_t usr_dout_hold: 1; /*spi is hold at data out state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_din_hold: 1; /*spi is hold at data in state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_dummy_hold: 1; /*spi is hold at dummy state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_addr_hold: 1; /*spi is hold at address state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_cmd_hold: 1; /*spi is hold at command state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_prep_hold: 1; /*spi is hold at prepare state the bit combined with spi_usr_hold_pol bit.*/ + uint32_t usr_miso_highpart: 1; /*read-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + uint32_t usr_mosi_highpart: 1; /*write-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + uint32_t usr_dummy_idle: 1; /*spi clock is disable in dummy phase when the bit is enable.*/ + uint32_t usr_mosi: 1; /*This bit enable the write-data phase of an operation.*/ + uint32_t usr_miso: 1; /*This bit enable the read-data phase of an operation.*/ + uint32_t usr_dummy: 1; /*This bit enable the dummy phase of an operation.*/ + uint32_t usr_addr: 1; /*This bit enable the address phase of an operation.*/ + uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ }; - volatile uint32_t val; + uint32_t val; }user; union { struct { - volatile uint32_t usr_dummy_cyclelen: 8; /*The length in spi_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ - volatile uint32_t reserved8: 18; /*reserved*/ - volatile uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ + uint32_t usr_dummy_cyclelen: 8; /*The length in spi_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ + uint32_t reserved8: 18; /*reserved*/ + uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ }; - volatile uint32_t val; + uint32_t val; }user1; union { struct { - volatile uint32_t usr_command_value: 16; /*The value of command.*/ - volatile uint32_t reserved16: 12; /*reserved*/ - volatile uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ + uint32_t usr_command_value: 16; /*The value of command.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ }; - volatile uint32_t val; + uint32_t val; }user2; union { struct { - volatile uint32_t usr_mosi_dbitlen:24; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ - volatile uint32_t reserved24: 8; /*reserved*/ + uint32_t usr_mosi_dbitlen:24; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }mosi_dlen; union { struct { - volatile uint32_t usr_miso_dbitlen:24; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ - volatile uint32_t reserved24: 8; /*reserved*/ + uint32_t usr_miso_dbitlen:24; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }miso_dlen; - volatile uint32_t slv_wr_status; /*In the slave mode this register are the status register for the master to write into. In the master mode this register are the higher 32bits in the 64 bits address condition.*/ + uint32_t slv_wr_status; /*In the slave mode this register are the status register for the master to write into. In the master mode this register are the higher 32bits in the 64 bits address condition.*/ union { struct { - volatile uint32_t cs0_dis: 1; /*SPI CS0 pin enable, 1: disable CS0, 0: spi_cs0 signal is from/to CS0 pin*/ - volatile uint32_t cs1_dis: 1; /*SPI CS1 pin enable, 1: disable CS1, 0: spi_cs1 signal is from/to CS1 pin*/ - volatile uint32_t cs2_dis: 1; /*SPI CS2 pin enable, 1: disable CS2, 0: spi_cs2 signal is from/to CS2 pin*/ - volatile uint32_t reserved3: 2; /*reserved*/ - volatile uint32_t ck_dis: 1; /*1: spi clk out disable 0: spi clk out enable*/ - volatile uint32_t master_cs_pol: 5; /*In the master mode the bits are the polarity of spi cs line the value is equivalent to spi_cs ^ spi_master_cs_pol.*/ - volatile uint32_t master_ck_sel: 5; /*In the master mode spi cs line is enable as spi clk it is combined with spi_cs0_dis spi_cs1_dis spi_cs2_dis.*/ - volatile uint32_t reserved16: 13; /*reserved*/ - volatile uint32_t ck_idle_edge: 1; /*1: spi clk line is high when idle 0: spi clk line is low when idle*/ - volatile uint32_t cs_keep_active: 1; /*spi cs line keep low when the bit is set.*/ - volatile uint32_t reserved31: 1; /*reserved*/ + uint32_t cs0_dis: 1; /*SPI CS0 pin enable, 1: disable CS0, 0: spi_cs0 signal is from/to CS0 pin*/ + uint32_t cs1_dis: 1; /*SPI CS1 pin enable, 1: disable CS1, 0: spi_cs1 signal is from/to CS1 pin*/ + uint32_t cs2_dis: 1; /*SPI CS2 pin enable, 1: disable CS2, 0: spi_cs2 signal is from/to CS2 pin*/ + uint32_t reserved3: 2; /*reserved*/ + uint32_t ck_dis: 1; /*1: spi clk out disable 0: spi clk out enable*/ + uint32_t master_cs_pol: 5; /*In the master mode the bits are the polarity of spi cs line the value is equivalent to spi_cs ^ spi_master_cs_pol.*/ + uint32_t master_ck_sel: 5; /*In the master mode spi cs line is enable as spi clk it is combined with spi_cs0_dis spi_cs1_dis spi_cs2_dis.*/ + uint32_t reserved16: 13; /*reserved*/ + uint32_t ck_idle_edge: 1; /*1: spi clk line is high when idle 0: spi clk line is low when idle*/ + uint32_t cs_keep_active: 1; /*spi cs line keep low when the bit is set.*/ + uint32_t reserved31: 1; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }pin; union { struct { - volatile uint32_t slv_rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ - volatile uint32_t slv_wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ - volatile uint32_t slv_rd_sta_done: 1; /*The interrupt raw bit for the completion of read-status operation in the slave mode.*/ - volatile uint32_t slv_wr_sta_done: 1; /*The interrupt raw bit for the completion of write-status operation in the slave mode.*/ - volatile uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ - volatile uint32_t int_en: 5; /*Interrupt enable bits for the below 5 sources*/ - volatile uint32_t cs_i_mode: 2; /*In the slave mode this bits used to synchronize the input spi cs signal and eliminate spi cs jitter.*/ - volatile uint32_t reserved12: 5; /*reserved*/ - volatile uint32_t slv_last_command: 3; /*In the slave mode it is the value of command.*/ - volatile uint32_t slv_last_state: 3; /*In the slave mode it is the state of spi state machine.*/ - volatile uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode. 4: read-status*/ - volatile uint32_t slv_cmd_define: 1; /*1: slave mode commands are defined in SPI_SLAVE3. 0: slave mode commands are fixed as: 1: write-status 2: write-buffer and 3: read-buffer.*/ - volatile uint32_t slv_wr_rd_sta_en: 1; /*write and read status enable in the slave mode*/ - volatile uint32_t slv_wr_rd_buf_en: 1; /*write and read buffer enable in the slave mode*/ - volatile uint32_t slave_mode: 1; /*1: slave mode 0: master mode.*/ - volatile uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ + uint32_t slv_rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ + uint32_t slv_wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ + uint32_t slv_rd_sta_done: 1; /*The interrupt raw bit for the completion of read-status operation in the slave mode.*/ + uint32_t slv_wr_sta_done: 1; /*The interrupt raw bit for the completion of write-status operation in the slave mode.*/ + uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ + uint32_t int_en: 5; /*Interrupt enable bits for the below 5 sources*/ + uint32_t cs_i_mode: 2; /*In the slave mode this bits used to synchronize the input spi cs signal and eliminate spi cs jitter.*/ + uint32_t reserved12: 5; /*reserved*/ + uint32_t slv_last_command: 3; /*In the slave mode it is the value of command.*/ + uint32_t slv_last_state: 3; /*In the slave mode it is the state of spi state machine.*/ + uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode. 4: read-status*/ + uint32_t slv_cmd_define: 1; /*1: slave mode commands are defined in SPI_SLAVE3. 0: slave mode commands are fixed as: 1: write-status 2: write-buffer and 3: read-buffer.*/ + uint32_t slv_wr_rd_sta_en: 1; /*write and read status enable in the slave mode*/ + uint32_t slv_wr_rd_buf_en: 1; /*write and read buffer enable in the slave mode*/ + uint32_t slave_mode: 1; /*1: slave mode 0: master mode.*/ + uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ }; - volatile uint32_t val; + uint32_t val; }slave; union { struct { - volatile uint32_t slv_rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ - volatile uint32_t slv_wrbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-buffer operations.*/ - volatile uint32_t slv_rdsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-status operations.*/ - volatile uint32_t slv_wrsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-status operations.*/ - volatile uint32_t slv_wr_addr_bitlen: 6; /*In the slave mode it is the address length in bits for write-buffer operation. The register value shall be (bit_num-1).*/ - volatile uint32_t slv_rd_addr_bitlen: 6; /*In the slave mode it is the address length in bits for read-buffer operation. The register value shall be (bit_num-1).*/ - volatile uint32_t reserved16: 9; /*reserved*/ - volatile uint32_t slv_status_readback: 1; /*In the slave mode 1:read register of SPI_SLV_WR_STATUS 0: read register of SPI_RD_STATUS.*/ - volatile uint32_t slv_status_fast_en: 1; /*In the slave mode enable fast read status.*/ - volatile uint32_t slv_status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ + uint32_t slv_rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ + uint32_t slv_wrbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-buffer operations.*/ + uint32_t slv_rdsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-status operations.*/ + uint32_t slv_wrsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-status operations.*/ + uint32_t slv_wr_addr_bitlen: 6; /*In the slave mode it is the address length in bits for write-buffer operation. The register value shall be (bit_num-1).*/ + uint32_t slv_rd_addr_bitlen: 6; /*In the slave mode it is the address length in bits for read-buffer operation. The register value shall be (bit_num-1).*/ + uint32_t reserved16: 9; /*reserved*/ + uint32_t slv_status_readback: 1; /*In the slave mode 1:read register of SPI_SLV_WR_STATUS 0: read register of SPI_RD_STATUS.*/ + uint32_t slv_status_fast_en: 1; /*In the slave mode enable fast read status.*/ + uint32_t slv_status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ }; - volatile uint32_t val; + uint32_t val; }slave1; union { struct { - volatile uint32_t slv_rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ - volatile uint32_t slv_wrsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-status operations. The register value shall be (cycle_num-1).*/ - volatile uint32_t slv_rdbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-buffer operations. The register value shall be (cycle_num-1).*/ - volatile uint32_t slv_wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ + uint32_t slv_rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ + uint32_t slv_wrsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-status operations. The register value shall be (cycle_num-1).*/ + uint32_t slv_rdbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-buffer operations. The register value shall be (cycle_num-1).*/ + uint32_t slv_wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ }; - volatile uint32_t val; + uint32_t val; }slave2; union { struct { - volatile uint32_t slv_rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ - volatile uint32_t slv_wrbuf_cmd_value: 8; /*In the slave mode it is the value of write-buffer command.*/ - volatile uint32_t slv_rdsta_cmd_value: 8; /*In the slave mode it is the value of read-status command.*/ - volatile uint32_t slv_wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ + uint32_t slv_rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ + uint32_t slv_wrbuf_cmd_value: 8; /*In the slave mode it is the value of write-buffer command.*/ + uint32_t slv_rdsta_cmd_value: 8; /*In the slave mode it is the value of read-status command.*/ + uint32_t slv_wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ }; - volatile uint32_t val; + uint32_t val; }slave3; union { struct { - volatile uint32_t slv_wrbuf_dbitlen:24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ - volatile uint32_t reserved24: 8; /*reserved*/ + uint32_t slv_wrbuf_dbitlen:24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }slv_wrbuf_dlen; union { struct { - volatile uint32_t slv_rdbuf_dbitlen:24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ - volatile uint32_t reserved24: 8; /*reserved*/ + uint32_t slv_rdbuf_dbitlen:24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }slv_rdbuf_dlen; union { struct { - volatile uint32_t cache_req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ - volatile uint32_t cache_usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ - volatile uint32_t cache_flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ - volatile uint32_t cache_flash_pes_en: 1; /*For SPI0 spi1 send suspend command before cache read flash 1: enable 0:disable.*/ - volatile uint32_t reserved4: 28; /*reserved*/ + uint32_t cache_req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ + uint32_t cache_usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ + uint32_t cache_flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ + uint32_t cache_flash_pes_en: 1; /*For SPI0 spi1 send suspend command before cache read flash 1: enable 0:disable.*/ + uint32_t reserved4: 28; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }cache_fctrl; union { struct { - volatile uint32_t reserved0: 1; /*reserved*/ - volatile uint32_t usr_sram_dio: 1; /*For SPI0 In the spi sram mode spi dual I/O mode enable 1: enable 0:disable*/ - volatile uint32_t usr_sram_qio: 1; /*For SPI0 In the spi sram mode spi quad I/O mode enable 1: enable 0:disable*/ - volatile uint32_t usr_wr_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for write operations.*/ - volatile uint32_t usr_rd_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for read operations.*/ - volatile uint32_t cache_sram_usr_rcmd: 1; /*For SPI0 In the spi sram mode cache read sram for user define command.*/ - volatile uint32_t sram_bytes_len: 8; /*For SPI0 In the sram mode it is the byte length of spi read sram data.*/ - volatile uint32_t sram_dummy_cyclelen: 8; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ - volatile uint32_t sram_addr_bitlen: 6; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ - volatile uint32_t cache_sram_usr_wcmd: 1; /*For SPI0 In the spi sram mode cache write sram for user define command*/ - volatile uint32_t reserved29: 3; /*reserved*/ + uint32_t reserved0: 1; /*reserved*/ + uint32_t usr_sram_dio: 1; /*For SPI0 In the spi sram mode spi dual I/O mode enable 1: enable 0:disable*/ + uint32_t usr_sram_qio: 1; /*For SPI0 In the spi sram mode spi quad I/O mode enable 1: enable 0:disable*/ + uint32_t usr_wr_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for write operations.*/ + uint32_t usr_rd_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for read operations.*/ + uint32_t cache_sram_usr_rcmd: 1; /*For SPI0 In the spi sram mode cache read sram for user define command.*/ + uint32_t sram_bytes_len: 8; /*For SPI0 In the sram mode it is the byte length of spi read sram data.*/ + uint32_t sram_dummy_cyclelen: 8; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ + uint32_t sram_addr_bitlen: 6; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ + uint32_t cache_sram_usr_wcmd: 1; /*For SPI0 In the spi sram mode cache write sram for user define command*/ + uint32_t reserved29: 3; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }cache_sctrl; union { struct { - volatile uint32_t sram_dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ - volatile uint32_t sram_qio: 1; /*For SPI0 SRAM QIO mode enable . SRAM QIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ - volatile uint32_t reserved2: 2; /*For SPI0 SRAM write enable . SRAM write operation will be triggered when the bit is set. The bit will be cleared once the operation done.*/ - volatile uint32_t sram_rstio: 1; /*For SPI0 SRAM IO mode reset enable. SRAM IO mode reset operation will be triggered when the bit is set. The bit will be cleared once the operation done*/ - volatile uint32_t reserved5: 27; /*reserved*/ + uint32_t sram_dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t sram_qio: 1; /*For SPI0 SRAM QIO mode enable . SRAM QIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t reserved2: 2; /*For SPI0 SRAM write enable . SRAM write operation will be triggered when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t sram_rstio: 1; /*For SPI0 SRAM IO mode reset enable. SRAM IO mode reset operation will be triggered when the bit is set. The bit will be cleared once the operation done*/ + uint32_t reserved5: 27; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }sram_cmd; union { struct { - volatile uint32_t cache_sram_usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ - volatile uint32_t reserved16: 12; /*reserved*/ - volatile uint32_t cache_sram_usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + uint32_t cache_sram_usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t cache_sram_usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; - volatile uint32_t val; + uint32_t val; }sram_drd_cmd; union { struct { - volatile uint32_t cache_sram_usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ - volatile uint32_t reserved16: 12; /*reserved*/ - volatile uint32_t cache_sram_usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + uint32_t cache_sram_usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t cache_sram_usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; - volatile uint32_t val; + uint32_t val; }sram_dwr_cmd; union { struct { - volatile uint32_t slv_rdata_bit:24; /*In the slave mode it is the bit length of read data. The value is the length - 1.*/ - volatile uint32_t reserved24: 8; /*reserved*/ + uint32_t slv_rdata_bit:24; /*In the slave mode it is the bit length of read data. The value is the length - 1.*/ + uint32_t reserved24: 8; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }slv_rd_bit; - volatile uint32_t reserved_68; - volatile uint32_t reserved_6c; - volatile uint32_t reserved_70; - volatile uint32_t reserved_74; - volatile uint32_t reserved_78; - volatile uint32_t reserved_7c; - volatile uint32_t data_buf[16]; /*data buffer*/ - volatile uint32_t tx_crc; /*For SPI1 the value of crc32 for 256 bits data.*/ - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; + uint32_t reserved_68; + uint32_t reserved_6c; + uint32_t reserved_70; + uint32_t reserved_74; + uint32_t reserved_78; + uint32_t reserved_7c; + uint32_t data_buf[16]; /*data buffer*/ + uint32_t tx_crc; /*For SPI1 the value of crc32 for 256 bits data.*/ + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; union { struct { - volatile uint32_t t_pp_time: 12; /*page program delay time by system clock.*/ - volatile uint32_t reserved12: 4; /*reserved*/ - volatile uint32_t t_pp_shift: 4; /*page program delay time shift .*/ - volatile uint32_t reserved20:11; /*reserved*/ - volatile uint32_t t_pp_ena: 1; /*page program delay enable.*/ + uint32_t t_pp_time: 12; /*page program delay time by system clock.*/ + uint32_t reserved12: 4; /*reserved*/ + uint32_t t_pp_shift: 4; /*page program delay time shift .*/ + uint32_t reserved20:11; /*reserved*/ + uint32_t t_pp_ena: 1; /*page program delay enable.*/ }; - volatile uint32_t val; + uint32_t val; }ext0; union { struct { - volatile uint32_t t_erase_time: 12; /*erase flash delay time by system clock.*/ - volatile uint32_t reserved12: 4; /*reserved*/ - volatile uint32_t t_erase_shift: 4; /*erase flash delay time shift.*/ - volatile uint32_t reserved20: 11; /*reserved*/ - volatile uint32_t t_erase_ena: 1; /*erase flash delay enable.*/ + uint32_t t_erase_time: 12; /*erase flash delay time by system clock.*/ + uint32_t reserved12: 4; /*reserved*/ + uint32_t t_erase_shift: 4; /*erase flash delay time shift.*/ + uint32_t reserved20: 11; /*reserved*/ + uint32_t t_erase_ena: 1; /*erase flash delay enable.*/ }; - volatile uint32_t val; + uint32_t val; }ext1; union { struct { - volatile uint32_t st: 3; /*The status of spi state machine .*/ - volatile uint32_t reserved3: 29; /*reserved*/ + uint32_t st: 3; /*The status of spi state machine .*/ + uint32_t reserved3: 29; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }ext2; union { struct { - volatile uint32_t int_hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at ,idle, phase 2: hold at ,prepare, phase.*/ - volatile uint32_t reserved2: 30; /*reserved*/ + uint32_t int_hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at ,idle, phase 2: hold at ,prepare, phase.*/ + uint32_t reserved2: 30; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }ext3; union { struct { - volatile uint32_t reserved0: 2; /*reserved*/ - volatile uint32_t in_rst: 1; /*The bit is used to reset in dma fsm and in data fifo pointer.*/ - volatile uint32_t out_rst: 1; /*The bit is used to reset out dma fsm and out data fifo pointer.*/ - volatile uint32_t ahbm_fifo_rst: 1; /*reset spi dma ahb master fifo pointer.*/ - volatile uint32_t ahbm_rst: 1; /*reset spi dma ahb master.*/ - volatile uint32_t in_loop_test: 1; /*Set bit to test in link.*/ - volatile uint32_t out_loop_test: 1; /*Set bit to test out link.*/ - volatile uint32_t out_auto_wrback: 1; /*when the link is empty jump to next automatically.*/ - volatile uint32_t out_eof_mode: 1; /*out eof flag generation mode . 1: when dma pop all data from fifo 0:when ahb push all data to fifo.*/ - volatile uint32_t outdscr_burst_en: 1; /*read descriptor use burst mode when read data for memory.*/ - volatile uint32_t indscr_burst_en: 1; /*read descriptor use burst mode when write data to memory.*/ - volatile uint32_t out_data_burst_en: 1; /*spi dma read data from memory in burst mode.*/ - volatile uint32_t reserved13: 1; /*reserved*/ - volatile uint32_t dma_rx_stop: 1; /*spi dma read data stop when in continue tx/rx mode.*/ - volatile uint32_t dma_tx_stop: 1; /*spi dma write data stop when in continue tx/rx mode.*/ - volatile uint32_t dma_continue: 1; /*spi dma continue tx/rx data.*/ - volatile uint32_t reserved17: 15; /*reserved*/ + uint32_t reserved0: 2; /*reserved*/ + uint32_t in_rst: 1; /*The bit is used to reset in dma fsm and in data fifo pointer.*/ + uint32_t out_rst: 1; /*The bit is used to reset out dma fsm and out data fifo pointer.*/ + uint32_t ahbm_fifo_rst: 1; /*reset spi dma ahb master fifo pointer.*/ + uint32_t ahbm_rst: 1; /*reset spi dma ahb master.*/ + uint32_t in_loop_test: 1; /*Set bit to test in link.*/ + uint32_t out_loop_test: 1; /*Set bit to test out link.*/ + uint32_t out_auto_wrback: 1; /*when the link is empty jump to next automatically.*/ + uint32_t out_eof_mode: 1; /*out eof flag generation mode . 1: when dma pop all data from fifo 0:when ahb push all data to fifo.*/ + uint32_t outdscr_burst_en: 1; /*read descriptor use burst mode when read data for memory.*/ + uint32_t indscr_burst_en: 1; /*read descriptor use burst mode when write data to memory.*/ + uint32_t out_data_burst_en: 1; /*spi dma read data from memory in burst mode.*/ + uint32_t reserved13: 1; /*reserved*/ + uint32_t dma_rx_stop: 1; /*spi dma read data stop when in continue tx/rx mode.*/ + uint32_t dma_tx_stop: 1; /*spi dma write data stop when in continue tx/rx mode.*/ + uint32_t dma_continue: 1; /*spi dma continue tx/rx data.*/ + uint32_t reserved17: 15; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_conf; union { struct { - volatile uint32_t outlink_addr: 20; /*The address of the first outlink descriptor.*/ - volatile uint32_t reserved20: 8; /*reserved*/ - volatile uint32_t outlink_stop: 1; /*Set the bit to stop to use outlink descriptor.*/ - volatile uint32_t outlink_start: 1; /*Set the bit to start to use outlink descriptor.*/ - volatile uint32_t outlink_restart: 1; /*Set the bit to mount on new outlink descriptors.*/ - volatile uint32_t reserved31: 1; /*reserved*/ + uint32_t outlink_addr: 20; /*The address of the first outlink descriptor.*/ + uint32_t reserved20: 8; /*reserved*/ + uint32_t outlink_stop: 1; /*Set the bit to stop to use outlink descriptor.*/ + uint32_t outlink_start: 1; /*Set the bit to start to use outlink descriptor.*/ + uint32_t outlink_restart: 1; /*Set the bit to mount on new outlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_out_link; union { struct { - volatile uint32_t inlink_addr: 20; /*The address of the first inlink descriptor.*/ - volatile uint32_t inlink_auto_ret: 1; /*when the bit is set inlink descriptor returns to the next descriptor while a packet is wrong*/ - volatile uint32_t reserved21: 7; /*reserved*/ - volatile uint32_t inlink_stop: 1; /*Set the bit to stop to use inlink descriptor.*/ - volatile uint32_t inlink_start: 1; /*Set the bit to start to use inlink descriptor.*/ - volatile uint32_t inlink_restart: 1; /*Set the bit to mount on new inlink descriptors.*/ - volatile uint32_t reserved31: 1; /*reserved*/ + uint32_t inlink_addr: 20; /*The address of the first inlink descriptor.*/ + uint32_t inlink_auto_ret: 1; /*when the bit is set inlink descriptor returns to the next descriptor while a packet is wrong*/ + uint32_t reserved21: 7; /*reserved*/ + uint32_t inlink_stop: 1; /*Set the bit to stop to use inlink descriptor.*/ + uint32_t inlink_start: 1; /*Set the bit to start to use inlink descriptor.*/ + uint32_t inlink_restart: 1; /*Set the bit to mount on new inlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_in_link; union { struct { - volatile uint32_t dma_rx_en: 1; /*spi dma read data status bit.*/ - volatile uint32_t dma_tx_en: 1; /*spi dma write data status bit.*/ - volatile uint32_t reserved2: 30; /*spi dma read data from memory count.*/ + uint32_t dma_rx_en: 1; /*spi dma read data status bit.*/ + uint32_t dma_tx_en: 1; /*spi dma write data status bit.*/ + uint32_t reserved2: 30; /*spi dma read data from memory count.*/ }; - volatile uint32_t val; + uint32_t val; }dma_status; union { struct { - volatile uint32_t inlink_dscr_empty_int_ena: 1; /*The enable bit for lack of enough inlink descriptors.*/ - volatile uint32_t outlink_dscr_error_int_ena: 1; /*The enable bit for outlink descriptor error.*/ - volatile uint32_t inlink_dscr_error_int_ena: 1; /*The enable bit for inlink descriptor error.*/ - volatile uint32_t in_done_int_ena: 1; /*The enable bit for completing usage of a inlink descriptor.*/ - volatile uint32_t in_err_eof_int_ena: 1; /*The enable bit for receiving error.*/ - volatile uint32_t in_suc_eof_int_ena: 1; /*The enable bit for completing receiving all the packets from host.*/ - volatile uint32_t out_done_int_ena: 1; /*The enable bit for completing usage of a outlink descriptor .*/ - volatile uint32_t out_eof_int_ena: 1; /*The enable bit for sending a packet to host done.*/ - volatile uint32_t out_total_eof_int_ena: 1; /*The enable bit for sending all the packets to host done.*/ - volatile uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty_int_ena: 1; /*The enable bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error_int_ena: 1; /*The enable bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error_int_ena: 1; /*The enable bit for inlink descriptor error.*/ + uint32_t in_done_int_ena: 1; /*The enable bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof_int_ena: 1; /*The enable bit for receiving error.*/ + uint32_t in_suc_eof_int_ena: 1; /*The enable bit for completing receiving all the packets from host.*/ + uint32_t out_done_int_ena: 1; /*The enable bit for completing usage of a outlink descriptor .*/ + uint32_t out_eof_int_ena: 1; /*The enable bit for sending a packet to host done.*/ + uint32_t out_total_eof_int_ena: 1; /*The enable bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_int_ena; union { struct { - volatile uint32_t inlink_dscr_empty_int_raw: 1; /*The raw bit for lack of enough inlink descriptors.*/ - volatile uint32_t outlink_dscr_error_int_raw: 1; /*The raw bit for outlink descriptor error.*/ - volatile uint32_t inlink_dscr_error_int_raw: 1; /*The raw bit for inlink descriptor error.*/ - volatile uint32_t in_done_int_raw: 1; /*The raw bit for completing usage of a inlink descriptor.*/ - volatile uint32_t in_err_eof_int_raw: 1; /*The raw bit for receiving error.*/ - volatile uint32_t in_suc_eof_int_raw: 1; /*The raw bit for completing receiving all the packets from host.*/ - volatile uint32_t out_done_int_raw: 1; /*The raw bit for completing usage of a outlink descriptor.*/ - volatile uint32_t out_eof_int_raw: 1; /*The raw bit for sending a packet to host done.*/ - volatile uint32_t out_total_eof_int_raw: 1; /*The raw bit for sending all the packets to host done.*/ - volatile uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty_int_raw: 1; /*The raw bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error_int_raw: 1; /*The raw bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error_int_raw: 1; /*The raw bit for inlink descriptor error.*/ + uint32_t in_done_int_raw: 1; /*The raw bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof_int_raw: 1; /*The raw bit for receiving error.*/ + uint32_t in_suc_eof_int_raw: 1; /*The raw bit for completing receiving all the packets from host.*/ + uint32_t out_done_int_raw: 1; /*The raw bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof_int_raw: 1; /*The raw bit for sending a packet to host done.*/ + uint32_t out_total_eof_int_raw: 1; /*The raw bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_int_raw; union { struct { - volatile uint32_t inlink_dscr_empty_int_st: 1; /*The status bit for lack of enough inlink descriptors.*/ - volatile uint32_t outlink_dscr_error_int_st: 1; /*The status bit for outlink descriptor error.*/ - volatile uint32_t inlink_dscr_error_int_st: 1; /*The status bit for inlink descriptor error.*/ - volatile uint32_t in_done_int_st: 1; /*The status bit for completing usage of a inlink descriptor.*/ - volatile uint32_t in_err_eof_int_st: 1; /*The status bit for receiving error.*/ - volatile uint32_t in_suc_eof_int_st: 1; /*The status bit for completing receiving all the packets from host.*/ - volatile uint32_t out_done_int_st: 1; /*The status bit for completing usage of a outlink descriptor.*/ - volatile uint32_t out_eof_int_st: 1; /*The status bit for sending a packet to host done.*/ - volatile uint32_t out_total_eof_int_st: 1; /*The status bit for sending all the packets to host done.*/ - volatile uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty_int_st: 1; /*The status bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error_int_st: 1; /*The status bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error_int_st: 1; /*The status bit for inlink descriptor error.*/ + uint32_t in_done_int_st: 1; /*The status bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof_int_st: 1; /*The status bit for receiving error.*/ + uint32_t in_suc_eof_int_st: 1; /*The status bit for completing receiving all the packets from host.*/ + uint32_t out_done_int_st: 1; /*The status bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof_int_st: 1; /*The status bit for sending a packet to host done.*/ + uint32_t out_total_eof_int_st: 1; /*The status bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_int_st; union { struct { - volatile uint32_t inlink_dscr_empty_int_clr: 1; /*The clear bit for lack of enough inlink descriptors.*/ - volatile uint32_t outlink_dscr_error_int_clr: 1; /*The clear bit for outlink descriptor error.*/ - volatile uint32_t inlink_dscr_error_int_clr: 1; /*The clear bit for inlink descriptor error.*/ - volatile uint32_t in_done_int_clr: 1; /*The clear bit for completing usage of a inlink descriptor.*/ - volatile uint32_t in_err_eof_int_clr: 1; /*The clear bit for receiving error.*/ - volatile uint32_t in_suc_eof_int_clr: 1; /*The clear bit for completing receiving all the packets from host.*/ - volatile uint32_t out_done_int_clr: 1; /*The clear bit for completing usage of a outlink descriptor.*/ - volatile uint32_t out_eof_int_clr: 1; /*The clear bit for sending a packet to host done.*/ - volatile uint32_t out_total_eof_int_clr: 1; /*The clear bit for sending all the packets to host done.*/ - volatile uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty_int_clr: 1; /*The clear bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error_int_clr: 1; /*The clear bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error_int_clr: 1; /*The clear bit for inlink descriptor error.*/ + uint32_t in_done_int_clr: 1; /*The clear bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof_int_clr: 1; /*The clear bit for receiving error.*/ + uint32_t in_suc_eof_int_clr: 1; /*The clear bit for completing receiving all the packets from host.*/ + uint32_t out_done_int_clr: 1; /*The clear bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof_int_clr: 1; /*The clear bit for sending a packet to host done.*/ + uint32_t out_total_eof_int_clr: 1; /*The clear bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }dma_int_clr; - volatile uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ - volatile uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ - volatile uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ - volatile uint32_t dma_inlink_dscr_bf0; /*The content of next in descriptor pointer.*/ - volatile uint32_t dma_inlink_dscr_bf1; /*The content of current in descriptor data buffer pointer.*/ - volatile uint32_t dma_out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produce eof.*/ - volatile uint32_t dma_out_eof_des_addr; /*The last outlink descriptor address when spi dma produce to_eof.*/ - volatile uint32_t dma_outlink_dscr; /*The content of current out descriptor pointer.*/ - volatile uint32_t dma_outlink_dscr_bf0; /*The content of next out descriptor pointer.*/ - volatile uint32_t dma_outlink_dscr_bf1; /*The content of current out descriptor data buffer pointer.*/ - volatile uint32_t dma_rx_status; /*spi dma read data from memory status.*/ - volatile uint32_t dma_tx_status; /*spi dma write data to memory status.*/ - volatile uint32_t reserved_150; - volatile uint32_t reserved_154; - volatile uint32_t reserved_158; - volatile uint32_t reserved_15c; - volatile uint32_t reserved_160; - volatile uint32_t reserved_164; - volatile uint32_t reserved_168; - volatile uint32_t reserved_16c; - volatile uint32_t reserved_170; - volatile uint32_t reserved_174; - volatile uint32_t reserved_178; - volatile uint32_t reserved_17c; - volatile uint32_t reserved_180; - volatile uint32_t reserved_184; - volatile uint32_t reserved_188; - volatile uint32_t reserved_18c; - volatile uint32_t reserved_190; - volatile uint32_t reserved_194; - volatile uint32_t reserved_198; - volatile uint32_t reserved_19c; - volatile uint32_t reserved_1a0; - volatile uint32_t reserved_1a4; - volatile uint32_t reserved_1a8; - volatile uint32_t reserved_1ac; - volatile uint32_t reserved_1b0; - volatile uint32_t reserved_1b4; - volatile uint32_t reserved_1b8; - volatile uint32_t reserved_1bc; - volatile uint32_t reserved_1c0; - volatile uint32_t reserved_1c4; - volatile uint32_t reserved_1c8; - volatile uint32_t reserved_1cc; - volatile uint32_t reserved_1d0; - volatile uint32_t reserved_1d4; - volatile uint32_t reserved_1d8; - volatile uint32_t reserved_1dc; - volatile uint32_t reserved_1e0; - volatile uint32_t reserved_1e4; - volatile uint32_t reserved_1e8; - volatile uint32_t reserved_1ec; - volatile uint32_t reserved_1f0; - volatile uint32_t reserved_1f4; - volatile uint32_t reserved_1f8; - volatile uint32_t reserved_1fc; - volatile uint32_t reserved_200; - volatile uint32_t reserved_204; - volatile uint32_t reserved_208; - volatile uint32_t reserved_20c; - volatile uint32_t reserved_210; - volatile uint32_t reserved_214; - volatile uint32_t reserved_218; - volatile uint32_t reserved_21c; - volatile uint32_t reserved_220; - volatile uint32_t reserved_224; - volatile uint32_t reserved_228; - volatile uint32_t reserved_22c; - volatile uint32_t reserved_230; - volatile uint32_t reserved_234; - volatile uint32_t reserved_238; - volatile uint32_t reserved_23c; - volatile uint32_t reserved_240; - volatile uint32_t reserved_244; - volatile uint32_t reserved_248; - volatile uint32_t reserved_24c; - volatile uint32_t reserved_250; - volatile uint32_t reserved_254; - volatile uint32_t reserved_258; - volatile uint32_t reserved_25c; - volatile uint32_t reserved_260; - volatile uint32_t reserved_264; - volatile uint32_t reserved_268; - volatile uint32_t reserved_26c; - volatile uint32_t reserved_270; - volatile uint32_t reserved_274; - volatile uint32_t reserved_278; - volatile uint32_t reserved_27c; - volatile uint32_t reserved_280; - volatile uint32_t reserved_284; - volatile uint32_t reserved_288; - volatile uint32_t reserved_28c; - volatile uint32_t reserved_290; - volatile uint32_t reserved_294; - volatile uint32_t reserved_298; - volatile uint32_t reserved_29c; - volatile uint32_t reserved_2a0; - volatile uint32_t reserved_2a4; - volatile uint32_t reserved_2a8; - volatile uint32_t reserved_2ac; - volatile uint32_t reserved_2b0; - volatile uint32_t reserved_2b4; - volatile uint32_t reserved_2b8; - volatile uint32_t reserved_2bc; - volatile uint32_t reserved_2c0; - volatile uint32_t reserved_2c4; - volatile uint32_t reserved_2c8; - volatile uint32_t reserved_2cc; - volatile uint32_t reserved_2d0; - volatile uint32_t reserved_2d4; - volatile uint32_t reserved_2d8; - volatile uint32_t reserved_2dc; - volatile uint32_t reserved_2e0; - volatile uint32_t reserved_2e4; - volatile uint32_t reserved_2e8; - volatile uint32_t reserved_2ec; - volatile uint32_t reserved_2f0; - volatile uint32_t reserved_2f4; - volatile uint32_t reserved_2f8; - volatile uint32_t reserved_2fc; - volatile uint32_t reserved_300; - volatile uint32_t reserved_304; - volatile uint32_t reserved_308; - volatile uint32_t reserved_30c; - volatile uint32_t reserved_310; - volatile uint32_t reserved_314; - volatile uint32_t reserved_318; - volatile uint32_t reserved_31c; - volatile uint32_t reserved_320; - volatile uint32_t reserved_324; - volatile uint32_t reserved_328; - volatile uint32_t reserved_32c; - volatile uint32_t reserved_330; - volatile uint32_t reserved_334; - volatile uint32_t reserved_338; - volatile uint32_t reserved_33c; - volatile uint32_t reserved_340; - volatile uint32_t reserved_344; - volatile uint32_t reserved_348; - volatile uint32_t reserved_34c; - volatile uint32_t reserved_350; - volatile uint32_t reserved_354; - volatile uint32_t reserved_358; - volatile uint32_t reserved_35c; - volatile uint32_t reserved_360; - volatile uint32_t reserved_364; - volatile uint32_t reserved_368; - volatile uint32_t reserved_36c; - volatile uint32_t reserved_370; - volatile uint32_t reserved_374; - volatile uint32_t reserved_378; - volatile uint32_t reserved_37c; - volatile uint32_t reserved_380; - volatile uint32_t reserved_384; - volatile uint32_t reserved_388; - volatile uint32_t reserved_38c; - volatile uint32_t reserved_390; - volatile uint32_t reserved_394; - volatile uint32_t reserved_398; - volatile uint32_t reserved_39c; - volatile uint32_t reserved_3a0; - volatile uint32_t reserved_3a4; - volatile uint32_t reserved_3a8; - volatile uint32_t reserved_3ac; - volatile uint32_t reserved_3b0; - volatile uint32_t reserved_3b4; - volatile uint32_t reserved_3b8; - volatile uint32_t reserved_3bc; - volatile uint32_t reserved_3c0; - volatile uint32_t reserved_3c4; - volatile uint32_t reserved_3c8; - volatile uint32_t reserved_3cc; - volatile uint32_t reserved_3d0; - volatile uint32_t reserved_3d4; - volatile uint32_t reserved_3d8; - volatile uint32_t reserved_3dc; - volatile uint32_t reserved_3e0; - volatile uint32_t reserved_3e4; - volatile uint32_t reserved_3e8; - volatile uint32_t reserved_3ec; - volatile uint32_t reserved_3f0; - volatile uint32_t reserved_3f4; - volatile uint32_t reserved_3f8; + uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ + uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ + uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf0; /*The content of next in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf1; /*The content of current in descriptor data buffer pointer.*/ + uint32_t dma_out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produce eof.*/ + uint32_t dma_out_eof_des_addr; /*The last outlink descriptor address when spi dma produce to_eof.*/ + uint32_t dma_outlink_dscr; /*The content of current out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf0; /*The content of next out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf1; /*The content of current out descriptor data buffer pointer.*/ + uint32_t dma_rx_status; /*spi dma read data from memory status.*/ + uint32_t dma_tx_status; /*spi dma write data to memory status.*/ + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t reserved_1fc; + uint32_t reserved_200; + uint32_t reserved_204; + uint32_t reserved_208; + uint32_t reserved_20c; + uint32_t reserved_210; + uint32_t reserved_214; + uint32_t reserved_218; + uint32_t reserved_21c; + uint32_t reserved_220; + uint32_t reserved_224; + uint32_t reserved_228; + uint32_t reserved_22c; + uint32_t reserved_230; + uint32_t reserved_234; + uint32_t reserved_238; + uint32_t reserved_23c; + uint32_t reserved_240; + uint32_t reserved_244; + uint32_t reserved_248; + uint32_t reserved_24c; + uint32_t reserved_250; + uint32_t reserved_254; + uint32_t reserved_258; + uint32_t reserved_25c; + uint32_t reserved_260; + uint32_t reserved_264; + uint32_t reserved_268; + uint32_t reserved_26c; + uint32_t reserved_270; + uint32_t reserved_274; + uint32_t reserved_278; + uint32_t reserved_27c; + uint32_t reserved_280; + uint32_t reserved_284; + uint32_t reserved_288; + uint32_t reserved_28c; + uint32_t reserved_290; + uint32_t reserved_294; + uint32_t reserved_298; + uint32_t reserved_29c; + uint32_t reserved_2a0; + uint32_t reserved_2a4; + uint32_t reserved_2a8; + uint32_t reserved_2ac; + uint32_t reserved_2b0; + uint32_t reserved_2b4; + uint32_t reserved_2b8; + uint32_t reserved_2bc; + uint32_t reserved_2c0; + uint32_t reserved_2c4; + uint32_t reserved_2c8; + uint32_t reserved_2cc; + uint32_t reserved_2d0; + uint32_t reserved_2d4; + uint32_t reserved_2d8; + uint32_t reserved_2dc; + uint32_t reserved_2e0; + uint32_t reserved_2e4; + uint32_t reserved_2e8; + uint32_t reserved_2ec; + uint32_t reserved_2f0; + uint32_t reserved_2f4; + uint32_t reserved_2f8; + uint32_t reserved_2fc; + uint32_t reserved_300; + uint32_t reserved_304; + uint32_t reserved_308; + uint32_t reserved_30c; + uint32_t reserved_310; + uint32_t reserved_314; + uint32_t reserved_318; + uint32_t reserved_31c; + uint32_t reserved_320; + uint32_t reserved_324; + uint32_t reserved_328; + uint32_t reserved_32c; + uint32_t reserved_330; + uint32_t reserved_334; + uint32_t reserved_338; + uint32_t reserved_33c; + uint32_t reserved_340; + uint32_t reserved_344; + uint32_t reserved_348; + uint32_t reserved_34c; + uint32_t reserved_350; + uint32_t reserved_354; + uint32_t reserved_358; + uint32_t reserved_35c; + uint32_t reserved_360; + uint32_t reserved_364; + uint32_t reserved_368; + uint32_t reserved_36c; + uint32_t reserved_370; + uint32_t reserved_374; + uint32_t reserved_378; + uint32_t reserved_37c; + uint32_t reserved_380; + uint32_t reserved_384; + uint32_t reserved_388; + uint32_t reserved_38c; + uint32_t reserved_390; + uint32_t reserved_394; + uint32_t reserved_398; + uint32_t reserved_39c; + uint32_t reserved_3a0; + uint32_t reserved_3a4; + uint32_t reserved_3a8; + uint32_t reserved_3ac; + uint32_t reserved_3b0; + uint32_t reserved_3b4; + uint32_t reserved_3b8; + uint32_t reserved_3bc; + uint32_t reserved_3c0; + uint32_t reserved_3c4; + uint32_t reserved_3c8; + uint32_t reserved_3cc; + uint32_t reserved_3d0; + uint32_t reserved_3d4; + uint32_t reserved_3d8; + uint32_t reserved_3dc; + uint32_t reserved_3e0; + uint32_t reserved_3e4; + uint32_t reserved_3e8; + uint32_t reserved_3ec; + uint32_t reserved_3f0; + uint32_t reserved_3f4; + uint32_t reserved_3f8; union { struct { - volatile uint32_t date: 28; /*SPI register version.*/ - volatile uint32_t reserved28: 4; /*reserved*/ + uint32_t date: 28; /*SPI register version.*/ + uint32_t reserved28: 4; /*reserved*/ }; - volatile uint32_t val; + uint32_t val; }date; } spi_dev_t; -extern volatile spi_dev_t SPI0; /* SPI0 IS FOR INTERNAL USE*/ -extern volatile spi_dev_t SPI1; -extern volatile spi_dev_t SPI2; -extern volatile spi_dev_t SPI3; +extern spi_dev_t SPI0; /* SPI0 IS FOR INTERNAL USE*/ +extern spi_dev_t SPI1; +extern spi_dev_t SPI2; +extern spi_dev_t SPI3; #endif /* _SOC_SPI_STRUCT_H_ */ diff --git a/components/esp32/include/soc/timer_group_struct.h b/components/esp32/include/soc/timer_group_struct.h index b385f04f77..2160dfeea1 100644 --- a/components/esp32/include/soc/timer_group_struct.h +++ b/components/esp32/include/soc/timer_group_struct.h @@ -13,183 +13,183 @@ // limitations under the License. #ifndef _SOC_TIMG_STRUCT_H_ #define _SOC_TIMG_STRUCT_H_ -typedef struct { +typedef volatile struct { struct{ union { struct { - volatile uint32_t reserved0: 10; - volatile uint32_t alarm_en: 1; /*When set alarm is enabled*/ - volatile uint32_t level_int_en: 1; /*When set level type interrupt will be generated during alarm*/ - volatile uint32_t edge_int_en: 1; /*When set edge type interrupt will be generated during alarm*/ - volatile uint32_t divider: 16; /*Timer clock (T0/1_clk) pre-scale value.*/ - volatile uint32_t autoreload: 1; /*When set timer 0/1 auto-reload at alarming is enabled*/ - volatile uint32_t increase: 1; /*When set timer 0/1 time-base counter increment. When cleared timer 0 time-base counter decrement.*/ - volatile uint32_t enable: 1; /*When set timer 0/1 time-base counter is enabled*/ + uint32_t reserved0: 10; + uint32_t alarm_en: 1; /*When set alarm is enabled*/ + uint32_t level_int_en: 1; /*When set level type interrupt will be generated during alarm*/ + uint32_t edge_int_en: 1; /*When set edge type interrupt will be generated during alarm*/ + uint32_t divider: 16; /*Timer clock (T0/1_clk) pre-scale value.*/ + uint32_t autoreload: 1; /*When set timer 0/1 auto-reload at alarming is enabled*/ + uint32_t increase: 1; /*When set timer 0/1 time-base counter increment. When cleared timer 0 time-base counter decrement.*/ + uint32_t enable: 1; /*When set timer 0/1 time-base counter is enabled*/ }; - volatile uint32_t val; + uint32_t val; }config; - volatile uint32_t timer_cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ - volatile uint32_t timer_cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ - volatile uint32_t timer_update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ - volatile uint32_t timer_alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/ - volatile uint32_t timer_alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/ - volatile uint32_t timer_load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ - volatile uint32_t timer_load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ - volatile uint32_t timer_reload; /*Write any value will trigger timer 0 time-base counter reload*/ + uint32_t timer_cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ + uint32_t timer_cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ + uint32_t timer_update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ + uint32_t timer_alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/ + uint32_t timer_alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/ + uint32_t timer_load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ + uint32_t timer_load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ + uint32_t timer_reload; /*Write any value will trigger timer 0 time-base counter reload*/ }hw_timer[2]; union { struct { - volatile uint32_t reserved0: 14; - volatile uint32_t wdt_flashboot_mod_en: 1; /*When set flash boot protection is enabled*/ - volatile uint32_t wdt_sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ - volatile uint32_t wdt_cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ - volatile uint32_t wdt_level_int_en: 1; /*When set level type interrupt generation is enabled*/ - volatile uint32_t wdt_edge_int_en: 1; /*When set edge type interrupt generation is enabled*/ - volatile uint32_t wdt_stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - volatile uint32_t wdt_stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - volatile uint32_t wdt_stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - volatile uint32_t wdt_stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - volatile uint32_t wdt_en: 1; /*When set SWDT is enabled*/ + uint32_t reserved0: 14; + uint32_t wdt_flashboot_mod_en: 1; /*When set flash boot protection is enabled*/ + uint32_t wdt_sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + uint32_t wdt_cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + uint32_t wdt_level_int_en: 1; /*When set level type interrupt generation is enabled*/ + uint32_t wdt_edge_int_en: 1; /*When set edge type interrupt generation is enabled*/ + uint32_t wdt_stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t wdt_stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t wdt_stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t wdt_stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t wdt_en: 1; /*When set SWDT is enabled*/ }; - volatile uint32_t val; + uint32_t val; }wdt_config0; union { struct { - volatile uint32_t reserved0: 16; - volatile uint32_t wdt_clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ + uint32_t reserved0: 16; + uint32_t wdt_clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ }; - volatile uint32_t val; + uint32_t val; }wdt_config1; - volatile uint32_t wdt_config2; /*Stage 0 timeout value in SWDT clock cycles*/ - volatile uint32_t wdt_config3; /*Stage 1 timeout value in SWDT clock cycles*/ - volatile uint32_t wdt_config4; /*Stage 2 timeout value in SWDT clock cycles*/ - volatile uint32_t wdt_config5; /*Stage 3 timeout value in SWDT clock cycles*/ - volatile uint32_t wdt_feed; /*Write any value will feed SWDT*/ - volatile uint32_t wdt_wprotect; /*If change its value from default then write protection is on.*/ + uint32_t wdt_config2; /*Stage 0 timeout value in SWDT clock cycles*/ + uint32_t wdt_config3; /*Stage 1 timeout value in SWDT clock cycles*/ + uint32_t wdt_config4; /*Stage 2 timeout value in SWDT clock cycles*/ + uint32_t wdt_config5; /*Stage 3 timeout value in SWDT clock cycles*/ + uint32_t wdt_feed; /*Write any value will feed SWDT*/ + uint32_t wdt_wprotect; /*If change its value from default then write protection is on.*/ union { struct { - volatile uint32_t reserved0: 12; - volatile uint32_t rtc_cali_start_cycling: 1; - volatile uint32_t rtc_cali_clk_sel: 2; - volatile uint32_t rtc_cali_rdy: 1; - volatile uint32_t rtc_cali_max: 15; - volatile uint32_t rtc_cali_start: 1; + uint32_t reserved0: 12; + uint32_t rtc_cali_start_cycling: 1; + uint32_t rtc_cali_clk_sel: 2; + uint32_t rtc_cali_rdy: 1; + uint32_t rtc_cali_max: 15; + uint32_t rtc_cali_start: 1; }; - volatile uint32_t val; + uint32_t val; }rtc_cali_cfg; union { struct { - volatile uint32_t reserved0: 7; - volatile uint32_t rtc_cali_value:25; + uint32_t reserved0: 7; + uint32_t rtc_cali_value:25; }; - volatile uint32_t val; + uint32_t val; }rtc_cali_cfg1; union { struct { - volatile uint32_t reserved0: 7; - volatile uint32_t lact_rtc_only: 1; - volatile uint32_t lact_cpst_en: 1; - volatile uint32_t lact_lac_en: 1; - volatile uint32_t lact_alarm_en: 1; - volatile uint32_t lact_level_int_en: 1; - volatile uint32_t lact_edge_int_en: 1; - volatile uint32_t lact_divider: 16; - volatile uint32_t lact_autoreload: 1; - volatile uint32_t lact_increase: 1; - volatile uint32_t lact_en: 1; + uint32_t reserved0: 7; + uint32_t lact_rtc_only: 1; + uint32_t lact_cpst_en: 1; + uint32_t lact_lac_en: 1; + uint32_t lact_alarm_en: 1; + uint32_t lact_level_int_en: 1; + uint32_t lact_edge_int_en: 1; + uint32_t lact_divider: 16; + uint32_t lact_autoreload: 1; + uint32_t lact_increase: 1; + uint32_t lact_en: 1; }; - volatile uint32_t val; + uint32_t val; }lactconfig; union { struct { - volatile uint32_t reserved0: 6; - volatile uint32_t lact_rtc_step_len:26; + uint32_t reserved0: 6; + uint32_t lact_rtc_step_len:26; }; - volatile uint32_t val; + uint32_t val; }lactrtc; - volatile uint32_t lactlo; /**/ - volatile uint32_t lacthi; /**/ - volatile uint32_t lactupdate; /**/ - volatile uint32_t lactalarmlo; /**/ - volatile uint32_t lactalarmhi; /**/ - volatile uint32_t lactloadlo; /**/ - volatile uint32_t lactloadhi; /**/ - volatile uint32_t lactload; /**/ + uint32_t lactlo; /**/ + uint32_t lacthi; /**/ + uint32_t lactupdate; /**/ + uint32_t lactalarmlo; /**/ + uint32_t lactalarmhi; /**/ + uint32_t lactloadlo; /**/ + uint32_t lactloadhi; /**/ + uint32_t lactload; /**/ union { struct { - volatile uint32_t t0_int_ena: 1; /*interrupt when timer0 alarm*/ - volatile uint32_t t1_int_ena: 1; /*interrupt when timer1 alarm*/ - volatile uint32_t wdt_int_ena: 1; /*Interrupt when an interrupt stage timeout*/ - volatile uint32_t lact_int_ena: 1; - volatile uint32_t reserved4: 28; + uint32_t t0_int_ena: 1; /*interrupt when timer0 alarm*/ + uint32_t t1_int_ena: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt_int_ena: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact_int_ena: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }int_ena_timers; union { struct { - volatile uint32_t t0_int_raw: 1; /*interrupt when timer0 alarm*/ - volatile uint32_t t1_int_raw: 1; /*interrupt when timer1 alarm*/ - volatile uint32_t wdt_int_raw: 1; /*Interrupt when an interrupt stage timeout*/ - volatile uint32_t lact_int_raw: 1; - volatile uint32_t reserved4: 28; + uint32_t t0_int_raw: 1; /*interrupt when timer0 alarm*/ + uint32_t t1_int_raw: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt_int_raw: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact_int_raw: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }int_raw_timers; union { struct { - volatile uint32_t t0_int_st: 1; /*interrupt when timer0 alarm*/ - volatile uint32_t t1_int_st: 1; /*interrupt when timer1 alarm*/ - volatile uint32_t wdt_int_st: 1; /*Interrupt when an interrupt stage timeout*/ - volatile uint32_t lact_int_st: 1; - volatile uint32_t reserved4: 28; + uint32_t t0_int_st: 1; /*interrupt when timer0 alarm*/ + uint32_t t1_int_st: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt_int_st: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact_int_st: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }int_st_timers; union { struct { - volatile uint32_t t0_int_clr: 1; /*interrupt when timer0 alarm*/ - volatile uint32_t t1_int_clr: 1; /*interrupt when timer1 alarm*/ - volatile uint32_t wdt_int_clr: 1; /*Interrupt when an interrupt stage timeout*/ - volatile uint32_t lact_int_clr: 1; - volatile uint32_t reserved4: 28; + uint32_t t0_int_clr: 1; /*interrupt when timer0 alarm*/ + uint32_t t1_int_clr: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt_int_clr: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact_int_clr: 1; + uint32_t reserved4: 28; }; - volatile uint32_t val; + uint32_t val; }int_clr_timers; - volatile uint32_t reserved_a8; - volatile uint32_t reserved_ac; - volatile uint32_t reserved_b0; - volatile uint32_t reserved_b4; - volatile uint32_t reserved_b8; - volatile uint32_t reserved_bc; - volatile uint32_t reserved_c0; - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; - volatile uint32_t reserved_f0; - volatile uint32_t reserved_f4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; union { struct { - volatile uint32_t date:28; /*Version of this regfile*/ - volatile uint32_t reserved28: 4; + uint32_t date:28; /*Version of this regfile*/ + uint32_t reserved28: 4; }; - volatile uint32_t val; + uint32_t val; }timg_date; union { struct { - volatile uint32_t reserved0: 31; - volatile uint32_t clk_en: 1; /*Force clock enable for this regfile*/ + uint32_t reserved0: 31; + uint32_t clk_en: 1; /*Force clock enable for this regfile*/ }; - volatile uint32_t val; + uint32_t val; }clk; } timg_dev_t; -extern volatile timg_dev_t TIMERG0; -extern volatile timg_dev_t TIMERG1; +extern timg_dev_t TIMERG0; +extern timg_dev_t TIMERG1; #endif /* _SOC_TIMG_STRUCT_H_ */ diff --git a/components/esp32/include/soc/uart_struct.h b/components/esp32/include/soc/uart_struct.h index cd756bec3d..9874a6af69 100644 --- a/components/esp32/include/soc/uart_struct.h +++ b/components/esp32/include/soc/uart_struct.h @@ -13,353 +13,353 @@ // limitations under the License. #ifndef _SOC_UART_STRUCT_H_ #define _SOC_UART_STRUCT_H_ -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t fifo_rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ - volatile uint32_t reserved8: 24; + uint32_t fifo_rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }fifo; union { struct { - volatile uint32_t rxfifo_full_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ - volatile uint32_t txfifo_empty_int_raw: 1; /*This interrupt raw bit turns to high level when the amount of data in transmitter's fifo is less than ((tx_mem_cnttxfifo_cnt) .*/ - volatile uint32_t parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the parity error of data.*/ - volatile uint32_t frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects data's frame error .*/ - volatile uint32_t rxfifo_ovf_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than the fifo can store.*/ - volatile uint32_t dsr_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of dsrn signal.*/ - volatile uint32_t cts_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of ctsn signal.*/ - volatile uint32_t brk_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the 0 after the stop bit.*/ - volatile uint32_t rxfifo_tout_int_raw: 1; /*This interrupt raw bit turns to high level when receiver takes more time than rx_tout_thrhd to receive a byte.*/ - volatile uint32_t sw_xon_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xoff char with uart_sw_flow_con_en is set to 1.*/ - volatile uint32_t sw_xoff_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xon char with uart_sw_flow_con_en is set to 1.*/ - volatile uint32_t glitch_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the start bit.*/ - volatile uint32_t tx_brk_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter completes sending 0 after all the data in transmitter's fifo are send.*/ - volatile uint32_t tx_brk_idle_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has kept the shortest duration after the last data has been send.*/ - volatile uint32_t tx_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has send all the data in fifo.*/ - volatile uint32_t rs485_parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the parity error.*/ - volatile uint32_t rs485_frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the data frame error.*/ - volatile uint32_t rs485_clash_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the clash between transmitter and receiver.*/ - volatile uint32_t at_cmd_char_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the configured at_cmd chars.*/ - volatile uint32_t reserved19: 13; + uint32_t rxfifo_full_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ + uint32_t txfifo_empty_int_raw: 1; /*This interrupt raw bit turns to high level when the amount of data in transmitter's fifo is less than ((tx_mem_cnttxfifo_cnt) .*/ + uint32_t parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the parity error of data.*/ + uint32_t frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects data's frame error .*/ + uint32_t rxfifo_ovf_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than the fifo can store.*/ + uint32_t dsr_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of dsrn signal.*/ + uint32_t cts_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of ctsn signal.*/ + uint32_t brk_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the 0 after the stop bit.*/ + uint32_t rxfifo_tout_int_raw: 1; /*This interrupt raw bit turns to high level when receiver takes more time than rx_tout_thrhd to receive a byte.*/ + uint32_t sw_xon_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xoff char with uart_sw_flow_con_en is set to 1.*/ + uint32_t sw_xoff_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xon char with uart_sw_flow_con_en is set to 1.*/ + uint32_t glitch_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the start bit.*/ + uint32_t tx_brk_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter completes sending 0 after all the data in transmitter's fifo are send.*/ + uint32_t tx_brk_idle_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has kept the shortest duration after the last data has been send.*/ + uint32_t tx_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has send all the data in fifo.*/ + uint32_t rs485_parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the parity error.*/ + uint32_t rs485_frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the data frame error.*/ + uint32_t rs485_clash_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the clash between transmitter and receiver.*/ + uint32_t at_cmd_char_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the configured at_cmd chars.*/ + uint32_t reserved19: 13; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t rxfifo_full_int_st: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ - volatile uint32_t txfifo_empty_int_st: 1; /*This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set to 1.*/ - volatile uint32_t parity_err_int_st: 1; /*This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.*/ - volatile uint32_t frm_err_int_st: 1; /*This is the status bit for frm_err_int_raw when fm_err_int_ena is set to 1.*/ - volatile uint32_t rxfifo_ovf_int_st: 1; /*This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.*/ - volatile uint32_t dsr_chg_int_st: 1; /*This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.*/ - volatile uint32_t cts_chg_int_st: 1; /*This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.*/ - volatile uint32_t brk_det_int_st: 1; /*This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.*/ - volatile uint32_t rxfifo_tout_int_st: 1; /*This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.*/ - volatile uint32_t sw_xon_int_st: 1; /*This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.*/ - volatile uint32_t sw_xoff_int_st: 1; /*This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.*/ - volatile uint32_t glitch_det_int_st: 1; /*This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.*/ - volatile uint32_t tx_brk_done_int_st: 1; /*This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.*/ - volatile uint32_t tx_brk_idle_done_int_st: 1; /*This is the status bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena is set to 1.*/ - volatile uint32_t tx_done_int_st: 1; /*This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.*/ - volatile uint32_t rs485_parity_err_int_st: 1; /*This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is set to 1.*/ - volatile uint32_t rs485_frm_err_int_st: 1; /*This is the status bit for rs485_fm_err_int_raw when rs485_fm_err_int_ena is set to 1.*/ - volatile uint32_t rs485_clash_int_st: 1; /*This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.*/ - volatile uint32_t at_cmd_char_det_int_st: 1; /*This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set to 1.*/ - volatile uint32_t reserved19: 13; + uint32_t rxfifo_full_int_st: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ + uint32_t txfifo_empty_int_st: 1; /*This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set to 1.*/ + uint32_t parity_err_int_st: 1; /*This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.*/ + uint32_t frm_err_int_st: 1; /*This is the status bit for frm_err_int_raw when fm_err_int_ena is set to 1.*/ + uint32_t rxfifo_ovf_int_st: 1; /*This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.*/ + uint32_t dsr_chg_int_st: 1; /*This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.*/ + uint32_t cts_chg_int_st: 1; /*This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.*/ + uint32_t brk_det_int_st: 1; /*This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.*/ + uint32_t rxfifo_tout_int_st: 1; /*This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.*/ + uint32_t sw_xon_int_st: 1; /*This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.*/ + uint32_t sw_xoff_int_st: 1; /*This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.*/ + uint32_t glitch_det_int_st: 1; /*This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.*/ + uint32_t tx_brk_done_int_st: 1; /*This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.*/ + uint32_t tx_brk_idle_done_int_st: 1; /*This is the status bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena is set to 1.*/ + uint32_t tx_done_int_st: 1; /*This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.*/ + uint32_t rs485_parity_err_int_st: 1; /*This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is set to 1.*/ + uint32_t rs485_frm_err_int_st: 1; /*This is the status bit for rs485_fm_err_int_raw when rs485_fm_err_int_ena is set to 1.*/ + uint32_t rs485_clash_int_st: 1; /*This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.*/ + uint32_t at_cmd_char_det_int_st: 1; /*This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set to 1.*/ + uint32_t reserved19: 13; }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t rxfifo_full_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ - volatile uint32_t txfifo_empty_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ - volatile uint32_t parity_err_int_ena: 1; /*This is the enable bit for parity_err_int_st register.*/ - volatile uint32_t frm_err_int_ena: 1; /*This is the enable bit for frm_err_int_st register.*/ - volatile uint32_t rxfifo_ovf_int_ena: 1; /*This is the enable bit for rxfifo_ovf_int_st register.*/ - volatile uint32_t dsr_chg_int_ena: 1; /*This is the enable bit for dsr_chg_int_st register.*/ - volatile uint32_t cts_chg_int_ena: 1; /*This is the enable bit for cts_chg_int_st register.*/ - volatile uint32_t brk_det_int_ena: 1; /*This is the enable bit for brk_det_int_st register.*/ - volatile uint32_t rxfifo_tout_int_ena: 1; /*This is the enable bit for rxfifo_tout_int_st register.*/ - volatile uint32_t sw_xon_int_ena: 1; /*This is the enable bit for sw_xon_int_st register.*/ - volatile uint32_t sw_xoff_int_ena: 1; /*This is the enable bit for sw_xoff_int_st register.*/ - volatile uint32_t glitch_det_int_ena: 1; /*This is the enable bit for glitch_det_int_st register.*/ - volatile uint32_t tx_brk_done_int_ena: 1; /*This is the enable bit for tx_brk_done_int_st register.*/ - volatile uint32_t tx_brk_idle_done_int_ena: 1; /*This is the enable bit for tx_brk_idle_done_int_st register.*/ - volatile uint32_t tx_done_int_ena: 1; /*This is the enable bit for tx_done_int_st register.*/ - volatile uint32_t rs485_parity_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ - volatile uint32_t rs485_frm_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ - volatile uint32_t rs485_clash_int_ena: 1; /*This is the enable bit for rs485_clash_int_st register.*/ - volatile uint32_t at_cmd_char_det_int_ena: 1; /*This is the enable bit for at_cmd_char_det_int_st register.*/ - volatile uint32_t reserved19: 13; + uint32_t rxfifo_full_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + uint32_t txfifo_empty_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + uint32_t parity_err_int_ena: 1; /*This is the enable bit for parity_err_int_st register.*/ + uint32_t frm_err_int_ena: 1; /*This is the enable bit for frm_err_int_st register.*/ + uint32_t rxfifo_ovf_int_ena: 1; /*This is the enable bit for rxfifo_ovf_int_st register.*/ + uint32_t dsr_chg_int_ena: 1; /*This is the enable bit for dsr_chg_int_st register.*/ + uint32_t cts_chg_int_ena: 1; /*This is the enable bit for cts_chg_int_st register.*/ + uint32_t brk_det_int_ena: 1; /*This is the enable bit for brk_det_int_st register.*/ + uint32_t rxfifo_tout_int_ena: 1; /*This is the enable bit for rxfifo_tout_int_st register.*/ + uint32_t sw_xon_int_ena: 1; /*This is the enable bit for sw_xon_int_st register.*/ + uint32_t sw_xoff_int_ena: 1; /*This is the enable bit for sw_xoff_int_st register.*/ + uint32_t glitch_det_int_ena: 1; /*This is the enable bit for glitch_det_int_st register.*/ + uint32_t tx_brk_done_int_ena: 1; /*This is the enable bit for tx_brk_done_int_st register.*/ + uint32_t tx_brk_idle_done_int_ena: 1; /*This is the enable bit for tx_brk_idle_done_int_st register.*/ + uint32_t tx_done_int_ena: 1; /*This is the enable bit for tx_done_int_st register.*/ + uint32_t rs485_parity_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + uint32_t rs485_frm_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + uint32_t rs485_clash_int_ena: 1; /*This is the enable bit for rs485_clash_int_st register.*/ + uint32_t at_cmd_char_det_int_ena: 1; /*This is the enable bit for at_cmd_char_det_int_st register.*/ + uint32_t reserved19: 13; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t rxfifo_full_int_clr: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ - volatile uint32_t txfifo_empty_int_clr: 1; /*Set this bit to clear txfifo_empty_int_raw interrupt.*/ - volatile uint32_t parity_err_int_clr: 1; /*Set this bit to clear parity_err_int_raw interrupt.*/ - volatile uint32_t frm_err_int_clr: 1; /*Set this bit to clear frm_err_int_raw interrupt.*/ - volatile uint32_t rxfifo_ovf_int_clr: 1; /*Set this bit to clear rxfifo_ovf_int_raw interrupt.*/ - volatile uint32_t dsr_chg_int_clr: 1; /*Set this bit to clear the dsr_chg_int_raw interrupt.*/ - volatile uint32_t cts_chg_int_clr: 1; /*Set this bit to clear the cts_chg_int_raw interrupt.*/ - volatile uint32_t brk_det_int_clr: 1; /*Set this bit to clear the brk_det_int_raw interrupt.*/ - volatile uint32_t rxfifo_tout_int_clr: 1; /*Set this bit to clear the rxfifo_tout_int_raw interrupt.*/ - volatile uint32_t sw_xon_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ - volatile uint32_t sw_xoff_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ - volatile uint32_t glitch_det_int_clr: 1; /*Set this bit to clear the glitch_det_int_raw interrupt.*/ - volatile uint32_t tx_brk_done_int_clr: 1; /*Set this bit to clear the tx_brk_done_int_raw interrupt..*/ - volatile uint32_t tx_brk_idle_done_int_clr: 1; /*Set this bit to clear the tx_brk_idle_done_int_raw interrupt.*/ - volatile uint32_t tx_done_int_clr: 1; /*Set this bit to clear the tx_done_int_raw interrupt.*/ - volatile uint32_t rs485_parity_err_int_clr: 1; /*Set this bit to clear the rs485_parity_err_int_raw interrupt.*/ - volatile uint32_t rs485_frm_err_int_clr: 1; /*Set this bit to clear the rs485_frm_err_int_raw interrupt.*/ - volatile uint32_t rs485_clash_int_clr: 1; /*Set this bit to clear the rs485_clash_int_raw interrupt.*/ - volatile uint32_t at_cmd_char_det_int_clr: 1; /*Set this bit to clear the at_cmd_char_det_int_raw interrupt.*/ - volatile uint32_t reserved19: 13; + uint32_t rxfifo_full_int_clr: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ + uint32_t txfifo_empty_int_clr: 1; /*Set this bit to clear txfifo_empty_int_raw interrupt.*/ + uint32_t parity_err_int_clr: 1; /*Set this bit to clear parity_err_int_raw interrupt.*/ + uint32_t frm_err_int_clr: 1; /*Set this bit to clear frm_err_int_raw interrupt.*/ + uint32_t rxfifo_ovf_int_clr: 1; /*Set this bit to clear rxfifo_ovf_int_raw interrupt.*/ + uint32_t dsr_chg_int_clr: 1; /*Set this bit to clear the dsr_chg_int_raw interrupt.*/ + uint32_t cts_chg_int_clr: 1; /*Set this bit to clear the cts_chg_int_raw interrupt.*/ + uint32_t brk_det_int_clr: 1; /*Set this bit to clear the brk_det_int_raw interrupt.*/ + uint32_t rxfifo_tout_int_clr: 1; /*Set this bit to clear the rxfifo_tout_int_raw interrupt.*/ + uint32_t sw_xon_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + uint32_t sw_xoff_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + uint32_t glitch_det_int_clr: 1; /*Set this bit to clear the glitch_det_int_raw interrupt.*/ + uint32_t tx_brk_done_int_clr: 1; /*Set this bit to clear the tx_brk_done_int_raw interrupt..*/ + uint32_t tx_brk_idle_done_int_clr: 1; /*Set this bit to clear the tx_brk_idle_done_int_raw interrupt.*/ + uint32_t tx_done_int_clr: 1; /*Set this bit to clear the tx_done_int_raw interrupt.*/ + uint32_t rs485_parity_err_int_clr: 1; /*Set this bit to clear the rs485_parity_err_int_raw interrupt.*/ + uint32_t rs485_frm_err_int_clr: 1; /*Set this bit to clear the rs485_frm_err_int_raw interrupt.*/ + uint32_t rs485_clash_int_clr: 1; /*Set this bit to clear the rs485_clash_int_raw interrupt.*/ + uint32_t at_cmd_char_det_int_clr: 1; /*Set this bit to clear the at_cmd_char_det_int_raw interrupt.*/ + uint32_t reserved19: 13; }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t clkdiv: 20; /*The register value is the integer part of the frequency divider's factor.*/ - volatile uint32_t clkdiv_frag: 4; /*The register value is the decimal part of the frequency divider's factor.*/ - volatile uint32_t reserved24: 8; + uint32_t clkdiv: 20; /*The register value is the integer part of the frequency divider's factor.*/ + uint32_t clkdiv_frag: 4; /*The register value is the decimal part of the frequency divider's factor.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }clk_div; union { struct { - volatile uint32_t auto_baud_en: 1; /*This is the enable bit for detecting baudrate.*/ - volatile uint32_t reserved1: 7; - volatile uint32_t glitch_filt: 8; /*when input pulse width is lower then this value ignore this pulse.this register is used in auto-baud detect process.*/ - volatile uint32_t reserved16: 16; + uint32_t auto_baud_en: 1; /*This is the enable bit for detecting baudrate.*/ + uint32_t reserved1: 7; + uint32_t glitch_filt: 8; /*when input pulse width is lower then this value ignore this pulse.this register is used in auto-baud detect process.*/ + uint32_t reserved16: 16; }; - volatile uint32_t val; + uint32_t val; }auto_baud; union { struct { - volatile uint32_t rxfifo_cnt: 8; /*(rx_mem_cnt rxfifo_cnt) stores the byte number of valid data in receiver's fifo. rx_mem_cnt register stores the 3 most significant bits rxfifo_cnt stores the 8 least significant bits.*/ - volatile uint32_t st_urx_out: 4; /*This register stores the value of receiver's finite state machine. 0:RX_IDLE 1:RX_STRT 2:RX_DAT0 3:RX_DAT1 4:RX_DAT2 5:RX_DAT3 6:RX_DAT4 7:RX_DAT5 8:RX_DAT6 9:RX_DAT7 10:RX_PRTY 11:RX_STP1 12:RX_STP2 13:RX_DL1*/ - volatile uint32_t reserved12: 1; - volatile uint32_t dsrn: 1; /*This register stores the level value of the internal uart dsr signal.*/ - volatile uint32_t ctsn: 1; /*This register stores the level value of the internal uart cts signal.*/ - volatile uint32_t rxd: 1; /*This register stores the level value of the internal uart rxd signal.*/ - volatile uint32_t txfifo_cnt: 8; /*(tx_mem_cnt txfifo_cnt) stores the byte number of valid data in transmitter's fifo.tx_mem_cnt stores the 3 most significant bits txfifo_cnt stores the 8 least significant bits.*/ - volatile uint32_t st_utx_out: 4; /*This register stores the value of transmitter's finite state machine. 0:TX_IDLE 1:TX_STRT 2:TX_DAT0 3:TX_DAT1 4:TX_DAT2 5:TX_DAT3 6:TX_DAT4 7:TX_DAT5 8:TX_DAT6 9:TX_DAT7 10:TX_PRTY 11:TX_STP1 12:TX_STP2 13:TX_DL0 14:TX_DL1*/ - volatile uint32_t reserved28: 1; - volatile uint32_t dtrn: 1; /*The register represent the level value of the internal uart dsr signal.*/ - volatile uint32_t rtsn: 1; /*This register represent the level value of the internal uart cts signal.*/ - volatile uint32_t txd: 1; /*This register represent the level value of the internal uart rxd signal.*/ + uint32_t rxfifo_cnt: 8; /*(rx_mem_cnt rxfifo_cnt) stores the byte number of valid data in receiver's fifo. rx_mem_cnt register stores the 3 most significant bits rxfifo_cnt stores the 8 least significant bits.*/ + uint32_t st_urx_out: 4; /*This register stores the value of receiver's finite state machine. 0:RX_IDLE 1:RX_STRT 2:RX_DAT0 3:RX_DAT1 4:RX_DAT2 5:RX_DAT3 6:RX_DAT4 7:RX_DAT5 8:RX_DAT6 9:RX_DAT7 10:RX_PRTY 11:RX_STP1 12:RX_STP2 13:RX_DL1*/ + uint32_t reserved12: 1; + uint32_t dsrn: 1; /*This register stores the level value of the internal uart dsr signal.*/ + uint32_t ctsn: 1; /*This register stores the level value of the internal uart cts signal.*/ + uint32_t rxd: 1; /*This register stores the level value of the internal uart rxd signal.*/ + uint32_t txfifo_cnt: 8; /*(tx_mem_cnt txfifo_cnt) stores the byte number of valid data in transmitter's fifo.tx_mem_cnt stores the 3 most significant bits txfifo_cnt stores the 8 least significant bits.*/ + uint32_t st_utx_out: 4; /*This register stores the value of transmitter's finite state machine. 0:TX_IDLE 1:TX_STRT 2:TX_DAT0 3:TX_DAT1 4:TX_DAT2 5:TX_DAT3 6:TX_DAT4 7:TX_DAT5 8:TX_DAT6 9:TX_DAT7 10:TX_PRTY 11:TX_STP1 12:TX_STP2 13:TX_DL0 14:TX_DL1*/ + uint32_t reserved28: 1; + uint32_t dtrn: 1; /*The register represent the level value of the internal uart dsr signal.*/ + uint32_t rtsn: 1; /*This register represent the level value of the internal uart cts signal.*/ + uint32_t txd: 1; /*This register represent the level value of the internal uart rxd signal.*/ }; - volatile uint32_t val; + uint32_t val; }status; union { struct { - volatile uint32_t parity: 1; /*This register is used to configure the parity check mode. 0:even 1:odd*/ - volatile uint32_t parity_en: 1; /*Set this bit to enable uart parity check.*/ - volatile uint32_t bit_num: 2; /*This register is used to set the length of data: 0:5bits 1:6bits 2:7bits 3:8bits*/ - volatile uint32_t stop_bit_num: 2; /*This register is used to set the length of stop bit. 1:1bit 2:1.5bits 3:2bits*/ - volatile uint32_t sw_rts: 1; /*This register is used to configure the software rts signal which is used in software flow control.*/ - volatile uint32_t sw_dtr: 1; /*This register is used to configure the software dtr signal which is used in software flow control..*/ - volatile uint32_t txd_brk: 1; /*Set this bit to enable transmitter to send 0 when the process of sending data is done.*/ - volatile uint32_t irda_dplx: 1; /*Set this bit to enable irda loopback mode.*/ - volatile uint32_t irda_tx_en: 1; /*This is the start enable bit for irda transmitter.*/ - volatile uint32_t irda_wctl: 1; /*1:the irda transmitter's 11th bit is the same to the 10th bit. 0:set irda transmitter's 11th bit to 0.*/ - volatile uint32_t irda_tx_inv: 1; /*Set this bit to inverse the level value of irda transmitter's level.*/ - volatile uint32_t irda_rx_inv: 1; /*Set this bit to inverse the level value of irda receiver's level.*/ - volatile uint32_t loopback: 1; /*Set this bit to enable uart loop-back test mode.*/ - volatile uint32_t tx_flow_en: 1; /*Set this bit to enable transmitter's flow control function.*/ - volatile uint32_t irda_en: 1; /*Set this bit to enable irda protocol.*/ - volatile uint32_t rxfifo_rst: 1; /*Set this bit to reset uart receiver's fifo.*/ - volatile uint32_t txfifo_rst: 1; /*Set this bit to reset uart transmitter's fifo.*/ - volatile uint32_t rxd_inv: 1; /*Set this bit to inverse the level value of uart rxd signal.*/ - volatile uint32_t cts_inv: 1; /*Set this bit to inverse the level value of uart cts signal.*/ - volatile uint32_t dsr_inv: 1; /*Set this bit to inverse the level value of uart dsr signal.*/ - volatile uint32_t txd_inv: 1; /*Set this bit to inverse the level value of uart txd signal.*/ - volatile uint32_t rts_inv: 1; /*Set this bit to inverse the level value of uart rts signal.*/ - volatile uint32_t dtr_inv: 1; /*Set this bit to inverse the level value of uart dtr signal.*/ - volatile uint32_t clk_en: 1; /*1:force clock on for registers:support clock only when write registers*/ - volatile uint32_t err_wr_mask: 1; /*1:receiver stops storing data int fifo when data is wrong. 0:receiver stores the data even if the received data is wrong.*/ - volatile uint32_t tick_ref_always_on: 1; /*This register is used to select the clock.1:apb clock:ref_tick*/ - volatile uint32_t reserved28: 4; + uint32_t parity: 1; /*This register is used to configure the parity check mode. 0:even 1:odd*/ + uint32_t parity_en: 1; /*Set this bit to enable uart parity check.*/ + uint32_t bit_num: 2; /*This register is used to set the length of data: 0:5bits 1:6bits 2:7bits 3:8bits*/ + uint32_t stop_bit_num: 2; /*This register is used to set the length of stop bit. 1:1bit 2:1.5bits 3:2bits*/ + uint32_t sw_rts: 1; /*This register is used to configure the software rts signal which is used in software flow control.*/ + uint32_t sw_dtr: 1; /*This register is used to configure the software dtr signal which is used in software flow control..*/ + uint32_t txd_brk: 1; /*Set this bit to enable transmitter to send 0 when the process of sending data is done.*/ + uint32_t irda_dplx: 1; /*Set this bit to enable irda loopback mode.*/ + uint32_t irda_tx_en: 1; /*This is the start enable bit for irda transmitter.*/ + uint32_t irda_wctl: 1; /*1:the irda transmitter's 11th bit is the same to the 10th bit. 0:set irda transmitter's 11th bit to 0.*/ + uint32_t irda_tx_inv: 1; /*Set this bit to inverse the level value of irda transmitter's level.*/ + uint32_t irda_rx_inv: 1; /*Set this bit to inverse the level value of irda receiver's level.*/ + uint32_t loopback: 1; /*Set this bit to enable uart loop-back test mode.*/ + uint32_t tx_flow_en: 1; /*Set this bit to enable transmitter's flow control function.*/ + uint32_t irda_en: 1; /*Set this bit to enable irda protocol.*/ + uint32_t rxfifo_rst: 1; /*Set this bit to reset uart receiver's fifo.*/ + uint32_t txfifo_rst: 1; /*Set this bit to reset uart transmitter's fifo.*/ + uint32_t rxd_inv: 1; /*Set this bit to inverse the level value of uart rxd signal.*/ + uint32_t cts_inv: 1; /*Set this bit to inverse the level value of uart cts signal.*/ + uint32_t dsr_inv: 1; /*Set this bit to inverse the level value of uart dsr signal.*/ + uint32_t txd_inv: 1; /*Set this bit to inverse the level value of uart txd signal.*/ + uint32_t rts_inv: 1; /*Set this bit to inverse the level value of uart rts signal.*/ + uint32_t dtr_inv: 1; /*Set this bit to inverse the level value of uart dtr signal.*/ + uint32_t clk_en: 1; /*1:force clock on for registers:support clock only when write registers*/ + uint32_t err_wr_mask: 1; /*1:receiver stops storing data int fifo when data is wrong. 0:receiver stores the data even if the received data is wrong.*/ + uint32_t tick_ref_always_on: 1; /*This register is used to select the clock.1:apb clock:ref_tick*/ + uint32_t reserved28: 4; }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t rxfifo_full_thrhd: 7; /*When receiver receives more data than its threshold value,receiver will produce rxfifo_full_int_raw interrupt.the threshold value is (rx_flow_thrhd_h3 rxfifo_full_thrhd).*/ - volatile uint32_t reserved7: 1; - volatile uint32_t txfifo_empty_thrhd: 7; /*when the data amount in transmitter fifo is less than its threshold value, it will produce txfifo_empty_int_raw interrupt. the threshold value is (tx_mem_empty_thrhd txfifo_empty_thrhd)*/ - volatile uint32_t reserved15: 1; - volatile uint32_t rx_flow_thrhd: 7; /*when receiver receives more data than its threshold value, receiver produce signal to tell the transmitter stop transferring data. the threshold value is (rx_flow_thrhd_h3 rx_flow_thrhd).*/ - volatile uint32_t rx_flow_en: 1; /*This is the flow enable bit for uart receiver. 1:choose software flow control with configuring sw_rts signal*/ - volatile uint32_t rx_tout_thrhd: 7; /*This register is used to configure the timeout value for uart receiver receiving a byte.*/ - volatile uint32_t rx_tout_en: 1; /*This is the enable bit for uart receiver's timeout function.*/ + uint32_t rxfifo_full_thrhd: 7; /*When receiver receives more data than its threshold value,receiver will produce rxfifo_full_int_raw interrupt.the threshold value is (rx_flow_thrhd_h3 rxfifo_full_thrhd).*/ + uint32_t reserved7: 1; + uint32_t txfifo_empty_thrhd: 7; /*when the data amount in transmitter fifo is less than its threshold value, it will produce txfifo_empty_int_raw interrupt. the threshold value is (tx_mem_empty_thrhd txfifo_empty_thrhd)*/ + uint32_t reserved15: 1; + uint32_t rx_flow_thrhd: 7; /*when receiver receives more data than its threshold value, receiver produce signal to tell the transmitter stop transferring data. the threshold value is (rx_flow_thrhd_h3 rx_flow_thrhd).*/ + uint32_t rx_flow_en: 1; /*This is the flow enable bit for uart receiver. 1:choose software flow control with configuring sw_rts signal*/ + uint32_t rx_tout_thrhd: 7; /*This register is used to configure the timeout value for uart receiver receiving a byte.*/ + uint32_t rx_tout_en: 1; /*This is the enable bit for uart receiver's timeout function.*/ }; - volatile uint32_t val; + uint32_t val; }conf1; union { struct { - volatile uint32_t lowpulse_min_cnt:20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ - volatile uint32_t reserved20: 12; + uint32_t lowpulse_min_cnt:20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }lowpulse; union { struct { - volatile uint32_t highpulse_min_cnt:20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ - volatile uint32_t reserved20: 12; + uint32_t highpulse_min_cnt:20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }highpulse; union { struct { - volatile uint32_t rxd_edge_cnt:10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ - volatile uint32_t reserved10: 22; + uint32_t rxd_edge_cnt:10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }rxd_cnt; union { struct { - volatile uint32_t sw_flow_con_en: 1; /*Set this bit to enable software flow control. it is used with register sw_xon or sw_xoff .*/ - volatile uint32_t xonoff_del: 1; /*Set this bit to remove flow control char from the received data.*/ - volatile uint32_t force_xon: 1; /*Set this bit to clear ctsn to stop the transmitter from sending data.*/ - volatile uint32_t force_xoff: 1; /*Set this bit to set ctsn to enable the transmitter to go on sending data.*/ - volatile uint32_t send_xon: 1; /*Set this bit to send xon char, it is cleared by hardware automatically.*/ - volatile uint32_t send_xoff: 1; /*Set this bit to send xoff char, it is cleared by hardware automatically.*/ - volatile uint32_t reserved6: 26; + uint32_t sw_flow_con_en: 1; /*Set this bit to enable software flow control. it is used with register sw_xon or sw_xoff .*/ + uint32_t xonoff_del: 1; /*Set this bit to remove flow control char from the received data.*/ + uint32_t force_xon: 1; /*Set this bit to clear ctsn to stop the transmitter from sending data.*/ + uint32_t force_xoff: 1; /*Set this bit to set ctsn to enable the transmitter to go on sending data.*/ + uint32_t send_xon: 1; /*Set this bit to send xon char, it is cleared by hardware automatically.*/ + uint32_t send_xoff: 1; /*Set this bit to send xoff char, it is cleared by hardware automatically.*/ + uint32_t reserved6: 26; }; - volatile uint32_t val; + uint32_t val; }flow_conf; union { struct { - volatile uint32_t active_threshold:10; /*When the input rxd edge changes more than this register value, the uart is active from light sleeping mode.*/ - volatile uint32_t reserved10: 22; + uint32_t active_threshold:10; /*When the input rxd edge changes more than this register value, the uart is active from light sleeping mode.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }sleep_conf; union { struct { - volatile uint32_t xon_threshold: 8; /*when the data amount in receiver's fifo is more than this register value, it will send a xoff char with uart_sw_flow_con_en set to 1.*/ - volatile uint32_t xoff_threshold: 8; /*When the data amount in receiver's fifo is less than this register value, it will send a xon char with uart_sw_flow_con_en set to 1.*/ - volatile uint32_t xon_char: 8; /*This register stores the xon flow control char.*/ - volatile uint32_t xoff_char: 8; /*This register stores the xoff flow control char.*/ + uint32_t xon_threshold: 8; /*when the data amount in receiver's fifo is more than this register value, it will send a xoff char with uart_sw_flow_con_en set to 1.*/ + uint32_t xoff_threshold: 8; /*When the data amount in receiver's fifo is less than this register value, it will send a xon char with uart_sw_flow_con_en set to 1.*/ + uint32_t xon_char: 8; /*This register stores the xon flow control char.*/ + uint32_t xoff_char: 8; /*This register stores the xoff flow control char.*/ }; - volatile uint32_t val; + uint32_t val; }swfc_conf; union { struct { - volatile uint32_t rx_idle_thrhd:10; /*when receiver takes more time than this register value to receive a byte data, it will produce frame end signal for uhci to stop receiving data.*/ - volatile uint32_t tx_idle_num: 10; /*This register is used to configure the duration time between transfers.*/ - volatile uint32_t tx_brk_num: 8; /*This register is used to configure the number of 0 send after the process of sending data is done. it is active when txd_brk is set to 1.*/ - volatile uint32_t reserved28: 4; + uint32_t rx_idle_thrhd:10; /*when receiver takes more time than this register value to receive a byte data, it will produce frame end signal for uhci to stop receiving data.*/ + uint32_t tx_idle_num: 10; /*This register is used to configure the duration time between transfers.*/ + uint32_t tx_brk_num: 8; /*This register is used to configure the number of 0 send after the process of sending data is done. it is active when txd_brk is set to 1.*/ + uint32_t reserved28: 4; }; - volatile uint32_t val; + uint32_t val; }idle_conf; union { struct { - volatile uint32_t rs485_en: 1; /*Set this bit to choose rs485 mode.*/ - volatile uint32_t dl0_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ - volatile uint32_t dl1_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ - volatile uint32_t rs485tx_rx_en: 1; /*Set this bit to enable loop-back transmitter's output data signal to receiver's input data signal.*/ - volatile uint32_t rs485rxby_tx_en: 1; /*1: enable rs485's transmitter to send data when rs485's receiver is busy. 0:rs485's transmitter should not send data when its receiver is busy.*/ - volatile uint32_t rs485_rx_dly_num: 1; /*This register is used to delay the receiver's internal data signal.*/ - volatile uint32_t rs485_tx_dly_num: 4; /*This register is used to delay the transmitter's internal data signal.*/ - volatile uint32_t reserved10: 22; + uint32_t rs485_en: 1; /*Set this bit to choose rs485 mode.*/ + uint32_t dl0_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ + uint32_t dl1_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ + uint32_t rs485tx_rx_en: 1; /*Set this bit to enable loop-back transmitter's output data signal to receiver's input data signal.*/ + uint32_t rs485rxby_tx_en: 1; /*1: enable rs485's transmitter to send data when rs485's receiver is busy. 0:rs485's transmitter should not send data when its receiver is busy.*/ + uint32_t rs485_rx_dly_num: 1; /*This register is used to delay the receiver's internal data signal.*/ + uint32_t rs485_tx_dly_num: 4; /*This register is used to delay the transmitter's internal data signal.*/ + uint32_t reserved10: 22; }; - volatile uint32_t val; + uint32_t val; }rs485_conf; union { struct { - volatile uint32_t pre_idle_num:24; /*This register is used to configure the idle duration time before the first at_cmd is received by receiver, when the the duration is less than this register value it will not take the next data received as at_cmd char.*/ - volatile uint32_t reserved24: 8; + uint32_t pre_idle_num:24; /*This register is used to configure the idle duration time before the first at_cmd is received by receiver, when the the duration is less than this register value it will not take the next data received as at_cmd char.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }at_cmd_precnt; union { struct { - volatile uint32_t post_idle_num:24; /*This register is used to configure the duration time between the last at_cmd and the next data, when the duration is less than this register value it will not take the previous data as at_cmd char.*/ - volatile uint32_t reserved24: 8; + uint32_t post_idle_num:24; /*This register is used to configure the duration time between the last at_cmd and the next data, when the duration is less than this register value it will not take the previous data as at_cmd char.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }at_cmd_postcnt; union { struct { - volatile uint32_t rx_gap_tout:24; /*This register is used to configure the duration time between the at_cmd chars, when the duration time is less than this register value it will not take the data as continous at_cmd chars.*/ - volatile uint32_t reserved24: 8; + uint32_t rx_gap_tout:24; /*This register is used to configure the duration time between the at_cmd chars, when the duration time is less than this register value it will not take the data as continous at_cmd chars.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }at_cmd_gaptout; union { struct { - volatile uint32_t at_cmd_char: 8; /*This register is used to configure the content of at_cmd char.*/ - volatile uint32_t char_num: 8; /*This register is used to configure the number of continuous at_cmd chars received by receiver.*/ - volatile uint32_t reserved16: 16; + uint32_t at_cmd_char: 8; /*This register is used to configure the content of at_cmd char.*/ + uint32_t char_num: 8; /*This register is used to configure the number of continuous at_cmd chars received by receiver.*/ + uint32_t reserved16: 16; }; - volatile uint32_t val; + uint32_t val; }at_cmd_char; union { struct { - volatile uint32_t mem_pd: 1; /*Set this bit to power down memory,when reg_mem_pd registers in the 3 uarts are all set to 1 memory will enter low power mode.*/ - volatile uint32_t reserved1: 1; - volatile uint32_t reserved2: 1; - volatile uint32_t rx_size: 4; /*This register is used to configure the amount of mem allocated to receiver's fifo. the default byte num is 128.*/ - volatile uint32_t tx_size: 4; /*This register is used to configure the amount of mem allocated to transmitter's fifo.the default byte num is 128.*/ - volatile uint32_t reserved11: 4; - volatile uint32_t rx_flow_thrhd_h3: 3; /*refer to the rx_flow_thrhd's description.*/ - volatile uint32_t rx_tout_thrhd_h3: 3; /*refer to the rx_tout_thrhd's description.*/ - volatile uint32_t xon_threshold_h2: 2; /*refer to the uart_xon_threshold's description.*/ - volatile uint32_t xoff_threshold_h2: 2; /*refer to the uart_xoff_threshold's description.*/ - volatile uint32_t rx_mem_full_thrhd: 3; /*refer to the rxfifo_full_thrhd's description.*/ - volatile uint32_t tx_mem_empty_thrhd: 3; /*refer to txfifo_empty_thrhd 's description.*/ - volatile uint32_t reserved31: 1; + uint32_t mem_pd: 1; /*Set this bit to power down memory,when reg_mem_pd registers in the 3 uarts are all set to 1 memory will enter low power mode.*/ + uint32_t reserved1: 1; + uint32_t reserved2: 1; + uint32_t rx_size: 4; /*This register is used to configure the amount of mem allocated to receiver's fifo. the default byte num is 128.*/ + uint32_t tx_size: 4; /*This register is used to configure the amount of mem allocated to transmitter's fifo.the default byte num is 128.*/ + uint32_t reserved11: 4; + uint32_t rx_flow_thrhd_h3: 3; /*refer to the rx_flow_thrhd's description.*/ + uint32_t rx_tout_thrhd_h3: 3; /*refer to the rx_tout_thrhd's description.*/ + uint32_t xon_threshold_h2: 2; /*refer to the uart_xon_threshold's description.*/ + uint32_t xoff_threshold_h2: 2; /*refer to the uart_xoff_threshold's description.*/ + uint32_t rx_mem_full_thrhd: 3; /*refer to the rxfifo_full_thrhd's description.*/ + uint32_t tx_mem_empty_thrhd: 3; /*refer to txfifo_empty_thrhd 's description.*/ + uint32_t reserved31: 1; }; - volatile uint32_t val; + uint32_t val; }mem_conf; union { struct { - volatile uint32_t mem_tx_status:24; - volatile uint32_t reserved24: 8; + uint32_t mem_tx_status:24; + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }mem_tx_status; union { struct { - volatile uint32_t mem_rx_status:24; - volatile uint32_t reserved24: 8; + uint32_t mem_rx_status:24; + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }mem_rx_status; union { struct { - volatile uint32_t rx_mem_cnt: 3; /*refer to the rxfifo_cnt's description.*/ - volatile uint32_t tx_mem_cnt: 3; /*refer to the txfifo_cnt's description.*/ - volatile uint32_t reserved6: 26; + uint32_t rx_mem_cnt: 3; /*refer to the rxfifo_cnt's description.*/ + uint32_t tx_mem_cnt: 3; /*refer to the txfifo_cnt's description.*/ + uint32_t reserved6: 26; }; - volatile uint32_t val; + uint32_t val; }mem_cnt_status; union { struct { - volatile uint32_t posedge_min_cnt:20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ - volatile uint32_t reserved20: 12; + uint32_t posedge_min_cnt:20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }pospulse; union { struct { - volatile uint32_t negedge_min_cnt:20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ - volatile uint32_t reserved20: 12; + uint32_t negedge_min_cnt:20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; - volatile uint32_t val; + uint32_t val; }negpulse; - volatile uint32_t reserved_70; - volatile uint32_t reserved_74; - volatile uint32_t date; /**/ - volatile uint32_t id; /**/ + uint32_t reserved_70; + uint32_t reserved_74; + uint32_t date; /**/ + uint32_t id; /**/ } uart_dev_t; -extern volatile uart_dev_t UART0; -extern volatile uart_dev_t UART1; -extern volatile uart_dev_t UART2; +extern uart_dev_t UART0; +extern uart_dev_t UART1; +extern uart_dev_t UART2; #endif /* _SOC_UART_STRUCT_H_ */ diff --git a/components/esp32/include/soc/uhci_struct.h b/components/esp32/include/soc/uhci_struct.h index 323d3beacc..5a78990f24 100644 --- a/components/esp32/include/soc/uhci_struct.h +++ b/components/esp32/include/soc/uhci_struct.h @@ -13,325 +13,325 @@ // limitations under the License. #ifndef _SOC_UHCI_STRUCT_H_ #define _SOC_UHCI_STRUCT_H_ -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t in_rst: 1; /*Set this bit to reset in link operations.*/ - volatile uint32_t out_rst: 1; /*Set this bit to reset out link operations.*/ - volatile uint32_t ahbm_fifo_rst: 1; /*Set this bit to reset dma ahb fifo.*/ - volatile uint32_t ahbm_rst: 1; /*Set this bit to reset dma ahb interface.*/ - volatile uint32_t in_loop_test: 1; /*Set this bit to enable loop test for in links.*/ - volatile uint32_t out_loop_test: 1; /*Set this bit to enable loop test for out links.*/ - volatile uint32_t out_auto_wrback: 1; /*when in link's length is 0 go on to use the next in link automatically.*/ - volatile uint32_t out_no_restart_clr: 1; /*don't use*/ - volatile uint32_t out_eof_mode: 1; /*Set this bit to produce eof after DMA pops all data clear this bit to produce eof after DMA pushes all data*/ - volatile uint32_t uart0_ce: 1; /*Set this bit to use UART to transmit or receive data.*/ - volatile uint32_t uart1_ce: 1; /*Set this bit to use UART1 to transmit or receive data.*/ - volatile uint32_t uart2_ce: 1; /*Set this bit to use UART2 to transmit or receive data.*/ - volatile uint32_t outdscr_burst_en: 1; /*Set this bit to enable DMA in links to use burst mode.*/ - volatile uint32_t indscr_burst_en: 1; /*Set this bit to enable DMA out links to use burst mode.*/ - volatile uint32_t out_data_burst_en: 1; /*Set this bit to enable DMA burst MODE*/ - volatile uint32_t mem_trans_en: 1; - volatile uint32_t seper_en: 1; /*Set this bit to use special char to separate the data frame.*/ - volatile uint32_t head_en: 1; /*Set this bit to enable to use head packet before the data frame.*/ - volatile uint32_t crc_rec_en: 1; /*Set this bit to enable receiver''s ability of crc calculation when crc_en bit in head packet is 1 then there will be crc bytes after data_frame*/ - volatile uint32_t uart_idle_eof_en: 1; /*Set this bit to enable to use idle time when the idle time after data frame is satisfied this means the end of a data frame.*/ - volatile uint32_t len_eof_en: 1; /*Set this bit to enable to use packet_len in packet head when the received data is equal to packet_len this means the end of a data frame.*/ - volatile uint32_t encode_crc_en: 1; /*Set this bit to enable crc calculation for data frame when bit6 in the head packet is 1.*/ - volatile uint32_t clk_en: 1; /*Set this bit to enable clock-gating for read or write registers.*/ - volatile uint32_t uart_rx_brk_eof_en: 1; /*Set this bit to enable to use brk char as the end of a data frame.*/ - volatile uint32_t reserved24: 8; + uint32_t in_rst: 1; /*Set this bit to reset in link operations.*/ + uint32_t out_rst: 1; /*Set this bit to reset out link operations.*/ + uint32_t ahbm_fifo_rst: 1; /*Set this bit to reset dma ahb fifo.*/ + uint32_t ahbm_rst: 1; /*Set this bit to reset dma ahb interface.*/ + uint32_t in_loop_test: 1; /*Set this bit to enable loop test for in links.*/ + uint32_t out_loop_test: 1; /*Set this bit to enable loop test for out links.*/ + uint32_t out_auto_wrback: 1; /*when in link's length is 0 go on to use the next in link automatically.*/ + uint32_t out_no_restart_clr: 1; /*don't use*/ + uint32_t out_eof_mode: 1; /*Set this bit to produce eof after DMA pops all data clear this bit to produce eof after DMA pushes all data*/ + uint32_t uart0_ce: 1; /*Set this bit to use UART to transmit or receive data.*/ + uint32_t uart1_ce: 1; /*Set this bit to use UART1 to transmit or receive data.*/ + uint32_t uart2_ce: 1; /*Set this bit to use UART2 to transmit or receive data.*/ + uint32_t outdscr_burst_en: 1; /*Set this bit to enable DMA in links to use burst mode.*/ + uint32_t indscr_burst_en: 1; /*Set this bit to enable DMA out links to use burst mode.*/ + uint32_t out_data_burst_en: 1; /*Set this bit to enable DMA burst MODE*/ + uint32_t mem_trans_en: 1; + uint32_t seper_en: 1; /*Set this bit to use special char to separate the data frame.*/ + uint32_t head_en: 1; /*Set this bit to enable to use head packet before the data frame.*/ + uint32_t crc_rec_en: 1; /*Set this bit to enable receiver''s ability of crc calculation when crc_en bit in head packet is 1 then there will be crc bytes after data_frame*/ + uint32_t uart_idle_eof_en: 1; /*Set this bit to enable to use idle time when the idle time after data frame is satisfied this means the end of a data frame.*/ + uint32_t len_eof_en: 1; /*Set this bit to enable to use packet_len in packet head when the received data is equal to packet_len this means the end of a data frame.*/ + uint32_t encode_crc_en: 1; /*Set this bit to enable crc calculation for data frame when bit6 in the head packet is 1.*/ + uint32_t clk_en: 1; /*Set this bit to enable clock-gating for read or write registers.*/ + uint32_t uart_rx_brk_eof_en: 1; /*Set this bit to enable to use brk char as the end of a data frame.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }conf0; union { struct { - volatile uint32_t rx_start_int_raw: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ - volatile uint32_t tx_start_int_raw: 1; /*when DMA detects a separator char it will produce uhci_tx_start_int interrupt.*/ - volatile uint32_t rx_hung_int_raw: 1; /*when DMA takes a lot of time to receive a data it will produce uhci_rx_hung_int interrupt.*/ - volatile uint32_t tx_hung_int_raw: 1; /*when DMA takes a lot of time to read a data from RAM it will produce uhci_tx_hung_int interrupt.*/ - volatile uint32_t in_done_int_raw: 1; /*when a in link descriptor has been completed it will produce uhci_in_done_int interrupt.*/ - volatile uint32_t in_suc_eof_int_raw: 1; /*when a data packet has been received it will produce uhci_in_suc_eof_int interrupt.*/ - volatile uint32_t in_err_eof_int_raw: 1; /*when there are some errors about eof in in link descriptor it will produce uhci_in_err_eof_int interrupt.*/ - volatile uint32_t out_done_int_raw: 1; /*when a out link descriptor is completed it will produce uhci_out_done_int interrupt.*/ - volatile uint32_t out_eof_int_raw: 1; /*when the current descriptor's eof bit is 1 it will produce uhci_out_eof_int interrupt.*/ - volatile uint32_t in_dscr_err_int_raw: 1; /*when there are some errors about the out link descriptor it will produce uhci_in_dscr_err_int interrupt.*/ - volatile uint32_t out_dscr_err_int_raw: 1; /*when there are some errors about the in link descriptor it will produce uhci_out_dscr_err_int interrupt.*/ - volatile uint32_t in_dscr_empty_int_raw: 1; /*when there are not enough in links for DMA it will produce uhci_in_dscr_err_int interrupt.*/ - volatile uint32_t outlink_eof_err_int_raw: 1; /*when there are some errors about eof in outlink descriptor it will produce uhci_outlink_eof_err_int interrupt.*/ - volatile uint32_t out_total_eof_int_raw: 1; /*When all data have been send it will produce uhci_out_total_eof_int interrupt.*/ - volatile uint32_t send_s_q_int_raw: 1; /*When use single send registers to send a short packets it will produce this interrupt when dma has send the short packet.*/ - volatile uint32_t send_a_q_int_raw: 1; /*When use always_send registers to send a series of short packets it will produce this interrupt when dma has send the short packet.*/ - volatile uint32_t dma_infifo_full_wm_int_raw: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_start_int_raw: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ + uint32_t tx_start_int_raw: 1; /*when DMA detects a separator char it will produce uhci_tx_start_int interrupt.*/ + uint32_t rx_hung_int_raw: 1; /*when DMA takes a lot of time to receive a data it will produce uhci_rx_hung_int interrupt.*/ + uint32_t tx_hung_int_raw: 1; /*when DMA takes a lot of time to read a data from RAM it will produce uhci_tx_hung_int interrupt.*/ + uint32_t in_done_int_raw: 1; /*when a in link descriptor has been completed it will produce uhci_in_done_int interrupt.*/ + uint32_t in_suc_eof_int_raw: 1; /*when a data packet has been received it will produce uhci_in_suc_eof_int interrupt.*/ + uint32_t in_err_eof_int_raw: 1; /*when there are some errors about eof in in link descriptor it will produce uhci_in_err_eof_int interrupt.*/ + uint32_t out_done_int_raw: 1; /*when a out link descriptor is completed it will produce uhci_out_done_int interrupt.*/ + uint32_t out_eof_int_raw: 1; /*when the current descriptor's eof bit is 1 it will produce uhci_out_eof_int interrupt.*/ + uint32_t in_dscr_err_int_raw: 1; /*when there are some errors about the out link descriptor it will produce uhci_in_dscr_err_int interrupt.*/ + uint32_t out_dscr_err_int_raw: 1; /*when there are some errors about the in link descriptor it will produce uhci_out_dscr_err_int interrupt.*/ + uint32_t in_dscr_empty_int_raw: 1; /*when there are not enough in links for DMA it will produce uhci_in_dscr_err_int interrupt.*/ + uint32_t outlink_eof_err_int_raw: 1; /*when there are some errors about eof in outlink descriptor it will produce uhci_outlink_eof_err_int interrupt.*/ + uint32_t out_total_eof_int_raw: 1; /*When all data have been send it will produce uhci_out_total_eof_int interrupt.*/ + uint32_t send_s_q_int_raw: 1; /*When use single send registers to send a short packets it will produce this interrupt when dma has send the short packet.*/ + uint32_t send_a_q_int_raw: 1; /*When use always_send registers to send a series of short packets it will produce this interrupt when dma has send the short packet.*/ + uint32_t dma_infifo_full_wm_int_raw: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_raw; union { struct { - volatile uint32_t rx_start_int_st: 1; - volatile uint32_t tx_start_int_st: 1; - volatile uint32_t rx_hung_int_st: 1; - volatile uint32_t tx_hung_int_st: 1; - volatile uint32_t in_done_int_st: 1; - volatile uint32_t in_suc_eof_int_st: 1; - volatile uint32_t in_err_eof_int_st: 1; - volatile uint32_t out_done_int_st: 1; - volatile uint32_t out_eof_int_st: 1; - volatile uint32_t in_dscr_err_int_st: 1; - volatile uint32_t out_dscr_err_int_st: 1; - volatile uint32_t in_dscr_empty_int_st: 1; - volatile uint32_t outlink_eof_err_int_st: 1; - volatile uint32_t out_total_eof_int_st: 1; - volatile uint32_t send_s_q_int_st: 1; - volatile uint32_t send_a_q_int_st: 1; - volatile uint32_t dma_infifo_full_wm_int_st: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_start_int_st: 1; + uint32_t tx_start_int_st: 1; + uint32_t rx_hung_int_st: 1; + uint32_t tx_hung_int_st: 1; + uint32_t in_done_int_st: 1; + uint32_t in_suc_eof_int_st: 1; + uint32_t in_err_eof_int_st: 1; + uint32_t out_done_int_st: 1; + uint32_t out_eof_int_st: 1; + uint32_t in_dscr_err_int_st: 1; + uint32_t out_dscr_err_int_st: 1; + uint32_t in_dscr_empty_int_st: 1; + uint32_t outlink_eof_err_int_st: 1; + uint32_t out_total_eof_int_st: 1; + uint32_t send_s_q_int_st: 1; + uint32_t send_a_q_int_st: 1; + uint32_t dma_infifo_full_wm_int_st: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_st; union { struct { - volatile uint32_t rx_start_int_ena: 1; - volatile uint32_t tx_start_int_ena: 1; - volatile uint32_t rx_hung_int_ena: 1; - volatile uint32_t tx_hung_int_ena: 1; - volatile uint32_t in_done_int_ena: 1; - volatile uint32_t in_suc_eof_int_ena: 1; - volatile uint32_t in_err_eof_int_ena: 1; - volatile uint32_t out_done_int_ena: 1; - volatile uint32_t out_eof_int_ena: 1; - volatile uint32_t in_dscr_err_int_ena: 1; - volatile uint32_t out_dscr_err_int_ena: 1; - volatile uint32_t in_dscr_empty_int_ena: 1; - volatile uint32_t outlink_eof_err_int_ena: 1; - volatile uint32_t out_total_eof_int_ena: 1; - volatile uint32_t send_s_q_int_ena: 1; - volatile uint32_t send_a_q_int_ena: 1; - volatile uint32_t dma_infifo_full_wm_int_ena: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_start_int_ena: 1; + uint32_t tx_start_int_ena: 1; + uint32_t rx_hung_int_ena: 1; + uint32_t tx_hung_int_ena: 1; + uint32_t in_done_int_ena: 1; + uint32_t in_suc_eof_int_ena: 1; + uint32_t in_err_eof_int_ena: 1; + uint32_t out_done_int_ena: 1; + uint32_t out_eof_int_ena: 1; + uint32_t in_dscr_err_int_ena: 1; + uint32_t out_dscr_err_int_ena: 1; + uint32_t in_dscr_empty_int_ena: 1; + uint32_t outlink_eof_err_int_ena: 1; + uint32_t out_total_eof_int_ena: 1; + uint32_t send_s_q_int_ena: 1; + uint32_t send_a_q_int_ena: 1; + uint32_t dma_infifo_full_wm_int_ena: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_ena; union { struct { - volatile uint32_t rx_start_int_clr: 1; - volatile uint32_t tx_start_int_clr: 1; - volatile uint32_t rx_hung_int_clr: 1; - volatile uint32_t tx_hung_int_clr: 1; - volatile uint32_t in_done_int_clr: 1; - volatile uint32_t in_suc_eof_int_clr: 1; - volatile uint32_t in_err_eof_int_clr: 1; - volatile uint32_t out_done_int_clr: 1; - volatile uint32_t out_eof_int_clr: 1; - volatile uint32_t in_dscr_err_int_clr: 1; - volatile uint32_t out_dscr_err_int_clr: 1; - volatile uint32_t in_dscr_empty_int_clr: 1; - volatile uint32_t outlink_eof_err_int_clr: 1; - volatile uint32_t out_total_eof_int_clr: 1; - volatile uint32_t send_s_q_int_clr: 1; - volatile uint32_t send_a_q_int_clr: 1; - volatile uint32_t dma_infifo_full_wm_int_clr: 1; - volatile uint32_t reserved17: 15; + uint32_t rx_start_int_clr: 1; + uint32_t tx_start_int_clr: 1; + uint32_t rx_hung_int_clr: 1; + uint32_t tx_hung_int_clr: 1; + uint32_t in_done_int_clr: 1; + uint32_t in_suc_eof_int_clr: 1; + uint32_t in_err_eof_int_clr: 1; + uint32_t out_done_int_clr: 1; + uint32_t out_eof_int_clr: 1; + uint32_t in_dscr_err_int_clr: 1; + uint32_t out_dscr_err_int_clr: 1; + uint32_t in_dscr_empty_int_clr: 1; + uint32_t outlink_eof_err_int_clr: 1; + uint32_t out_total_eof_int_clr: 1; + uint32_t send_s_q_int_clr: 1; + uint32_t send_a_q_int_clr: 1; + uint32_t dma_infifo_full_wm_int_clr: 1; + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }int_clr; union { struct { - volatile uint32_t out_full: 1; /*1:DMA out link descriptor's fifo is full.*/ - volatile uint32_t out_empty: 1; /*1:DMA in link descriptor's fifo is empty.*/ - volatile uint32_t reserved2: 30; + uint32_t out_full: 1; /*1:DMA out link descriptor's fifo is full.*/ + uint32_t out_empty: 1; /*1:DMA in link descriptor's fifo is empty.*/ + uint32_t reserved2: 30; }; - volatile uint32_t val; + uint32_t val; }dma_out_status; union { struct { - volatile uint32_t outfifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ - volatile uint32_t reserved9: 7; - volatile uint32_t outfifo_push: 1; /*Set this bit to push data in out link descriptor's fifo.*/ - volatile uint32_t reserved17: 15; + uint32_t outfifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ + uint32_t reserved9: 7; + uint32_t outfifo_push: 1; /*Set this bit to push data in out link descriptor's fifo.*/ + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }dma_out_push; union { struct { - volatile uint32_t in_full: 1; - volatile uint32_t in_empty: 1; - volatile uint32_t reserved2: 2; - volatile uint32_t rx_err_cause: 3; /*This register stores the errors caused in out link descriptor's data packet.*/ - volatile uint32_t reserved7: 25; + uint32_t in_full: 1; + uint32_t in_empty: 1; + uint32_t reserved2: 2; + uint32_t rx_err_cause: 3; /*This register stores the errors caused in out link descriptor's data packet.*/ + uint32_t reserved7: 25; }; - volatile uint32_t val; + uint32_t val; }dma_in_status; union { struct { - volatile uint32_t infifo_rdata:12; /*This register stores the data pop from in link descriptor's fifo.*/ - volatile uint32_t reserved12: 4; - volatile uint32_t infifo_pop: 1; /*Set this bit to pop data in in link descriptor's fifo.*/ - volatile uint32_t reserved17: 15; + uint32_t infifo_rdata:12; /*This register stores the data pop from in link descriptor's fifo.*/ + uint32_t reserved12: 4; + uint32_t infifo_pop: 1; /*Set this bit to pop data in in link descriptor's fifo.*/ + uint32_t reserved17: 15; }; - volatile uint32_t val; + uint32_t val; }dma_in_pop; union { struct { - volatile uint32_t outlink_addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ - volatile uint32_t reserved20: 8; - volatile uint32_t outlink_stop: 1; /*Set this bit to stop dealing with the out link descriptors.*/ - volatile uint32_t outlink_start: 1; /*Set this bit to start dealing with the out link descriptors.*/ - volatile uint32_t outlink_restart: 1; /*Set this bit to mount on new out link descriptors*/ - volatile uint32_t outlink_park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ + uint32_t outlink_addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ + uint32_t reserved20: 8; + uint32_t outlink_stop: 1; /*Set this bit to stop dealing with the out link descriptors.*/ + uint32_t outlink_start: 1; /*Set this bit to start dealing with the out link descriptors.*/ + uint32_t outlink_restart: 1; /*Set this bit to mount on new out link descriptors*/ + uint32_t outlink_park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ }; - volatile uint32_t val; + uint32_t val; }dma_out_link; union { struct { - volatile uint32_t inlink_addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ - volatile uint32_t inlink_auto_ret: 1; /*1:when a packet is wrong in link descriptor returns to the descriptor which is lately used.*/ - volatile uint32_t reserved21: 7; - volatile uint32_t inlink_stop: 1; /*Set this bit to stop dealing with the in link descriptors.*/ - volatile uint32_t inlink_start: 1; /*Set this bit to start dealing with the in link descriptors.*/ - volatile uint32_t inlink_restart: 1; /*Set this bit to mount on new in link descriptors*/ - volatile uint32_t inlink_park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ + uint32_t inlink_addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ + uint32_t inlink_auto_ret: 1; /*1:when a packet is wrong in link descriptor returns to the descriptor which is lately used.*/ + uint32_t reserved21: 7; + uint32_t inlink_stop: 1; /*Set this bit to stop dealing with the in link descriptors.*/ + uint32_t inlink_start: 1; /*Set this bit to start dealing with the in link descriptors.*/ + uint32_t inlink_restart: 1; /*Set this bit to mount on new in link descriptors*/ + uint32_t inlink_park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ }; - volatile uint32_t val; + uint32_t val; }dma_in_link; union { struct { - volatile uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ - volatile uint32_t check_seq_en: 1; /*Set this bit to enable decoder to check seq num in packet header.*/ - volatile uint32_t crc_disable: 1; /*Set this bit to disable crc calculation.*/ - volatile uint32_t save_head: 1; /*Set this bit to save packet header .*/ - volatile uint32_t tx_check_sum_re: 1; /*Set this bit to enable hardware replace check_sum in packet header automatically.*/ - volatile uint32_t tx_ack_num_re: 1; /*Set this bit to enable hardware replace ack num in packet header automatically.*/ - volatile uint32_t check_owner: 1; /*Set this bit to check the owner bit in link descriptor.*/ - volatile uint32_t wait_sw_start: 1; /*Set this bit to enable software way to add packet header.*/ - volatile uint32_t sw_start: 1; /*Set this bit to start inserting the packet header.*/ - volatile uint32_t dma_infifo_full_thrs:12; /*when data amount in link descriptor's fifo is more than this register value it will produce uhci_dma_infifo_full_wm_int interrupt.*/ - volatile uint32_t reserved21: 11; + uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ + uint32_t check_seq_en: 1; /*Set this bit to enable decoder to check seq num in packet header.*/ + uint32_t crc_disable: 1; /*Set this bit to disable crc calculation.*/ + uint32_t save_head: 1; /*Set this bit to save packet header .*/ + uint32_t tx_check_sum_re: 1; /*Set this bit to enable hardware replace check_sum in packet header automatically.*/ + uint32_t tx_ack_num_re: 1; /*Set this bit to enable hardware replace ack num in packet header automatically.*/ + uint32_t check_owner: 1; /*Set this bit to check the owner bit in link descriptor.*/ + uint32_t wait_sw_start: 1; /*Set this bit to enable software way to add packet header.*/ + uint32_t sw_start: 1; /*Set this bit to start inserting the packet header.*/ + uint32_t dma_infifo_full_thrs:12; /*when data amount in link descriptor's fifo is more than this register value it will produce uhci_dma_infifo_full_wm_int interrupt.*/ + uint32_t reserved21: 11; }; - volatile uint32_t val; + uint32_t val; }conf1; - volatile uint32_t state0; /**/ - volatile uint32_t state1; /**/ - volatile uint32_t dma_out_eof_des_addr; /*This register stores the address of out link description when eof bit in this descriptor is 1.*/ - volatile uint32_t dma_in_suc_eof_des_addr; /*This register stores the address of in link descriptor when eof bit in this descriptor is 1.*/ - volatile uint32_t dma_in_err_eof_des_addr; /*This register stores the address of in link descriptor when there are some errors in this descriptor.*/ - volatile uint32_t dma_out_eof_bfr_des_addr; /*This register stores the address of out link descriptor when there are some errors in this descriptor.*/ + uint32_t state0; /**/ + uint32_t state1; /**/ + uint32_t dma_out_eof_des_addr; /*This register stores the address of out link description when eof bit in this descriptor is 1.*/ + uint32_t dma_in_suc_eof_des_addr; /*This register stores the address of in link descriptor when eof bit in this descriptor is 1.*/ + uint32_t dma_in_err_eof_des_addr; /*This register stores the address of in link descriptor when there are some errors in this descriptor.*/ + uint32_t dma_out_eof_bfr_des_addr; /*This register stores the address of out link descriptor when there are some errors in this descriptor.*/ union { struct { - volatile uint32_t ahb_testmode: 3; /*bit2 is ahb bus test enable ,bit1 is used to choose write(1) or read(0) mode. bit0 is used to choose test only once(1) or continue(0)*/ - volatile uint32_t reserved3: 1; - volatile uint32_t ahb_testaddr: 2; /*The two bits represent ahb bus address bit[20:19]*/ - volatile uint32_t reserved6: 26; + uint32_t ahb_testmode: 3; /*bit2 is ahb bus test enable ,bit1 is used to choose write(1) or read(0) mode. bit0 is used to choose test only once(1) or continue(0)*/ + uint32_t reserved3: 1; + uint32_t ahb_testaddr: 2; /*The two bits represent ahb bus address bit[20:19]*/ + uint32_t reserved6: 26; }; - volatile uint32_t val; + uint32_t val; }ahb_test; - volatile uint32_t dma_in_dscr; /*The content of current in link descriptor's third dword*/ - volatile uint32_t dma_in_dscr_bf0; /*The content of current in link descriptor's first dword*/ - volatile uint32_t dma_in_dscr_bf1; /*The content of current in link descriptor's second dword*/ - volatile uint32_t dma_out_dscr; /*The content of current out link descriptor's third dword*/ - volatile uint32_t dma_out_dscr_bf0; /*The content of current out link descriptor's first dword*/ - volatile uint32_t dma_out_dscr_bf1; /*The content of current out link descriptor's second dword*/ + uint32_t dma_in_dscr; /*The content of current in link descriptor's third dword*/ + uint32_t dma_in_dscr_bf0; /*The content of current in link descriptor's first dword*/ + uint32_t dma_in_dscr_bf1; /*The content of current in link descriptor's second dword*/ + uint32_t dma_out_dscr; /*The content of current out link descriptor's third dword*/ + uint32_t dma_out_dscr_bf0; /*The content of current out link descriptor's first dword*/ + uint32_t dma_out_dscr_bf1; /*The content of current out link descriptor's second dword*/ union { struct { - volatile uint32_t tx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char decode when DMA receives data.*/ - volatile uint32_t tx_db_esc_en: 1; /*Set this bit to enable 0xdb char decode when DMA receives data.*/ - volatile uint32_t tx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 decode when DMA receives data.*/ - volatile uint32_t tx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 decode when DMA receives data.*/ - volatile uint32_t rx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char replace when DMA sends data.*/ - volatile uint32_t rx_db_esc_en: 1; /*Set this bit to enable 0xdb char replace when DMA sends data.*/ - volatile uint32_t rx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 replace when DMA sends data.*/ - volatile uint32_t rx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 replace when DMA sends data.*/ - volatile uint32_t reserved8: 24; + uint32_t tx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char decode when DMA receives data.*/ + uint32_t tx_db_esc_en: 1; /*Set this bit to enable 0xdb char decode when DMA receives data.*/ + uint32_t tx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 decode when DMA receives data.*/ + uint32_t tx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 decode when DMA receives data.*/ + uint32_t rx_c0_esc_en: 1; /*Set this bit to enable 0xc0 char replace when DMA sends data.*/ + uint32_t rx_db_esc_en: 1; /*Set this bit to enable 0xdb char replace when DMA sends data.*/ + uint32_t rx_11_esc_en: 1; /*Set this bit to enable flow control char 0x11 replace when DMA sends data.*/ + uint32_t rx_13_esc_en: 1; /*Set this bit to enable flow control char 0x13 replace when DMA sends data.*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }escape_conf; union { struct { - volatile uint32_t txfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to receive a data it will produce uhci_tx_hung_int interrupt.*/ - volatile uint32_t txfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_txfifo_timeout_shift)*/ - volatile uint32_t txfifo_timeout_ena: 1; /*The enable bit for tx fifo receive data timeout*/ - volatile uint32_t rxfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to read a data from RAM it will produce uhci_rx_hung_int interrupt.*/ - volatile uint32_t rxfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_rxfifo_timeout_shift)*/ - volatile uint32_t rxfifo_timeout_ena: 1; /*This is the enable bit for DMA send data timeout*/ - volatile uint32_t reserved24: 8; + uint32_t txfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to receive a data it will produce uhci_tx_hung_int interrupt.*/ + uint32_t txfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_txfifo_timeout_shift)*/ + uint32_t txfifo_timeout_ena: 1; /*The enable bit for tx fifo receive data timeout*/ + uint32_t rxfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to read a data from RAM it will produce uhci_rx_hung_int interrupt.*/ + uint32_t rxfifo_timeout_shift: 3; /*The tick count is cleared when its value >=(17'd8000>>reg_rxfifo_timeout_shift)*/ + uint32_t rxfifo_timeout_ena: 1; /*This is the enable bit for DMA send data timeout*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }hung_conf; - volatile uint32_t ack_num; /**/ - volatile uint32_t rx_head; /*This register stores the packet header received by DMA*/ + uint32_t ack_num; /**/ + uint32_t rx_head; /*This register stores the packet header received by DMA*/ union { struct { - volatile uint32_t single_send_num: 3; /*The bits are used to choose which short packet*/ - volatile uint32_t single_send_en: 1; /*Set this bit to enable send a short packet*/ - volatile uint32_t always_send_num: 3; /*The bits are used to choose which short packet*/ - volatile uint32_t always_send_en: 1; /*Set this bit to enable continuously send the same short packet*/ - volatile uint32_t reserved8: 24; + uint32_t single_send_num: 3; /*The bits are used to choose which short packet*/ + uint32_t single_send_en: 1; /*Set this bit to enable send a short packet*/ + uint32_t always_send_num: 3; /*The bits are used to choose which short packet*/ + uint32_t always_send_en: 1; /*Set this bit to enable continuously send the same short packet*/ + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }quick_sent; struct{ - volatile uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ + uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ }q_data[7]; union { struct { - volatile uint32_t seper_char: 8; /*This register stores the separator char separator char is used to separate the data frame.*/ - volatile uint32_t seper_esc_char0: 8; /*This register stores the first char used to replace separator char in data.*/ - volatile uint32_t seper_esc_char1: 8; /*This register stores the second char used to replace separator char in data . 0xdc 0xdb replace 0xc0 by default.*/ - volatile uint32_t reserved24: 8; + uint32_t seper_char: 8; /*This register stores the separator char separator char is used to separate the data frame.*/ + uint32_t seper_esc_char0: 8; /*This register stores the first char used to replace separator char in data.*/ + uint32_t seper_esc_char1: 8; /*This register stores the second char used to replace separator char in data . 0xdc 0xdb replace 0xc0 by default.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }esc_conf0; union { struct { - volatile uint32_t esc_seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ - volatile uint32_t esc_seq0_char0: 8; /*This register stores the first char used to replace reg_esc_seq0 in data.*/ - volatile uint32_t esc_seq0_char1: 8; /*This register stores the second char used to replace the reg_esc_seq0 in data*/ - volatile uint32_t reserved24: 8; + uint32_t esc_seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ + uint32_t esc_seq0_char0: 8; /*This register stores the first char used to replace reg_esc_seq0 in data.*/ + uint32_t esc_seq0_char1: 8; /*This register stores the second char used to replace the reg_esc_seq0 in data*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }esc_conf1; union { struct { - volatile uint32_t esc_seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ - volatile uint32_t esc_seq1_char0: 8; /*This register stores the first char used to replace the reg_esc_seq1 in data.*/ - volatile uint32_t esc_seq1_char1: 8; /*This register stores the second char used to replace the reg_esc_seq1 in data.*/ - volatile uint32_t reserved24: 8; + uint32_t esc_seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ + uint32_t esc_seq1_char0: 8; /*This register stores the first char used to replace the reg_esc_seq1 in data.*/ + uint32_t esc_seq1_char1: 8; /*This register stores the second char used to replace the reg_esc_seq1 in data.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }esc_conf2; union { struct { - volatile uint32_t esc_seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ - volatile uint32_t esc_seq2_char0: 8; /*This register stores the first char used to replace the reg_esc_seq2 in data.*/ - volatile uint32_t esc_seq2_char1: 8; /*This register stores the second char used to replace the reg_esc_seq2 in data.*/ - volatile uint32_t reserved24: 8; + uint32_t esc_seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ + uint32_t esc_seq2_char0: 8; /*This register stores the first char used to replace the reg_esc_seq2 in data.*/ + uint32_t esc_seq2_char1: 8; /*This register stores the second char used to replace the reg_esc_seq2 in data.*/ + uint32_t reserved24: 8; }; - volatile uint32_t val; + uint32_t val; }esc_conf3; union { struct { - volatile uint32_t pkt_thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ - volatile uint32_t reserved13:19; + uint32_t pkt_thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ + uint32_t reserved13:19; }; - volatile uint32_t val; + uint32_t val; }pkt_thres; - volatile uint32_t reserved_c4; - volatile uint32_t reserved_c8; - volatile uint32_t reserved_cc; - volatile uint32_t reserved_d0; - volatile uint32_t reserved_d4; - volatile uint32_t reserved_d8; - volatile uint32_t reserved_dc; - volatile uint32_t reserved_e0; - volatile uint32_t reserved_e4; - volatile uint32_t reserved_e8; - volatile uint32_t reserved_ec; - volatile uint32_t reserved_f0; - volatile uint32_t reserved_f4; - volatile uint32_t reserved_f8; - volatile uint32_t date; /*version information*/ + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /*version information*/ } uhci_dev_t; -extern volatile uhci_dev_t UHCI0; -extern volatile uhci_dev_t UHCI1; +extern uhci_dev_t UHCI0; +extern uhci_dev_t UHCI1; #endif /* _SOC_UHCI_STRUCT_H_ */ From 4c74ec9415bdcbc704064a9fef832c256b110ab5 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Sun, 18 Sep 2016 15:35:42 +0800 Subject: [PATCH 018/179] freertos: fix memory debug macro issue Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG --- components/freertos/include/freertos/FreeRTOSConfig.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 95bf1e103a..663f015acd 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -222,7 +222,9 @@ #define INCLUDE_vTaskDelay 1 #define INCLUDE_uxTaskGetStackHighWaterMark 1 -#ifndef configENABLE_MEMORY_DEBUG +#if CONFIG_ENABLE_MEMORY_DEBUG +#define configENABLE_MEMORY_DEBUG 1 +#else #define configENABLE_MEMORY_DEBUG 0 #endif From 4d4c6a36942a0c730940a15091fd91cd7a580010 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sun, 18 Sep 2016 16:43:48 +0800 Subject: [PATCH 019/179] Enable SO_REUSEADDR in LWIP --- components/lwip/include/lwip/port/lwipopts.h | 2 +- components/mbedtls/port/net.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index 65b3889f0b..99520f1cd9 100755 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -405,7 +405,7 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void); /** * SO_REUSE==1: Enable SO_REUSEADDR option. */ -#define SO_REUSE 0 +#define SO_REUSE 1 /* ---------------------------------------- diff --git a/components/mbedtls/port/net.c b/components/mbedtls/port/net.c index 482a11f970..45aa4b2deb 100644 --- a/components/mbedtls/port/net.c +++ b/components/mbedtls/port/net.c @@ -147,7 +147,7 @@ int mbedtls_net_bind( mbedtls_net_context *ctx, const char *bind_ip, const char /*SO_REUSEADDR option dafault is disable in source code(lwip)*/ #if SO_REUSE - n = 1; + int n = 1; if ( setsockopt( ctx->fd, SOL_SOCKET, SO_REUSEADDR, (const char *) &n, sizeof( n ) ) != 0 ) { close( ctx->fd ); From 94bcb14bcce4014e57521af936cb920ae80fdd4c Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Sun, 18 Sep 2016 19:05:37 +0800 Subject: [PATCH 020/179] remove prefix and postfix --- components/esp32/include/soc/gpio_sd_struct.h | 10 +- components/esp32/include/soc/gpio_struct.h | 90 +++--- components/esp32/include/soc/i2c_struct.h | 174 ++++++------ components/esp32/include/soc/i2s_struct.h | 260 ++++++++--------- components/esp32/include/soc/ledc_struct.h | 199 +++++++------ components/esp32/include/soc/pcnt_struct.h | 72 ++--- components/esp32/include/soc/rmt_struct.h | 264 +++++++++--------- components/esp32/include/soc/spi_struct.h | 220 +++++++-------- .../esp32/include/soc/timer_group_struct.h | 120 ++++---- components/esp32/include/soc/uart_struct.h | 214 +++++++------- components/esp32/include/soc/uhci_struct.h | 250 ++++++++--------- 11 files changed, 936 insertions(+), 937 deletions(-) diff --git a/components/esp32/include/soc/gpio_sd_struct.h b/components/esp32/include/soc/gpio_sd_struct.h index d06ad2e9a4..a4ca24fc34 100644 --- a/components/esp32/include/soc/gpio_sd_struct.h +++ b/components/esp32/include/soc/gpio_sd_struct.h @@ -16,33 +16,33 @@ typedef volatile struct { union { struct { - uint32_t sd_in: 8; + uint32_t duty: 8; uint32_t prescale: 8; uint32_t reserved16: 16; }; uint32_t val; - }sigmadelta[8]; + }channel[8]; union { struct { uint32_t reserved0: 31; uint32_t clk_en: 1; }; uint32_t val; - }sigmadelta_cg; + }cg; union { struct { uint32_t reserved0: 31; uint32_t spi_swap: 1; }; uint32_t val; - }sigmadelta_misc; + }misc; union { struct { uint32_t date: 28; uint32_t reserved28: 4; }; uint32_t val; - }sigmadelta_version; + }version; } gpio_sd_dev_t; extern gpio_sd_dev_t SIGMADELTA; #endif /* _SOC_GPIO_SD_STRUCT_H_ */ diff --git a/components/esp32/include/soc/gpio_struct.h b/components/esp32/include/soc/gpio_struct.h index 080d638e92..649a17ff02 100644 --- a/components/esp32/include/soc/gpio_struct.h +++ b/components/esp32/include/soc/gpio_struct.h @@ -20,28 +20,28 @@ typedef volatile struct { uint32_t out_w1tc; /*GPIO0~31 output value write 1 to clear*/ union { struct { - uint32_t out_data: 8; /*GPIO32~39 output value*/ + uint32_t data: 8; /*GPIO32~39 output value*/ uint32_t reserved8: 24; }; uint32_t val; }out1; union { struct { - uint32_t out_data: 8; /*GPIO32~39 output value write 1 to set*/ + uint32_t data: 8; /*GPIO32~39 output value write 1 to set*/ uint32_t reserved8: 24; }; uint32_t val; }out1_w1ts; union { struct { - uint32_t out_data: 8; /*GPIO32~39 output value write 1 to clear*/ + uint32_t data: 8; /*GPIO32~39 output value write 1 to clear*/ uint32_t reserved8: 24; }; uint32_t val; }out1_w1tc; union { struct { - uint32_t sdio_sel: 8; /*SDIO PADS on/off control from outside*/ + uint32_t sel: 8; /*SDIO PADS on/off control from outside*/ uint32_t reserved8: 24; }; uint32_t val; @@ -51,21 +51,21 @@ typedef volatile struct { uint32_t enable_w1tc; /*GPIO0~31 output enable write 1 to clear*/ union { struct { - uint32_t enable_data: 8; /*GPIO32~39 output enable*/ + uint32_t data: 8; /*GPIO32~39 output enable*/ uint32_t reserved8: 24; }; uint32_t val; }enable1; union { struct { - uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to set*/ + uint32_t data: 8; /*GPIO32~39 output enable write 1 to set*/ uint32_t reserved8: 24; }; uint32_t val; }enable1_w1ts; union { struct { - uint32_t enable_data: 8; /*GPIO32~39 output enable write 1 to clear*/ + uint32_t data: 8; /*GPIO32~39 output enable write 1 to clear*/ uint32_t reserved8: 24; }; uint32_t val; @@ -80,8 +80,8 @@ typedef volatile struct { uint32_t in; /*GPIO0~31 input value*/ union { struct { - uint32_t in_data: 8; /*GPIO32~39 input value*/ - uint32_t reserved8: 24; + uint32_t data: 8; /*GPIO32~39 input value*/ + uint32_t reserved8: 24; }; uint32_t val; }in1; @@ -90,22 +90,22 @@ typedef volatile struct { uint32_t status_w1tc; /*GPIO0~31 interrupt status write 1 to clear*/ union { struct { - uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status*/ - uint32_t reserved8: 24; + uint32_t intr_st: 8; /*GPIO32~39 interrupt status*/ + uint32_t reserved8: 24; }; uint32_t val; }status1; union { struct { - uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to set*/ - uint32_t reserved8: 24; + uint32_t intr_st: 8; /*GPIO32~39 interrupt status write 1 to set*/ + uint32_t reserved8: 24; }; uint32_t val; }status1_w1ts; union { struct { - uint32_t status_interrupt: 8; /*GPIO32~39 interrupt status write 1 to clear*/ - uint32_t reserved8: 24; + uint32_t intr_st: 8; /*GPIO32~39 interrupt status write 1 to clear*/ + uint32_t reserved8: 24; }; uint32_t val; }status1_w1tc; @@ -117,85 +117,85 @@ typedef volatile struct { uint32_t cpusdio_int; /*SDIO's extent GPIO0~31 interrupt*/ union { struct { - uint32_t appcpu_int: 8; /*GPIO32~39 APP CPU interrupt status*/ + uint32_t intr: 8; /*GPIO32~39 APP CPU interrupt status*/ uint32_t reserved8: 24; }; uint32_t val; }acpu_int1; union { struct { - uint32_t appcpu_nmi_int: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ - uint32_t reserved8: 24; + uint32_t intr: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ + uint32_t reserved8: 24; }; uint32_t val; }acpu_nmi_int1; union { struct { - uint32_t procpu_int: 8; /*GPIO32~39 PRO CPU interrupt status*/ + uint32_t intr: 8; /*GPIO32~39 PRO CPU interrupt status*/ uint32_t reserved8: 24; }; uint32_t val; }pcpu_int1; union { struct { - uint32_t procpu_nmi_int: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ - uint32_t reserved8: 24; + uint32_t intr: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ + uint32_t reserved8: 24; }; uint32_t val; }pcpu_nmi_int1; union { struct { - uint32_t sdio_int: 8; /*SDIO's extent GPIO32~39 interrupt*/ + uint32_t intr: 8; /*SDIO's extent GPIO32~39 interrupt*/ uint32_t reserved8: 24; }; uint32_t val; }cpusdio_int1; union { struct { - uint32_t reserved0: 2; - uint32_t pin_pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ - uint32_t reserved3: 4; - uint32_t pin_int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ - uint32_t pin_wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ - uint32_t pin_config: 2; /*NA*/ - uint32_t pin_int_ena: 5; /*bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt enable bit3: PRO CPU interrupt enable bit4: PRO CPU non-maskable interrupt enable bit5: SDIO's extent interrupt enable*/ - uint32_t reserved18: 14; + uint32_t reserved0: 2; + uint32_t pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ + uint32_t reserved3: 4; + uint32_t int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ + uint32_t wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/ + uint32_t config: 2; /*NA*/ + uint32_t int_ena: 5; /*bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt enable bit3: PRO CPU interrupt enable bit4: PRO CPU non-maskable interrupt enable bit5: SDIO's extent interrupt enable*/ + uint32_t reserved18: 14; }; uint32_t val; }pin[40]; union { struct { - uint32_t cali_rtc_max:10; + uint32_t rtc_max: 10; uint32_t reserved10: 21; - uint32_t cali_start: 1; + uint32_t start: 1; }; uint32_t val; }cali_conf; union { struct { - uint32_t cali_value_sync2:20; - uint32_t reserved20: 10; - uint32_t cali_rdy_real: 1; - uint32_t cali_rdy_sync2: 1; + uint32_t value_sync2: 20; + uint32_t reserved20: 10; + uint32_t rdy_real: 1; + uint32_t rdy_sync2: 1; }; uint32_t val; }cali_data; union { struct { - uint32_t func_in_sel: 6; /*select one of the 256 inputs*/ - uint32_t func_in_inv_sel: 1; /*revert the value of the input if you want to revert please set the value to 1*/ - uint32_t sig_in_sel: 1; /*if the slow signal bypass the io matrix or not if you want setting the value to 1*/ - uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ + uint32_t func_sel: 6; /*select one of the 256 inputs*/ + uint32_t sig_in_inv: 1; /*revert the value of the input if you want to revert please set the value to 1*/ + uint32_t sig_in_sel: 1; /*if the slow signal bypass the io matrix or not if you want setting the value to 1*/ + uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ }; uint32_t val; }func_in_sel_cfg[256]; union { struct { - uint32_t func_out_sel: 9; /*select one of the 256 output to 40 GPIO*/ - uint32_t func_out_inv_sel: 1; /*invert the output value if you want to revert the output value setting the value to 1*/ - uint32_t func_oen_sel: 1; /*weather using the logical oen signal or not using the value setting by the register*/ - uint32_t func_oen_inv_sel: 1; /*invert the output enable value if you want to revert the output enable value setting the value to 1*/ - uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ + uint32_t func_sel: 9; /*select one of the 256 output to 40 GPIO*/ + uint32_t inv_sel: 1; /*invert the output value if you want to revert the output value setting the value to 1*/ + uint32_t oen_sel: 1; /*weather using the logical oen signal or not using the value setting by the register*/ + uint32_t oen_inv_sel: 1; /*invert the output enable value if you want to revert the output enable value setting the value to 1*/ + uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ }; uint32_t val; }func_out_sel_cfg[40]; diff --git a/components/esp32/include/soc/i2c_struct.h b/components/esp32/include/soc/i2c_struct.h index 99c0e9743d..d6917e7fdc 100644 --- a/components/esp32/include/soc/i2c_struct.h +++ b/components/esp32/include/soc/i2c_struct.h @@ -58,29 +58,29 @@ typedef volatile struct { }status_reg; union { struct { - uint32_t time_out: 20; /*This register is used to configure the max clock number of receiving a data.*/ + uint32_t tout: 20; /*This register is used to configure the max clock number of receiving a data.*/ uint32_t reserved20:12; }; uint32_t val; }timeout; union { struct { - uint32_t slave_addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ - uint32_t reserved15: 16; - uint32_t addr_10bit_en: 1; /*This register is used to enable slave 10bit address mode.*/ + uint32_t addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ + uint32_t reserved15: 16; + uint32_t en_10bit: 1; /*This register is used to enable slave 10bit address mode.*/ }; uint32_t val; }slave_addr; union { struct { - uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ - uint32_t rx_fifo_end_addr: 5; /*This is the offset address of the first receiving data as described in nonfifo_rx_thres_register.*/ - uint32_t tx_fifo_start_addr: 5; /*This is the offset address of the first sending data as described in nonfifo_tx_thres register.*/ - uint32_t tx_fifo_end_addr: 5; /*This is the offset address of the last sending data as described in nonfifo_tx_thres register.*/ + uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ + uint32_t rx_fifo_end_addr: 5; /*This is the offset address of the first receiving data as described in nonfifo_rx_thres_register.*/ + uint32_t tx_fifo_start_addr: 5; /*This is the offset address of the first sending data as described in nonfifo_tx_thres register.*/ + uint32_t tx_fifo_end_addr: 5; /*This is the offset address of the last sending data as described in nonfifo_tx_thres register.*/ uint32_t reserved20: 12; }; uint32_t val; - }rx_fifo_st; + }fifo_st; union { struct { uint32_t rx_fifo_full_thrhd: 5; @@ -97,150 +97,150 @@ typedef volatile struct { }fifo_conf; union { struct { - uint32_t fifo_rdata: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ + uint32_t data: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ uint32_t reserved8: 24; }; uint32_t val; }fifo_data; union { struct { - uint32_t rx_fifo_full_int_raw: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ - uint32_t tx_fifo_empty_int_raw: 1; /*The raw interrupt status bit for tx_fifo empty when use apb fifo access.*/ - uint32_t rx_fifo_ovf_int_raw: 1; /*The raw interrupt status bit for receiving data overflow when use apb fifo access.*/ - uint32_t end_detect_int_raw: 1; /*The raw interrupt status bit for end_detect_int interrupt. when I2C deals with the END command it will produce end_detect_int interrupt.*/ - uint32_t slave_tran_comp_int_raw: 1; /*The raw interrupt status bit for slave_tran_comp_int interrupt. when I2C Slave detects the STOP bit it will produce slave_tran_comp_int interrupt.*/ - uint32_t arbitration_lost_int_raw: 1; /*The raw interrupt status bit for arbitration_lost_int interrupt.when I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ - uint32_t master_tran_comp_int_raw: 1; /*The raw interrupt status bit for master_tra_comp_int interrupt. when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ - uint32_t trans_complete_int_raw: 1; /*The raw interrupt status bit for trans_complete_int interrupt. when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ - uint32_t time_out_int_raw: 1; /*The raw interrupt status bit for time_out_int interrupt. when I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ - uint32_t trans_start_int_raw: 1; /*The raw interrupt status bit for trans_start_int interrupt. when I2C sends the START bit it will produce trans_start_int interrupt.*/ - uint32_t ack_err_int_raw: 1; /*The raw interrupt status bit for ack_err_int interrupt. when I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ - uint32_t rx_rec_full_int_raw: 1; /*The raw interrupt status bit for rx_rec_full_int interrupt. when I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ - uint32_t tx_send_empty_int_raw: 1; /*The raw interrupt status bit for tx_send_empty_int interrupt.when I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ - uint32_t reserved13: 19; + uint32_t rx_fifo_full: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ + uint32_t tx_fifo_empty: 1; /*The raw interrupt status bit for tx_fifo empty when use apb fifo access.*/ + uint32_t rx_fifo_ovf: 1; /*The raw interrupt status bit for receiving data overflow when use apb fifo access.*/ + uint32_t end_detect: 1; /*The raw interrupt status bit for end_detect_int interrupt. when I2C deals with the END command it will produce end_detect_int interrupt.*/ + uint32_t slave_tran_comp: 1; /*The raw interrupt status bit for slave_tran_comp_int interrupt. when I2C Slave detects the STOP bit it will produce slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost: 1; /*The raw interrupt status bit for arbitration_lost_int interrupt.when I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp: 1; /*The raw interrupt status bit for master_tra_comp_int interrupt. when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ + uint32_t trans_complete: 1; /*The raw interrupt status bit for trans_complete_int interrupt. when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ + uint32_t time_out: 1; /*The raw interrupt status bit for time_out_int interrupt. when I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ + uint32_t trans_start: 1; /*The raw interrupt status bit for trans_start_int interrupt. when I2C sends the START bit it will produce trans_start_int interrupt.*/ + uint32_t ack_err: 1; /*The raw interrupt status bit for ack_err_int interrupt. when I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ + uint32_t rx_rec_full: 1; /*The raw interrupt status bit for rx_rec_full_int interrupt. when I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty: 1; /*The raw interrupt status bit for tx_send_empty_int interrupt.when I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ + uint32_t reserved13: 19; }; uint32_t val; }int_raw; union { struct { - uint32_t rx_fifo_full_int_clr: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ - uint32_t tx_fifo_empty_int_clr: 1; /*Set this bit to clear the tx_fifo_empty_int interrupt.*/ - uint32_t rx_fifo_ovf_int_clr: 1; /*Set this bit to clear the rx_fifo_ovf_int interrupt.*/ - uint32_t end_detect_int_clr: 1; /*Set this bit to clear the end_detect_int interrupt.*/ - uint32_t slave_tran_comp_int_clr: 1; /*Set this bit to clear the slave_tran_comp_int interrupt.*/ - uint32_t arbitration_lost_int_clr: 1; /*Set this bit to clear the arbitration_lost_int interrupt.*/ - uint32_t master_tran_comp_int_clr: 1; /*Set this bit to clear the master_tran_comp interrupt.*/ - uint32_t trans_complete_int_clr: 1; /*Set this bit to clear the trans_complete_int interrupt.*/ - uint32_t time_out_int_clr: 1; /*Set this bit to clear the time_out_int interrupt.*/ - uint32_t trans_start_int_clr: 1; /*Set this bit to clear the trans_start_int interrupt.*/ - uint32_t ack_err_int_clr: 1; /*Set this bit to clear the ack_err_int interrupt.*/ - uint32_t rx_rec_full_int_clr: 1; /*Set this bit to clear the rx_rec_full_int interrupt.*/ - uint32_t tx_send_empty_int_clr: 1; /*Set this bit to clear the tx_send_empty_int interrupt.*/ - uint32_t reserved13: 19; + uint32_t rx_fifo_full: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty: 1; /*Set this bit to clear the tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf: 1; /*Set this bit to clear the rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect: 1; /*Set this bit to clear the end_detect_int interrupt.*/ + uint32_t slave_tran_comp: 1; /*Set this bit to clear the slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost: 1; /*Set this bit to clear the arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp: 1; /*Set this bit to clear the master_tran_comp interrupt.*/ + uint32_t trans_complete: 1; /*Set this bit to clear the trans_complete_int interrupt.*/ + uint32_t time_out: 1; /*Set this bit to clear the time_out_int interrupt.*/ + uint32_t trans_start: 1; /*Set this bit to clear the trans_start_int interrupt.*/ + uint32_t ack_err: 1; /*Set this bit to clear the ack_err_int interrupt.*/ + uint32_t rx_rec_full: 1; /*Set this bit to clear the rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty: 1; /*Set this bit to clear the tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; uint32_t val; }int_clr; union { struct { - uint32_t rx_fifo_full_int_ena: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ - uint32_t tx_fifo_empty_int_ena: 1; /*The enable bit for tx_fifo_empty_int interrupt.*/ - uint32_t rx_fifo_ovf_int_ena: 1; /*The enable bit for rx_fifo_ovf_int interrupt.*/ - uint32_t end_detect_int_ena: 1; /*The enable bit for end_detect_int interrupt.*/ - uint32_t slave_tran_comp_int_ena: 1; /*The enable bit for slave_tran_comp_int interrupt.*/ - uint32_t arbitration_lost_int_ena: 1; /*The enable bit for arbitration_lost_int interrupt.*/ - uint32_t master_tran_comp_int_ena: 1; /*The enable bit for master_tran_comp_int interrupt.*/ - uint32_t trans_complete_int_ena: 1; /*The enable bit for trans_complete_int interrupt.*/ - uint32_t time_out_int_ena: 1; /*The enable bit for time_out_int interrupt.*/ - uint32_t trans_start_int_ena: 1; /*The enable bit for trans_start_int interrupt.*/ - uint32_t ack_err_int_ena: 1; /*The enable bit for ack_err_int interrupt.*/ - uint32_t rx_rec_full_int_ena: 1; /*The enable bit for rx_rec_full_int interrupt.*/ - uint32_t tx_send_empty_int_ena: 1; /*The enable bit for tx_send_empty_int interrupt.*/ - uint32_t reserved13: 19; + uint32_t rx_fifo_full: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty: 1; /*The enable bit for tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf: 1; /*The enable bit for rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect: 1; /*The enable bit for end_detect_int interrupt.*/ + uint32_t slave_tran_comp: 1; /*The enable bit for slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost: 1; /*The enable bit for arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp: 1; /*The enable bit for master_tran_comp_int interrupt.*/ + uint32_t trans_complete: 1; /*The enable bit for trans_complete_int interrupt.*/ + uint32_t time_out: 1; /*The enable bit for time_out_int interrupt.*/ + uint32_t trans_start: 1; /*The enable bit for trans_start_int interrupt.*/ + uint32_t ack_err: 1; /*The enable bit for ack_err_int interrupt.*/ + uint32_t rx_rec_full: 1; /*The enable bit for rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty: 1; /*The enable bit for tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; uint32_t val; }int_ena; union { struct { - uint32_t rx_fifo_full_int_st: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ - uint32_t tx_fifo_empty_int_st: 1; /*The masked interrupt status for tx_fifo_empty_int interrupt.*/ - uint32_t rx_fifo_ovf_int_st: 1; /*The masked interrupt status for rx_fifo_ovf_int interrupt.*/ - uint32_t end_detect_int_st: 1; /*The masked interrupt status for end_detect_int interrupt.*/ - uint32_t slave_tran_comp_int_st: 1; /*The masked interrupt status for slave_tran_comp_int interrupt.*/ - uint32_t arbitration_lost_int_st: 1; /*The masked interrupt status for arbitration_lost_int interrupt.*/ - uint32_t master_tran_comp_int_st: 1; /*The masked interrupt status for master_tran_comp_int interrupt.*/ - uint32_t trans_complete_int_st: 1; /*The masked interrupt status for trans_complete_int interrupt.*/ - uint32_t time_out_int_st: 1; /*The masked interrupt status for time_out_int interrupt.*/ - uint32_t trans_start_int_st: 1; /*The masked interrupt status for trans_start_int interrupt.*/ - uint32_t ack_err_int_st: 1; /*The masked interrupt status for ack_err_int interrupt.*/ - uint32_t rx_rec_full_int_st: 1; /*The masked interrupt status for rx_rec_full_int interrupt.*/ - uint32_t tx_send_empty_int_st: 1; /*The masked interrupt status for tx_send_empty_int interrupt.*/ - uint32_t reserved13: 19; + uint32_t rx_fifo_full: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ + uint32_t tx_fifo_empty: 1; /*The masked interrupt status for tx_fifo_empty_int interrupt.*/ + uint32_t rx_fifo_ovf: 1; /*The masked interrupt status for rx_fifo_ovf_int interrupt.*/ + uint32_t end_detect: 1; /*The masked interrupt status for end_detect_int interrupt.*/ + uint32_t slave_tran_comp: 1; /*The masked interrupt status for slave_tran_comp_int interrupt.*/ + uint32_t arbitration_lost: 1; /*The masked interrupt status for arbitration_lost_int interrupt.*/ + uint32_t master_tran_comp: 1; /*The masked interrupt status for master_tran_comp_int interrupt.*/ + uint32_t trans_complete: 1; /*The masked interrupt status for trans_complete_int interrupt.*/ + uint32_t time_out: 1; /*The masked interrupt status for time_out_int interrupt.*/ + uint32_t trans_start: 1; /*The masked interrupt status for trans_start_int interrupt.*/ + uint32_t ack_err: 1; /*The masked interrupt status for ack_err_int interrupt.*/ + uint32_t rx_rec_full: 1; /*The masked interrupt status for rx_rec_full_int interrupt.*/ + uint32_t tx_send_empty: 1; /*The masked interrupt status for tx_send_empty_int interrupt.*/ + uint32_t reserved13: 19; }; uint32_t val; }int_status; union { struct { - uint32_t sda_hold_time:10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ - uint32_t reserved10: 22; + uint32_t time: 10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ + uint32_t reserved10: 22; }; uint32_t val; }sda_hold; union { struct { - uint32_t sda_sample_time:10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ - uint32_t reserved10: 22; + uint32_t time: 10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ + uint32_t reserved10: 22; }; uint32_t val; }sda_sample; union { struct { - uint32_t scl_high_period:14; /*This register is used to configure the clock num during SCL is low level.*/ - uint32_t reserved14: 18; + uint32_t period: 14; /*This register is used to configure the clock num during SCL is low level.*/ + uint32_t reserved14: 18; }; uint32_t val; }scl_high_period; uint32_t reserved_3c; union { struct { - uint32_t scl_start_hold_time:10; /*This register is used to configure the clock num between the negedge of SDA and negedge of SCL for start mark.*/ - uint32_t reserved10: 22; + uint32_t time: 10; /*This register is used to configure the clock num between the negedge of SDA and negedge of SCL for start mark.*/ + uint32_t reserved10: 22; }; uint32_t val; }scl_start_hold; union { struct { - uint32_t scl_rstart_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ - uint32_t reserved10: 22; + uint32_t time: 10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ + uint32_t reserved10: 22; }; uint32_t val; }scl_rstart_setup; union { struct { - uint32_t scl_stop_hold_time:14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ - uint32_t reserved14: 18; + uint32_t time: 14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ + uint32_t reserved14: 18; }; uint32_t val; }scl_stop_hold; union { struct { - uint32_t scl_stop_setup_time:10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ - uint32_t reserved10: 22; + uint32_t time: 10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ + uint32_t reserved10: 22; }; uint32_t val; }scl_stop_setup; union { struct { - uint32_t scl_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ - uint32_t scl_filter_en: 1; /*This is the filter enable bit for SCL.*/ - uint32_t reserved4: 28; + uint32_t thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + uint32_t en: 1; /*This is the filter enable bit for SCL.*/ + uint32_t reserved4: 28; }; uint32_t val; }scl_filter_cfg; union { struct { - uint32_t sda_filter_thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ - uint32_t sda_filter_en: 1; /*This is the filter enable bit for SDA.*/ - uint32_t reserved4: 28; + uint32_t thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ + uint32_t en: 1; /*This is the filter enable bit for SDA.*/ + uint32_t reserved4: 28; }; uint32_t val; }sda_filter_cfg; @@ -252,7 +252,7 @@ typedef volatile struct { uint32_t ack_val: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ uint32_t op_code: 3; /*op_code is the command 0:RSTART 1:WRITE 2:READ 3:STOP . 4:END.*/ uint32_t reserved14: 17; - uint32_t command_done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ + uint32_t done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ }; uint32_t val; }command[16]; diff --git a/components/esp32/include/soc/i2s_struct.h b/components/esp32/include/soc/i2s_struct.h index 0bf990cd68..e565c6b76f 100644 --- a/components/esp32/include/soc/i2s_struct.h +++ b/components/esp32/include/soc/i2s_struct.h @@ -43,93 +43,93 @@ typedef volatile struct { }conf; union { struct { - uint32_t rx_take_data_int_raw: 1; - uint32_t tx_put_data_int_raw: 1; - uint32_t rx_wfull_int_raw: 1; - uint32_t rx_rempty_int_raw: 1; - uint32_t tx_wfull_int_raw: 1; - uint32_t tx_rempty_int_raw: 1; - uint32_t rx_hung_int_raw: 1; - uint32_t tx_hung_int_raw: 1; - uint32_t in_done_int_raw: 1; - uint32_t in_suc_eof_int_raw: 1; - uint32_t in_err_eof_int_raw: 1; - uint32_t out_done_int_raw: 1; - uint32_t out_eof_int_raw: 1; - uint32_t in_dscr_err_int_raw: 1; - uint32_t out_dscr_err_int_raw: 1; - uint32_t in_dscr_empty_int_raw: 1; - uint32_t out_total_eof_int_raw: 1; - uint32_t reserved17: 15; + uint32_t rx_take_data: 1; + uint32_t tx_put_data: 1; + uint32_t rx_wfull: 1; + uint32_t rx_rempty: 1; + uint32_t tx_wfull: 1; + uint32_t tx_rempty: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t out_total_eof: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_raw; union { struct { - uint32_t rx_take_data_int_st: 1; - uint32_t tx_put_data_int_st: 1; - uint32_t rx_wfull_int_st: 1; - uint32_t rx_rempty_int_st: 1; - uint32_t tx_wfull_int_st: 1; - uint32_t tx_rempty_int_st: 1; - uint32_t rx_hung_int_st: 1; - uint32_t tx_hung_int_st: 1; - uint32_t in_done_int_st: 1; - uint32_t in_suc_eof_int_st: 1; - uint32_t in_err_eof_int_st: 1; - uint32_t out_done_int_st: 1; - uint32_t out_eof_int_st: 1; - uint32_t in_dscr_err_int_st: 1; - uint32_t out_dscr_err_int_st: 1; - uint32_t in_dscr_empty_int_st: 1; - uint32_t out_total_eof_int_st: 1; - uint32_t reserved17: 15; + uint32_t rx_take_data: 1; + uint32_t tx_put_data: 1; + uint32_t rx_wfull: 1; + uint32_t rx_rempty: 1; + uint32_t tx_wfull: 1; + uint32_t tx_rempty: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t out_total_eof: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_st; union { struct { - uint32_t rx_take_data_int_ena: 1; - uint32_t tx_put_data_int_ena: 1; - uint32_t rx_wfull_int_ena: 1; - uint32_t rx_rempty_int_ena: 1; - uint32_t tx_wfull_int_ena: 1; - uint32_t tx_rempty_int_ena: 1; - uint32_t rx_hung_int_ena: 1; - uint32_t tx_hung_int_ena: 1; - uint32_t in_done_int_ena: 1; - uint32_t in_suc_eof_int_ena: 1; - uint32_t in_err_eof_int_ena: 1; - uint32_t out_done_int_ena: 1; - uint32_t out_eof_int_ena: 1; - uint32_t in_dscr_err_int_ena: 1; - uint32_t out_dscr_err_int_ena: 1; - uint32_t in_dscr_empty_int_ena: 1; - uint32_t out_total_eof_int_ena: 1; - uint32_t reserved17: 15; + uint32_t rx_take_data: 1; + uint32_t tx_put_data: 1; + uint32_t rx_wfull: 1; + uint32_t rx_rempty: 1; + uint32_t tx_wfull: 1; + uint32_t tx_rempty: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t out_total_eof: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_ena; union { struct { - uint32_t take_data_int_clr: 1; - uint32_t put_data_int_clr: 1; - uint32_t rx_wfull_int_clr: 1; - uint32_t rx_rempty_int_clr: 1; - uint32_t tx_wfull_int_clr: 1; - uint32_t tx_rempty_int_clr: 1; - uint32_t rx_hung_int_clr: 1; - uint32_t tx_hung_int_clr: 1; - uint32_t in_done_int_clr: 1; - uint32_t in_suc_eof_int_clr: 1; - uint32_t in_err_eof_int_clr: 1; - uint32_t out_done_int_clr: 1; - uint32_t out_eof_int_clr: 1; - uint32_t in_dscr_err_int_clr: 1; - uint32_t out_dscr_err_int_clr: 1; - uint32_t in_dscr_empty_int_clr: 1; - uint32_t out_total_eof_int_clr: 1; - uint32_t reserved17: 15; + uint32_t take_data: 1; + uint32_t put_data: 1; + uint32_t rx_wfull: 1; + uint32_t rx_rempty: 1; + uint32_t tx_wfull: 1; + uint32_t tx_rempty: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t out_total_eof: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_clr; @@ -178,23 +178,23 @@ typedef volatile struct { }conf_chan; union { struct { - uint32_t outlink_addr: 20; - uint32_t reserved20: 8; - uint32_t outlink_stop: 1; - uint32_t outlink_start: 1; - uint32_t outlink_restart: 1; - uint32_t outlink_park: 1; + uint32_t addr: 20; + uint32_t reserved20: 8; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; }; uint32_t val; }out_link; union { struct { - uint32_t inlink_addr: 20; - uint32_t reserved20: 8; - uint32_t inlink_stop: 1; - uint32_t inlink_start: 1; - uint32_t inlink_restart: 1; - uint32_t inlink_park: 1; + uint32_t addr: 20; + uint32_t reserved20: 8; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; }; uint32_t val; }in_link; @@ -203,10 +203,10 @@ typedef volatile struct { uint32_t out_eof_bfr_des_addr; union { struct { - uint32_t ahb_testmode: 3; - uint32_t reserved3: 1; - uint32_t ahb_testaddr: 2; - uint32_t reserved6: 26; + uint32_t mode: 3; + uint32_t reserved3: 1; + uint32_t addr: 2; + uint32_t reserved6: 26; }; uint32_t val; }ahb_test; @@ -238,19 +238,19 @@ typedef volatile struct { }lc_conf; union { struct { - uint32_t out_fifo_wdata: 9; - uint32_t reserved9: 7; - uint32_t out_fifo_push: 1; - uint32_t reserved17: 15; + uint32_t wdata: 9; + uint32_t reserved9: 7; + uint32_t push: 1; + uint32_t reserved17: 15; }; uint32_t val; }out_fifo_push; union { struct { - uint32_t in_fifo_rdata:12; - uint32_t reserved12: 4; - uint32_t in_fifo_pop: 1; - uint32_t reserved17: 15; + uint32_t rdata: 12; + uint32_t reserved12: 4; + uint32_t pop: 1; + uint32_t reserved17: 15; }; uint32_t val; }in_fifo_pop; @@ -258,10 +258,10 @@ typedef volatile struct { uint32_t lc_state1; union { struct { - uint32_t lc_fifo_timeout: 8; - uint32_t lc_fifo_timeout_shift: 3; - uint32_t lc_fifo_timeout_ena: 1; - uint32_t reserved12: 20; + uint32_t fifo_timeout: 8; + uint32_t fifo_timeout_shift: 3; + uint32_t fifo_timeout_ena: 1; + uint32_t reserved12: 20; }; uint32_t val; }lc_hung_conf; @@ -269,15 +269,15 @@ typedef volatile struct { uint32_t reserved_7c; union { struct { - uint32_t cvsd_y_max:16; - uint32_t cvsd_y_min:16; + uint32_t y_max:16; + uint32_t y_min:16; }; uint32_t val; }cvsd_conf0; union { struct { - uint32_t cvsd_sigma_max:16; - uint32_t cvsd_sigma_min:16; + uint32_t sigma_max:16; + uint32_t sigma_min:16; }; uint32_t val; }cvsd_conf1; @@ -323,23 +323,23 @@ typedef volatile struct { }plc_conf2; union { struct { - uint32_t esco_en: 1; - uint32_t esco_chan_mod: 1; - uint32_t esco_cvsd_dec_pack_err: 1; - uint32_t esco_cvsd_pack_len_8k: 5; - uint32_t esco_cvsd_inf_en: 1; - uint32_t cvsd_dec_start: 1; - uint32_t cvsd_dec_reset: 1; - uint32_t plc_en: 1; - uint32_t plc2dma_en: 1; - uint32_t reserved13: 19; + uint32_t en: 1; + uint32_t chan_mod: 1; + uint32_t cvsd_dec_pack_err: 1; + uint32_t cvsd_pack_len_8k: 5; + uint32_t cvsd_inf_en: 1; + uint32_t cvsd_dec_start: 1; + uint32_t cvsd_dec_reset: 1; + uint32_t plc_en: 1; + uint32_t plc2dma_en: 1; + uint32_t reserved13: 19; }; uint32_t val; }esco_conf0; union { struct { - uint32_t sco_with_en: 1; - uint32_t sco_no_en: 1; + uint32_t with_en: 1; + uint32_t no_en: 1; uint32_t cvsd_enc_start: 1; uint32_t cvsd_enc_reset: 1; uint32_t reserved4: 28; @@ -388,7 +388,7 @@ typedef volatile struct { uint32_t clkm_div_b: 6; uint32_t clkm_div_a: 6; uint32_t clk_en: 1; - uint32_t clka_ena: 1; + uint32_t clka_en: 1; uint32_t reserved22: 10; }; uint32_t val; @@ -405,19 +405,19 @@ typedef volatile struct { }sample_rate_conf; union { struct { - uint32_t tx_pdm_en: 1; - uint32_t rx_pdm_en: 1; - uint32_t pcm2pdm_conv_en: 1; - uint32_t pdm2pcm_conv_en: 1; - uint32_t tx_pdm_sinc_osr2: 4; - uint32_t tx_pdm_prescale: 8; - uint32_t tx_pdm_hp_in_shift: 2; - uint32_t tx_pdm_lp_in_shift: 2; - uint32_t tx_pdm_sinc_in_shift: 2; - uint32_t tx_pdm_sigmadelta_in_shift: 2; - uint32_t rx_pdm_sinc_dsr_16_en: 1; - uint32_t tx_pdm_hp_bypass: 1; - uint32_t reserved26: 6; + uint32_t tx_pdm_en: 1; + uint32_t rx_pdm_en: 1; + uint32_t pcm2pdm_conv_en: 1; + uint32_t pdm2pcm_conv_en: 1; + uint32_t tx_sinc_osr2: 4; + uint32_t tx_prescale: 8; + uint32_t tx_hp_in_shift: 2; + uint32_t tx_lp_in_shift: 2; + uint32_t tx_sinc_in_shift: 2; + uint32_t tx_sigmadelta_in_shift: 2; + uint32_t rx_sinc_dsr_16_en: 1; + uint32_t txhp_bypass: 1; + uint32_t reserved26: 6; }; uint32_t val; }pdm_conf; diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index 2eb316b953..26ddf6867e 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -143,121 +143,120 @@ typedef volatile struct { }low_speed_timer[4]; union { struct { - uint32_t hstimer0_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ - uint32_t hstimer1_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel1 counter overflow.*/ - uint32_t hstimer2_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel2 counter overflow.*/ - uint32_t hstimer3_ovf_int_raw: 1; /*The interrupt raw bit for high speed channel3 counter overflow.*/ - uint32_t lstimer0_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ - uint32_t lstimer1_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ - uint32_t lstimer2_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ - uint32_t lstimer3_ovf_int_raw: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ - uint32_t duty_chng_end_hsch0_int_raw: 1; /*The interrupt raw bit for high speed channel 0 duty change done.*/ - uint32_t duty_chng_end_hsch1_int_raw: 1; /*The interrupt raw bit for high speed channel 1 duty change done.*/ - uint32_t duty_chng_end_hsch2_int_raw: 1; /*The interrupt raw bit for high speed channel 2 duty change done.*/ - uint32_t duty_chng_end_hsch3_int_raw: 1; /*The interrupt raw bit for high speed channel 3 duty change done.*/ - uint32_t duty_chng_end_hsch4_int_raw: 1; /*The interrupt raw bit for high speed channel 4 duty change done.*/ - uint32_t duty_chng_end_hsch5_int_raw: 1; /*The interrupt raw bit for high speed channel 5 duty change done.*/ - uint32_t duty_chng_end_hsch6_int_raw: 1; /*The interrupt raw bit for high speed channel 6 duty change done.*/ - uint32_t duty_chng_end_hsch7_int_raw: 1; /*The interrupt raw bit for high speed channel 7 duty change done.*/ - uint32_t duty_chng_end_lsch0_int_raw: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ - uint32_t duty_chng_end_lsch1_int_raw: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ - uint32_t duty_chng_end_lsch2_int_raw: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ - uint32_t duty_chng_end_lsch3_int_raw: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ - uint32_t duty_chng_end_lsch4_int_raw: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ - uint32_t duty_chng_end_lsch5_int_raw: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ - uint32_t duty_chng_end_lsch6_int_raw: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ - uint32_t duty_chng_end_lsch7_int_raw: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ - uint32_t reserved24: 8; + uint32_t hstimer0_ovf: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ + uint32_t hstimer1_ovf: 1; /*The interrupt raw bit for high speed channel1 counter overflow.*/ + uint32_t hstimer2_ovf: 1; /*The interrupt raw bit for high speed channel2 counter overflow.*/ + uint32_t hstimer3_ovf: 1; /*The interrupt raw bit for high speed channel3 counter overflow.*/ + uint32_t lstimer0_ovf: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ + uint32_t lstimer1_ovf: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ + uint32_t lstimer2_ovf: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ + uint32_t lstimer3_ovf: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ + uint32_t duty_chng_end_hsch0: 1; /*The interrupt raw bit for high speed channel 0 duty change done.*/ + uint32_t duty_chng_end_hsch1: 1; /*The interrupt raw bit for high speed channel 1 duty change done.*/ + uint32_t duty_chng_end_hsch2: 1; /*The interrupt raw bit for high speed channel 2 duty change done.*/ + uint32_t duty_chng_end_hsch3: 1; /*The interrupt raw bit for high speed channel 3 duty change done.*/ + uint32_t duty_chng_end_hsch4: 1; /*The interrupt raw bit for high speed channel 4 duty change done.*/ + uint32_t duty_chng_end_hsch5: 1; /*The interrupt raw bit for high speed channel 5 duty change done.*/ + uint32_t duty_chng_end_hsch6: 1; /*The interrupt raw bit for high speed channel 6 duty change done.*/ + uint32_t duty_chng_end_hsch7: 1; /*The interrupt raw bit for high speed channel 7 duty change done.*/ + uint32_t duty_chng_end_lsch0: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ + uint32_t duty_chng_end_lsch1: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ + uint32_t duty_chng_end_lsch2: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ + uint32_t duty_chng_end_lsch3: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ + uint32_t duty_chng_end_lsch4: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ + uint32_t duty_chng_end_lsch5: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ + uint32_t duty_chng_end_lsch6: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ + uint32_t duty_chng_end_lsch7: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ + uint32_t reserved24: 8; }; uint32_t val; }int_raw; union { struct { - uint32_t hstimer0_ovf_int_st: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ - uint32_t hstimer1_ovf_int_st: 1; /*The interrupt status bit for high speed channel1 counter overflow event.*/ - uint32_t hstimer2_ovf_int_st: 1; /*The interrupt status bit for high speed channel2 counter overflow event.*/ - uint32_t hstimer3_ovf_int_st: 1; /*The interrupt status bit for high speed channel3 counter overflow event.*/ - uint32_t lstimer0_ovf_int_st: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ - uint32_t lstimer1_ovf_int_st: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ - uint32_t lstimer2_ovf_int_st: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ - uint32_t lstimer3_ovf_int_st: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ - uint32_t duty_chng_end_hsch0_int_st: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ - uint32_t duty_chng_end_hsch1_int_st: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ - uint32_t duty_chng_end_hsch2_int_st: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ - uint32_t duty_chng_end_hsch3_int_st: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ - uint32_t duty_chng_end_hsch4_int_st: 1; /*The interrupt status bit for high speed channel 4 duty change done event.*/ - uint32_t duty_chng_end_hsch5_int_st: 1; /*The interrupt status bit for high speed channel 5 duty change done event.*/ - uint32_t duty_chng_end_hsch6_int_st: 1; /*The interrupt status bit for high speed channel 6 duty change done event.*/ - uint32_t duty_chng_end_hsch7_int_st: 1; /*The interrupt status bit for high speed channel 7 duty change done event.*/ - uint32_t duty_chng_end_lsch0_int_st: 1; /*The interrupt status bit for low speed channel 0 duty change done event.*/ - uint32_t duty_chng_end_lsch1_int_st: 1; /*The interrupt status bit for low speed channel 1 duty change done event.*/ - uint32_t duty_chng_end_lsch2_int_st: 1; /*The interrupt status bit for low speed channel 2 duty change done event.*/ - uint32_t duty_chng_end_lsch3_int_st: 1; /*The interrupt status bit for low speed channel 3 duty change done event.*/ - uint32_t duty_chng_end_lsch4_int_st: 1; /*The interrupt status bit for low speed channel 4 duty change done event.*/ - uint32_t duty_chng_end_lsch5_int_st: 1; /*The interrupt status bit for low speed channel 5 duty change done event.*/ - uint32_t duty_chng_end_lsch6_int_st: 1; /*The interrupt status bit for low speed channel 6 duty change done event.*/ - uint32_t duty_chng_end_lsch7_int_st: 1; /*The interrupt status bit for low speed channel 7 duty change done event*/ - uint32_t reserved24: 8; + uint32_t hstimer0_ovf: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ + uint32_t hstimer1_ovf: 1; /*The interrupt status bit for high speed channel1 counter overflow event.*/ + uint32_t hstimer2_ovf: 1; /*The interrupt status bit for high speed channel2 counter overflow event.*/ + uint32_t hstimer3_ovf: 1; /*The interrupt status bit for high speed channel3 counter overflow event.*/ + uint32_t lstimer0_ovf: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ + uint32_t lstimer1_ovf: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ + uint32_t lstimer2_ovf: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ + uint32_t lstimer3_ovf: 1; /*The interrupt status bit for low speed channel3 counter overflow event.* uint32_t duty_chng_end_hsch0: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ + uint32_t duty_chng_end_hsch1: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ + uint32_t duty_chng_end_hsch2: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ + uint32_t duty_chng_end_hsch3: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ + uint32_t duty_chng_end_hsch4: 1; /*The interrupt status bit for high speed channel 4 duty change done event.*/ + uint32_t duty_chng_end_hsch5: 1; /*The interrupt status bit for high speed channel 5 duty change done event.*/ + uint32_t duty_chng_end_hsch6: 1; /*The interrupt status bit for high speed channel 6 duty change done event.*/ + uint32_t duty_chng_end_hsch7: 1; /*The interrupt status bit for high speed channel 7 duty change done event.*/ + uint32_t duty_chng_end_lsch0: 1; /*The interrupt status bit for low speed channel 0 duty change done event.*/ + uint32_t duty_chng_end_lsch1: 1; /*The interrupt status bit for low speed channel 1 duty change done event.*/ + uint32_t duty_chng_end_lsch2: 1; /*The interrupt status bit for low speed channel 2 duty change done event.*/ + uint32_t duty_chng_end_lsch3: 1; /*The interrupt status bit for low speed channel 3 duty change done event.*/ + uint32_t duty_chng_end_lsch4: 1; /*The interrupt status bit for low speed channel 4 duty change done event.*/ + uint32_t duty_chng_end_lsch5: 1; /*The interrupt status bit for low speed channel 5 duty change done event.*/ + uint32_t duty_chng_end_lsch6: 1; /*The interrupt status bit for low speed channel 6 duty change done event.*/ + uint32_t duty_chng_end_lsch7: 1; /*The interrupt status bit for low speed channel 7 duty change done event*/ + uint32_t reserved24: 8; }; uint32_t val; }int_st; union { struct { - uint32_t hstimer0_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ - uint32_t hstimer1_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel1 counter overflow interrupt.*/ - uint32_t hstimer2_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel2 counter overflow interrupt.*/ - uint32_t hstimer3_ovf_int_ena: 1; /*The interrupt enable bit for high speed channel3 counter overflow interrupt.*/ - uint32_t lstimer0_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel0 counter overflow interrupt.*/ - uint32_t lstimer1_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel1 counter overflow interrupt.*/ - uint32_t lstimer2_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel2 counter overflow interrupt.*/ - uint32_t lstimer3_ovf_int_ena: 1; /*The interrupt enable bit for low speed channel3 counter overflow interrupt.*/ - uint32_t duty_chng_end_hsch0_int_ena: 1; /*The interrupt enable bit for high speed channel 0 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch1_int_ena: 1; /*The interrupt enable bit for high speed channel 1 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch2_int_ena: 1; /*The interrupt enable bit for high speed channel 2 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch3_int_ena: 1; /*The interrupt enable bit for high speed channel 3 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch4_int_ena: 1; /*The interrupt enable bit for high speed channel 4 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch5_int_ena: 1; /*The interrupt enable bit for high speed channel 5 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch6_int_ena: 1; /*The interrupt enable bit for high speed channel 6 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch7_int_ena: 1; /*The interrupt enable bit for high speed channel 7 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch0_int_ena: 1; /*The interrupt enable bit for low speed channel 0 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch1_int_ena: 1; /*The interrupt enable bit for low speed channel 1 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch2_int_ena: 1; /*The interrupt enable bit for low speed channel 2 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch3_int_ena: 1; /*The interrupt enable bit for low speed channel 3 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch4_int_ena: 1; /*The interrupt enable bit for low speed channel 4 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch5_int_ena: 1; /*The interrupt enable bit for low speed channel 5 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch6_int_ena: 1; /*The interrupt enable bit for low speed channel 6 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch7_int_ena: 1; /*The interrupt enable bit for low speed channel 7 duty change done interrupt.*/ - uint32_t reserved24: 8; + uint32_t hstimer0_ovf: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ + uint32_t hstimer1_ovf: 1; /*The interrupt enable bit for high speed channel1 counter overflow interrupt.*/ + uint32_t hstimer2_ovf: 1; /*The interrupt enable bit for high speed channel2 counter overflow interrupt.*/ + uint32_t hstimer3_ovf: 1; /*The interrupt enable bit for high speed channel3 counter overflow interrupt.*/ + uint32_t lstimer0_ovf: 1; /*The interrupt enable bit for low speed channel0 counter overflow interrupt.*/ + uint32_t lstimer1_ovf: 1; /*The interrupt enable bit for low speed channel1 counter overflow interrupt.*/ + uint32_t lstimer2_ovf: 1; /*The interrupt enable bit for low speed channel2 counter overflow interrupt.*/ + uint32_t lstimer3_ovf: 1; /*The interrupt enable bit for low speed channel3 counter overflow interrupt.*/ + uint32_t duty_chng_end_hsch0: 1; /*The interrupt enable bit for high speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch1: 1; /*The interrupt enable bit for high speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch2: 1; /*The interrupt enable bit for high speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch3: 1; /*The interrupt enable bit for high speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch4: 1; /*The interrupt enable bit for high speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch5: 1; /*The interrupt enable bit for high speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch6: 1; /*The interrupt enable bit for high speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch7: 1; /*The interrupt enable bit for high speed channel 7 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch0: 1; /*The interrupt enable bit for low speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch1: 1; /*The interrupt enable bit for low speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch2: 1; /*The interrupt enable bit for low speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch3: 1; /*The interrupt enable bit for low speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch4: 1; /*The interrupt enable bit for low speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch5: 1; /*The interrupt enable bit for low speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch6: 1; /*The interrupt enable bit for low speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch7: 1; /*The interrupt enable bit for low speed channel 7 duty change done interrupt.*/ + uint32_t reserved24: 8; }; uint32_t val; }int_ena; union { struct { - uint32_t hstimer0_ovf_int_clr: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ - uint32_t hstimer1_ovf_int_clr: 1; /*Set this bit to clear high speed channel1 counter overflow interrupt.*/ - uint32_t hstimer2_ovf_int_clr: 1; /*Set this bit to clear high speed channel2 counter overflow interrupt.*/ - uint32_t hstimer3_ovf_int_clr: 1; /*Set this bit to clear high speed channel3 counter overflow interrupt.*/ - uint32_t lstimer0_ovf_int_clr: 1; /*Set this bit to clear low speed channel0 counter overflow interrupt.*/ - uint32_t lstimer1_ovf_int_clr: 1; /*Set this bit to clear low speed channel1 counter overflow interrupt.*/ - uint32_t lstimer2_ovf_int_clr: 1; /*Set this bit to clear low speed channel2 counter overflow interrupt.*/ - uint32_t lstimer3_ovf_int_clr: 1; /*Set this bit to clear low speed channel3 counter overflow interrupt.*/ - uint32_t duty_chng_end_hsch0_int_clr: 1; /*Set this bit to clear high speed channel 0 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch1_int_clr: 1; /*Set this bit to clear high speed channel 1 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch2_int_clr: 1; /*Set this bit to clear high speed channel 2 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch3_int_clr: 1; /*Set this bit to clear high speed channel 3 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch4_int_clr: 1; /*Set this bit to clear high speed channel 4 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch5_int_clr: 1; /*Set this bit to clear high speed channel 5 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch6_int_clr: 1; /*Set this bit to clear high speed channel 6 duty change done interrupt.*/ - uint32_t duty_chng_end_hsch7_int_clr: 1; /*Set this bit to clear high speed channel 7 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch0_int_clr: 1; /*Set this bit to clear low speed channel 0 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch1_int_clr: 1; /*Set this bit to clear low speed channel 1 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch2_int_clr: 1; /*Set this bit to clear low speed channel 2 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch3_int_clr: 1; /*Set this bit to clear low speed channel 3 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch4_int_clr: 1; /*Set this bit to clear low speed channel 4 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch5_int_clr: 1; /*Set this bit to clear low speed channel 5 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch6_int_clr: 1; /*Set this bit to clear low speed channel 6 duty change done interrupt.*/ - uint32_t duty_chng_end_lsch7_int_clr: 1; /*Set this bit to clear low speed channel 7 duty change done interrupt.*/ - uint32_t reserved24: 8; + uint32_t hstimer0_ovf: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ + uint32_t hstimer1_ovf: 1; /*Set this bit to clear high speed channel1 counter overflow interrupt.*/ + uint32_t hstimer2_ovf: 1; /*Set this bit to clear high speed channel2 counter overflow interrupt.*/ + uint32_t hstimer3_ovf: 1; /*Set this bit to clear high speed channel3 counter overflow interrupt.*/ + uint32_t lstimer0_ovf: 1; /*Set this bit to clear low speed channel0 counter overflow interrupt.*/ + uint32_t lstimer1_ovf: 1; /*Set this bit to clear low speed channel1 counter overflow interrupt.*/ + uint32_t lstimer2_ovf: 1; /*Set this bit to clear low speed channel2 counter overflow interrupt.*/ + uint32_t lstimer3_ovf: 1; /*Set this bit to clear low speed channel3 counter overflow interrupt.*/ + uint32_t duty_chng_end_hsch0: 1; /*Set this bit to clear high speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch1: 1; /*Set this bit to clear high speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch2: 1; /*Set this bit to clear high speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch3: 1; /*Set this bit to clear high speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch4: 1; /*Set this bit to clear high speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch5: 1; /*Set this bit to clear high speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch6: 1; /*Set this bit to clear high speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_hsch7: 1; /*Set this bit to clear high speed channel 7 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch0: 1; /*Set this bit to clear low speed channel 0 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch1: 1; /*Set this bit to clear low speed channel 1 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch2: 1; /*Set this bit to clear low speed channel 2 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch3: 1; /*Set this bit to clear low speed channel 3 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch4: 1; /*Set this bit to clear low speed channel 4 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch5: 1; /*Set this bit to clear low speed channel 5 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch6: 1; /*Set this bit to clear low speed channel 6 duty change done interrupt.*/ + uint32_t duty_chng_end_lsch7: 1; /*Set this bit to clear low speed channel 7 duty change done interrupt.*/ + uint32_t reserved24: 8; }; uint32_t val; }int_clr; diff --git a/components/esp32/include/soc/pcnt_struct.h b/components/esp32/include/soc/pcnt_struct.h index 1505cc692a..5cd1f93137 100644 --- a/components/esp32/include/soc/pcnt_struct.h +++ b/components/esp32/include/soc/pcnt_struct.h @@ -59,57 +59,57 @@ typedef volatile struct { }cnt_unit[8]; union { struct { - uint32_t cnt_thr_event_u0_int_raw: 1; /*This is the interrupt raw bit for channel0 event.*/ - uint32_t cnt_thr_event_u1_int_raw: 1; /*This is the interrupt raw bit for channel1 event.*/ - uint32_t cnt_thr_event_u2_int_raw: 1; /*This is the interrupt raw bit for channel2 event.*/ - uint32_t cnt_thr_event_u3_int_raw: 1; /*This is the interrupt raw bit for channel3 event.*/ - uint32_t cnt_thr_event_u4_int_raw: 1; /*This is the interrupt raw bit for channel4 event.*/ - uint32_t cnt_thr_event_u5_int_raw: 1; /*This is the interrupt raw bit for channel5 event.*/ - uint32_t cnt_thr_event_u6_int_raw: 1; /*This is the interrupt raw bit for channel6 event.*/ - uint32_t cnt_thr_event_u7_int_raw: 1; /*This is the interrupt raw bit for channel7 event.*/ - uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt raw bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt raw bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt raw bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt raw bit for channel3 event.*/ + uint32_t cnt_thr_event_u4: 1; /*This is the interrupt raw bit for channel4 event.*/ + uint32_t cnt_thr_event_u5: 1; /*This is the interrupt raw bit for channel5 event.*/ + uint32_t cnt_thr_event_u6: 1; /*This is the interrupt raw bit for channel6 event.*/ + uint32_t cnt_thr_event_u7: 1; /*This is the interrupt raw bit for channel7 event.*/ + uint32_t reserved8: 24; }; uint32_t val; }int_raw; union { struct { - uint32_t cnt_thr_event_u0_int_st: 1; /*This is the interrupt status bit for channel0 event.*/ - uint32_t cnt_thr_event_u1_int_st: 1; /*This is the interrupt status bit for channel1 event.*/ - uint32_t cnt_thr_event_u2_int_st: 1; /*This is the interrupt status bit for channel2 event.*/ - uint32_t cnt_thr_event_u3_int_st: 1; /*This is the interrupt status bit for channel3 event.*/ - uint32_t cnt_thr_event_u4_int_st: 1; /*This is the interrupt status bit for channel4 event.*/ - uint32_t cnt_thr_event_u5_int_st: 1; /*This is the interrupt status bit for channel5 event.*/ - uint32_t cnt_thr_event_u6_int_st: 1; /*This is the interrupt status bit for channel6 event.*/ - uint32_t cnt_thr_event_u7_int_st: 1; /*This is the interrupt status bit for channel7 event.*/ - uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt status bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt status bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt status bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt status bit for channel3 event.*/ + uint32_t cnt_thr_event_u4: 1; /*This is the interrupt status bit for channel4 event.*/ + uint32_t cnt_thr_event_u5: 1; /*This is the interrupt status bit for channel5 event.*/ + uint32_t cnt_thr_event_u6: 1; /*This is the interrupt status bit for channel6 event.*/ + uint32_t cnt_thr_event_u7: 1; /*This is the interrupt status bit for channel7 event.*/ + uint32_t reserved8: 24; }; uint32_t val; }int_st; union { struct { - uint32_t cnt_thr_event_u0_int_ena: 1; /*This is the interrupt enable bit for channel0 event.*/ - uint32_t cnt_thr_event_u1_int_ena: 1; /*This is the interrupt enable bit for channel1 event.*/ - uint32_t cnt_thr_event_u2_int_ena: 1; /*This is the interrupt enable bit for channel2 event.*/ - uint32_t cnt_thr_event_u3_int_ena: 1; /*This is the interrupt enable bit for channel3 event.*/ - uint32_t cnt_thr_event_u4_int_ena: 1; /*This is the interrupt enable bit for channel4 event.*/ - uint32_t cnt_thr_event_u5_int_ena: 1; /*This is the interrupt enable bit for channel5 event.*/ - uint32_t cnt_thr_event_u6_int_ena: 1; /*This is the interrupt enable bit for channel6 event.*/ - uint32_t cnt_thr_event_u7_int_ena: 1; /*This is the interrupt enable bit for channel7 event.*/ - uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt enable bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt enable bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt enable bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt enable bit for channel3 event.*/ + uint32_t cnt_thr_event_u4: 1; /*This is the interrupt enable bit for channel4 event.*/ + uint32_t cnt_thr_event_u5: 1; /*This is the interrupt enable bit for channel5 event.*/ + uint32_t cnt_thr_event_u6: 1; /*This is the interrupt enable bit for channel6 event.*/ + uint32_t cnt_thr_event_u7: 1; /*This is the interrupt enable bit for channel7 event.*/ + uint32_t reserved8: 24; }; uint32_t val; }int_ena; union { struct { - uint32_t cnt_thr_event_u0_int_clr: 1; /*Set this bit to clear channel0 event interrupt.*/ - uint32_t cnt_thr_event_u1_int_clr: 1; /*Set this bit to clear channel1 event interrupt.*/ - uint32_t cnt_thr_event_u2_int_clr: 1; /*Set this bit to clear channel2 event interrupt.*/ - uint32_t cnt_thr_event_u3_int_clr: 1; /*Set this bit to clear channel3 event interrupt.*/ - uint32_t cnt_thr_event_u4_int_clr: 1; /*Set this bit to clear channel4 event interrupt.*/ - uint32_t cnt_thr_event_u5_int_clr: 1; /*Set this bit to clear channel5 event interrupt.*/ - uint32_t cnt_thr_event_u6_int_clr: 1; /*Set this bit to clear channel6 event interrupt.*/ - uint32_t cnt_thr_event_u7_int_clr: 1; /*Set this bit to clear channel7 event interrupt.*/ - uint32_t reserved8: 24; + uint32_t cnt_thr_event_u0: 1; /*Set this bit to clear channel0 event interrupt.*/ + uint32_t cnt_thr_event_u1: 1; /*Set this bit to clear channel1 event interrupt.*/ + uint32_t cnt_thr_event_u2: 1; /*Set this bit to clear channel2 event interrupt.*/ + uint32_t cnt_thr_event_u3: 1; /*Set this bit to clear channel3 event interrupt.*/ + uint32_t cnt_thr_event_u4: 1; /*Set this bit to clear channel4 event interrupt.*/ + uint32_t cnt_thr_event_u5: 1; /*Set this bit to clear channel5 event interrupt.*/ + uint32_t cnt_thr_event_u6: 1; /*Set this bit to clear channel6 event interrupt.*/ + uint32_t cnt_thr_event_u7: 1; /*Set this bit to clear channel7 event interrupt.*/ + uint32_t reserved8: 24; }; uint32_t val; }int_clr; diff --git a/components/esp32/include/soc/rmt_struct.h b/components/esp32/include/soc/rmt_struct.h index dc3148eaac..6523e2191c 100644 --- a/components/esp32/include/soc/rmt_struct.h +++ b/components/esp32/include/soc/rmt_struct.h @@ -52,169 +52,169 @@ typedef volatile struct { uint32_t apb_mem_addr_ch[8]; /*The ram relative address in channel0-7 by apb fifo access*/ union { struct { - uint32_t ch0_tx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the transmit process is done.*/ - uint32_t ch0_rx_end_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when the receive process is done.*/ - uint32_t ch0_err_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when channel 0 detects some errors.*/ - uint32_t ch1_tx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the transmit process is done.*/ - uint32_t ch1_rx_end_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when the receive process is done.*/ - uint32_t ch1_err_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when channel 1 detects some errors.*/ - uint32_t ch2_tx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the transmit process is done.*/ - uint32_t ch2_rx_end_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when the receive process is done.*/ - uint32_t ch2_err_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when channel 2 detects some errors.*/ - uint32_t ch3_tx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the transmit process is done.*/ - uint32_t ch3_rx_end_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when the receive process is done.*/ - uint32_t ch3_err_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when channel 3 detects some errors.*/ - uint32_t ch4_tx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the transmit process is done.*/ - uint32_t ch4_rx_end_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when the receive process is done.*/ - uint32_t ch4_err_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when channel 4 detects some errors.*/ - uint32_t ch5_tx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the transmit process is done.*/ - uint32_t ch5_rx_end_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when the receive process is done.*/ - uint32_t ch5_err_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when channel 5 detects some errors.*/ - uint32_t ch6_tx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the transmit process is done.*/ - uint32_t ch6_rx_end_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when the receive process is done.*/ - uint32_t ch6_err_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when channel 6 detects some errors.*/ - uint32_t ch7_tx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the transmit process is done.*/ - uint32_t ch7_rx_end_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when the receive process is done.*/ - uint32_t ch7_err_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when channel 7 detects some errors.*/ - uint32_t ch0_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 0 turns to high level when transmitter in channel0 have send data more than reg_rmt_tx_lim_ch0 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch1_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 1 turns to high level when transmitter in channel1 have send data more than reg_rmt_tx_lim_ch1 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch2_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 2 turns to high level when transmitter in channel2 have send data more than reg_rmt_tx_lim_ch2 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch3_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 3 turns to high level when transmitter in channel3 have send data more than reg_rmt_tx_lim_ch3 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch4_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 4 turns to high level when transmitter in channel4 have send data more than reg_rmt_tx_lim_ch4 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch5_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 5 turns to high level when transmitter in channel5 have send data more than reg_rmt_tx_lim_ch5 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch6_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 6 turns to high level when transmitter in channel6 have send data more than reg_rmt_tx_lim_ch6 after detecting this interrupt software can updata the old data with new data.*/ - uint32_t ch7_tx_thr_event_int_raw: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch0_tx_end: 1; /*The interrupt raw bit for channel 0 turns to high level when the transmit process is done.*/ + uint32_t ch0_rx_end: 1; /*The interrupt raw bit for channel 0 turns to high level when the receive process is done.*/ + uint32_t ch0_err: 1; /*The interrupt raw bit for channel 0 turns to high level when channel 0 detects some errors.*/ + uint32_t ch1_tx_end: 1; /*The interrupt raw bit for channel 1 turns to high level when the transmit process is done.*/ + uint32_t ch1_rx_end: 1; /*The interrupt raw bit for channel 1 turns to high level when the receive process is done.*/ + uint32_t ch1_err: 1; /*The interrupt raw bit for channel 1 turns to high level when channel 1 detects some errors.*/ + uint32_t ch2_tx_end: 1; /*The interrupt raw bit for channel 2 turns to high level when the transmit process is done.*/ + uint32_t ch2_rx_end: 1; /*The interrupt raw bit for channel 2 turns to high level when the receive process is done.*/ + uint32_t ch2_err: 1; /*The interrupt raw bit for channel 2 turns to high level when channel 2 detects some errors.*/ + uint32_t ch3_tx_end: 1; /*The interrupt raw bit for channel 3 turns to high level when the transmit process is done.*/ + uint32_t ch3_rx_end: 1; /*The interrupt raw bit for channel 3 turns to high level when the receive process is done.*/ + uint32_t ch3_err: 1; /*The interrupt raw bit for channel 3 turns to high level when channel 3 detects some errors.*/ + uint32_t ch4_tx_end: 1; /*The interrupt raw bit for channel 4 turns to high level when the transmit process is done.*/ + uint32_t ch4_rx_end: 1; /*The interrupt raw bit for channel 4 turns to high level when the receive process is done.*/ + uint32_t ch4_err: 1; /*The interrupt raw bit for channel 4 turns to high level when channel 4 detects some errors.*/ + uint32_t ch5_tx_end: 1; /*The interrupt raw bit for channel 5 turns to high level when the transmit process is done.*/ + uint32_t ch5_rx_end: 1; /*The interrupt raw bit for channel 5 turns to high level when the receive process is done.*/ + uint32_t ch5_err: 1; /*The interrupt raw bit for channel 5 turns to high level when channel 5 detects some errors.*/ + uint32_t ch6_tx_end: 1; /*The interrupt raw bit for channel 6 turns to high level when the transmit process is done.*/ + uint32_t ch6_rx_end: 1; /*The interrupt raw bit for channel 6 turns to high level when the receive process is done.*/ + uint32_t ch6_err: 1; /*The interrupt raw bit for channel 6 turns to high level when channel 6 detects some errors.*/ + uint32_t ch7_tx_end: 1; /*The interrupt raw bit for channel 7 turns to high level when the transmit process is done.*/ + uint32_t ch7_rx_end: 1; /*The interrupt raw bit for channel 7 turns to high level when the receive process is done.*/ + uint32_t ch7_err: 1; /*The interrupt raw bit for channel 7 turns to high level when channel 7 detects some errors.*/ + uint32_t ch0_tx_thr_event: 1; /*The interrupt raw bit for channel 0 turns to high level when transmitter in channel0 have send data more than reg_rmt_tx_lim_ch0 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch1_tx_thr_event: 1; /*The interrupt raw bit for channel 1 turns to high level when transmitter in channel1 have send data more than reg_rmt_tx_lim_ch1 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch2_tx_thr_event: 1; /*The interrupt raw bit for channel 2 turns to high level when transmitter in channel2 have send data more than reg_rmt_tx_lim_ch2 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch3_tx_thr_event: 1; /*The interrupt raw bit for channel 3 turns to high level when transmitter in channel3 have send data more than reg_rmt_tx_lim_ch3 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch4_tx_thr_event: 1; /*The interrupt raw bit for channel 4 turns to high level when transmitter in channel4 have send data more than reg_rmt_tx_lim_ch4 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch5_tx_thr_event: 1; /*The interrupt raw bit for channel 5 turns to high level when transmitter in channel5 have send data more than reg_rmt_tx_lim_ch5 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch6_tx_thr_event: 1; /*The interrupt raw bit for channel 6 turns to high level when transmitter in channel6 have send data more than reg_rmt_tx_lim_ch6 after detecting this interrupt software can updata the old data with new data.*/ + uint32_t ch7_tx_thr_event: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ }; uint32_t val; }int_raw; union { struct { - uint32_t ch0_tx_end_int_st: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ - uint32_t ch0_rx_end_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_rx_end_int_raw when rmt_ch0_rx_end_int_ena is set to 0.*/ - uint32_t ch0_err_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_err_int_raw when rmt_ch0_err_int_ena is set to 0.*/ - uint32_t ch1_tx_end_int_st: 1; /*The interrupt state bit for channel 1's mt_ch1_tx_end_int_raw when mt_ch1_tx_end_int_ena is set to 1.*/ - uint32_t ch1_rx_end_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_rx_end_int_raw when rmt_ch1_rx_end_int_ena is set to 1.*/ - uint32_t ch1_err_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_err_int_raw when rmt_ch1_err_int_ena is set to 1.*/ - uint32_t ch2_tx_end_int_st: 1; /*The interrupt state bit for channel 2's mt_ch2_tx_end_int_raw when mt_ch2_tx_end_int_ena is set to 1.*/ - uint32_t ch2_rx_end_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_rx_end_int_raw when rmt_ch2_rx_end_int_ena is set to 1.*/ - uint32_t ch2_err_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_err_int_raw when rmt_ch2_err_int_ena is set to 1.*/ - uint32_t ch3_tx_end_int_st: 1; /*The interrupt state bit for channel 3's mt_ch3_tx_end_int_raw when mt_ch3_tx_end_int_ena is set to 1.*/ - uint32_t ch3_rx_end_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_rx_end_int_raw when rmt_ch3_rx_end_int_ena is set to 1.*/ - uint32_t ch3_err_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_err_int_raw when rmt_ch3_err_int_ena is set to 1.*/ - uint32_t ch4_tx_end_int_st: 1; /*The interrupt state bit for channel 4's mt_ch4_tx_end_int_raw when mt_ch4_tx_end_int_ena is set to 1.*/ - uint32_t ch4_rx_end_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_rx_end_int_raw when rmt_ch4_rx_end_int_ena is set to 1.*/ - uint32_t ch4_err_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_err_int_raw when rmt_ch4_err_int_ena is set to 1.*/ - uint32_t ch5_tx_end_int_st: 1; /*The interrupt state bit for channel 5's mt_ch5_tx_end_int_raw when mt_ch5_tx_end_int_ena is set to 1.*/ - uint32_t ch5_rx_end_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_rx_end_int_raw when rmt_ch5_rx_end_int_ena is set to 1.*/ - uint32_t ch5_err_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_err_int_raw when rmt_ch5_err_int_ena is set to 1.*/ - uint32_t ch6_tx_end_int_st: 1; /*The interrupt state bit for channel 6's mt_ch6_tx_end_int_raw when mt_ch6_tx_end_int_ena is set to 1.*/ - uint32_t ch6_rx_end_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_rx_end_int_raw when rmt_ch6_rx_end_int_ena is set to 1.*/ - uint32_t ch6_err_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_err_int_raw when rmt_ch6_err_int_ena is set to 1.*/ - uint32_t ch7_tx_end_int_st: 1; /*The interrupt state bit for channel 7's mt_ch7_tx_end_int_raw when mt_ch7_tx_end_int_ena is set to 1.*/ - uint32_t ch7_rx_end_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_rx_end_int_raw when rmt_ch7_rx_end_int_ena is set to 1.*/ - uint32_t ch7_err_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_err_int_raw when rmt_ch7_err_int_ena is set to 1.*/ - uint32_t ch0_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 0's rmt_ch0_tx_thr_event_int_raw when mt_ch0_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch1_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 1's rmt_ch1_tx_thr_event_int_raw when mt_ch1_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch2_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 2's rmt_ch2_tx_thr_event_int_raw when mt_ch2_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch3_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 3's rmt_ch3_tx_thr_event_int_raw when mt_ch3_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch4_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 4's rmt_ch4_tx_thr_event_int_raw when mt_ch4_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch5_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 5's rmt_ch5_tx_thr_event_int_raw when mt_ch5_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch6_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 6's rmt_ch6_tx_thr_event_int_raw when mt_ch6_tx_thr_event_int_ena is set to 1.*/ - uint32_t ch7_tx_thr_event_int_st: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch0_tx_end: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ + uint32_t ch0_rx_end: 1; /*The interrupt state bit for channel 0's rmt_ch0_rx_end_int_raw when rmt_ch0_rx_end_int_ena is set to 0.*/ + uint32_t ch0_err: 1; /*The interrupt state bit for channel 0's rmt_ch0_err_int_raw when rmt_ch0_err_int_ena is set to 0.*/ + uint32_t ch1_tx_end: 1; /*The interrupt state bit for channel 1's mt_ch1_tx_end_int_raw when mt_ch1_tx_end_int_ena is set to 1.*/ + uint32_t ch1_rx_end: 1; /*The interrupt state bit for channel 1's rmt_ch1_rx_end_int_raw when rmt_ch1_rx_end_int_ena is set to 1.*/ + uint32_t ch1_err: 1; /*The interrupt state bit for channel 1's rmt_ch1_err_int_raw when rmt_ch1_err_int_ena is set to 1.*/ + uint32_t ch2_tx_end: 1; /*The interrupt state bit for channel 2's mt_ch2_tx_end_int_raw when mt_ch2_tx_end_int_ena is set to 1.*/ + uint32_t ch2_rx_end: 1; /*The interrupt state bit for channel 2's rmt_ch2_rx_end_int_raw when rmt_ch2_rx_end_int_ena is set to 1.*/ + uint32_t ch2_err: 1; /*The interrupt state bit for channel 2's rmt_ch2_err_int_raw when rmt_ch2_err_int_ena is set to 1.*/ + uint32_t ch3_tx_end: 1; /*The interrupt state bit for channel 3's mt_ch3_tx_end_int_raw when mt_ch3_tx_end_int_ena is set to 1.*/ + uint32_t ch3_rx_end: 1; /*The interrupt state bit for channel 3's rmt_ch3_rx_end_int_raw when rmt_ch3_rx_end_int_ena is set to 1.*/ + uint32_t ch3_err: 1; /*The interrupt state bit for channel 3's rmt_ch3_err_int_raw when rmt_ch3_err_int_ena is set to 1.*/ + uint32_t ch4_tx_end: 1; /*The interrupt state bit for channel 4's mt_ch4_tx_end_int_raw when mt_ch4_tx_end_int_ena is set to 1.*/ + uint32_t ch4_rx_end: 1; /*The interrupt state bit for channel 4's rmt_ch4_rx_end_int_raw when rmt_ch4_rx_end_int_ena is set to 1.*/ + uint32_t ch4_err: 1; /*The interrupt state bit for channel 4's rmt_ch4_err_int_raw when rmt_ch4_err_int_ena is set to 1.*/ + uint32_t ch5_tx_end: 1; /*The interrupt state bit for channel 5's mt_ch5_tx_end_int_raw when mt_ch5_tx_end_int_ena is set to 1.*/ + uint32_t ch5_rx_end: 1; /*The interrupt state bit for channel 5's rmt_ch5_rx_end_int_raw when rmt_ch5_rx_end_int_ena is set to 1.*/ + uint32_t ch5_err: 1; /*The interrupt state bit for channel 5's rmt_ch5_err_int_raw when rmt_ch5_err_int_ena is set to 1.*/ + uint32_t ch6_tx_end: 1; /*The interrupt state bit for channel 6's mt_ch6_tx_end_int_raw when mt_ch6_tx_end_int_ena is set to 1.*/ + uint32_t ch6_rx_end: 1; /*The interrupt state bit for channel 6's rmt_ch6_rx_end_int_raw when rmt_ch6_rx_end_int_ena is set to 1.*/ + uint32_t ch6_err: 1; /*The interrupt state bit for channel 6's rmt_ch6_err_int_raw when rmt_ch6_err_int_ena is set to 1.*/ + uint32_t ch7_tx_end: 1; /*The interrupt state bit for channel 7's mt_ch7_tx_end_int_raw when mt_ch7_tx_end_int_ena is set to 1.*/ + uint32_t ch7_rx_end: 1; /*The interrupt state bit for channel 7's rmt_ch7_rx_end_int_raw when rmt_ch7_rx_end_int_ena is set to 1.*/ + uint32_t ch7_err: 1; /*The interrupt state bit for channel 7's rmt_ch7_err_int_raw when rmt_ch7_err_int_ena is set to 1.*/ + uint32_t ch0_tx_thr_event: 1; /*The interrupt state bit for channel 0's rmt_ch0_tx_thr_event_int_raw when mt_ch0_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch1_tx_thr_event: 1; /*The interrupt state bit for channel 1's rmt_ch1_tx_thr_event_int_raw when mt_ch1_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch2_tx_thr_event: 1; /*The interrupt state bit for channel 2's rmt_ch2_tx_thr_event_int_raw when mt_ch2_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch3_tx_thr_event: 1; /*The interrupt state bit for channel 3's rmt_ch3_tx_thr_event_int_raw when mt_ch3_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch4_tx_thr_event: 1; /*The interrupt state bit for channel 4's rmt_ch4_tx_thr_event_int_raw when mt_ch4_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch5_tx_thr_event: 1; /*The interrupt state bit for channel 5's rmt_ch5_tx_thr_event_int_raw when mt_ch5_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch6_tx_thr_event: 1; /*The interrupt state bit for channel 6's rmt_ch6_tx_thr_event_int_raw when mt_ch6_tx_thr_event_int_ena is set to 1.*/ + uint32_t ch7_tx_thr_event: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ }; uint32_t val; }int_st; union { struct { - uint32_t ch0_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ - uint32_t ch0_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch0_rx_end_int_st.*/ - uint32_t ch0_err_int_ena: 1; /*Set this bit to enable rmt_ch0_err_int_st.*/ - uint32_t ch1_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_end_int_st.*/ - uint32_t ch1_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch1_rx_end_int_st.*/ - uint32_t ch1_err_int_ena: 1; /*Set this bit to enable rmt_ch1_err_int_st.*/ - uint32_t ch2_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_end_int_st.*/ - uint32_t ch2_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch2_rx_end_int_st.*/ - uint32_t ch2_err_int_ena: 1; /*Set this bit to enable rmt_ch2_err_int_st.*/ - uint32_t ch3_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_end_int_st.*/ - uint32_t ch3_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch3_rx_end_int_st.*/ - uint32_t ch3_err_int_ena: 1; /*Set this bit to enable rmt_ch3_err_int_st.*/ - uint32_t ch4_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_end_int_st.*/ - uint32_t ch4_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch4_rx_end_int_st.*/ - uint32_t ch4_err_int_ena: 1; /*Set this bit to enable rmt_ch4_err_int_st.*/ - uint32_t ch5_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_end_int_st.*/ - uint32_t ch5_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch5_rx_end_int_st.*/ - uint32_t ch5_err_int_ena: 1; /*Set this bit to enable rmt_ch5_err_int_st.*/ - uint32_t ch6_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_end_int_st.*/ - uint32_t ch6_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch6_rx_end_int_st.*/ - uint32_t ch6_err_int_ena: 1; /*Set this bit to enable rmt_ch6_err_int_st.*/ - uint32_t ch7_tx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_end_int_st.*/ - uint32_t ch7_rx_end_int_ena: 1; /*Set this bit to enable rmt_ch7_rx_end_int_st.*/ - uint32_t ch7_err_int_ena: 1; /*Set this bit to enable rmt_ch7_err_int_st.*/ - uint32_t ch0_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch0_tx_thr_event_int_st.*/ - uint32_t ch1_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch1_tx_thr_event_int_st.*/ - uint32_t ch2_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch2_tx_thr_event_int_st.*/ - uint32_t ch3_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch3_tx_thr_event_int_st.*/ - uint32_t ch4_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch4_tx_thr_event_int_st.*/ - uint32_t ch5_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch5_tx_thr_event_int_st.*/ - uint32_t ch6_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch6_tx_thr_event_int_st.*/ - uint32_t ch7_tx_thr_event_int_ena: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ + uint32_t ch0_tx_end: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ + uint32_t ch0_rx_end: 1; /*Set this bit to enable rmt_ch0_rx_end_int_st.*/ + uint32_t ch0_err: 1; /*Set this bit to enable rmt_ch0_err_int_st.*/ + uint32_t ch1_tx_end: 1; /*Set this bit to enable rmt_ch1_tx_end_int_st.*/ + uint32_t ch1_rx_end: 1; /*Set this bit to enable rmt_ch1_rx_end_int_st.*/ + uint32_t ch1_err: 1; /*Set this bit to enable rmt_ch1_err_int_st.*/ + uint32_t ch2_tx_end: 1; /*Set this bit to enable rmt_ch2_tx_end_int_st.*/ + uint32_t ch2_rx_end: 1; /*Set this bit to enable rmt_ch2_rx_end_int_st.*/ + uint32_t ch2_err: 1; /*Set this bit to enable rmt_ch2_err_int_st.*/ + uint32_t ch3_tx_end: 1; /*Set this bit to enable rmt_ch3_tx_end_int_st.*/ + uint32_t ch3_rx_end: 1; /*Set this bit to enable rmt_ch3_rx_end_int_st.*/ + uint32_t ch3_err: 1; /*Set this bit to enable rmt_ch3_err_int_st.*/ + uint32_t ch4_tx_end: 1; /*Set this bit to enable rmt_ch4_tx_end_int_st.*/ + uint32_t ch4_rx_end: 1; /*Set this bit to enable rmt_ch4_rx_end_int_st.*/ + uint32_t ch4_err: 1; /*Set this bit to enable rmt_ch4_err_int_st.*/ + uint32_t ch5_tx_end: 1; /*Set this bit to enable rmt_ch5_tx_end_int_st.*/ + uint32_t ch5_rx_end: 1; /*Set this bit to enable rmt_ch5_rx_end_int_st.*/ + uint32_t ch5_err: 1; /*Set this bit to enable rmt_ch5_err_int_st.*/ + uint32_t ch6_tx_end: 1; /*Set this bit to enable rmt_ch6_tx_end_int_st.*/ + uint32_t ch6_rx_end: 1; /*Set this bit to enable rmt_ch6_rx_end_int_st.*/ + uint32_t ch6_err: 1; /*Set this bit to enable rmt_ch6_err_int_st.*/ + uint32_t ch7_tx_end: 1; /*Set this bit to enable rmt_ch7_tx_end_int_st.*/ + uint32_t ch7_rx_end: 1; /*Set this bit to enable rmt_ch7_rx_end_int_st.*/ + uint32_t ch7_err: 1; /*Set this bit to enable rmt_ch7_err_int_st.*/ + uint32_t ch0_tx_thr_event: 1; /*Set this bit to enable rmt_ch0_tx_thr_event_int_st.*/ + uint32_t ch1_tx_thr_event: 1; /*Set this bit to enable rmt_ch1_tx_thr_event_int_st.*/ + uint32_t ch2_tx_thr_event: 1; /*Set this bit to enable rmt_ch2_tx_thr_event_int_st.*/ + uint32_t ch3_tx_thr_event: 1; /*Set this bit to enable rmt_ch3_tx_thr_event_int_st.*/ + uint32_t ch4_tx_thr_event: 1; /*Set this bit to enable rmt_ch4_tx_thr_event_int_st.*/ + uint32_t ch5_tx_thr_event: 1; /*Set this bit to enable rmt_ch5_tx_thr_event_int_st.*/ + uint32_t ch6_tx_thr_event: 1; /*Set this bit to enable rmt_ch6_tx_thr_event_int_st.*/ + uint32_t ch7_tx_thr_event: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ }; uint32_t val; }int_ena; union { struct { - uint32_t ch0_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ - uint32_t ch0_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_end_int_raw.*/ - uint32_t ch0_err_int_clr: 1; /*Set this bit to clear the rmt_ch0_err_int_raw.*/ - uint32_t ch1_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_rx_end_int_raw..*/ - uint32_t ch1_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_end_int_raw.*/ - uint32_t ch1_err_int_clr: 1; /*Set this bit to clear the rmt_ch1_err_int_raw.*/ - uint32_t ch2_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_rx_end_int_raw..*/ - uint32_t ch2_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_end_int_raw.*/ - uint32_t ch2_err_int_clr: 1; /*Set this bit to clear the rmt_ch2_err_int_raw.*/ - uint32_t ch3_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_rx_end_int_raw..*/ - uint32_t ch3_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_end_int_raw.*/ - uint32_t ch3_err_int_clr: 1; /*Set this bit to clear the rmt_ch3_err_int_raw.*/ - uint32_t ch4_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_rx_end_int_raw..*/ - uint32_t ch4_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_end_int_raw.*/ - uint32_t ch4_err_int_clr: 1; /*Set this bit to clear the rmt_ch4_err_int_raw.*/ - uint32_t ch5_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_rx_end_int_raw..*/ - uint32_t ch5_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_end_int_raw.*/ - uint32_t ch5_err_int_clr: 1; /*Set this bit to clear the rmt_ch5_err_int_raw.*/ - uint32_t ch6_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_rx_end_int_raw..*/ - uint32_t ch6_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_end_int_raw.*/ - uint32_t ch6_err_int_clr: 1; /*Set this bit to clear the rmt_ch6_err_int_raw.*/ - uint32_t ch7_tx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_rx_end_int_raw..*/ - uint32_t ch7_rx_end_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_end_int_raw.*/ - uint32_t ch7_err_int_clr: 1; /*Set this bit to clear the rmt_ch7_err_int_raw.*/ - uint32_t ch0_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch0_tx_thr_event_int_raw interrupt.*/ - uint32_t ch1_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch1_tx_thr_event_int_raw interrupt.*/ - uint32_t ch2_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch2_tx_thr_event_int_raw interrupt.*/ - uint32_t ch3_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch3_tx_thr_event_int_raw interrupt.*/ - uint32_t ch4_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch4_tx_thr_event_int_raw interrupt.*/ - uint32_t ch5_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch5_tx_thr_event_int_raw interrupt.*/ - uint32_t ch6_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch6_tx_thr_event_int_raw interrupt.*/ - uint32_t ch7_tx_thr_event_int_clr: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ + uint32_t ch0_tx_end: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ + uint32_t ch0_rx_end: 1; /*Set this bit to clear the rmt_ch0_tx_end_int_raw.*/ + uint32_t ch0_err: 1; /*Set this bit to clear the rmt_ch0_err_int_raw.*/ + uint32_t ch1_tx_end: 1; /*Set this bit to clear the rmt_ch1_rx_end_int_raw..*/ + uint32_t ch1_rx_end: 1; /*Set this bit to clear the rmt_ch1_tx_end_int_raw.*/ + uint32_t ch1_err: 1; /*Set this bit to clear the rmt_ch1_err_int_raw.*/ + uint32_t ch2_tx_end: 1; /*Set this bit to clear the rmt_ch2_rx_end_int_raw..*/ + uint32_t ch2_rx_end: 1; /*Set this bit to clear the rmt_ch2_tx_end_int_raw.*/ + uint32_t ch2_err: 1; /*Set this bit to clear the rmt_ch2_err_int_raw.*/ + uint32_t ch3_tx_end: 1; /*Set this bit to clear the rmt_ch3_rx_end_int_raw..*/ + uint32_t ch3_rx_end: 1; /*Set this bit to clear the rmt_ch3_tx_end_int_raw.*/ + uint32_t ch3_err: 1; /*Set this bit to clear the rmt_ch3_err_int_raw.*/ + uint32_t ch4_tx_end: 1; /*Set this bit to clear the rmt_ch4_rx_end_int_raw..*/ + uint32_t ch4_rx_end: 1; /*Set this bit to clear the rmt_ch4_tx_end_int_raw.*/ + uint32_t ch4_err: 1; /*Set this bit to clear the rmt_ch4_err_int_raw.*/ + uint32_t ch5_tx_end: 1; /*Set this bit to clear the rmt_ch5_rx_end_int_raw..*/ + uint32_t ch5_rx_end: 1; /*Set this bit to clear the rmt_ch5_tx_end_int_raw.*/ + uint32_t ch5_err: 1; /*Set this bit to clear the rmt_ch5_err_int_raw.*/ + uint32_t ch6_tx_end: 1; /*Set this bit to clear the rmt_ch6_rx_end_int_raw..*/ + uint32_t ch6_rx_end: 1; /*Set this bit to clear the rmt_ch6_tx_end_int_raw.*/ + uint32_t ch6_err: 1; /*Set this bit to clear the rmt_ch6_err_int_raw.*/ + uint32_t ch7_tx_end: 1; /*Set this bit to clear the rmt_ch7_rx_end_int_raw..*/ + uint32_t ch7_rx_end: 1; /*Set this bit to clear the rmt_ch7_tx_end_int_raw.*/ + uint32_t ch7_err: 1; /*Set this bit to clear the rmt_ch7_err_int_raw.*/ + uint32_t ch0_tx_thr_event: 1; /*Set this bit to clear the rmt_ch0_tx_thr_event_int_raw interrupt.*/ + uint32_t ch1_tx_thr_event: 1; /*Set this bit to clear the rmt_ch1_tx_thr_event_int_raw interrupt.*/ + uint32_t ch2_tx_thr_event: 1; /*Set this bit to clear the rmt_ch2_tx_thr_event_int_raw interrupt.*/ + uint32_t ch3_tx_thr_event: 1; /*Set this bit to clear the rmt_ch3_tx_thr_event_int_raw interrupt.*/ + uint32_t ch4_tx_thr_event: 1; /*Set this bit to clear the rmt_ch4_tx_thr_event_int_raw interrupt.*/ + uint32_t ch5_tx_thr_event: 1; /*Set this bit to clear the rmt_ch5_tx_thr_event_int_raw interrupt.*/ + uint32_t ch6_tx_thr_event: 1; /*Set this bit to clear the rmt_ch6_tx_thr_event_int_raw interrupt.*/ + uint32_t ch7_tx_thr_event: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ }; uint32_t val; }int_clr; union { struct { - uint32_t carrier_low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ - uint32_t carrier_high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ + uint32_t low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ + uint32_t high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ }; uint32_t val; }carrier_duty_ch[8]; union { struct { - uint32_t tx_lim: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ + uint32_t limit: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ uint32_t reserved9: 23; }; uint32_t val; }tx_lim_ch[8]; union { struct { - uint32_t apb_fifo_mask: 1; /*Set this bit to disable apb fifo access*/ + uint32_t fifo_mask: 1; /*Set this bit to disable apb fifo access*/ uint32_t mem_tx_wrap_en: 1; /*when data need to be send is more than channel's mem can store then set this bit to enable reuse of mem this bit is used together with reg_rmt_tx_lim_chn.*/ uint32_t reserved2: 30; }; diff --git a/components/esp32/include/soc/spi_struct.h b/components/esp32/include/soc/spi_struct.h index 0eb64e91d3..31b86308ba 100644 --- a/components/esp32/include/soc/spi_struct.h +++ b/components/esp32/include/soc/spi_struct.h @@ -188,79 +188,79 @@ typedef volatile struct { }pin; union { struct { - uint32_t slv_rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ - uint32_t slv_wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ - uint32_t slv_rd_sta_done: 1; /*The interrupt raw bit for the completion of read-status operation in the slave mode.*/ - uint32_t slv_wr_sta_done: 1; /*The interrupt raw bit for the completion of write-status operation in the slave mode.*/ - uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ - uint32_t int_en: 5; /*Interrupt enable bits for the below 5 sources*/ - uint32_t cs_i_mode: 2; /*In the slave mode this bits used to synchronize the input spi cs signal and eliminate spi cs jitter.*/ - uint32_t reserved12: 5; /*reserved*/ - uint32_t slv_last_command: 3; /*In the slave mode it is the value of command.*/ - uint32_t slv_last_state: 3; /*In the slave mode it is the state of spi state machine.*/ - uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode. 4: read-status*/ - uint32_t slv_cmd_define: 1; /*1: slave mode commands are defined in SPI_SLAVE3. 0: slave mode commands are fixed as: 1: write-status 2: write-buffer and 3: read-buffer.*/ - uint32_t slv_wr_rd_sta_en: 1; /*write and read status enable in the slave mode*/ - uint32_t slv_wr_rd_buf_en: 1; /*write and read buffer enable in the slave mode*/ - uint32_t slave_mode: 1; /*1: slave mode 0: master mode.*/ - uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ + uint32_t rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ + uint32_t wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ + uint32_t rd_sta_done: 1; /*The interrupt raw bit for the completion of read-status operation in the slave mode.*/ + uint32_t wr_sta_done: 1; /*The interrupt raw bit for the completion of write-status operation in the slave mode.*/ + uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ + uint32_t int_en: 5; /*Interrupt enable bits for the below 5 sources*/ + uint32_t cs_i_mode: 2; /*In the slave mode this bits used to synchronize the input spi cs signal and eliminate spi cs jitter.*/ + uint32_t reserved12: 5; /*reserved*/ + uint32_t last_command: 3; /*In the slave mode it is the value of command.*/ + uint32_t last_state: 3; /*In the slave mode it is the state of spi state machine.*/ + uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode. 4: read-status*/ + uint32_t cmd_define: 1; /*1: slave mode commands are defined in SPI_SLAVE3. 0: slave mode commands are fixed as: 1: write-status 2: write-buffer and 3: read-buffer.*/ + uint32_t wr_rd_sta_en: 1; /*write and read status enable in the slave mode*/ + uint32_t wr_rd_buf_en: 1; /*write and read buffer enable in the slave mode*/ + uint32_t slave_mode: 1; /*1: slave mode 0: master mode.*/ + uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ }; uint32_t val; }slave; union { struct { - uint32_t slv_rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ - uint32_t slv_wrbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-buffer operations.*/ - uint32_t slv_rdsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-status operations.*/ - uint32_t slv_wrsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-status operations.*/ - uint32_t slv_wr_addr_bitlen: 6; /*In the slave mode it is the address length in bits for write-buffer operation. The register value shall be (bit_num-1).*/ - uint32_t slv_rd_addr_bitlen: 6; /*In the slave mode it is the address length in bits for read-buffer operation. The register value shall be (bit_num-1).*/ - uint32_t reserved16: 9; /*reserved*/ - uint32_t slv_status_readback: 1; /*In the slave mode 1:read register of SPI_SLV_WR_STATUS 0: read register of SPI_RD_STATUS.*/ - uint32_t slv_status_fast_en: 1; /*In the slave mode enable fast read status.*/ - uint32_t slv_status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ + uint32_t rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ + uint32_t wrbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-buffer operations.*/ + uint32_t rdsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-status operations.*/ + uint32_t wrsta_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for write-status operations.*/ + uint32_t wr_addr_bitlen: 6; /*In the slave mode it is the address length in bits for write-buffer operation. The register value shall be (bit_num-1).*/ + uint32_t rd_addr_bitlen: 6; /*In the slave mode it is the address length in bits for read-buffer operation. The register value shall be (bit_num-1).*/ + uint32_t reserved16: 9; /*reserved*/ + uint32_t status_readback: 1; /*In the slave mode 1:read register of SPI_SLV_WR_STATUS 0: read register of SPI_RD_STATUS.*/ + uint32_t status_fast_en: 1; /*In the slave mode enable fast read status.*/ + uint32_t status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ }; uint32_t val; }slave1; union { struct { - uint32_t slv_rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ - uint32_t slv_wrsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-status operations. The register value shall be (cycle_num-1).*/ - uint32_t slv_rdbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-buffer operations. The register value shall be (cycle_num-1).*/ - uint32_t slv_wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ + uint32_t rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ + uint32_t wrsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-status operations. The register value shall be (cycle_num-1).*/ + uint32_t rdbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-buffer operations. The register value shall be (cycle_num-1).*/ + uint32_t wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ }; uint32_t val; }slave2; union { struct { - uint32_t slv_rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ - uint32_t slv_wrbuf_cmd_value: 8; /*In the slave mode it is the value of write-buffer command.*/ - uint32_t slv_rdsta_cmd_value: 8; /*In the slave mode it is the value of read-status command.*/ - uint32_t slv_wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ + uint32_t rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ + uint32_t wrbuf_cmd_value: 8; /*In the slave mode it is the value of write-buffer command.*/ + uint32_t rdsta_cmd_value: 8; /*In the slave mode it is the value of read-status command.*/ + uint32_t wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ }; uint32_t val; }slave3; union { struct { - uint32_t slv_wrbuf_dbitlen:24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ - uint32_t reserved24: 8; /*reserved*/ + uint32_t bit_len: 24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; }slv_wrbuf_dlen; union { struct { - uint32_t slv_rdbuf_dbitlen:24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ - uint32_t reserved24: 8; /*reserved*/ + uint32_t bit_len: 24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; }slv_rdbuf_dlen; union { struct { - uint32_t cache_req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ - uint32_t cache_usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ - uint32_t cache_flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ - uint32_t cache_flash_pes_en: 1; /*For SPI0 spi1 send suspend command before cache read flash 1: enable 0:disable.*/ - uint32_t reserved4: 28; /*reserved*/ + uint32_t req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ + uint32_t usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ + uint32_t flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ + uint32_t flash_pes_en: 1; /*For SPI0 spi1 send suspend command before cache read flash 1: enable 0:disable.*/ + uint32_t reserved4: 28; /*reserved*/ }; uint32_t val; }cache_fctrl; @@ -282,27 +282,27 @@ typedef volatile struct { }cache_sctrl; union { struct { - uint32_t sram_dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ - uint32_t sram_qio: 1; /*For SPI0 SRAM QIO mode enable . SRAM QIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ - uint32_t reserved2: 2; /*For SPI0 SRAM write enable . SRAM write operation will be triggered when the bit is set. The bit will be cleared once the operation done.*/ - uint32_t sram_rstio: 1; /*For SPI0 SRAM IO mode reset enable. SRAM IO mode reset operation will be triggered when the bit is set. The bit will be cleared once the operation done*/ - uint32_t reserved5: 27; /*reserved*/ + uint32_t dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t qio: 1; /*For SPI0 SRAM QIO mode enable . SRAM QIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t reserved2: 2; /*For SPI0 SRAM write enable . SRAM write operation will be triggered when the bit is set. The bit will be cleared once the operation done.*/ + uint32_t rst_io: 1; /*For SPI0 SRAM IO mode reset enable. SRAM IO mode reset operation will be triggered when the bit is set. The bit will be cleared once the operation done*/ + uint32_t reserved5:27; /*reserved*/ }; uint32_t val; }sram_cmd; union { struct { - uint32_t cache_sram_usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ - uint32_t reserved16: 12; /*reserved*/ - uint32_t cache_sram_usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + uint32_t usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; uint32_t val; }sram_drd_cmd; union { struct { - uint32_t cache_sram_usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ - uint32_t reserved16: 12; /*reserved*/ - uint32_t cache_sram_usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ + uint32_t usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; uint32_t val; }sram_dwr_cmd; @@ -390,92 +390,92 @@ typedef volatile struct { }dma_conf; union { struct { - uint32_t outlink_addr: 20; /*The address of the first outlink descriptor.*/ - uint32_t reserved20: 8; /*reserved*/ - uint32_t outlink_stop: 1; /*Set the bit to stop to use outlink descriptor.*/ - uint32_t outlink_start: 1; /*Set the bit to start to use outlink descriptor.*/ - uint32_t outlink_restart: 1; /*Set the bit to mount on new outlink descriptors.*/ - uint32_t reserved31: 1; /*reserved*/ + uint32_t addr: 20; /*The address of the first outlink descriptor.*/ + uint32_t reserved20: 8; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use outlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use outlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new outlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ }; uint32_t val; }dma_out_link; union { struct { - uint32_t inlink_addr: 20; /*The address of the first inlink descriptor.*/ - uint32_t inlink_auto_ret: 1; /*when the bit is set inlink descriptor returns to the next descriptor while a packet is wrong*/ - uint32_t reserved21: 7; /*reserved*/ - uint32_t inlink_stop: 1; /*Set the bit to stop to use inlink descriptor.*/ - uint32_t inlink_start: 1; /*Set the bit to start to use inlink descriptor.*/ - uint32_t inlink_restart: 1; /*Set the bit to mount on new inlink descriptors.*/ - uint32_t reserved31: 1; /*reserved*/ + uint32_t addr: 20; /*The address of the first inlink descriptor.*/ + uint32_t auto_ret: 1; /*when the bit is set inlink descriptor returns to the next descriptor while a packet is wrong*/ + uint32_t reserved21: 7; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use inlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use inlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new inlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ }; uint32_t val; }dma_in_link; union { struct { - uint32_t dma_rx_en: 1; /*spi dma read data status bit.*/ - uint32_t dma_tx_en: 1; /*spi dma write data status bit.*/ + uint32_t rx_en: 1; /*spi dma read data status bit.*/ + uint32_t tx_en: 1; /*spi dma write data status bit.*/ uint32_t reserved2: 30; /*spi dma read data from memory count.*/ }; uint32_t val; }dma_status; union { - struct { - uint32_t inlink_dscr_empty_int_ena: 1; /*The enable bit for lack of enough inlink descriptors.*/ - uint32_t outlink_dscr_error_int_ena: 1; /*The enable bit for outlink descriptor error.*/ - uint32_t inlink_dscr_error_int_ena: 1; /*The enable bit for inlink descriptor error.*/ - uint32_t in_done_int_ena: 1; /*The enable bit for completing usage of a inlink descriptor.*/ - uint32_t in_err_eof_int_ena: 1; /*The enable bit for receiving error.*/ - uint32_t in_suc_eof_int_ena: 1; /*The enable bit for completing receiving all the packets from host.*/ - uint32_t out_done_int_ena: 1; /*The enable bit for completing usage of a outlink descriptor .*/ - uint32_t out_eof_int_ena: 1; /*The enable bit for sending a packet to host done.*/ - uint32_t out_total_eof_int_ena: 1; /*The enable bit for sending all the packets to host done.*/ - uint32_t reserved9: 23; /*reserved*/ + struct {_int_clr + uint32_t inlink_dscr_empty: 1; /*The enable bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The enable bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The enable bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The enable bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The enable bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The enable bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The enable bit for completing usage of a outlink descriptor .*/ + uint32_t out_eof: 1; /*The enable bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The enable bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; }dma_int_ena; union { struct { - uint32_t inlink_dscr_empty_int_raw: 1; /*The raw bit for lack of enough inlink descriptors.*/ - uint32_t outlink_dscr_error_int_raw: 1; /*The raw bit for outlink descriptor error.*/ - uint32_t inlink_dscr_error_int_raw: 1; /*The raw bit for inlink descriptor error.*/ - uint32_t in_done_int_raw: 1; /*The raw bit for completing usage of a inlink descriptor.*/ - uint32_t in_err_eof_int_raw: 1; /*The raw bit for receiving error.*/ - uint32_t in_suc_eof_int_raw: 1; /*The raw bit for completing receiving all the packets from host.*/ - uint32_t out_done_int_raw: 1; /*The raw bit for completing usage of a outlink descriptor.*/ - uint32_t out_eof_int_raw: 1; /*The raw bit for sending a packet to host done.*/ - uint32_t out_total_eof_int_raw: 1; /*The raw bit for sending all the packets to host done.*/ - uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty: 1; /*The raw bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The raw bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The raw bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The raw bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The raw bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The raw bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The raw bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The raw bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The raw bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; }dma_int_raw; union { struct { - uint32_t inlink_dscr_empty_int_st: 1; /*The status bit for lack of enough inlink descriptors.*/ - uint32_t outlink_dscr_error_int_st: 1; /*The status bit for outlink descriptor error.*/ - uint32_t inlink_dscr_error_int_st: 1; /*The status bit for inlink descriptor error.*/ - uint32_t in_done_int_st: 1; /*The status bit for completing usage of a inlink descriptor.*/ - uint32_t in_err_eof_int_st: 1; /*The status bit for receiving error.*/ - uint32_t in_suc_eof_int_st: 1; /*The status bit for completing receiving all the packets from host.*/ - uint32_t out_done_int_st: 1; /*The status bit for completing usage of a outlink descriptor.*/ - uint32_t out_eof_int_st: 1; /*The status bit for sending a packet to host done.*/ - uint32_t out_total_eof_int_st: 1; /*The status bit for sending all the packets to host done.*/ - uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty: 1; /*The status bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The status bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The status bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The status bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The status bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The status bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The status bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The status bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The status bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; }dma_int_st; union { struct { - uint32_t inlink_dscr_empty_int_clr: 1; /*The clear bit for lack of enough inlink descriptors.*/ - uint32_t outlink_dscr_error_int_clr: 1; /*The clear bit for outlink descriptor error.*/ - uint32_t inlink_dscr_error_int_clr: 1; /*The clear bit for inlink descriptor error.*/ - uint32_t in_done_int_clr: 1; /*The clear bit for completing usage of a inlink descriptor.*/ - uint32_t in_err_eof_int_clr: 1; /*The clear bit for receiving error.*/ - uint32_t in_suc_eof_int_clr: 1; /*The clear bit for completing receiving all the packets from host.*/ - uint32_t out_done_int_clr: 1; /*The clear bit for completing usage of a outlink descriptor.*/ - uint32_t out_eof_int_clr: 1; /*The clear bit for sending a packet to host done.*/ - uint32_t out_total_eof_int_clr: 1; /*The clear bit for sending all the packets to host done.*/ - uint32_t reserved9: 23; /*reserved*/ + uint32_t inlink_dscr_empty: 1; /*The clear bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The clear bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The clear bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The clear bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The clear bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The clear bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The clear bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The clear bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The clear bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; }dma_int_clr; diff --git a/components/esp32/include/soc/timer_group_struct.h b/components/esp32/include/soc/timer_group_struct.h index 2160dfeea1..8f25ce9b62 100644 --- a/components/esp32/include/soc/timer_group_struct.h +++ b/components/esp32/include/soc/timer_group_struct.h @@ -28,35 +28,35 @@ typedef volatile struct { }; uint32_t val; }config; - uint32_t timer_cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ - uint32_t timer_cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ - uint32_t timer_update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ - uint32_t timer_alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/ - uint32_t timer_alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/ - uint32_t timer_load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ - uint32_t timer_load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ - uint32_t timer_reload; /*Write any value will trigger timer 0 time-base counter reload*/ + uint32_t cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ + uint32_t cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ + uint32_t update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ + uint32_t alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/ + uint32_t alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/ + uint32_t load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ + uint32_t load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ + uint32_t reload; /*Write any value will trigger timer 0 time-base counter reload*/ }hw_timer[2]; union { struct { - uint32_t reserved0: 14; - uint32_t wdt_flashboot_mod_en: 1; /*When set flash boot protection is enabled*/ - uint32_t wdt_sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ - uint32_t wdt_cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ - uint32_t wdt_level_int_en: 1; /*When set level type interrupt generation is enabled*/ - uint32_t wdt_edge_int_en: 1; /*When set edge type interrupt generation is enabled*/ - uint32_t wdt_stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - uint32_t wdt_stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - uint32_t wdt_stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - uint32_t wdt_stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ - uint32_t wdt_en: 1; /*When set SWDT is enabled*/ + uint32_t reserved0: 14; + uint32_t flashboot_mod_en: 1; /*When set flash boot protection is enabled*/ + uint32_t sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + uint32_t cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/ + uint32_t level_int_en: 1; /*When set level type interrupt generation is enabled*/ + uint32_t edge_int_en: 1; /*When set edge type interrupt generation is enabled*/ + uint32_t stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/ + uint32_t en: 1; /*When set SWDT is enabled*/ }; uint32_t val; }wdt_config0; union { struct { uint32_t reserved0: 16; - uint32_t wdt_clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ + uint32_t clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ }; uint32_t val; }wdt_config1; @@ -69,41 +69,41 @@ typedef volatile struct { union { struct { uint32_t reserved0: 12; - uint32_t rtc_cali_start_cycling: 1; - uint32_t rtc_cali_clk_sel: 2; - uint32_t rtc_cali_rdy: 1; - uint32_t rtc_cali_max: 15; - uint32_t rtc_cali_start: 1; + uint32_t start_cycling: 1; + uint32_t clk_sel: 2; + uint32_t rdy: 1; + uint32_t max: 15; + uint32_t start: 1; }; uint32_t val; }rtc_cali_cfg; union { struct { uint32_t reserved0: 7; - uint32_t rtc_cali_value:25; + uint32_t value:25; }; uint32_t val; }rtc_cali_cfg1; union { struct { uint32_t reserved0: 7; - uint32_t lact_rtc_only: 1; - uint32_t lact_cpst_en: 1; - uint32_t lact_lac_en: 1; - uint32_t lact_alarm_en: 1; - uint32_t lact_level_int_en: 1; - uint32_t lact_edge_int_en: 1; - uint32_t lact_divider: 16; - uint32_t lact_autoreload: 1; - uint32_t lact_increase: 1; - uint32_t lact_en: 1; + uint32_t rtc_only: 1; + uint32_t cpst_en: 1; + uint32_t lac_en: 1; + uint32_t alarm_en: 1; + uint32_t level_int_en: 1; + uint32_t edge_int_en: 1; + uint32_t divider: 16; + uint32_t autoreload: 1; + uint32_t increase: 1; + uint32_t en: 1; }; uint32_t val; }lactconfig; union { struct { uint32_t reserved0: 6; - uint32_t lact_rtc_step_len:26; + uint32_t step_len:26; }; uint32_t val; }lactrtc; @@ -117,41 +117,41 @@ typedef volatile struct { uint32_t lactload; /**/ union { struct { - uint32_t t0_int_ena: 1; /*interrupt when timer0 alarm*/ - uint32_t t1_int_ena: 1; /*interrupt when timer1 alarm*/ - uint32_t wdt_int_ena: 1; /*Interrupt when an interrupt stage timeout*/ - uint32_t lact_int_ena: 1; - uint32_t reserved4: 28; + uint32_t t0: 1; /*interrupt when timer0 alarm*/ + uint32_t t1: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact: 1; + uint32_t reserved4: 28; }; uint32_t val; - }int_ena_timers; + }int_ena; union { struct { - uint32_t t0_int_raw: 1; /*interrupt when timer0 alarm*/ - uint32_t t1_int_raw: 1; /*interrupt when timer1 alarm*/ - uint32_t wdt_int_raw: 1; /*Interrupt when an interrupt stage timeout*/ - uint32_t lact_int_raw: 1; - uint32_t reserved4: 28; + uint32_t t0: 1; /*interrupt when timer0 alarm*/ + uint32_t t1: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact: 1; + uint32_t reserved4:28; }; uint32_t val; - }int_raw_timers; + }int_raw; union { struct { - uint32_t t0_int_st: 1; /*interrupt when timer0 alarm*/ - uint32_t t1_int_st: 1; /*interrupt when timer1 alarm*/ - uint32_t wdt_int_st: 1; /*Interrupt when an interrupt stage timeout*/ - uint32_t lact_int_st: 1; - uint32_t reserved4: 28; + uint32_t t0: 1; /*interrupt when timer0 alarm*/ + uint32_t t1: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact: 1; + uint32_t reserved4: 28; }; uint32_t val; }int_st_timers; union { struct { - uint32_t t0_int_clr: 1; /*interrupt when timer0 alarm*/ - uint32_t t1_int_clr: 1; /*interrupt when timer1 alarm*/ - uint32_t wdt_int_clr: 1; /*Interrupt when an interrupt stage timeout*/ - uint32_t lact_int_clr: 1; - uint32_t reserved4: 28; + uint32_t t0: 1; /*interrupt when timer0 alarm*/ + uint32_t t1: 1; /*interrupt when timer1 alarm*/ + uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/ + uint32_t lact: 1; + uint32_t reserved4: 28; }; uint32_t val; }int_clr_timers; @@ -185,7 +185,7 @@ typedef volatile struct { union { struct { uint32_t reserved0: 31; - uint32_t clk_en: 1; /*Force clock enable for this regfile*/ + uint32_t en: 1; /*Force clock enable for this regfile*/ }; uint32_t val; }clk; diff --git a/components/esp32/include/soc/uart_struct.h b/components/esp32/include/soc/uart_struct.h index 9874a6af69..54baf4f0e5 100644 --- a/components/esp32/include/soc/uart_struct.h +++ b/components/esp32/include/soc/uart_struct.h @@ -16,122 +16,122 @@ typedef volatile struct { union { struct { - uint32_t fifo_rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ - uint32_t reserved8: 24; + uint32_t rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ + uint32_t reserved8: 24; }; uint32_t val; }fifo; union { struct { - uint32_t rxfifo_full_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ - uint32_t txfifo_empty_int_raw: 1; /*This interrupt raw bit turns to high level when the amount of data in transmitter's fifo is less than ((tx_mem_cnttxfifo_cnt) .*/ - uint32_t parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the parity error of data.*/ - uint32_t frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects data's frame error .*/ - uint32_t rxfifo_ovf_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives more data than the fifo can store.*/ - uint32_t dsr_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of dsrn signal.*/ - uint32_t cts_chg_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of ctsn signal.*/ - uint32_t brk_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the 0 after the stop bit.*/ - uint32_t rxfifo_tout_int_raw: 1; /*This interrupt raw bit turns to high level when receiver takes more time than rx_tout_thrhd to receive a byte.*/ - uint32_t sw_xon_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xoff char with uart_sw_flow_con_en is set to 1.*/ - uint32_t sw_xoff_int_raw: 1; /*This interrupt raw bit turns to high level when receiver receives xon char with uart_sw_flow_con_en is set to 1.*/ - uint32_t glitch_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the start bit.*/ - uint32_t tx_brk_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter completes sending 0 after all the data in transmitter's fifo are send.*/ - uint32_t tx_brk_idle_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has kept the shortest duration after the last data has been send.*/ - uint32_t tx_done_int_raw: 1; /*This interrupt raw bit turns to high level when transmitter has send all the data in fifo.*/ - uint32_t rs485_parity_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the parity error.*/ - uint32_t rs485_frm_err_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the data frame error.*/ - uint32_t rs485_clash_int_raw: 1; /*This interrupt raw bit turns to high level when rs485 detects the clash between transmitter and receiver.*/ - uint32_t at_cmd_char_det_int_raw: 1; /*This interrupt raw bit turns to high level when receiver detects the configured at_cmd chars.*/ - uint32_t reserved19: 13; + uint32_t rxfifo_full: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ + uint32_t txfifo_empty: 1; /*This interrupt raw bit turns to high level when the amount of data in transmitter's fifo is less than ((tx_mem_cnttxfifo_cnt) .*/ + uint32_t parity_err: 1; /*This interrupt raw bit turns to high level when receiver detects the parity error of data.*/ + uint32_t frm_err: 1; /*This interrupt raw bit turns to high level when receiver detects data's frame error .*/ + uint32_t rxfifo_ovf: 1; /*This interrupt raw bit turns to high level when receiver receives more data than the fifo can store.*/ + uint32_t dsr_chg: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of dsrn signal.*/ + uint32_t cts_chg: 1; /*This interrupt raw bit turns to high level when receiver detects the edge change of ctsn signal.*/ + uint32_t brk_det: 1; /*This interrupt raw bit turns to high level when receiver detects the 0 after the stop bit.*/ + uint32_t rxfifo_tout: 1; /*This interrupt raw bit turns to high level when receiver takes more time than rx_tout_thrhd to receive a byte.*/ + uint32_t sw_xon: 1; /*This interrupt raw bit turns to high level when receiver receives xoff char with uart_sw_flow_con_en is set to 1.*/ + uint32_t sw_xoff: 1; /*This interrupt raw bit turns to high level when receiver receives xon char with uart_sw_flow_con_en is set to 1.*/ + uint32_t glitch_det: 1; /*This interrupt raw bit turns to high level when receiver detects the start bit.*/ + uint32_t tx_brk_done: 1; /*This interrupt raw bit turns to high level when transmitter completes sending 0 after all the data in transmitter's fifo are send.*/ + uint32_t tx_brk_idle_done: 1; /*This interrupt raw bit turns to high level when transmitter has kept the shortest duration after the last data has been send.*/ + uint32_t tx_done: 1; /*This interrupt raw bit turns to high level when transmitter has send all the data in fifo.*/ + uint32_t rs485_parity_err: 1; /*This interrupt raw bit turns to high level when rs485 detects the parity error.*/ + uint32_t rs485_frm_err: 1; /*This interrupt raw bit turns to high level when rs485 detects the data frame error.*/ + uint32_t rs485_clash: 1; /*This interrupt raw bit turns to high level when rs485 detects the clash between transmitter and receiver.*/ + uint32_t at_cmd_char_det: 1; /*This interrupt raw bit turns to high level when receiver detects the configured at_cmd chars.*/ + uint32_t reserved19: 13; }; uint32_t val; }int_raw; union { struct { - uint32_t rxfifo_full_int_st: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ - uint32_t txfifo_empty_int_st: 1; /*This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set to 1.*/ - uint32_t parity_err_int_st: 1; /*This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.*/ - uint32_t frm_err_int_st: 1; /*This is the status bit for frm_err_int_raw when fm_err_int_ena is set to 1.*/ - uint32_t rxfifo_ovf_int_st: 1; /*This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.*/ - uint32_t dsr_chg_int_st: 1; /*This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.*/ - uint32_t cts_chg_int_st: 1; /*This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.*/ - uint32_t brk_det_int_st: 1; /*This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.*/ - uint32_t rxfifo_tout_int_st: 1; /*This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.*/ - uint32_t sw_xon_int_st: 1; /*This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.*/ - uint32_t sw_xoff_int_st: 1; /*This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.*/ - uint32_t glitch_det_int_st: 1; /*This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.*/ - uint32_t tx_brk_done_int_st: 1; /*This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.*/ - uint32_t tx_brk_idle_done_int_st: 1; /*This is the status bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena is set to 1.*/ - uint32_t tx_done_int_st: 1; /*This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.*/ - uint32_t rs485_parity_err_int_st: 1; /*This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is set to 1.*/ - uint32_t rs485_frm_err_int_st: 1; /*This is the status bit for rs485_fm_err_int_raw when rs485_fm_err_int_ena is set to 1.*/ - uint32_t rs485_clash_int_st: 1; /*This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.*/ - uint32_t at_cmd_char_det_int_st: 1; /*This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set to 1.*/ - uint32_t reserved19: 13; + uint32_t rxfifo_full: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ + uint32_t txfifo_empty: 1; /*This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set to 1.*/ + uint32_t parity_err: 1; /*This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.*/ + uint32_t frm_err: 1; /*This is the status bit for frm_err_int_raw when fm_err_int_ena is set to 1.*/ + uint32_t rxfifo_ovf: 1; /*This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.*/ + uint32_t dsr_chg: 1; /*This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.*/ + uint32_t cts_chg: 1; /*This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.*/ + uint32_t brk_det: 1; /*This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.*/ + uint32_t rxfifo_tout: 1; /*This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.*/ + uint32_t sw_xon: 1; /*This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.*/ + uint32_t sw_xoff: 1; /*This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.*/ + uint32_t glitch_det: 1; /*This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.*/ + uint32_t tx_brk_done: 1; /*This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.*/ + uint32_t tx_brk_idle_done: 1; /*This is the status bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena is set to 1.*/ + uint32_t tx_done: 1; /*This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.*/ + uint32_t rs485_parity_err: 1; /*This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is set to 1.*/ + uint32_t rs485_frm_err: 1; /*This is the status bit for rs485_fm_err_int_raw when rs485_fm_err_int_ena is set to 1.*/ + uint32_t rs485_clash: 1; /*This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.*/ + uint32_t at_cmd_char_det: 1; /*This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set to 1.*/ + uint32_t reserved19: 13; }; uint32_t val; }int_st; union { struct { - uint32_t rxfifo_full_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ - uint32_t txfifo_empty_int_ena: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ - uint32_t parity_err_int_ena: 1; /*This is the enable bit for parity_err_int_st register.*/ - uint32_t frm_err_int_ena: 1; /*This is the enable bit for frm_err_int_st register.*/ - uint32_t rxfifo_ovf_int_ena: 1; /*This is the enable bit for rxfifo_ovf_int_st register.*/ - uint32_t dsr_chg_int_ena: 1; /*This is the enable bit for dsr_chg_int_st register.*/ - uint32_t cts_chg_int_ena: 1; /*This is the enable bit for cts_chg_int_st register.*/ - uint32_t brk_det_int_ena: 1; /*This is the enable bit for brk_det_int_st register.*/ - uint32_t rxfifo_tout_int_ena: 1; /*This is the enable bit for rxfifo_tout_int_st register.*/ - uint32_t sw_xon_int_ena: 1; /*This is the enable bit for sw_xon_int_st register.*/ - uint32_t sw_xoff_int_ena: 1; /*This is the enable bit for sw_xoff_int_st register.*/ - uint32_t glitch_det_int_ena: 1; /*This is the enable bit for glitch_det_int_st register.*/ - uint32_t tx_brk_done_int_ena: 1; /*This is the enable bit for tx_brk_done_int_st register.*/ - uint32_t tx_brk_idle_done_int_ena: 1; /*This is the enable bit for tx_brk_idle_done_int_st register.*/ - uint32_t tx_done_int_ena: 1; /*This is the enable bit for tx_done_int_st register.*/ - uint32_t rs485_parity_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ - uint32_t rs485_frm_err_int_ena: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ - uint32_t rs485_clash_int_ena: 1; /*This is the enable bit for rs485_clash_int_st register.*/ - uint32_t at_cmd_char_det_int_ena: 1; /*This is the enable bit for at_cmd_char_det_int_st register.*/ - uint32_t reserved19: 13; + uint32_t rxfifo_full: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + uint32_t txfifo_empty: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ + uint32_t parity_err: 1; /*This is the enable bit for parity_err_int_st register.*/ + uint32_t frm_err: 1; /*This is the enable bit for frm_err_int_st register.*/ + uint32_t rxfifo_ovf: 1; /*This is the enable bit for rxfifo_ovf_int_st register.*/ + uint32_t dsr_chg: 1; /*This is the enable bit for dsr_chg_int_st register.*/ + uint32_t cts_chg: 1; /*This is the enable bit for cts_chg_int_st register.*/ + uint32_t brk_det: 1; /*This is the enable bit for brk_det_int_st register.*/ + uint32_t rxfifo_tout: 1; /*This is the enable bit for rxfifo_tout_int_st register.*/ + uint32_t sw_xon: 1; /*This is the enable bit for sw_xon_int_st register.*/ + uint32_t sw_xoff: 1; /*This is the enable bit for sw_xoff_int_st register.*/ + uint32_t glitch_det: 1; /*This is the enable bit for glitch_det_int_st register.*/ + uint32_t tx_brk_done: 1; /*This is the enable bit for tx_brk_done_int_st register.*/ + uint32_t tx_brk_idle_done: 1; /*This is the enable bit for tx_brk_idle_done_int_st register.*/ + uint32_t tx_done: 1; /*This is the enable bit for tx_done_int_st register.*/ + uint32_t rs485_parity_err: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + uint32_t rs485_frm_err: 1; /*This is the enable bit for rs485_parity_err_int_st register.*/ + uint32_t rs485_clash: 1; /*This is the enable bit for rs485_clash_int_st register.*/ + uint32_t at_cmd_char_det: 1; /*This is the enable bit for at_cmd_char_det_int_st register.*/ + uint32_t reserved19: 13; }; uint32_t val; }int_ena; union { struct { - uint32_t rxfifo_full_int_clr: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ - uint32_t txfifo_empty_int_clr: 1; /*Set this bit to clear txfifo_empty_int_raw interrupt.*/ - uint32_t parity_err_int_clr: 1; /*Set this bit to clear parity_err_int_raw interrupt.*/ - uint32_t frm_err_int_clr: 1; /*Set this bit to clear frm_err_int_raw interrupt.*/ - uint32_t rxfifo_ovf_int_clr: 1; /*Set this bit to clear rxfifo_ovf_int_raw interrupt.*/ - uint32_t dsr_chg_int_clr: 1; /*Set this bit to clear the dsr_chg_int_raw interrupt.*/ - uint32_t cts_chg_int_clr: 1; /*Set this bit to clear the cts_chg_int_raw interrupt.*/ - uint32_t brk_det_int_clr: 1; /*Set this bit to clear the brk_det_int_raw interrupt.*/ - uint32_t rxfifo_tout_int_clr: 1; /*Set this bit to clear the rxfifo_tout_int_raw interrupt.*/ - uint32_t sw_xon_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ - uint32_t sw_xoff_int_clr: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ - uint32_t glitch_det_int_clr: 1; /*Set this bit to clear the glitch_det_int_raw interrupt.*/ - uint32_t tx_brk_done_int_clr: 1; /*Set this bit to clear the tx_brk_done_int_raw interrupt..*/ - uint32_t tx_brk_idle_done_int_clr: 1; /*Set this bit to clear the tx_brk_idle_done_int_raw interrupt.*/ - uint32_t tx_done_int_clr: 1; /*Set this bit to clear the tx_done_int_raw interrupt.*/ - uint32_t rs485_parity_err_int_clr: 1; /*Set this bit to clear the rs485_parity_err_int_raw interrupt.*/ - uint32_t rs485_frm_err_int_clr: 1; /*Set this bit to clear the rs485_frm_err_int_raw interrupt.*/ - uint32_t rs485_clash_int_clr: 1; /*Set this bit to clear the rs485_clash_int_raw interrupt.*/ - uint32_t at_cmd_char_det_int_clr: 1; /*Set this bit to clear the at_cmd_char_det_int_raw interrupt.*/ - uint32_t reserved19: 13; + uint32_t rxfifo_full: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ + uint32_t txfifo_empty: 1; /*Set this bit to clear txfifo_empty_int_raw interrupt.*/ + uint32_t parity_err: 1; /*Set this bit to clear parity_err_int_raw interrupt.*/ + uint32_t frm_err: 1; /*Set this bit to clear frm_err_int_raw interrupt.*/ + uint32_t rxfifo_ovf: 1; /*Set this bit to clear rxfifo_ovf_int_raw interrupt.*/ + uint32_t dsr_chg: 1; /*Set this bit to clear the dsr_chg_int_raw interrupt.*/ + uint32_t cts_chg: 1; /*Set this bit to clear the cts_chg_int_raw interrupt.*/ + uint32_t brk_det: 1; /*Set this bit to clear the brk_det_int_raw interrupt.*/ + uint32_t rxfifo_tout: 1; /*Set this bit to clear the rxfifo_tout_int_raw interrupt.*/ + uint32_t sw_xon: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + uint32_t sw_xoff: 1; /*Set this bit to clear the sw_xon_int_raw interrupt.*/ + uint32_t glitch_det: 1; /*Set this bit to clear the glitch_det_int_raw interrupt.*/ + uint32_t tx_brk_done: 1; /*Set this bit to clear the tx_brk_done_int_raw interrupt..*/ + uint32_t tx_brk_idle_done: 1; /*Set this bit to clear the tx_brk_idle_done_int_raw interrupt.*/ + uint32_t tx_done: 1; /*Set this bit to clear the tx_done_int_raw interrupt.*/ + uint32_t rs485_parity_err: 1; /*Set this bit to clear the rs485_parity_err_int_raw interrupt.*/ + uint32_t rs485_frm_err: 1; /*Set this bit to clear the rs485_frm_err_int_raw interrupt.*/ + uint32_t rs485_clash: 1; /*Set this bit to clear the rs485_clash_int_raw interrupt.*/ + uint32_t at_cmd_char_det: 1; /*Set this bit to clear the at_cmd_char_det_int_raw interrupt.*/ + uint32_t reserved19: 13; }; uint32_t val; }int_clr; union { struct { - uint32_t clkdiv: 20; /*The register value is the integer part of the frequency divider's factor.*/ - uint32_t clkdiv_frag: 4; /*The register value is the decimal part of the frequency divider's factor.*/ + uint32_t div_int: 20; /*The register value is the integer part of the frequency divider's factor.*/ + uint32_t div_frag: 4; /*The register value is the decimal part of the frequency divider's factor.*/ uint32_t reserved24: 8; }; uint32_t val; }clk_div; union { struct { - uint32_t auto_baud_en: 1; /*This is the enable bit for detecting baudrate.*/ + uint32_t en: 1; /*This is the enable bit for detecting baudrate.*/ uint32_t reserved1: 7; uint32_t glitch_filt: 8; /*when input pulse width is lower then this value ignore this pulse.this register is used in auto-baud detect process.*/ uint32_t reserved16: 16; @@ -164,7 +164,7 @@ typedef volatile struct { uint32_t sw_rts: 1; /*This register is used to configure the software rts signal which is used in software flow control.*/ uint32_t sw_dtr: 1; /*This register is used to configure the software dtr signal which is used in software flow control..*/ uint32_t txd_brk: 1; /*Set this bit to enable transmitter to send 0 when the process of sending data is done.*/ - uint32_t irda_dplx: 1; /*Set this bit to enable irda loopback mode.*/ + uint32_t irda_dplx: 1; /*Set this bit to enable irda loop-back mode.*/ uint32_t irda_tx_en: 1; /*This is the start enable bit for irda transmitter.*/ uint32_t irda_wctl: 1; /*1:the irda transmitter's 11th bit is the same to the 10th bit. 0:set irda transmitter's 11th bit to 0.*/ uint32_t irda_tx_inv: 1; /*Set this bit to inverse the level value of irda transmitter's level.*/ @@ -202,21 +202,21 @@ typedef volatile struct { }conf1; union { struct { - uint32_t lowpulse_min_cnt:20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ - uint32_t reserved20: 12; + uint32_t min_cnt: 20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; uint32_t val; }lowpulse; union { struct { - uint32_t highpulse_min_cnt:20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ - uint32_t reserved20: 12; + uint32_t min_cnt: 20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; uint32_t val; }highpulse; union { struct { - uint32_t rxd_edge_cnt:10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ + uint32_t edge_cnt: 10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ uint32_t reserved10: 22; }; uint32_t val; @@ -260,13 +260,13 @@ typedef volatile struct { }idle_conf; union { struct { - uint32_t rs485_en: 1; /*Set this bit to choose rs485 mode.*/ + uint32_t en: 1; /*Set this bit to choose rs485 mode.*/ uint32_t dl0_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ uint32_t dl1_en: 1; /*Set this bit to delay the stop bit by 1 bit.*/ - uint32_t rs485tx_rx_en: 1; /*Set this bit to enable loop-back transmitter's output data signal to receiver's input data signal.*/ - uint32_t rs485rxby_tx_en: 1; /*1: enable rs485's transmitter to send data when rs485's receiver is busy. 0:rs485's transmitter should not send data when its receiver is busy.*/ - uint32_t rs485_rx_dly_num: 1; /*This register is used to delay the receiver's internal data signal.*/ - uint32_t rs485_tx_dly_num: 4; /*This register is used to delay the transmitter's internal data signal.*/ + uint32_t tx_rx_en: 1; /*Set this bit to enable loop-back transmitter's output data signal to receiver's input data signal.*/ + uint32_t rx_busy_tx_en: 1; /*1: enable rs485's transmitter to send data when rs485's receiver is busy. 0:rs485's transmitter should not send data when its receiver is busy.*/ + uint32_t rx_dly_num: 1; /*This register is used to delay the receiver's internal data signal.*/ + uint32_t tx_dly_num: 4; /*This register is used to delay the transmitter's internal data signal.*/ uint32_t reserved10: 22; }; uint32_t val; @@ -294,7 +294,7 @@ typedef volatile struct { }at_cmd_gaptout; union { struct { - uint32_t at_cmd_char: 8; /*This register is used to configure the content of at_cmd char.*/ + uint32_t data: 8; /*This register is used to configure the content of at_cmd char.*/ uint32_t char_num: 8; /*This register is used to configure the number of continuous at_cmd chars received by receiver.*/ uint32_t reserved16: 16; }; @@ -320,44 +320,44 @@ typedef volatile struct { }mem_conf; union { struct { - uint32_t mem_tx_status:24; + uint32_t status:24; uint32_t reserved24: 8; }; uint32_t val; }mem_tx_status; union { struct { - uint32_t mem_rx_status:24; + uint32_t status:24; uint32_t reserved24: 8; }; uint32_t val; }mem_rx_status; union { struct { - uint32_t rx_mem_cnt: 3; /*refer to the rxfifo_cnt's description.*/ - uint32_t tx_mem_cnt: 3; /*refer to the txfifo_cnt's description.*/ + uint32_t rx_cnt: 3; /*refer to the rxfifo_cnt's description.*/ + uint32_t tx_cnt: 3; /*refer to the txfifo_cnt's description.*/ uint32_t reserved6: 26; }; uint32_t val; }mem_cnt_status; union { struct { - uint32_t posedge_min_cnt:20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ - uint32_t reserved20: 12; + uint32_t min_cnt: 20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; uint32_t val; }pospulse; union { struct { - uint32_t negedge_min_cnt:20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ - uint32_t reserved20: 12; + uint32_t min_cnt: 20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ + uint32_t reserved20: 12; }; uint32_t val; }negpulse; uint32_t reserved_70; uint32_t reserved_74; - uint32_t date; /**/ - uint32_t id; /**/ + uint32_t date; /**/ + uint32_t id; /**/ } uart_dev_t; extern uart_dev_t UART0; extern uart_dev_t UART1; diff --git a/components/esp32/include/soc/uhci_struct.h b/components/esp32/include/soc/uhci_struct.h index 5a78990f24..58e18d0ea5 100644 --- a/components/esp32/include/soc/uhci_struct.h +++ b/components/esp32/include/soc/uhci_struct.h @@ -46,168 +46,168 @@ typedef volatile struct { }conf0; union { struct { - uint32_t rx_start_int_raw: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ - uint32_t tx_start_int_raw: 1; /*when DMA detects a separator char it will produce uhci_tx_start_int interrupt.*/ - uint32_t rx_hung_int_raw: 1; /*when DMA takes a lot of time to receive a data it will produce uhci_rx_hung_int interrupt.*/ - uint32_t tx_hung_int_raw: 1; /*when DMA takes a lot of time to read a data from RAM it will produce uhci_tx_hung_int interrupt.*/ - uint32_t in_done_int_raw: 1; /*when a in link descriptor has been completed it will produce uhci_in_done_int interrupt.*/ - uint32_t in_suc_eof_int_raw: 1; /*when a data packet has been received it will produce uhci_in_suc_eof_int interrupt.*/ - uint32_t in_err_eof_int_raw: 1; /*when there are some errors about eof in in link descriptor it will produce uhci_in_err_eof_int interrupt.*/ - uint32_t out_done_int_raw: 1; /*when a out link descriptor is completed it will produce uhci_out_done_int interrupt.*/ - uint32_t out_eof_int_raw: 1; /*when the current descriptor's eof bit is 1 it will produce uhci_out_eof_int interrupt.*/ - uint32_t in_dscr_err_int_raw: 1; /*when there are some errors about the out link descriptor it will produce uhci_in_dscr_err_int interrupt.*/ - uint32_t out_dscr_err_int_raw: 1; /*when there are some errors about the in link descriptor it will produce uhci_out_dscr_err_int interrupt.*/ - uint32_t in_dscr_empty_int_raw: 1; /*when there are not enough in links for DMA it will produce uhci_in_dscr_err_int interrupt.*/ - uint32_t outlink_eof_err_int_raw: 1; /*when there are some errors about eof in outlink descriptor it will produce uhci_outlink_eof_err_int interrupt.*/ - uint32_t out_total_eof_int_raw: 1; /*When all data have been send it will produce uhci_out_total_eof_int interrupt.*/ - uint32_t send_s_q_int_raw: 1; /*When use single send registers to send a short packets it will produce this interrupt when dma has send the short packet.*/ - uint32_t send_a_q_int_raw: 1; /*When use always_send registers to send a series of short packets it will produce this interrupt when dma has send the short packet.*/ - uint32_t dma_infifo_full_wm_int_raw: 1; - uint32_t reserved17: 15; + uint32_t rx_start: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ + uint32_t tx_start: 1; /*when DMA detects a separator char it will produce uhci_tx_start_int interrupt.*/ + uint32_t rx_hung: 1; /*when DMA takes a lot of time to receive a data it will produce uhci_rx_hung_int interrupt.*/ + uint32_t tx_hung: 1; /*when DMA takes a lot of time to read a data from RAM it will produce uhci_tx_hung_int interrupt.*/ + uint32_t in_done: 1; /*when a in link descriptor has been completed it will produce uhci_in_done_int interrupt.*/ + uint32_t in_suc_eof: 1; /*when a data packet has been received it will produce uhci_in_suc_eof_int interrupt.*/ + uint32_t in_err_eof: 1; /*when there are some errors about eof in in link descriptor it will produce uhci_in_err_eof_int interrupt.*/ + uint32_t out_done: 1; /*when a out link descriptor is completed it will produce uhci_out_done_int interrupt.*/ + uint32_t out_eof: 1; /*when the current descriptor's eof bit is 1 it will produce uhci_out_eof_int interrupt.*/ + uint32_t in_dscr_err: 1; /*when there are some errors about the out link descriptor it will produce uhci_in_dscr_err_int interrupt.*/ + uint32_t out_dscr_err: 1; /*when there are some errors about the in link descriptor it will produce uhci_out_dscr_err_int interrupt.*/ + uint32_t in_dscr_empty: 1; /*when there are not enough in links for DMA it will produce uhci_in_dscr_err_int interrupt.*/ + uint32_t outlink_eof_err: 1; /*when there are some errors about eof in outlink descriptor it will produce uhci_outlink_eof_err_int interrupt.*/ + uint32_t out_total_eof: 1; /*When all data have been send it will produce uhci_out_total_eof_int interrupt.*/ + uint32_t send_s_q: 1; /*When use single send registers to send a short packets it will produce this interrupt when dma has send the short packet.*/ + uint32_t send_a_q: 1; /*When use always_send registers to send a series of short packets it will produce this interrupt when dma has send the short packet.*/ + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_raw; union { struct { - uint32_t rx_start_int_st: 1; - uint32_t tx_start_int_st: 1; - uint32_t rx_hung_int_st: 1; - uint32_t tx_hung_int_st: 1; - uint32_t in_done_int_st: 1; - uint32_t in_suc_eof_int_st: 1; - uint32_t in_err_eof_int_st: 1; - uint32_t out_done_int_st: 1; - uint32_t out_eof_int_st: 1; - uint32_t in_dscr_err_int_st: 1; - uint32_t out_dscr_err_int_st: 1; - uint32_t in_dscr_empty_int_st: 1; - uint32_t outlink_eof_err_int_st: 1; - uint32_t out_total_eof_int_st: 1; - uint32_t send_s_q_int_st: 1; - uint32_t send_a_q_int_st: 1; - uint32_t dma_infifo_full_wm_int_st: 1; - uint32_t reserved17: 15; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_st; union { struct { - uint32_t rx_start_int_ena: 1; - uint32_t tx_start_int_ena: 1; - uint32_t rx_hung_int_ena: 1; - uint32_t tx_hung_int_ena: 1; - uint32_t in_done_int_ena: 1; - uint32_t in_suc_eof_int_ena: 1; - uint32_t in_err_eof_int_ena: 1; - uint32_t out_done_int_ena: 1; - uint32_t out_eof_int_ena: 1; - uint32_t in_dscr_err_int_ena: 1; - uint32_t out_dscr_err_int_ena: 1; - uint32_t in_dscr_empty_int_ena: 1; - uint32_t outlink_eof_err_int_ena: 1; - uint32_t out_total_eof_int_ena: 1; - uint32_t send_s_q_int_ena: 1; - uint32_t send_a_q_int_ena: 1; - uint32_t dma_infifo_full_wm_int_ena: 1; - uint32_t reserved17: 15; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_ena; union { struct { - uint32_t rx_start_int_clr: 1; - uint32_t tx_start_int_clr: 1; - uint32_t rx_hung_int_clr: 1; - uint32_t tx_hung_int_clr: 1; - uint32_t in_done_int_clr: 1; - uint32_t in_suc_eof_int_clr: 1; - uint32_t in_err_eof_int_clr: 1; - uint32_t out_done_int_clr: 1; - uint32_t out_eof_int_clr: 1; - uint32_t in_dscr_err_int_clr: 1; - uint32_t out_dscr_err_int_clr: 1; - uint32_t in_dscr_empty_int_clr: 1; - uint32_t outlink_eof_err_int_clr: 1; - uint32_t out_total_eof_int_clr: 1; - uint32_t send_s_q_int_clr: 1; - uint32_t send_a_q_int_clr: 1; - uint32_t dma_infifo_full_wm_int_clr: 1; - uint32_t reserved17: 15; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; }; uint32_t val; }int_clr; union { struct { - uint32_t out_full: 1; /*1:DMA out link descriptor's fifo is full.*/ - uint32_t out_empty: 1; /*1:DMA in link descriptor's fifo is empty.*/ + uint32_t full: 1; /*1:DMA out link descriptor's fifo is full.*/ + uint32_t empty: 1; /*1:DMA in link descriptor's fifo is empty.*/ uint32_t reserved2: 30; }; uint32_t val; }dma_out_status; union { struct { - uint32_t outfifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ - uint32_t reserved9: 7; - uint32_t outfifo_push: 1; /*Set this bit to push data in out link descriptor's fifo.*/ - uint32_t reserved17: 15; + uint32_t fifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ + uint32_t reserved9: 7; + uint32_t fifo_push: 1; /*Set this bit to push data in out link descriptor's fifo.*/ + uint32_t reserved17:15; }; uint32_t val; }dma_out_push; union { struct { - uint32_t in_full: 1; - uint32_t in_empty: 1; + uint32_t full: 1; + uint32_t empty: 1; uint32_t reserved2: 2; - uint32_t rx_err_cause: 3; /*This register stores the errors caused in out link descriptor's data packet.*/ + uint32_t rx_err_cause: 3; /*This register stores the errors caused in out link descriptor's data packet.*/ uint32_t reserved7: 25; }; uint32_t val; }dma_in_status; union { struct { - uint32_t infifo_rdata:12; /*This register stores the data pop from in link descriptor's fifo.*/ + uint32_t fifo_rdata: 12; /*This register stores the data pop from in link descriptor's fifo.*/ uint32_t reserved12: 4; - uint32_t infifo_pop: 1; /*Set this bit to pop data in in link descriptor's fifo.*/ + uint32_t fifo_pop: 1; /*Set this bit to pop data in in link descriptor's fifo.*/ uint32_t reserved17: 15; }; uint32_t val; }dma_in_pop; union { struct { - uint32_t outlink_addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ - uint32_t reserved20: 8; - uint32_t outlink_stop: 1; /*Set this bit to stop dealing with the out link descriptors.*/ - uint32_t outlink_start: 1; /*Set this bit to start dealing with the out link descriptors.*/ - uint32_t outlink_restart: 1; /*Set this bit to mount on new out link descriptors*/ - uint32_t outlink_park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ + uint32_t addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ + uint32_t reserved20: 8; + uint32_t stop: 1; /*Set this bit to stop dealing with the out link descriptors.*/ + uint32_t start: 1; /*Set this bit to start dealing with the out link descriptors.*/ + uint32_t restart: 1; /*Set this bit to mount on new out link descriptors*/ + uint32_t park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ }; uint32_t val; }dma_out_link; union { struct { - uint32_t inlink_addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ - uint32_t inlink_auto_ret: 1; /*1:when a packet is wrong in link descriptor returns to the descriptor which is lately used.*/ - uint32_t reserved21: 7; - uint32_t inlink_stop: 1; /*Set this bit to stop dealing with the in link descriptors.*/ - uint32_t inlink_start: 1; /*Set this bit to start dealing with the in link descriptors.*/ - uint32_t inlink_restart: 1; /*Set this bit to mount on new in link descriptors*/ - uint32_t inlink_park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ + uint32_t addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ + uint32_t auto_ret: 1; /*1:when a packet is wrong in link descriptor returns to the descriptor which is lately used.*/ + uint32_t reserved21: 7; + uint32_t stop: 1; /*Set this bit to stop dealing with the in link descriptors.*/ + uint32_t start: 1; /*Set this bit to start dealing with the in link descriptors.*/ + uint32_t restart: 1; /*Set this bit to mount on new in link descriptors*/ + uint32_t park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ }; uint32_t val; }dma_in_link; union { struct { - uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ - uint32_t check_seq_en: 1; /*Set this bit to enable decoder to check seq num in packet header.*/ - uint32_t crc_disable: 1; /*Set this bit to disable crc calculation.*/ - uint32_t save_head: 1; /*Set this bit to save packet header .*/ - uint32_t tx_check_sum_re: 1; /*Set this bit to enable hardware replace check_sum in packet header automatically.*/ - uint32_t tx_ack_num_re: 1; /*Set this bit to enable hardware replace ack num in packet header automatically.*/ - uint32_t check_owner: 1; /*Set this bit to check the owner bit in link descriptor.*/ - uint32_t wait_sw_start: 1; /*Set this bit to enable software way to add packet header.*/ - uint32_t sw_start: 1; /*Set this bit to start inserting the packet header.*/ - uint32_t dma_infifo_full_thrs:12; /*when data amount in link descriptor's fifo is more than this register value it will produce uhci_dma_infifo_full_wm_int interrupt.*/ - uint32_t reserved21: 11; + uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ + uint32_t check_seq_en: 1; /*Set this bit to enable decoder to check seq num in packet header.*/ + uint32_t crc_disable: 1; /*Set this bit to disable crc calculation.*/ + uint32_t save_head: 1; /*Set this bit to save packet header .*/ + uint32_t tx_check_sum_re: 1; /*Set this bit to enable hardware replace check_sum in packet header automatically.*/ + uint32_t tx_ack_num_re: 1; /*Set this bit to enable hardware replace ack num in packet header automatically.*/ + uint32_t check_owner: 1; /*Set this bit to check the owner bit in link descriptor.*/ + uint32_t wait_sw_start: 1; /*Set this bit to enable software way to add packet header.*/ + uint32_t sw_start: 1; /*Set this bit to start inserting the packet header.*/ + uint32_t dma_in_fifo_full_thrs:12; /*when data amount in link descriptor's fifo is more than this register value it will produce uhci_dma_in_fifo_full_wm_int interrupt.*/ + uint32_t reserved21: 11; }; uint32_t val; }conf1; @@ -219,10 +219,10 @@ typedef volatile struct { uint32_t dma_out_eof_bfr_des_addr; /*This register stores the address of out link descriptor when there are some errors in this descriptor.*/ union { struct { - uint32_t ahb_testmode: 3; /*bit2 is ahb bus test enable ,bit1 is used to choose write(1) or read(0) mode. bit0 is used to choose test only once(1) or continue(0)*/ - uint32_t reserved3: 1; - uint32_t ahb_testaddr: 2; /*The two bits represent ahb bus address bit[20:19]*/ - uint32_t reserved6: 26; + uint32_t test_mode: 3; /*bit2 is ahb bus test enable ,bit1 is used to choose write(1) or read(0) mode. bit0 is used to choose test only once(1) or continue(0)*/ + uint32_t reserved3: 1; + uint32_t test_addr: 2; /*The two bits represent ahb bus address bit[20:19]*/ + uint32_t reserved6: 26; }; uint32_t val; }ahb_test; @@ -271,7 +271,7 @@ typedef volatile struct { uint32_t val; }quick_sent; struct{ - uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ + uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ }q_data[7]; union { struct { @@ -284,34 +284,34 @@ typedef volatile struct { }esc_conf0; union { struct { - uint32_t esc_seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ - uint32_t esc_seq0_char0: 8; /*This register stores the first char used to replace reg_esc_seq0 in data.*/ - uint32_t esc_seq0_char1: 8; /*This register stores the second char used to replace the reg_esc_seq0 in data*/ - uint32_t reserved24: 8; + uint32_t seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ + uint32_t seq0_char0: 8; /*This register stores the first char used to replace reg_esc_seq0 in data.*/ + uint32_t seq0_char1: 8; /*This register stores the second char used to replace the reg_esc_seq0 in data*/ + uint32_t reserved24: 8; }; uint32_t val; }esc_conf1; union { struct { - uint32_t esc_seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ - uint32_t esc_seq1_char0: 8; /*This register stores the first char used to replace the reg_esc_seq1 in data.*/ - uint32_t esc_seq1_char1: 8; /*This register stores the second char used to replace the reg_esc_seq1 in data.*/ - uint32_t reserved24: 8; + uint32_t seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ + uint32_t seq1_char0: 8; /*This register stores the first char used to replace the reg_esc_seq1 in data.*/ + uint32_t seq1_char1: 8; /*This register stores the second char used to replace the reg_esc_seq1 in data.*/ + uint32_t reserved24: 8; }; uint32_t val; }esc_conf2; union { struct { - uint32_t esc_seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ - uint32_t esc_seq2_char0: 8; /*This register stores the first char used to replace the reg_esc_seq2 in data.*/ - uint32_t esc_seq2_char1: 8; /*This register stores the second char used to replace the reg_esc_seq2 in data.*/ - uint32_t reserved24: 8; + uint32_t seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ + uint32_t seq2_char0: 8; /*This register stores the first char used to replace the reg_esc_seq2 in data.*/ + uint32_t seq2_char1: 8; /*This register stores the second char used to replace the reg_esc_seq2 in data.*/ + uint32_t reserved24: 8; }; uint32_t val; }esc_conf3; union { struct { - uint32_t pkt_thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ + uint32_t thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ uint32_t reserved13:19; }; uint32_t val; From 015ae7e0d0680c697589f5b5e05f0dcade3e9db2 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Sun, 18 Sep 2016 19:24:43 +0800 Subject: [PATCH 021/179] fix ledc and spi typo --- components/esp32/include/soc/ledc_struct.h | 2 +- components/esp32/include/soc/spi_struct.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index 26ddf6867e..40341f00e5 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -180,7 +180,7 @@ typedef volatile struct { uint32_t lstimer0_ovf: 1; /*The interrupt status bit for low speed channel0 counter overflow event.*/ uint32_t lstimer1_ovf: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ uint32_t lstimer2_ovf: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ - uint32_t lstimer3_ovf: 1; /*The interrupt status bit for low speed channel3 counter overflow event.* uint32_t duty_chng_end_hsch0: 1; /*The interrupt status bit for high speed channel 0 duty change done event.*/ + uint32_t lstimer3_ovf: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ uint32_t duty_chng_end_hsch1: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ uint32_t duty_chng_end_hsch2: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ uint32_t duty_chng_end_hsch3: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ diff --git a/components/esp32/include/soc/spi_struct.h b/components/esp32/include/soc/spi_struct.h index 31b86308ba..5c1c93021e 100644 --- a/components/esp32/include/soc/spi_struct.h +++ b/components/esp32/include/soc/spi_struct.h @@ -420,7 +420,7 @@ typedef volatile struct { uint32_t val; }dma_status; union { - struct {_int_clr + struct { uint32_t inlink_dscr_empty: 1; /*The enable bit for lack of enough inlink descriptors.*/ uint32_t outlink_dscr_error: 1; /*The enable bit for outlink descriptor error.*/ uint32_t inlink_dscr_error: 1; /*The enable bit for inlink descriptor error.*/ From 69278b28bfc326e3a04c2c934dd59885c0906bfe Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 20:24:31 +0800 Subject: [PATCH 022/179] components/log: fix bugs, add options to override log level for files, components, and bootloader --- components/bootloader/Kconfig.projbuild | 28 +++++ components/log/include/esp_log.h | 65 +++++------- components/log/log.c | 134 +++++++++++++++--------- 3 files changed, 138 insertions(+), 89 deletions(-) diff --git a/components/bootloader/Kconfig.projbuild b/components/bootloader/Kconfig.projbuild index 8d5f667216..394bcc1bd1 100644 --- a/components/bootloader/Kconfig.projbuild +++ b/components/bootloader/Kconfig.projbuild @@ -1,3 +1,31 @@ menu "Bootloader config" +choice LOG_BOOTLOADER_LEVEL + bool "Bootloader log verbosity" + default LOG_BOOTLOADER_LEVEL_WARN + help + Specify how much output to see in bootloader logs. + +config LOG_BOOTLOADER_LEVEL_NONE + bool "No output" +config LOG_BOOTLOADER_LEVEL_ERROR + bool "Error" +config LOG_BOOTLOADER_LEVEL_WARN + bool "Warning" +config LOG_BOOTLOADER_LEVEL_INFO + bool "Info" +config LOG_BOOTLOADER_LEVEL_DEBUG + bool "Debug" +config LOG_BOOTLOADER_LEVEL_VERBOSE + bool "Verbose" +endchoice + +config LOG_BOOTLOADER_LEVEL + int + default 0 if LOG_BOOTLOADER_LEVEL_NONE + default 1 if LOG_BOOTLOADER_LEVEL_ERROR + default 2 if LOG_BOOTLOADER_LEVEL_WARN + default 3 if LOG_BOOTLOADER_LEVEL_INFO + default 4 if LOG_BOOTLOADER_LEVEL_DEBUG + default 5 if LOG_BOOTLOADER_LEVEL_VERBOSE endmenu diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index 32f6d0bb30..a12d324de1 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -68,8 +68,17 @@ extern "C" { * from _EARLY version to normal version on the fly. Unfortunately, ets_vprintf in ROM * has been inlined by the compiler into ets_printf, so it is not accessible outside.) * + * To override default verbosity level at file or component scope, define LOG_LOCAL_LEVEL macro. + * At file scope, define it before including esp_log.h, e.g.: * - * To configure logging output per module, add calls to esp_log_set_level function: + * #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE + * #include "esp_log.h" + * + * At component scope, define it in component makefile: + * + * CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG + * + * To configure logging output per module at runtime, add calls to esp_log_set_level function: * * esp_log_set_level("*", ESP_LOG_ERROR); // set all components to ERROR level * esp_log_set_level("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack @@ -162,68 +171,50 @@ uint32_t esp_log_timestamp(); #define LOG_RESET_COLOR #endif //CONFIG_LOG_COLORS +#ifndef LOG_LOCAL_LEVEL +#ifndef BOOTLOADER_BUILD +#define LOG_LOCAL_LEVEL ((esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL) +#else +#define LOG_LOCAL_LEVEL ((esp_log_level_t) CONFIG_LOG_BOOTLOADER_LEVEL) +#endif +#endif + #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" -#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_ERROR) -#define ESP_EARLY_LOGE( tag, format, ... ) ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_EARLY_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #ifndef BOOTLOADER_BUILD -#define ESP_LOGE( tag, format, ... ) esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else #define ESP_LOGE( tag, format, ... ) ESP_EARLY_LOGE( tag, format, ##__VA_ARGS__) #endif // BOOTLOADER_BUILD -#else -#define ESP_LOGE( tag, format, ... ) -#define ESP_EARLY_LOGE( tag, format, ... ) -#endif -#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_WARN) -#define ESP_EARLY_LOGW( tag, format, ... ) ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_EARLY_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #ifndef BOOTLOADER_BUILD -#define ESP_LOGW( tag, format, ... ) esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else #define ESP_LOGW( tag, format, ... ) ESP_EARLY_LOGW( tag, format, ##__VA_ARGS__) #endif // BOOTLOADER_BUILD -#else -#define ESP_LOGW( tag, format, ... ) -#define ESP_EARLY_LOGW( tag, format, ... ) -#endif -#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_INFO) -#define ESP_EARLY_LOGI( tag, format, ... ) ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_EARLY_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #ifndef BOOTLOADER_BUILD -#define ESP_LOGI( tag, format, ... ) esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else #define ESP_LOGI( tag, format, ... ) ESP_EARLY_LOGI( tag, format, ##__VA_ARGS__) #endif //BOOTLOADER_BUILD -#else -#define ESP_LOGI( tag, format, ... ) -#define ESP_EARLY_LOGI( tag, format, ... ) -#endif - -#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_DEBUG) -#define ESP_EARLY_LOGD( tag, format, ... ) ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_EARLY_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #ifndef BOOTLOADER_BUILD -#define ESP_LOGD( tag, format, ... ) esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else #define ESP_LOGD( tag, format, ... ) ESP_EARLY_LOGD(tag, format, ##__VA_ARGS__) #endif // BOOTLOADER_BUILD -#else -#define ESP_LOGD( tag, format, ... ) -#define ESP_EARLY_LOGD( tag, format, ... ) -#endif -#if (CONFIG_LOG_DEFAULT_LEVEL >= ESP_LOG_VERBOSE) -#define ESP_EARLY_LOGV( tag, format, ... ) ets_printf(LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_EARLY_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { ets_printf(LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #ifndef BOOTLOADER_BUILD -#define ESP_LOGV( tag, format, ... ) esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__) +#define ESP_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else #define ESP_LOGV( tag, format, ... ) ESP_EARLY_LOGV(tag, format, ##__VA_ARGS__) #endif // BOOTLOADER_BUILD -#else -#define ESP_LOGV( tag, format, ... ) -#define ESP_EARLY_LOGV( tag, format, ... ) -#endif #ifdef __cplusplus } diff --git a/components/log/log.c b/components/log/log.c index bd6df01b28..9063d264e4 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -51,13 +51,21 @@ #include #include #include +#include #include "esp_log.h" #ifndef BOOTLOADER_BUILD -#define TAG_CACHE_SIZE 32 -#define MAX_MUTEX_WAIT_TICKS ((10 + portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS) +// Number of tags to be cached. Must be 2**n - 1, n >= 2. +#define TAG_CACHE_SIZE 31 + +// Maximum time to wait for the mutex in a logging statement. +#define MAX_MUTEX_WAIT_MS 10 +#define MAX_MUTEX_WAIT_TICKS ((MAX_MUTEX_WAIT_MS + portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS) + +// Uncomment this to enable consistency checks and cache statistics in this file. +// #define LOG_BUILTIN_CHECKS typedef struct { const char* tag; @@ -71,14 +79,18 @@ typedef struct uncached_tag_entry_{ char tag[0]; // beginning of a zero-terminated string } uncached_tag_entry_t; -static esp_log_level_t s_default_level = (esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL; -static uncached_tag_entry_t* s_head = NULL; -static uncached_tag_entry_t* s_tail = NULL; -static cached_tag_entry_t s_cache[TAG_CACHE_SIZE]; -static uint32_t s_cache_max_generation = 0; -static uint32_t s_cache_entry_count = 0; -static vprintf_like_t s_print_func = &vprintf; -static SemaphoreHandle_t s_mutex = NULL; +static esp_log_level_t s_log_default_level = (esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL; +static uncached_tag_entry_t* s_log_tags_head = NULL; +static uncached_tag_entry_t* s_log_tags_tail = NULL; +static cached_tag_entry_t s_log_cache[TAG_CACHE_SIZE]; +static uint32_t s_log_cache_max_generation = 0; +static uint32_t s_log_cache_entry_count = 0; +static vprintf_like_t s_log_print_func = &vprintf; +static SemaphoreHandle_t s_log_mutex = NULL; + +#ifdef LOG_BUILTIN_CHECKS +static uint32_t s_log_cache_misses = 0; +#endif static inline bool get_cached_log_level(const char* tag, esp_log_level_t* level); static inline bool get_uncached_log_level(const char* tag, esp_log_level_t* level); @@ -90,21 +102,21 @@ static inline void clear_log_level_list(); void esp_log_set_vprintf(vprintf_like_t func) { - s_print_func = func; + s_log_print_func = func; } void esp_log_level_set(const char* tag, esp_log_level_t level) { - if (!s_mutex) { - s_mutex = xSemaphoreCreateMutex(); + if (!s_log_mutex) { + s_log_mutex = xSemaphoreCreateMutex(); } - xSemaphoreTake(&s_mutex, portMAX_DELAY); + xSemaphoreTake(s_log_mutex, portMAX_DELAY); // for wildcard tag, remove all linked list items and clear the cache if (strcmp(tag, "*") == 0) { - s_default_level = level; + s_log_default_level = level; clear_log_level_list(); - xSemaphoreGive(&s_mutex); + xSemaphoreGive(s_log_mutex); return; } @@ -112,60 +124,68 @@ void esp_log_level_set(const char* tag, esp_log_level_t level) size_t entry_size = offsetof(uncached_tag_entry_t, tag) + strlen(tag) + 1; uncached_tag_entry_t* new_entry = (uncached_tag_entry_t*) malloc(entry_size); if (!new_entry) { - xSemaphoreGive(&s_mutex); + xSemaphoreGive(s_log_mutex); return; } new_entry->next = NULL; new_entry->level = (uint8_t) level; strcpy(new_entry->tag, tag); - if (s_tail) { - s_tail->next = new_entry; + if (s_log_tags_tail) { + s_log_tags_tail->next = new_entry; } - s_tail = new_entry; - if (!s_head) { - s_head = new_entry; + s_log_tags_tail = new_entry; + if (!s_log_tags_head) { + s_log_tags_head = new_entry; } - xSemaphoreGive(&s_mutex); + xSemaphoreGive(s_log_mutex); } void clear_log_level_list() { - for (uncached_tag_entry_t* it = s_head; it != NULL; ) { + for (uncached_tag_entry_t* it = s_log_tags_head; it != NULL; ) { uncached_tag_entry_t* next = it->next; free(it); it = next; } + s_log_tags_tail = NULL; + s_log_tags_head = NULL; + s_log_cache_entry_count = 0; + s_log_cache_max_generation = 0; +#ifdef LOG_BUILTIN_CHECKS + s_log_cache_misses = 0; +#endif - s_cache_entry_count = 0; - s_cache_max_generation = 0; } void IRAM_ATTR esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) { - if (!s_mutex) { - s_mutex = xSemaphoreCreateMutex(); + if (!s_log_mutex) { + s_log_mutex = xSemaphoreCreateMutex(); } - if (xSemaphoreTake(&s_mutex, MAX_MUTEX_WAIT_TICKS) == pdFALSE) { + if (xSemaphoreTake(s_log_mutex, MAX_MUTEX_WAIT_TICKS) == pdFALSE) { return; } esp_log_level_t level_for_tag; // Look for the tag in cache first, then in the linked list of all tags if (!get_cached_log_level(tag, &level_for_tag)) { if (!get_uncached_log_level(tag, &level_for_tag)) { - level_for_tag = s_default_level; + level_for_tag = s_log_default_level; } add_to_cache(tag, level_for_tag); +#ifdef LOG_BUILTIN_CHECKS + ++s_log_cache_misses; +#endif } - xSemaphoreGive(&s_mutex); + xSemaphoreGive(s_log_mutex); if (!should_output(level, level_for_tag)) { return; } va_list list; va_start(list, format); - (*s_print_func)(format, list); + (*s_log_print_func)(format, list); va_end(list); } @@ -173,43 +193,53 @@ static inline bool get_cached_log_level(const char* tag, esp_log_level_t* level) { // Look for `tag` in cache int i; - for (i = 0; i < s_cache_entry_count; ++i) { - if (s_cache[i].tag == tag) { + for (i = 0; i < s_log_cache_entry_count; ++i) { +#ifdef LOG_BUILTIN_CHECKS + assert(i == 0 || s_log_cache[(i - 1) / 2].generation < s_log_cache[i].generation); +#endif + if (s_log_cache[i].tag == tag) { break; } } - if (i == s_cache_entry_count) { // Not found in cache + if (i == s_log_cache_entry_count) { // Not found in cache return false; } // Return level from cache - *level = (esp_log_level_t) s_cache[i].level; - // Update item generation - s_cache[i].generation = s_cache_max_generation++; - // Restore heap ordering - heap_bubble_down(i); + *level = (esp_log_level_t) s_log_cache[i].level; + // If cache has been filled, start taking ordering into account + // (other options are: dynamically resize cache, add "dummy" entries + // to the cache; this option was chosen because code is much simpler, + // and the unfair behavior of cache will show it self at most once, when + // it has just been filled) + if (s_log_cache_entry_count == TAG_CACHE_SIZE) { + // Update item generation + s_log_cache[i].generation = s_log_cache_max_generation++; + // Restore heap ordering + heap_bubble_down(i); + } return true; } static inline void add_to_cache(const char* tag, esp_log_level_t level) { - uint32_t generation = s_cache_max_generation++; + uint32_t generation = s_log_cache_max_generation++; // First consider the case when cache is not filled yet. // In this case, just add new entry at the end. // This happens to satisfy binary min-heap ordering. - if (s_cache_entry_count < TAG_CACHE_SIZE) { - s_cache[s_cache_entry_count] = (cached_tag_entry_t) { + if (s_log_cache_entry_count < TAG_CACHE_SIZE) { + s_log_cache[s_log_cache_entry_count] = (cached_tag_entry_t) { .generation = generation, .level = level, .tag = tag }; - ++s_cache_entry_count; + ++s_log_cache_entry_count; return; } // Cache is full, so we replace the oldest entry (which is at index 0 // because this is a min-heap) with the new one, and do bubble-down // operation to restore min-heap ordering. - s_cache[0] = (cached_tag_entry_t) { + s_log_cache[0] = (cached_tag_entry_t) { .tag = tag, .level = level, .generation = generation @@ -221,7 +251,7 @@ static inline bool get_uncached_log_level(const char* tag, esp_log_level_t* leve { // Walk the linked list of all tags and see if given tag is present in the list. // This is slow because tags are compared as strings. - for (uncached_tag_entry_t* it = s_head; it != NULL; ++it) { + for (uncached_tag_entry_t* it = s_log_tags_head; it != NULL; it = it->next) { if (strcmp(tag, it->tag) == 0) { *level = it->level; return true; @@ -240,7 +270,7 @@ static void heap_bubble_down(int index) while (index < TAG_CACHE_SIZE / 2) { int left_index = index * 2 + 1; int right_index = left_index + 1; - int next = (s_cache[left_index].generation < s_cache[right_index].generation) ? left_index : right_index; + int next = (s_log_cache[left_index].generation < s_log_cache[right_index].generation) ? left_index : right_index; heap_swap(index, next); index = next; } @@ -248,13 +278,13 @@ static void heap_bubble_down(int index) static inline void heap_swap(int i, int j) { - cached_tag_entry_t tmp = s_cache[i]; - s_cache[i] = s_cache[j]; - s_cache[j] = tmp; + cached_tag_entry_t tmp = s_log_cache[i]; + s_log_cache[i] = s_log_cache[j]; + s_log_cache[j] = tmp; } #endif //BOOTLOADER_BUILD -inline uint32_t esp_log_early_timestamp() +inline IRAM_ATTR uint32_t esp_log_early_timestamp() { return xthal_get_ccount() / (CPU_CLK_FREQ_ROM / 1000); } @@ -275,7 +305,7 @@ uint32_t IRAM_ATTR esp_log_timestamp() #else -uint32_t esp_log_timestamp() +uint32_t IRAM_ATTR esp_log_timestamp() { return esp_log_early_timestamp(); } From 3cdefd99238e1e209ef6d83b803120ff5a76db79 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 20:51:57 +0800 Subject: [PATCH 023/179] components/log: fix error when using ESP_LOGx from C++ code --- components/log/include/esp_log.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index a12d324de1..d2097e3620 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -154,8 +154,8 @@ uint32_t esp_log_timestamp(); #define LOG_COLOR_BLUE "34" #define LOG_COLOR_PURPLE "35" #define LOG_COLOR_CYAN "36" -#define LOG_COLOR(COLOR) "\033[0;"COLOR"m" -#define LOG_BOLD(COLOR) "\033[1;"COLOR"m" +#define LOG_COLOR(COLOR) "\033[0;" COLOR "m" +#define LOG_BOLD(COLOR) "\033[1;" COLOR "m" #define LOG_RESET_COLOR "\033[0m" #define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED) #define LOG_COLOR_W LOG_COLOR(LOG_COLOR_BROWN) From 26bf85bad6d926255f7bf0fcb483849f92b7755c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 21:01:28 +0800 Subject: [PATCH 024/179] components/log: set default runtime log level to ESP_LOG_VERBOSE With this change, it is possible to use LOG_LOCAL_LEVEL to raise debug level for given file/component --- components/log/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/log/log.c b/components/log/log.c index 9063d264e4..b347b20a3c 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -79,7 +79,7 @@ typedef struct uncached_tag_entry_{ char tag[0]; // beginning of a zero-terminated string } uncached_tag_entry_t; -static esp_log_level_t s_log_default_level = (esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL; +static esp_log_level_t s_log_default_level = ESP_LOG_VERBOSE; static uncached_tag_entry_t* s_log_tags_head = NULL; static uncached_tag_entry_t* s_log_tags_tail = NULL; static cached_tag_entry_t s_log_cache[TAG_CACHE_SIZE]; From 1188bdfc684bda5cfc84ca239526d87509320743 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 21:06:43 +0800 Subject: [PATCH 025/179] components/log: fix timestamp calculation --- components/log/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/log/log.c b/components/log/log.c index b347b20a3c..aae12a7735 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -300,7 +300,7 @@ uint32_t IRAM_ATTR esp_log_timestamp() if (base == 0) { base = esp_log_early_timestamp(); } - return base + xTaskGetTickCount() * configTICK_RATE_HZ; + return base + xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); } #else From d9338e64e5bc751003b53313912849d122259a3f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 18 Sep 2016 23:12:50 +0800 Subject: [PATCH 026/179] gitlab-ci: allow running tests for branches, triggered via API --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10a9298db6..7233d9ac4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,6 +95,7 @@ test_build_system: when: on_success only: - master + - triggers variables: # need user to set SDK_NAME and CONFIG_FILE (may need to set BIN_PATH and APP_NAME later) in before_script From 14e003fcf205b6b2ac2904f1faf701dc4898a49d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 19 Sep 2016 08:53:09 +0800 Subject: [PATCH 027/179] components/log: regroup macros for better readability --- components/log/include/esp_log.h | 45 +++++++++++--------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index d2097e3620..8ca6e241d4 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -171,6 +171,8 @@ uint32_t esp_log_timestamp(); #define LOG_RESET_COLOR #endif //CONFIG_LOG_COLORS +#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" + #ifndef LOG_LOCAL_LEVEL #ifndef BOOTLOADER_BUILD #define LOG_LOCAL_LEVEL ((esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL) @@ -179,40 +181,23 @@ uint32_t esp_log_timestamp(); #endif #endif -#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" - -#define ESP_EARLY_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#ifndef BOOTLOADER_BUILD -#define ESP_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#else -#define ESP_LOGE( tag, format, ... ) ESP_EARLY_LOGE( tag, format, ##__VA_ARGS__) -#endif // BOOTLOADER_BUILD - -#define ESP_EARLY_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#ifndef BOOTLOADER_BUILD -#define ESP_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#else -#define ESP_LOGW( tag, format, ... ) ESP_EARLY_LOGW( tag, format, ##__VA_ARGS__) -#endif // BOOTLOADER_BUILD - -#define ESP_EARLY_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#ifndef BOOTLOADER_BUILD -#define ESP_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#else -#define ESP_LOGI( tag, format, ... ) ESP_EARLY_LOGI( tag, format, ##__VA_ARGS__) -#endif //BOOTLOADER_BUILD - -#define ESP_EARLY_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#ifndef BOOTLOADER_BUILD -#define ESP_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } -#else -#define ESP_LOGD( tag, format, ... ) ESP_EARLY_LOGD(tag, format, ##__VA_ARGS__) -#endif // BOOTLOADER_BUILD - +#define ESP_EARLY_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_EARLY_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_EARLY_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_EARLY_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #define ESP_EARLY_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { ets_printf(LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } + #ifndef BOOTLOADER_BUILD +#define ESP_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } +#define ESP_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #define ESP_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } #else +#define ESP_LOGE( tag, format, ... ) ESP_EARLY_LOGE(tag, format, ##__VA_ARGS__) +#define ESP_LOGW( tag, format, ... ) ESP_EARLY_LOGW(tag, format, ##__VA_ARGS__) +#define ESP_LOGI( tag, format, ... ) ESP_EARLY_LOGI(tag, format, ##__VA_ARGS__) +#define ESP_LOGD( tag, format, ... ) ESP_EARLY_LOGD(tag, format, ##__VA_ARGS__) #define ESP_LOGV( tag, format, ... ) ESP_EARLY_LOGV(tag, format, ##__VA_ARGS__) #endif // BOOTLOADER_BUILD From ff2750ab07a1fe54cb821a0db79ddac116c205d8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 19 Sep 2016 15:05:32 +0800 Subject: [PATCH 028/179] components/esp32: move peripheral symbols to separate ld script --- components/esp32/component.mk | 2 +- components/esp32/ld/esp32.peripherals.ld | 20 ++++++++++++++++++++ components/esp32/ld/esp32.rom.ld | 23 ----------------------- 3 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 components/esp32/ld/esp32.peripherals.ld diff --git a/components/esp32/component.mk b/components/esp32/component.mk index e7397b2a14..d275898db3 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -26,7 +26,7 @@ else endif endif -LINKER_SCRIPTS += -T esp32.common.ld -T esp32.rom.ld +LINKER_SCRIPTS += -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld COMPONENT_ADD_LDFLAGS := -lesp32 \ $(abspath libhal.a) \ diff --git a/components/esp32/ld/esp32.peripherals.ld b/components/esp32/ld/esp32.peripherals.ld new file mode 100644 index 0000000000..aaadedce49 --- /dev/null +++ b/components/esp32/ld/esp32.peripherals.ld @@ -0,0 +1,20 @@ +PROVIDE ( UART0 = 0x3ff40000 ); +PROVIDE ( SPI1 = 0x3ff42000 ); +PROVIDE ( SPI0 = 0x3ff43000 ); +PROVIDE ( GPIO = 0x3ff44000 ); +PROVIDE ( SIGMADELTA = 0x3ff44f00 ); +PROVIDE ( UHCI1 = 0x3ff4C000 ); +PROVIDE ( I2S0 = 0x3ff4F000 ); +PROVIDE ( UART1 = 0x3ff50000 ); +PROVIDE ( I2C0 = 0x3ff53000 ); +PROVIDE ( UHCI0 = 0x3ff54000 ); +PROVIDE ( RMT = 0x3ff56000 ); +PROVIDE ( PCNT = 0x3ff57000 ); +PROVIDE ( LEDC = 0x3ff59000 ); +PROVIDE ( TIMERG0 = 0x3ff5F000 ); +PROVIDE ( TIMERG1 = 0x3ff60000 ); +PROVIDE ( SPI2 = 0x3ff64000 ); +PROVIDE ( SPI3 = 0x3ff65000 ); +PROVIDE ( I2C1 = 0x3ff67000 ); +PROVIDE ( I2S1 = 0x3ff6D000 ); +PROVIDE ( UART2 = 0x3ff6E000 ); diff --git a/components/esp32/ld/esp32.rom.ld b/components/esp32/ld/esp32.rom.ld index f8aa70631a..6f9064a398 100644 --- a/components/esp32/ld/esp32.rom.ld +++ b/components/esp32/ld/esp32.rom.ld @@ -1835,26 +1835,3 @@ PROVIDE ( _xtos_syscall_handler = 0x40000790 ); PROVIDE ( _xtos_unhandled_exception = 0x4000c024 ); PROVIDE ( _xtos_unhandled_interrupt = 0x4000c01c ); PROVIDE ( _xtos_vpri_enabled = 0x3ffe0654 ); - -PROVIDE ( I2S0 = 0x3ff4F000 ); -PROVIDE ( I2S1 = 0x3ff6D000 ); -PROVIDE ( GPIO = 0x3ff44000 ); -PROVIDE ( SIGMADELTA = 0x3ff44f00 ); -PROVIDE ( I2C0 = 0x3ff53000 ); -PROVIDE ( I2C1 = 0x3ff67000 ); -PROVIDE ( LEDC = 0x3ff59000 ); -PROVIDE ( PCNT = 0x3ff57000 ); -PROVIDE ( RMT = 0x3ff56000 ); -PROVIDE ( SPI0 = 0x3ff43000 ); -PROVIDE ( SPI1 = 0x3ff42000 ); -PROVIDE ( SPI2 = 0x3ff64000 ); -PROVIDE ( SPI3 = 0x3ff65000 ); -PROVIDE ( TIMERG0 = 0x3ff5F000 ); -PROVIDE ( TIMERG1 = 0x3ff60000 ); -PROVIDE ( UART0 = 0x3ff40000 ); -PROVIDE ( UART1 = 0x3ff50000 ); -PROVIDE ( UART2 = 0x3ff6E000 ); -PROVIDE ( UHCI0 = 0x3ff54000 ); -PROVIDE ( UHCI1 = 0x3ff4C000 ); - - From 2be163f6cc2a7a9e537cf71bf1db4c1ffca53c94 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Mon, 19 Sep 2016 17:33:21 +0800 Subject: [PATCH 029/179] add gpio driver code --- components/driver/component.mk | 14 + components/driver/gpio.c | 457 ++++++++++++++++++ components/driver/include/driver/gpio.h | 442 +++++++++++++++++ components/esp32/include/soc/gpio_reg.h | 22 + components/esp32/include/soc/gpio_sd_struct.h | 8 +- components/esp32/include/soc/gpio_struct.h | 46 +- components/esp32/include/soc/i2c_struct.h | 44 +- components/esp32/include/soc/i2s_struct.h | 62 +-- components/esp32/include/soc/ledc_struct.h | 46 +- components/esp32/include/soc/pcnt_struct.h | 20 +- components/esp32/include/soc/rmt_struct.h | 20 +- components/esp32/include/soc/spi_struct.h | 76 +-- .../esp32/include/soc/timer_group_struct.h | 28 +- components/esp32/include/soc/uart_struct.h | 56 +-- components/esp32/include/soc/uhci_struct.h | 44 +- 15 files changed, 1160 insertions(+), 225 deletions(-) create mode 100644 components/driver/component.mk create mode 100644 components/driver/gpio.c create mode 100644 components/driver/include/driver/gpio.h diff --git a/components/driver/component.mk b/components/driver/component.mk new file mode 100644 index 0000000000..a19b131ef5 --- /dev/null +++ b/components/driver/component.mk @@ -0,0 +1,14 @@ +# +# Component Makefile +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, +# this will take the sources in this directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the SDK documents if you need to do this. +# + +COMPONENT_ADD_INCLUDEDIRS := include + +COMPONENT_PRIV_INCLUDEDIRS := include/driver + +include $(IDF_PATH)/make/component_common.mk diff --git a/components/driver/gpio.c b/components/driver/gpio.c new file mode 100644 index 0000000000..b621e3ffc4 --- /dev/null +++ b/components/driver/gpio.c @@ -0,0 +1,457 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. +#include +#include "rom/ets_sys.h" +#include "esp_err.h" +#include "esp_intr.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/xtensa_api.h" +#include "soc/soc.h" +#include "driver/gpio.h" + +//TODO: move debug options to menuconfig +#define GPIO_DBG_ENABLE (0) +#define GPIO_WARNING_ENABLE (0) +#define GPIO_ERROR_ENABLE (0) +#define GPIO_INFO_ENABLE (0) +//DBG INFOR +#if GPIO_INFO_ENABLE +#define GPIO_INFO ets_printf +#else +#define GPIO_INFO(...) +#endif +#if GPIO_WARNING_ENABLE +#define GPIO_WARNING(format,...) do{\ + ets_printf("[waring][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define GPIO_WARNING(...) +#endif +#if GPIO_ERROR_ENABLE +#define GPIO_ERROR(format,...) do{\ + ets_printf("[error][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define GPIO_ERROR(...) +#endif + +const uint32_t GPIO_PIN_MUX_REG[40] = { + GPIO_PIN_REG_0, + GPIO_PIN_REG_1, + GPIO_PIN_REG_2, + GPIO_PIN_REG_3, + GPIO_PIN_REG_4, + GPIO_PIN_REG_5, + GPIO_PIN_REG_6, + GPIO_PIN_REG_7, + GPIO_PIN_REG_8, + GPIO_PIN_REG_9, + GPIO_PIN_REG_10, + GPIO_PIN_REG_11, + GPIO_PIN_REG_12, + GPIO_PIN_REG_13, + GPIO_PIN_REG_14, + GPIO_PIN_REG_15, + GPIO_PIN_REG_16, + GPIO_PIN_REG_17, + GPIO_PIN_REG_18, + GPIO_PIN_REG_19, + 0, + GPIO_PIN_REG_21, + GPIO_PIN_REG_22, + GPIO_PIN_REG_23, + 0, + GPIO_PIN_REG_25, + GPIO_PIN_REG_26, + GPIO_PIN_REG_27, + 0, + 0, + 0, + 0, + GPIO_PIN_REG_32, + GPIO_PIN_REG_33, + GPIO_PIN_REG_34, + GPIO_PIN_REG_35, + GPIO_PIN_REG_36, + GPIO_PIN_REG_37, + GPIO_PIN_REG_38, + GPIO_PIN_REG_39 +}; + +static SemaphoreHandle_t gpio_mutex = NULL; + +static int is_valid_gpio(int gpio_num) +{ + if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { + GPIO_ERROR("GPIO io_num=%d does not exist\n",gpio_num); + return 0; + } + return 1; +} + +static esp_err_t gpio_mutex_init() +{ + if(gpio_mutex == NULL) { + gpio_mutex = xSemaphoreCreateRecursiveMutex(); + if(gpio_mutex == NULL) + return ESP_FAIL; + } + return ESP_OK; +} + +static esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, uint8_t intr_type) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(intr_type >= GPIO_PIN_INTR_MAX) { + GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); + return ESP_ERR_INVALID_ARG; + } + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + GPIO.pin[gpio_num].int_type = intr_type; + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +static esp_err_t gpio_intr_enable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + if(xPortGetCoreID() == 0) { + GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr + } else { + GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr + } + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +static esp_err_t gpio_intr_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +static esp_err_t gpio_input_enable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +static esp_err_t gpio_input_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]); + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +static esp_err_t gpio_output_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_num < 32) { + GPIO.enable_w1tc = (0x1 << gpio_num); + } else { + GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); + } + return ESP_OK; +} + +static esp_err_t gpio_output_enable(gpio_num_t gpio_num) +{ + if(gpio_num >= 34) { + GPIO_ERROR("io_num=%d only input\n",gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { + GPIO_ERROR("io_num=%d not exits\n",gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(gpio_num < 32) { + GPIO.enable_w1ts = (0x1 << gpio_num); + } else { + GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); + } + return ESP_OK; +} + +esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) +{ + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(level) { + if(gpio_num < 32) + GPIO.out_w1ts = (1 << gpio_num); + else + GPIO.out1_w1ts.data = (1 << (gpio_num - 32)); + } else { + if(gpio_num < 32) + GPIO.out_w1tc = (1 << gpio_num); + else + GPIO.out1_w1tc.data = (1 << (gpio_num - 32)); + } + return ESP_OK; +} + +int gpio_get_level(gpio_num_t gpio_num) +{ + if(gpio_num < 32) { + return (GPIO.in >> gpio_num) & 0x1; + } else { + return (GPIO.in1.data >> (gpio_num - 32)) & 0x1; + } +} + +esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) +{ + if(gpio_mutex != NULL) { + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + esp_err_t ret = ESP_OK; + switch(pull) { + case GPIO_PULLUP_ONLY: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLDOWN_ONLY: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLUP_PULLDOWN: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_FLOATING: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + default: + GPIO_ERROR("Unknown pull up/down mode,gpio_num=%u,pull=%u\n",gpio_num,pull); + ret = ESP_ERR_INVALID_ARG; + break; + } + xSemaphoreGiveRecursive(gpio_mutex); + return ret; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_direction_t direction) +{ + if(gpio_mutex != NULL) { + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + esp_err_t ret = ESP_OK; + switch(direction) { + case GPIO_DIR_OUTPUT_ONLY: + gpio_input_disable(gpio_num); + gpio_output_enable(gpio_num); + break; + case GPIO_DIR_INPUT_ONLY: + gpio_input_enable(gpio_num); + gpio_output_disable(gpio_num); + break; + case GPIO_DIR_INPUT_AND_OUTPUT: + gpio_input_enable(gpio_num); + gpio_output_enable(gpio_num); + break; + case GPIO_DIR_DISABLE_IO: + gpio_input_disable(gpio_num); + gpio_output_disable(gpio_num); + break; + default: + GPIO_ERROR("Unkown direction type,gpio_num=%u,direction=%u\n",gpio_num,direction); + ret = ESP_ERR_INVALID_ARG; + break; + } + xSemaphoreGiveRecursive(gpio_mutex); + return ret; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +esp_err_t gpio_config(gpio_config_t *pGPIOConfig) +{ + if(gpio_mutex == NULL) { + gpio_mutex = xSemaphoreCreateRecursiveMutex(); + if(gpio_mutex == NULL) { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } + } + uint64_t gpio_pin_mask = (pGPIOConfig->pin_bit_mask); + uint32_t io_reg = 0; + uint8_t io_num = 0; + uint64_t bit_valid = 0; + if(pGPIOConfig->pin_bit_mask == 0) { + GPIO_ERROR("GPIO_PIN = 0 \n"); + return ESP_ERR_INVALID_ARG; + } + if((pGPIOConfig->mode) & (BIT1)) { + //GPIO 34/35/36/37/38/39 can only be used as input mode; + if((gpio_pin_mask & ( GPIO_SEL_34 | GPIO_SEL_35 | GPIO_SEL_36 | GPIO_SEL_37 | GPIO_SEL_38 | GPIO_SEL_39))) { + GPIO_ERROR("GPIO34-39 can only be used as input mode\n"); + return ESP_ERR_INVALID_ARG; + } + } + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + do { + io_reg = GPIO_PIN_MUX_REG[io_num]; + if(((gpio_pin_mask >> io_num) & BIT(0)) && io_reg) { + GPIO_INFO("Gpio%02d |Mode:",io_num); + if((pGPIOConfig->mode) & GPIO_MODE_INPUT) { + GPIO_INFO("INPUT "); + gpio_input_enable(io_num); + } else { + gpio_input_disable(io_num); + } + if((pGPIOConfig->mode) & BIT2) { + GPIO_INFO("OD "); + GPIO.pin[io_num].pad_driver = 1; /*0x01 Open-drain */ + } else { + GPIO.pin[io_num].pad_driver = 0; /*0x00 Normal gpio output */ + } + if((pGPIOConfig->mode) & GPIO_MODE_OUTPUT) { + GPIO_INFO("OUTPUT "); + gpio_output_enable(io_num); + } else { + gpio_output_disable(io_num); + } + GPIO_INFO("|"); + if(pGPIOConfig->pull_up_en) { + GPIO_INFO("PU "); + PIN_PULLUP_EN(io_reg); + } else { + PIN_PULLUP_DIS(io_reg); + } + if(pGPIOConfig->pull_down_en) { + GPIO_INFO("PD "); + PIN_PULLDWN_EN(io_reg); + } else { + PIN_PULLDWN_DIS(io_reg); + } + GPIO_INFO("Intr:%d |\n",pGPIOConfig->intr_type); + gpio_set_intr_type(io_num, pGPIOConfig->intr_type); + if(pGPIOConfig->intr_type) { + gpio_intr_enable(io_num); + } else { + gpio_intr_disable(io_num); + } + PIN_FUNC_SELECT(io_reg, GPIO_FUNC_SEL); /*function number 2 is GPIO_FUNC for each pin */ + } else if(bit_valid && (io_reg == 0)) { + GPIO_WARNING("io_num=%d not exits\n",io_num); + } + io_num++; + } while(io_num < GPIO_PIN_COUNT); + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; +} + +esp_err_t gpio_intr_handler_register(uint8_t gpio_intr_num, void (*fn)(void*), void * arg) +{ + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + ESP_INTR_DISABLE(gpio_intr_num); + intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); + xt_set_interrupt_handler(gpio_intr_num, fn, arg); + ESP_INTR_ENABLE(gpio_intr_num); + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +/*only level interrupt can be used for wake-up function*/ +esp_err_t gpio_pin_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) +{ + if(gpio_mutex != NULL) { + esp_err_t ret = ESP_OK; + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + if((intr_type == GPIO_PIN_INTR_LOW_LEVEL) || (intr_type == GPIO_PIN_INTR_HIGH_LEVEL)) { + GPIO.pin[gpio_num].int_type = intr_type; + GPIO.pin[gpio_num].wakeup_enable = 0x1; + } else { + GPIO_ERROR("GPIO wakeup only support Level mode,but edge mode set. gpio_num:%u\n",gpio_num); + ret = ESP_ERR_INVALID_ARG; + } + xSemaphoreGiveRecursive(gpio_mutex); + return ret; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } +} + +esp_err_t gpio_pin_wakeup_disable(gpio_num_t gpio_num) +{ + if(gpio_mutex != NULL) { + xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); + GPIO.pin[gpio_num].wakeup_enable = 0; + xSemaphoreGiveRecursive(gpio_mutex); + return ESP_OK; + } else { + GPIO_ERROR("Mutex null\n"); + return ESP_FAIL; + } + +} diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h new file mode 100644 index 0000000000..9bc62adc8d --- /dev/null +++ b/components/driver/include/driver/gpio.h @@ -0,0 +1,442 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _DRIVER_GPIO_H_ +#define _DRIVER_GPIO_H_ + +#include +#include "soc/gpio_reg.h" +#include "soc/gpio_struct.h" +#include "soc/rtc_io_reg.h" +#include "soc/io_mux_reg.h" +#include "esp_attr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const uint32_t GPIO_PIN_MUX_REG[40]; + +#define GPIO_SEL_0 (BIT(0)) /* Pin 0 selected */ +#define GPIO_SEL_1 (BIT(1)) /* Pin 1 selected */ +#define GPIO_SEL_2 (BIT(2)) /* Pin 2 selected */ +#define GPIO_SEL_3 (BIT(3)) /* Pin 3 selected */ +#define GPIO_SEL_4 (BIT(4)) /* Pin 4 selected */ +#define GPIO_SEL_5 (BIT(5)) /* Pin 5 selected */ +#define GPIO_SEL_6 (BIT(6)) /* Pin 6 selected */ +#define GPIO_SEL_7 (BIT(7)) /* Pin 7 selected */ +#define GPIO_SEL_8 (BIT(8)) /* Pin 8 selected */ +#define GPIO_SEL_9 (BIT(9)) /* Pin 9 selected */ +#define GPIO_SEL_10 (BIT(10)) /* Pin 10 selected */ +#define GPIO_SEL_11 (BIT(11)) /* Pin 11 selected */ +#define GPIO_SEL_12 (BIT(12)) /* Pin 12 selected */ +#define GPIO_SEL_13 (BIT(13)) /* Pin 13 selected */ +#define GPIO_SEL_14 (BIT(14)) /* Pin 14 selected */ +#define GPIO_SEL_15 (BIT(15)) /* Pin 15 selected */ +#define GPIO_SEL_16 (BIT(16)) /* Pin 16 selected */ +#define GPIO_SEL_17 (BIT(17)) /* Pin 17 selected */ +#define GPIO_SEL_18 (BIT(18)) /* Pin 18 selected */ +#define GPIO_SEL_19 (BIT(19)) /* Pin 19 selected */ + +#define GPIO_SEL_21 (BIT(21)) /* Pin 21 selected */ +#define GPIO_SEL_22 (BIT(22)) /* Pin 22 selected */ +#define GPIO_SEL_23 (BIT(23)) /* Pin 23 selected */ + +#define GPIO_SEL_25 (BIT(25)) /* Pin 25 selected */ +#define GPIO_SEL_26 (BIT(26)) /* Pin 26 selected */ +#define GPIO_SEL_27 (BIT(27)) /* Pin 27 selected */ + +#define GPIO_SEL_32 ((uint64_t)(((uint64_t)1)<<32)) /* Pin 32 selected */ +#define GPIO_SEL_33 ((uint64_t)(((uint64_t)1)<<33)) /* Pin 33 selected */ +#define GPIO_SEL_34 ((uint64_t)(((uint64_t)1)<<34)) /* Pin 34 selected */ +#define GPIO_SEL_35 ((uint64_t)(((uint64_t)1)<<35)) /* Pin 35 selected */ +#define GPIO_SEL_36 ((uint64_t)(((uint64_t)1)<<36)) /* Pin 36 selected */ +#define GPIO_SEL_37 ((uint64_t)(((uint64_t)1)<<37)) /* Pin 37 selected */ +#define GPIO_SEL_38 ((uint64_t)(((uint64_t)1)<<38)) /* Pin 38 selected */ +#define GPIO_SEL_39 ((uint64_t)(((uint64_t)1)<<39)) /* Pin 39 selected */ + +#define GPIO_FUNC_SEL 2 + +#define GPIO_PIN_REG_0 PERIPHS_IO_MUX_GPIO0_U +#define GPIO_PIN_REG_1 PERIPHS_IO_MUX_U0TXD_U +#define GPIO_PIN_REG_2 PERIPHS_IO_MUX_GPIO2_U +#define GPIO_PIN_REG_3 PERIPHS_IO_MUX_U0RXD_U +#define GPIO_PIN_REG_4 PERIPHS_IO_MUX_GPIO4_U +#define GPIO_PIN_REG_5 PERIPHS_IO_MUX_GPIO5_U +#define GPIO_PIN_REG_6 PERIPHS_IO_MUX_SD_CLK_U +#define GPIO_PIN_REG_7 PERIPHS_IO_MUX_SD_DATA0_U +#define GPIO_PIN_REG_8 PERIPHS_IO_MUX_SD_DATA1_U +#define GPIO_PIN_REG_9 PERIPHS_IO_MUX_SD_DATA2_U +#define GPIO_PIN_REG_10 PERIPHS_IO_MUX_SD_DATA3_U +#define GPIO_PIN_REG_11 PERIPHS_IO_MUX_SD_CMD_U +#define GPIO_PIN_REG_12 PERIPHS_IO_MUX_MTDI_U +#define GPIO_PIN_REG_13 PERIPHS_IO_MUX_MTCK_U +#define GPIO_PIN_REG_14 PERIPHS_IO_MUX_MTMS_U +#define GPIO_PIN_REG_15 PERIPHS_IO_MUX_MTDO_U +#define GPIO_PIN_REG_16 PERIPHS_IO_MUX_GPIO16_U +#define GPIO_PIN_REG_17 PERIPHS_IO_MUX_GPIO17_U +#define GPIO_PIN_REG_18 PERIPHS_IO_MUX_GPIO18_U +#define GPIO_PIN_REG_19 PERIPHS_IO_MUX_GPIO19_U +#define GPIO_PIN_REG_20 PERIPHS_IO_MUX_GPIO20_U +#define GPIO_PIN_REG_21 PERIPHS_IO_MUX_GPIO21_U +#define GPIO_PIN_REG_22 PERIPHS_IO_MUX_GPIO22_U +#define GPIO_PIN_REG_23 PERIPHS_IO_MUX_GPIO23_U +#define GPIO_PIN_REG_25 PERIPHS_IO_MUX_GPIO25_U +#define GPIO_PIN_REG_26 PERIPHS_IO_MUX_GPIO26_U +#define GPIO_PIN_REG_27 PERIPHS_IO_MUX_GPIO27_U +#define GPIO_PIN_REG_32 PERIPHS_IO_MUX_GPIO32_U +#define GPIO_PIN_REG_33 PERIPHS_IO_MUX_GPIO33_U +#define GPIO_PIN_REG_34 PERIPHS_IO_MUX_GPIO34_U +#define GPIO_PIN_REG_35 PERIPHS_IO_MUX_GPIO35_U +#define GPIO_PIN_REG_36 PERIPHS_IO_MUX_GPIO36_U +#define GPIO_PIN_REG_37 PERIPHS_IO_MUX_GPIO37_U +#define GPIO_PIN_REG_38 PERIPHS_IO_MUX_GPIO38_U +#define GPIO_PIN_REG_39 PERIPHS_IO_MUX_GPIO39_U + +#define GPIO_APP_CPU_INTR_ENA (BIT(0)) +#define GPIO_APP_CPU_NMI_INTR_ENA (BIT(1)) +#define GPIO_PRO_CPU_INTR_ENA (BIT(2)) +#define GPIO_PRO_CPU_NMI_INTR_ENA (BIT(3)) +#define GPIO_SDIO_EXT_INTR_ENA (BIT(4)) + +#define GPIO_PIN_COUNT 40 +#define GPIO_ID_PIN0 0 +#define GPIO_ID_PIN(n) (GPIO_ID_PIN0 + (n)) +#define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i * 4) + +typedef enum { + GPIO_NUM_0 = 0, + GPIO_NUM_1 = 1, + GPIO_NUM_2 = 2, + GPIO_NUM_3 = 3, + GPIO_NUM_4 = 4, + GPIO_NUM_5 = 5, + GPIO_NUM_6 = 6, + GPIO_NUM_7 = 7, + GPIO_NUM_8 = 8, + GPIO_NUM_9 = 9, + GPIO_NUM_10 = 10, + GPIO_NUM_11 = 11, + GPIO_NUM_12 = 12, + GPIO_NUM_13 = 13, + GPIO_NUM_14 = 14, + GPIO_NUM_15 = 15, + GPIO_NUM_16 = 16, + GPIO_NUM_17 = 17, + GPIO_NUM_18 = 18, + GPIO_NUM_19 = 19, + + GPIO_NUM_21 = 21, + GPIO_NUM_22 = 22, + GPIO_NUM_23 = 23, + + GPIO_NUM_25 = 25, + GPIO_NUM_26 = 26, + GPIO_NUM_27 = 27, + + GPIO_NUM_32 = 32, + GPIO_NUM_33 = 33, + GPIO_NUM_34 = 34, /*input mode only */ + GPIO_NUM_35 = 35, /*input mode only */ + GPIO_NUM_36 = 36, /*input mode only */ + GPIO_NUM_37 = 37, /*input mode only */ + GPIO_NUM_38 = 38, /*input mode only */ + GPIO_NUM_39 = 39, /*input mode only */ +} gpio_num_t; + +typedef enum { + GPIO_PIN_INTR_DISABLE = 0, /* disable GPIO interrupt */ + GPIO_PIN_INTR_POSEDGE = 1, /* GPIO interrupt type : rising edge */ + GPIO_PIN_INTR_NEGEDGE = 2, /* GPIO interrupt type : falling edge */ + GPIO_PIN_INTR_ANYEDGE = 3, /* GPIO interrupt type : both rising and falling edge */ + GPIO_PIN_INTR_LOW_LEVEL = 4, /* GPIO interrupt type : input low level trigger */ + GPIO_PIN_INTR_HIGH_LEVEL = 5, /* GPIO interrupt type : input high level trigger */ + GPIO_PIN_INTR_MAX, +} gpio_int_type_t; + +typedef enum { + GPIO_MODE_INPUT = (BIT0), /* GPIO mode : input only */ + GPIO_MODE_OUTPUT = (BIT1), /* GPIO mode : output only mode */ + GPIO_MODE_OUTPUT_OD = ((BIT1)|(BIT2)), /* GPIO mode : output only with open-drain mode */ + GPIO_MODE_INPUT_OUTPUT_OD = ((BIT0)|(BIT1)|(BIT2)), /* GPIO mode : output and input with open-drain mode*/ + GPIO_MODE_INPUT_OUTPUT = ((BIT0)|(BIT1)), /* GPIO mode : output and input mode */ +} gpio_mode_t; + +typedef enum { + GPIO_PULLUP_DISABLE = 0x0, /* disable GPIO pull-up resistor */ + GPIO_PULLUP_ENABLE = 0x1, /* enable GPIO pull-up resistor */ +} gpio_pullup_t; + +typedef enum { + GPIO_PULLDOWN_DISABLE = 0x0, /* disable GPIO pull-down resistor */ + GPIO_PULLDOWN_ENABLE = 0x1, /* enable GPIO pull-down resistor */ +} gpio_pulldown_t; + +typedef struct { + uint64_t pin_bit_mask; /* GPIO pin: set with bit mask, each bit maps to a GPIO */ + gpio_mode_t mode; /* GPIO mode: set input/output mode */ + gpio_pullup_t pull_up_en; /* GPIO pull-up */ + gpio_pulldown_t pull_down_en; /* GPIO pull-down */ + gpio_int_type_t intr_type; /* GPIO interrupt type */ +} gpio_config_t; + +typedef enum { + GPIO_DIR_OUTPUT_ONLY, /* GPIO output */ + GPIO_DIR_INPUT_ONLY, /* GPIO input */ + GPIO_DIR_INPUT_AND_OUTPUT, /* GPIO input + output */ + GPIO_DIR_DISABLE_IO, /* GPIO disable */ +} gpio_direction_t; + +typedef enum { + GPIO_LOW_LEVEL = 0, + GPIO_HIGH_LEVEL = 1, + GPIO_LEVEL_ERR, +} gpio_level_t; + +typedef enum { + GPIO_PULLUP_ONLY, /* Pad pull up */ + GPIO_PULLDOWN_ONLY, /* Pad pull down */ + GPIO_PULLUP_PULLDOWN, /* Pad pull up + pull down*/ + GPIO_FLOATING, /* Pad floating */ +} gpio_pull_mode_t; + +typedef void (*gpio_event_callback)(gpio_num_t gpio_intr_num); + +/** \defgroup Driver_APIs Driver APIs + * @brief Driver APIs + */ + +/** @addtogroup Driver_APIs + * @{ + */ + +/** \defgroup GPIO_Driver_APIs GPIO Driver APIs + * @brief GPIO APIs + */ + +/** @addtogroup GPIO_Driver_APIs + * @{ + */ + +/** + * @brief GPIO common configuration + * + * Use this Function ,Configure GPIO's Mode,pull-up,PullDown,IntrType + * + * @parameter[in] pGPIOConfig + * pGPIOConfig.pin_bit_mask : Configure GPIO pins bits,set this parameter with bit mask. + * If you want to configure GPIO34 and GPIO16, pin_bit_mask=GPIO_Pin_16|GPIO_Pin_34; + * pGPIOConfig.mode : Configure GPIO mode,such as output ,input... + * pGPIOConfig.pull_up_en : Enable or Disable pull-up + * pGPIOConfig.pull_down_en : Enable or Disable pull-down + * pGPIOConfig.intr_type : Configure GPIO interrupt trigger type + * @return ESP_OK: success ; + * ESP_ERR_INVALID_ARG: parameters error + * ESP_FAIL : GPIO mutex error + * + */ +esp_err_t gpio_config(gpio_config_t *pGPIOConfig); + +/** + * @brief GPIO set output level + * + * @parameter[in] gpio_num : GPIO number. + * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] level : Output level. 0: low ; 1: high + * + * @return ESP_OK : success + * ESP_FAIL : GPIO mutex error + * + */ +esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level); + +/** + * @brief GPIO get input level + * + * @parameter[in] gpio_num : GPIO number. + * If you want to get level of pin GPIO16, gpio_num should be GPIO_NUM_16 (16); + * + * @return 0 : the GPIO input level is 0 + * 1 : the GPIO input level is 1 + * + */ +int gpio_get_level(gpio_num_t gpio_num); + +/** + * @brief GPIO set direction + * + * Configure GPIO direction,such as output_only,input_only,output_and_input + * + * @parameter[in] gpio_num : Configure GPIO pins number,it should GPIO number. + * If you want to set direction of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] direction: Configure GPIO direction,such as output_only,input_only,... + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG : fail + * ESP_FAIL : GPIO mutex error + * + */ +esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_direction_t direction); + +/** + * @brief GPIO set pull + * + * User this Function,configure GPIO pull mode,such as pull-up,pull-down + * + * @parameter[in] gpio_num : Configure GPIO pins number,it should GPIO number. + * If you want to set pull up or down mode for GPIO16,gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] pull : Configure GPIO pull up/down mode,such as pullup_only,pulldown_only,pullup_and_pulldown,... + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG : fail + * ESP_FAIL : GPIO mutex error + * + */ +esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); + +/** + * @brief bind input signal to the GPIO + * + * bind input signal to the GPIO,when you want to bind the signal to the GPIO + * First , configure the pad as GPIO,use the gpio_config function or pin_func_as_gpio function + * Second , enable the GPIO input,if you use pin_func_as_gpio,you can use gpio_set_direction function + * Third , call gpio_matrix_in function + * + * @parameter[in] GPIO : Configure GPIO pins number,it should GPIO number. + * If you want to configure GPIO16, gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] signal_idx : the signal_idx,find the signal index from gpio_sig_map.h + * + * @parameter[in] inverse : the signal input inverse, default inverse=0 + * + * @return None + * + */ +void gpio_matrix_in(uint32_t GPIO, uint32_t signal_idx, bool inverse) ROMFN_ATTR; + +/** + * @brief bind output signal to the GPIO + * + * bind output signal to the GPIO,when you want to bind the signal to the GPIO + * First , configure the pad as GPIO,use the gpio_config function or pin_func_as_gpio function + * Second , enable the GPIO output,if you use pin_func_as_gpio,you can use gpio_set_direction function + * Third , call gpio_matrix_out function + * + * @parameter[in] GPIO : Configure GPIO pins number,it should GPIO number. + * If you want to configure GPIO16,gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] signal_idx : the signal_idx,find the signal index from gpio_sig_map.h + * + * @parameter[in] out_inv : the signal output inverse, default out_inv=0 + * + * @parameter[in] oen_inv : the signal output enable inverse, default oen_inv=0 + * + * @return None + * + */ +void gpio_matrix_out(uint32_t GPIO, uint32_t signal_idx, bool out_inv, bool oen_inv) ROMFN_ATTR; + +/** + * @brief register GPIO interrupt handler, the handler is an ISR. + * The handler will be attached to the same CPU core that this function is running on. + * Users should know that which CPU is running and then pick a INUM that is not used by system. + * We can find the information of INUM and interrupt level in soc.h. + * TODO: to move INUM options to menu_config + * @parameter uint8_t gpio_intr_num : GPIO interrupt number,check the info in soc.h, and please see the core-isa.h for more details + * @parameter void (* fn)(void* ) : interrupt handler function. + * Note that the handler function MUST be defined with attribution of "IRAM_ATTR". + * @parameter void * arg : parameter for handler function + * + * @return ESP_OK : success ; + * ESP_FAIL: gpio_mutex error + */ +esp_err_t gpio_intr_handler_register(uint8_t gpio_intr_num, void (*fn)(void*), void * arg); + + + + +/*----------EXAMPLE TO CONIFGURE GPIO AS OUTPUT ------------ */ +/* gpio_config_t io_conf; + * io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt + * io_conf.mode = GPIO_MODE_OUTPUT; //set as output mode + * io_conf.pin_bit_mask = GPIO_SEL_18 | GPIO_SEL_19; //bit mask of the pins that you want to set,e.g.GPIO18/19 + * io_conf.pull_down_en = 0; //disable pull-down mode + * io_conf.pull_up_en = 0; //disable pull-up mode + * gpio_config(&io_conf); //configure GPIO with the given settings + **/ +/*----------EXAMPLE TO CONIFGURE GPIO AS OUTPUT ------------ */ +/* io_conf.intr_type = GPIO_PIN_INTR_POSEDGE; //set posedge interrupt + * io_conf.mode = GPIO_MODE_INPUT; //set as input + * io_conf.pin_bit_mask = GPIO_SEL_4 | GPIO_SEL_5; //bit mask of the pins that you want to set, e.g.,GPIO4/5 + * io_conf.pull_down_en = 0; //disable pull-down mode + * io_conf.pull_up_en = 1; //enable pull-up mode + * gpio_config(&io_conf); //configure GPIO with the given settings + *----------EXAMPLE TO SET ISR HANDLER ----------------------*/ +/* gpio_intr_handler_register(18,gpio_intr_test,NULL); //hook the isr handler for GPIO interrupt + * //the first parameter is INUM, you can pick one form interrupt level 1/2 which is not used by the system. + * //NOTE1:user should arrange the INUMs that used, better not to use a same INUM for different interrupt. + * //NOTE2:do not pick the INUM that already occupied by the system. + * //NOTE3:refer to soc.h to check which INUMs that can be used. + *-------------EXAMPLE OF HANDLER FUNCTION-------------------*/ +/*#include "esp_attr.h" + * void IRAM_ATTR gpio_intr_test(void* arg) + *{ + * //GPIO intr process + * ets_printf("in gpio_intr\n"); + * uint32_t gpio_num = 0; + * uint32_t gpio_intr_status = READ_PERI_REG(GPIO_STATUS_REG); //read status to get interrupt status for GPIO0-31 + * uint32_t gpio_intr_status_h = READ_PERI_REG(GPIO_STATUS1_REG);//read status1 to get interrupt status for GPIO32-39 + * SET_PERI_REG_MASK(GPIO_STATUS_W1TC_REG, gpio_intr_status); //Clear intr for gpio0-gpio31 + * SET_PERI_REG_MASK(GPIO_STATUS1_W1TC_REG, gpio_intr_status_h); //Clear intr for gpio32-39 + * do { + * if(gpio_num < 32) { + * if(gpio_intr_status & BIT(gpio_num)) { //gpio0-gpio31 + * ets_printf("Intr Gpio%d ,val: %d\n",gpio_num,gpio_get_level(gpio_num)); + * //This is a 'isr' handler, you should post an event to process it in RTOS queue. + * } + * } else { + * if(gpio_intr_status_h & BIT(gpio_num - 32)) { + * ets_printf("Intr Gpio%d, val : %d\n",gpio_num,gpio_get_level(gpio_num)); + * //This is a 'isr' handler, you should post an event to process it in RTOS queue. + * } + * } + * } while(++gpio_num < GPIO_PIN_COUNT); + *} + *----EXAMPLE OF I2C CONFIG AND PICK SIGNAL FOR IO MATRIX---*/ +/* gpio_config_t io_conf; + * io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt + * io_conf.mode = GPIO_MODE_INPUT_OUTPUT_OD; //set as output mode + * io_conf.pin_bit_mask = GPIO_SEL_21 | GPIO_SEL_22; //bit mask of the pins that you want to set,e.g.GPIO21/22 + * io_conf.pull_down_en = 0; //disable pull-down mode + * io_conf.pull_up_en = 1; //enable pull-up mode + * gpio_config(&io_conf); //configure GPIO with the given settings + * gpio_matrix_out(21, EXT_I2C_SCL_O_IDX, 0, 0); //set output signal for io_matrix + * gpio_matrix_out(22, EXT_I2C_SDA_O_IDX, 0, 0); //set output signal for io_matrix + * gpio_matrix_in( 22, EXT_I2C_SDA_I_IDX, 0); //set input signal for io_matrix + * + */ + + + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DRIVER_GPIO_H_ */ diff --git a/components/esp32/include/soc/gpio_reg.h b/components/esp32/include/soc/gpio_reg.h index 4f84fe827d..1f4b08d43d 100644 --- a/components/esp32/include/soc/gpio_reg.h +++ b/components/esp32/include/soc/gpio_reg.h @@ -280,6 +280,28 @@ #define GPIO_SDIO_INT_H_V 0xFF #define GPIO_SDIO_INT_H_S 0 +#define GPIO_REG(io_num) (GPIO_PIN0_REG + (io_num)*0x4) +#define GPIO_PIN_INT_ENA 0x0000001F +#define GPIO_PIN_INT_ENA_M ((GPIO_PIN_INT_ENA_V)<<(GPIO_PIN_INT_ENA_S)) +#define GPIO_PIN_INT_ENA_V 0x0000001F +#define GPIO_PIN_INT_ENA_S 13 +#define GPIO_PIN_CONFIG 0x00000003 +#define GPIO_PIN_CONFIG_M ((GPIO_PIN_CONFIG_V)<<(GPIO_PIN_CONFIG_S)) +#define GPIO_PIN_CONFIG_V 0x00000003 +#define GPIO_PIN_CONFIG_S 11 +#define GPIO_PIN_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN_WAKEUP_ENABLE_S 10 +#define GPIO_PIN_INT_TYPE 0x00000007 +#define GPIO_PIN_INT_TYPE_M ((GPIO_PIN_INT_TYPE_V)<<(GPIO_PIN_INT_TYPE_S)) +#define GPIO_PIN_INT_TYPE_V 0x00000007 +#define GPIO_PIN_INT_TYPE_S 7 +#define GPIO_PIN_PAD_DRIVER (BIT(2)) +#define GPIO_PIN_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN_PAD_DRIVER_V 0x1 +#define GPIO_PIN_PAD_DRIVER_S 2 + #define GPIO_PIN0_REG (DR_REG_GPIO_BASE + 0x0088) /* GPIO_PIN0_INT_ENA : R/W ;bitpos:[17:13] ;default: x ; */ /*description: bit0: APP CPU interrupt enable bit1: APP CPU non-maskable interrupt diff --git a/components/esp32/include/soc/gpio_sd_struct.h b/components/esp32/include/soc/gpio_sd_struct.h index a4ca24fc34..94ddd5ba88 100644 --- a/components/esp32/include/soc/gpio_sd_struct.h +++ b/components/esp32/include/soc/gpio_sd_struct.h @@ -21,28 +21,28 @@ typedef volatile struct { uint32_t reserved16: 16; }; uint32_t val; - }channel[8]; + } channel[8]; union { struct { uint32_t reserved0: 31; uint32_t clk_en: 1; }; uint32_t val; - }cg; + } cg; union { struct { uint32_t reserved0: 31; uint32_t spi_swap: 1; }; uint32_t val; - }misc; + } misc; union { struct { uint32_t date: 28; uint32_t reserved28: 4; }; uint32_t val; - }version; + } version; } gpio_sd_dev_t; extern gpio_sd_dev_t SIGMADELTA; #endif /* _SOC_GPIO_SD_STRUCT_H_ */ diff --git a/components/esp32/include/soc/gpio_struct.h b/components/esp32/include/soc/gpio_struct.h index 649a17ff02..7a90b71af3 100644 --- a/components/esp32/include/soc/gpio_struct.h +++ b/components/esp32/include/soc/gpio_struct.h @@ -24,28 +24,28 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }out1; + } out1; union { struct { uint32_t data: 8; /*GPIO32~39 output value write 1 to set*/ uint32_t reserved8: 24; }; uint32_t val; - }out1_w1ts; + } out1_w1ts; union { struct { uint32_t data: 8; /*GPIO32~39 output value write 1 to clear*/ uint32_t reserved8: 24; }; uint32_t val; - }out1_w1tc; + } out1_w1tc; union { struct { uint32_t sel: 8; /*SDIO PADS on/off control from outside*/ uint32_t reserved8: 24; }; uint32_t val; - }sdio_select; + } sdio_select; uint32_t enable; /*GPIO0~31 output enable*/ uint32_t enable_w1ts; /*GPIO0~31 output enable write 1 to set*/ uint32_t enable_w1tc; /*GPIO0~31 output enable write 1 to clear*/ @@ -55,28 +55,28 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }enable1; + } enable1; union { struct { uint32_t data: 8; /*GPIO32~39 output enable write 1 to set*/ uint32_t reserved8: 24; }; uint32_t val; - }enable1_w1ts; + } enable1_w1ts; union { struct { uint32_t data: 8; /*GPIO32~39 output enable write 1 to clear*/ uint32_t reserved8: 24; }; uint32_t val; - }enable1_w1tc; + } enable1_w1tc; union { struct { - uint32_t strapping: 16; /*GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel boot_sel_chip[5:0]}. Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3}. vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5}*/ + uint32_t strapping: 16; /*GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel boot_sel_chip[5:0]} . Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3} . vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5} */ uint32_t reserved16:16; }; uint32_t val; - }strap; + } strap; uint32_t in; /*GPIO0~31 input value*/ union { struct { @@ -84,7 +84,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }in1; + } in1; uint32_t status; /*GPIO0~31 interrupt status*/ uint32_t status_w1ts; /*GPIO0~31 interrupt status write 1 to set*/ uint32_t status_w1tc; /*GPIO0~31 interrupt status write 1 to clear*/ @@ -94,21 +94,21 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }status1; + } status1; union { struct { uint32_t intr_st: 8; /*GPIO32~39 interrupt status write 1 to set*/ uint32_t reserved8: 24; }; uint32_t val; - }status1_w1ts; + } status1_w1ts; union { struct { uint32_t intr_st: 8; /*GPIO32~39 interrupt status write 1 to clear*/ uint32_t reserved8: 24; }; uint32_t val; - }status1_w1tc; + } status1_w1tc; uint32_t reserved_5c; uint32_t acpu_int; /*GPIO0~31 APP CPU interrupt status*/ uint32_t acpu_nmi_int; /*GPIO0~31 APP CPU non-maskable interrupt status*/ @@ -121,35 +121,35 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }acpu_int1; + } acpu_int1; union { struct { uint32_t intr: 8; /*GPIO32~39 APP CPU non-maskable interrupt status*/ uint32_t reserved8: 24; }; uint32_t val; - }acpu_nmi_int1; + } acpu_nmi_int1; union { struct { uint32_t intr: 8; /*GPIO32~39 PRO CPU interrupt status*/ uint32_t reserved8: 24; }; uint32_t val; - }pcpu_int1; + } pcpu_int1; union { struct { uint32_t intr: 8; /*GPIO32~39 PRO CPU non-maskable interrupt status*/ uint32_t reserved8: 24; }; uint32_t val; - }pcpu_nmi_int1; + } pcpu_nmi_int1; union { struct { uint32_t intr: 8; /*SDIO's extent GPIO32~39 interrupt*/ uint32_t reserved8: 24; }; uint32_t val; - }cpusdio_int1; + } cpusdio_int1; union { struct { uint32_t reserved0: 2; @@ -162,7 +162,7 @@ typedef volatile struct { uint32_t reserved18: 14; }; uint32_t val; - }pin[40]; + } pin[40]; union { struct { uint32_t rtc_max: 10; @@ -170,7 +170,7 @@ typedef volatile struct { uint32_t start: 1; }; uint32_t val; - }cali_conf; + } cali_conf; union { struct { uint32_t value_sync2: 20; @@ -179,7 +179,7 @@ typedef volatile struct { uint32_t rdy_sync2: 1; }; uint32_t val; - }cali_data; + } cali_data; union { struct { uint32_t func_sel: 6; /*select one of the 256 inputs*/ @@ -188,7 +188,7 @@ typedef volatile struct { uint32_t reserved8: 24; /*The 256 registers below are selection control for 256 input signals connected to GPIO matrix's 40 GPIO input if GPIO_FUNCx_IN_SEL is set to n(0<=n<40): it means GPIOn input is used for input signal x if GPIO_FUNCx_IN_SEL is set to 0x38: the input signal x is set to 1 if GPIO_FUNCx_IN_SEL is set to 0x30: the input signal x is set to 0*/ }; uint32_t val; - }func_in_sel_cfg[256]; + } func_in_sel_cfg[256]; union { struct { uint32_t func_sel: 9; /*select one of the 256 output to 40 GPIO*/ @@ -198,7 +198,7 @@ typedef volatile struct { uint32_t reserved12: 20; /*The 40 registers below are selection control for 40 GPIO output if GPIO_FUNCx_OUT_SEL is set to n(0<=n<256): it means GPIOn input is used for output signal x if GPIO_FUNCx_OUT_INV_SEL is set to 1 the output signal x is set to ~value. if GPIO_FUNC0_OUT_SEL is 256 or GPIO_FUNC0_OEN_SEL is 1 using GPIO_ENABLE_DATA[x] for the enable value else using the signal enable*/ }; uint32_t val; - }func_out_sel_cfg[40]; + } func_out_sel_cfg[40]; } gpio_dev_t; extern gpio_dev_t GPIO; #endif /* _SOC_GPIO_STRUCT_H_ */ diff --git a/components/esp32/include/soc/i2c_struct.h b/components/esp32/include/soc/i2c_struct.h index d6917e7fdc..26b7f4c786 100644 --- a/components/esp32/include/soc/i2c_struct.h +++ b/components/esp32/include/soc/i2c_struct.h @@ -20,7 +20,7 @@ typedef volatile struct { uint32_t reserved14: 18; }; uint32_t val; - }scl_low_period; + } scl_low_period; union { struct { uint32_t sda_force_out: 1; /*1:normally output sda data 0: exchange the function of sda_o and sda_oe (sda_o is the original internal output sda signal sda_oe is the enable bit for the internal output sda signal)*/ @@ -35,7 +35,7 @@ typedef volatile struct { uint32_t reserved9: 23; }; uint32_t val; - }ctr; + } ctr; union { struct { uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/ @@ -55,14 +55,14 @@ typedef volatile struct { uint32_t reserved31: 1; }; uint32_t val; - }status_reg; + } status_reg; union { struct { uint32_t tout: 20; /*This register is used to configure the max clock number of receiving a data.*/ uint32_t reserved20:12; }; uint32_t val; - }timeout; + } timeout; union { struct { uint32_t addr: 15; /*when configured as i2c slave this register is used to configure slave's address.*/ @@ -70,7 +70,7 @@ typedef volatile struct { uint32_t en_10bit: 1; /*This register is used to enable slave 10bit address mode.*/ }; uint32_t val; - }slave_addr; + } slave_addr; union { struct { uint32_t rx_fifo_start_addr: 5; /*This is the offset address of the last receiving data as described in nonfifo_rx_thres_register.*/ @@ -80,7 +80,7 @@ typedef volatile struct { uint32_t reserved20: 12; }; uint32_t val; - }fifo_st; + } fifo_st; union { struct { uint32_t rx_fifo_full_thrhd: 5; @@ -94,14 +94,14 @@ typedef volatile struct { uint32_t reserved26: 6; }; uint32_t val; - }fifo_conf; + } fifo_conf; union { struct { uint32_t data: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ uint32_t reserved8: 24; }; uint32_t val; - }fifo_data; + } fifo_data; union { struct { uint32_t rx_fifo_full: 1; /*The raw interrupt status bit for rx_fifo full when use apb fifo access.*/ @@ -120,7 +120,7 @@ typedef volatile struct { uint32_t reserved13: 19; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t rx_fifo_full: 1; /*Set this bit to clear the rx_fifo_full_int interrupt.*/ @@ -139,7 +139,7 @@ typedef volatile struct { uint32_t reserved13: 19; }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t rx_fifo_full: 1; /*The enable bit for rx_fifo_full_int interrupt.*/ @@ -158,7 +158,7 @@ typedef volatile struct { uint32_t reserved13: 19; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t rx_fifo_full: 1; /*The masked interrupt status for rx_fifo_full_int interrupt.*/ @@ -177,28 +177,28 @@ typedef volatile struct { uint32_t reserved13: 19; }; uint32_t val; - }int_status; + } int_status; union { struct { uint32_t time: 10; /*This register is used to configure the clock num I2C used to hold the data after the negedge of SCL.*/ uint32_t reserved10: 22; }; uint32_t val; - }sda_hold; + } sda_hold; union { struct { uint32_t time: 10; /*This register is used to configure the clock num I2C used to sample data on SDA after the posedge of SCL*/ uint32_t reserved10: 22; }; uint32_t val; - }sda_sample; + } sda_sample; union { struct { uint32_t period: 14; /*This register is used to configure the clock num during SCL is low level.*/ uint32_t reserved14: 18; }; uint32_t val; - }scl_high_period; + } scl_high_period; uint32_t reserved_3c; union { struct { @@ -206,28 +206,28 @@ typedef volatile struct { uint32_t reserved10: 22; }; uint32_t val; - }scl_start_hold; + } scl_start_hold; union { struct { uint32_t time: 10; /*This register is used to configure the clock num between the posedge of SCL and the negedge of SDA for restart mark.*/ uint32_t reserved10: 22; }; uint32_t val; - }scl_rstart_setup; + } scl_rstart_setup; union { struct { uint32_t time: 14; /*This register is used to configure the clock num after the STOP bit's posedge.*/ uint32_t reserved14: 18; }; uint32_t val; - }scl_stop_hold; + } scl_stop_hold; union { struct { uint32_t time: 10; /*This register is used to configure the clock num between the posedge of SCL and the posedge of SDA.*/ uint32_t reserved10: 22; }; uint32_t val; - }scl_stop_setup; + } scl_stop_setup; union { struct { uint32_t thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ @@ -235,7 +235,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }scl_filter_cfg; + } scl_filter_cfg; union { struct { uint32_t thres: 3; /*When input SCL's pulse width is smaller than this register value I2C ignores this pulse.*/ @@ -243,7 +243,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }sda_filter_cfg; + } sda_filter_cfg; union { struct { uint32_t byte_num: 8; /*Byte_num represent the number of data need to be send or data need to be received.*/ @@ -255,7 +255,7 @@ typedef volatile struct { uint32_t done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ }; uint32_t val; - }command[16]; + } command[16]; uint32_t reserved_98; uint32_t reserved_9c; uint32_t reserved_a0; diff --git a/components/esp32/include/soc/i2s_struct.h b/components/esp32/include/soc/i2s_struct.h index e565c6b76f..6d9fcbabed 100644 --- a/components/esp32/include/soc/i2s_struct.h +++ b/components/esp32/include/soc/i2s_struct.h @@ -40,7 +40,7 @@ typedef volatile struct { uint32_t reserved19: 13; }; uint32_t val; - }conf; + } conf; union { struct { uint32_t rx_take_data: 1; @@ -63,7 +63,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t rx_take_data: 1; @@ -86,7 +86,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t rx_take_data: 1; @@ -109,7 +109,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t take_data: 1; @@ -132,7 +132,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t tx_bck_in_delay: 2; @@ -152,7 +152,7 @@ typedef volatile struct { uint32_t reserved25: 7; }; uint32_t val; - }timing; + } timing; union { struct { uint32_t rx_data_num: 6; @@ -165,7 +165,7 @@ typedef volatile struct { uint32_t reserved21: 11; }; uint32_t val; - }fifo_conf; + } fifo_conf; uint32_t rx_eof_num; uint32_t conf_single_data; union { @@ -175,7 +175,7 @@ typedef volatile struct { uint32_t reserved5: 27; }; uint32_t val; - }conf_chan; + } conf_chan; union { struct { uint32_t addr: 20; @@ -186,7 +186,7 @@ typedef volatile struct { uint32_t park: 1; }; uint32_t val; - }out_link; + } out_link; union { struct { uint32_t addr: 20; @@ -197,7 +197,7 @@ typedef volatile struct { uint32_t park: 1; }; uint32_t val; - }in_link; + } in_link; uint32_t out_eof_des_addr; uint32_t in_eof_des_addr; uint32_t out_eof_bfr_des_addr; @@ -209,7 +209,7 @@ typedef volatile struct { uint32_t reserved6: 26; }; uint32_t val; - }ahb_test; + } ahb_test; uint32_t in_link_dscr; uint32_t in_link_dscr_bf0; uint32_t in_link_dscr_bf1; @@ -235,7 +235,7 @@ typedef volatile struct { uint32_t reserved14: 18; }; uint32_t val; - }lc_conf; + } lc_conf; union { struct { uint32_t wdata: 9; @@ -244,7 +244,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }out_fifo_push; + } out_fifo_push; union { struct { uint32_t rdata: 12; @@ -253,7 +253,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }in_fifo_pop; + } in_fifo_pop; uint32_t lc_state0; uint32_t lc_state1; union { @@ -264,7 +264,7 @@ typedef volatile struct { uint32_t reserved12: 20; }; uint32_t val; - }lc_hung_conf; + } lc_hung_conf; uint32_t reserved_78; uint32_t reserved_7c; union { @@ -273,14 +273,14 @@ typedef volatile struct { uint32_t y_min:16; }; uint32_t val; - }cvsd_conf0; + } cvsd_conf0; union { struct { uint32_t sigma_max:16; uint32_t sigma_min:16; }; uint32_t val; - }cvsd_conf1; + } cvsd_conf1; union { struct { uint32_t cvsd_k: 3; @@ -290,7 +290,7 @@ typedef volatile struct { uint32_t reserved19:13; }; uint32_t val; - }cvsd_conf2; + } cvsd_conf2; union { struct { uint32_t good_pack_max: 6; @@ -302,7 +302,7 @@ typedef volatile struct { uint32_t reserved28: 4; }; uint32_t val; - }plc_conf0; + } plc_conf0; union { struct { uint32_t bad_cef_atten_para: 8; @@ -312,7 +312,7 @@ typedef volatile struct { uint32_t slide_win_len: 8; }; uint32_t val; - }plc_conf1; + } plc_conf1; union { struct { uint32_t cvsd_seg_mod: 2; @@ -320,7 +320,7 @@ typedef volatile struct { uint32_t reserved7: 25; }; uint32_t val; - }plc_conf2; + } plc_conf2; union { struct { uint32_t en: 1; @@ -335,7 +335,7 @@ typedef volatile struct { uint32_t reserved13: 19; }; uint32_t val; - }esco_conf0; + } esco_conf0; union { struct { uint32_t with_en: 1; @@ -345,7 +345,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }sco_conf0; + } sco_conf0; union { struct { uint32_t tx_pcm_conf: 3; @@ -357,7 +357,7 @@ typedef volatile struct { uint32_t reserved10: 22; }; uint32_t val; - }conf1; + } conf1; union { struct { uint32_t fifo_force_pd: 1; @@ -367,7 +367,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }pd_conf; + } pd_conf; union { struct { uint32_t camera_en: 1; @@ -381,7 +381,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }conf2; + } conf2; union { struct { uint32_t clkm_div_num: 8; @@ -392,7 +392,7 @@ typedef volatile struct { uint32_t reserved22: 10; }; uint32_t val; - }clkm_conf; + } clkm_conf; union { struct { uint32_t tx_bck_div_num: 6; @@ -402,7 +402,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }sample_rate_conf; + } sample_rate_conf; union { struct { uint32_t tx_pdm_en: 1; @@ -420,7 +420,7 @@ typedef volatile struct { uint32_t reserved26: 6; }; uint32_t val; - }pdm_conf; + } pdm_conf; union { struct { uint32_t tx_pdm_fs: 10; @@ -428,7 +428,7 @@ typedef volatile struct { uint32_t reserved20:12; }; uint32_t val; - }pdm_freq_conf; + } pdm_freq_conf; union { struct { uint32_t tx_idle: 1; @@ -437,7 +437,7 @@ typedef volatile struct { uint32_t reserved3: 29; }; uint32_t val; - }state; + } state; uint32_t reserved_c0; uint32_t reserved_c4; uint32_t reserved_c8; diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index 40341f00e5..d44720a149 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -24,21 +24,21 @@ typedef volatile struct { uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ uint32_t reserved20: 12; }; uint32_t val; - }hpoint; + } hpoint; union { struct { uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ uint32_t reserved25: 7; }; uint32_t val; - }duty; + } duty; union { struct { uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ @@ -48,15 +48,15 @@ typedef volatile struct { uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ }; uint32_t val; - }conf1; + } conf1; union { struct { uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ uint32_t reserved25: 7; }; uint32_t val; - }duty_rd; - }high_speed_channel[8]; + } duty_rd; + } high_speed_channel[8]; struct{ union { struct { @@ -67,21 +67,21 @@ typedef volatile struct { uint32_t reserved5: 27; }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t hpoint: 20; /*The output value changes to high when lstimerx(x=[0 3]) selected by low speed channel has reached reg_hpoint_lsch0[19:0]*/ uint32_t reserved20: 12; }; uint32_t val; - }hpoint; + } hpoint; union { struct { uint32_t duty: 25; /*The register is used to control output duty. When lstimerx(x=[0 3]) choosed by low speed channel has reached reg_lpoint_lsch0 the output signal changes to low. reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4]) (1) reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ uint32_t reserved25: 7; }; uint32_t val; - }duty; + } duty; union { struct { uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for low speed channel.*/ @@ -91,15 +91,15 @@ typedef volatile struct { uint32_t duty_start: 1; /*When reg_duty_num_hsch1 reg_duty_cycle_hsch1 and reg_duty_scale_hsch1 has been configured. these register won't take effect until set reg_duty_start_hsch1. this bit is automatically cleared by hardware.*/ }; uint32_t val; - }conf1; + } conf1; union { struct { uint32_t duty_read: 25; /*This register represents the current duty of the output signal for low speed channel.*/ uint32_t reserved25: 7; }; uint32_t val; - }duty_r; - }low_speed_channel[8]; + } duty_r; + } low_speed_channel[8]; struct{ union { struct { @@ -111,15 +111,15 @@ typedef volatile struct { uint32_t reserved26: 6; }; uint32_t val; - }conf; + } conf; union { struct { uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ uint32_t reserved20: 12; }; uint32_t val; - }value; - }high_speed_timer[4]; + } value; + } high_speed_timer[4]; struct{ union { struct { @@ -132,15 +132,15 @@ typedef volatile struct { uint32_t reserved27: 5; }; uint32_t val; - }conf; + } conf; union { struct { uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in low speed timer.*/ uint32_t reserved20: 12; }; uint32_t val; - }value; - }low_speed_timer[4]; + } value; + } low_speed_timer[4]; union { struct { uint32_t hstimer0_ovf: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ @@ -170,7 +170,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t hstimer0_ovf: 1; /*The interrupt status bit for high speed channel0 counter overflow event.*/ @@ -199,7 +199,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t hstimer0_ovf: 1; /*The interrupt enable bit for high speed channel0 counter overflow interrupt.*/ @@ -229,7 +229,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t hstimer0_ovf: 1; /*Set this bit to clear high speed channel0 counter overflow interrupt.*/ @@ -259,14 +259,14 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t apb_clk_sel: 1; /*This bit is used to set the frequency of slow_clk. 1'b1:80mhz 1'b0:8mhz*/ uint32_t reserved1: 31; }; uint32_t val; - }conf; + } conf; uint32_t reserved_194; uint32_t reserved_198; uint32_t reserved_19c; diff --git a/components/esp32/include/soc/pcnt_struct.h b/components/esp32/include/soc/pcnt_struct.h index 5cd1f93137..eef64a336f 100644 --- a/components/esp32/include/soc/pcnt_struct.h +++ b/components/esp32/include/soc/pcnt_struct.h @@ -34,29 +34,29 @@ typedef volatile struct { uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/ uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/ }; uint32_t val; - }conf1; + } conf1; union { struct { uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/ uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/ }; uint32_t val; - }conf2; - }conf_unit[8]; + } conf2; + } conf_unit[8]; union { struct { uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/ uint32_t reserved16: 16; }; uint32_t val; - }cnt_unit[8]; + } cnt_unit[8]; union { struct { uint32_t cnt_thr_event_u0: 1; /*This is the interrupt raw bit for channel0 event.*/ @@ -70,7 +70,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t cnt_thr_event_u0: 1; /*This is the interrupt status bit for channel0 event.*/ @@ -84,7 +84,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t cnt_thr_event_u0: 1; /*This is the interrupt enable bit for channel0 event.*/ @@ -98,7 +98,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t cnt_thr_event_u0: 1; /*Set this bit to clear channel0 event interrupt.*/ @@ -112,7 +112,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }int_clr; + } int_clr; uint32_t status_unit[8]; union { struct { @@ -136,7 +136,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }ctrl; + } ctrl; uint32_t reserved_b4; uint32_t reserved_b8; uint32_t reserved_bc; diff --git a/components/esp32/include/soc/rmt_struct.h b/components/esp32/include/soc/rmt_struct.h index 6523e2191c..15beb8c6d6 100644 --- a/components/esp32/include/soc/rmt_struct.h +++ b/components/esp32/include/soc/rmt_struct.h @@ -27,7 +27,7 @@ typedef volatile struct { uint32_t clk_en: 1; /*This bit is used to control clock.when software configure RMT internal registers it controls the register clock.*/ }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t tx_start: 1; /*Set this bit to start sending data for channel0-7.*/ @@ -46,8 +46,8 @@ typedef volatile struct { uint32_t reserved20: 12; }; uint32_t val; - }conf1; - }conf_ch[8]; + } conf1; + } conf_ch[8]; uint32_t status_ch[8]; /*The status for channel0-7*/ uint32_t apb_mem_addr_ch[8]; /*The ram relative address in channel0-7 by apb fifo access*/ union { @@ -86,7 +86,7 @@ typedef volatile struct { uint32_t ch7_tx_thr_event: 1; /*The interrupt raw bit for channel 7 turns to high level when transmitter in channel7 have send data more than reg_rmt_tx_lim_ch7 after detecting this interrupt software can updata the old data with new data.*/ }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t ch0_tx_end: 1; /*The interrupt state bit for channel 0's mt_ch0_tx_end_int_raw when mt_ch0_tx_end_int_ena is set to 0.*/ @@ -123,7 +123,7 @@ typedef volatile struct { uint32_t ch7_tx_thr_event: 1; /*The interrupt state bit for channel 7's rmt_ch7_tx_thr_event_int_raw when mt_ch7_tx_thr_event_int_ena is set to 1.*/ }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t ch0_tx_end: 1; /*Set this bit to enable rmt_ch0_tx_end_int_st.*/ @@ -160,7 +160,7 @@ typedef volatile struct { uint32_t ch7_tx_thr_event: 1; /*Set this bit to enable rmt_ch7_tx_thr_event_int_st.*/ }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t ch0_tx_end: 1; /*Set this bit to clear the rmt_ch0_rx_end_int_raw..*/ @@ -197,21 +197,21 @@ typedef volatile struct { uint32_t ch7_tx_thr_event: 1; /*Set this bit to clear the rmt_ch7_tx_thr_event_int_raw interrupt.*/ }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t low: 16; /*This register is used to configure carrier wave's low level value for channel0-7.*/ uint32_t high:16; /*This register is used to configure carrier wave's high level value for channel0-7.*/ }; uint32_t val; - }carrier_duty_ch[8]; + } carrier_duty_ch[8]; union { struct { uint32_t limit: 9; /*When channel0-7 sends more than reg_rmt_tx_lim_ch0 data then channel0-7 produce the relative interrupt.*/ uint32_t reserved9: 23; }; uint32_t val; - }tx_lim_ch[8]; + } tx_lim_ch[8]; union { struct { uint32_t fifo_mask: 1; /*Set this bit to disable apb fifo access*/ @@ -219,7 +219,7 @@ typedef volatile struct { uint32_t reserved2: 30; }; uint32_t val; - }apb_conf; + } apb_conf; uint32_t reserved_f4; uint32_t reserved_f8; uint32_t date; /*This is the version register.*/ diff --git a/components/esp32/include/soc/spi_struct.h b/components/esp32/include/soc/spi_struct.h index 5c1c93021e..c7aa29a7c9 100644 --- a/components/esp32/include/soc/spi_struct.h +++ b/components/esp32/include/soc/spi_struct.h @@ -35,14 +35,14 @@ typedef volatile struct { uint32_t flash_read: 1; /*Read flash enable. Read flash operation will be triggered when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ }; uint32_t val; - }cmd; + } cmd; union { struct { uint32_t reserved : 8; uint32_t usr_addr_value:24; /*[31:8]:address to slave [7:0]:Reserved.*/ }; uint32_t val; - }addr; + } addr; union { struct { uint32_t reserved0: 10; /*reserved*/ @@ -63,7 +63,7 @@ typedef volatile struct { uint32_t reserved27: 5; /*reserved*/ }; uint32_t val; - }ctrl; + } ctrl; union { struct { uint32_t reserved0: 16; /*reserved*/ @@ -71,7 +71,7 @@ typedef volatile struct { uint32_t cs_hold_delay: 4; /*SPI cs signal is delayed by spi clock cycles*/ }; uint32_t val; - }ctrl1; + } ctrl1; union { struct { uint32_t status: 16; /*In the slave mode, it is the status for master to read out.*/ @@ -79,7 +79,7 @@ typedef volatile struct { uint32_t status_ext: 8; /*In the slave mode,it is the status for master to read out.*/ }; uint32_t val; - }rd_status; + } rd_status; union { struct { uint32_t setup_time: 4; /*(cycles-1) of ,prepare, phase by spi clock, this bits combined with spi_cs_setup bit.*/ @@ -94,7 +94,7 @@ typedef volatile struct { uint32_t cs_delay_num: 4; /*spi_cs signal is delayed by system clock cycles*/ }; uint32_t val; - }ctrl2; + } ctrl2; union { struct { uint32_t clkcnt_l: 6; /*In the master mode it must be equal to spi_clkcnt_N. In the slave mode it must be 0.*/ @@ -104,7 +104,7 @@ typedef volatile struct { uint32_t clk_equ_sysclk: 1; /*In the master mode 1: spi_clk is eqaul to system 0: spi_clk is divided from system clock.*/ }; uint32_t val; - }clock; + } clock; union { struct { uint32_t doutdin: 1; /*Set the bit to enable full duplex communication. 1: enable 0: disable.*/ @@ -138,7 +138,7 @@ typedef volatile struct { uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ }; uint32_t val; - }user; + } user; union { struct { uint32_t usr_dummy_cyclelen: 8; /*The length in spi_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ @@ -146,7 +146,7 @@ typedef volatile struct { uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ }; uint32_t val; - }user1; + } user1; union { struct { uint32_t usr_command_value: 16; /*The value of command.*/ @@ -154,21 +154,21 @@ typedef volatile struct { uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ }; uint32_t val; - }user2; + } user2; union { struct { uint32_t usr_mosi_dbitlen:24; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; - }mosi_dlen; + } mosi_dlen; union { struct { uint32_t usr_miso_dbitlen:24; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; - }miso_dlen; + } miso_dlen; uint32_t slv_wr_status; /*In the slave mode this register are the status register for the master to write into. In the master mode this register are the higher 32bits in the 64 bits address condition.*/ union { struct { @@ -185,7 +185,7 @@ typedef volatile struct { uint32_t reserved31: 1; /*reserved*/ }; uint32_t val; - }pin; + } pin; union { struct { uint32_t rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ @@ -206,7 +206,7 @@ typedef volatile struct { uint32_t sync_reset: 1; /*Software reset enable, reset the spi clock line cs line and data lines.*/ }; uint32_t val; - }slave; + } slave; union { struct { uint32_t rdbuf_dummy_en: 1; /*In the slave mode it is the enable bit of dummy phase for read-buffer operations.*/ @@ -221,7 +221,7 @@ typedef volatile struct { uint32_t status_bitlen: 5; /*In the slave mode it is the length of status bit.*/ }; uint32_t val; - }slave1; + } slave1; union { struct { uint32_t rdsta_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for read-status operations. The register value shall be (cycle_num-1).*/ @@ -230,7 +230,7 @@ typedef volatile struct { uint32_t wrbuf_dummy_cyclelen: 8; /*In the slave mode it is the length in spi_clk cycles of dummy phase for write-buffer operations. The register value shall be (cycle_num-1).*/ }; uint32_t val; - }slave2; + } slave2; union { struct { uint32_t rdbuf_cmd_value: 8; /*In the slave mode it is the value of read-buffer command.*/ @@ -239,21 +239,21 @@ typedef volatile struct { uint32_t wrsta_cmd_value: 8; /*In the slave mode it is the value of write-status command.*/ }; uint32_t val; - }slave3; + } slave3; union { struct { uint32_t bit_len: 24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; - }slv_wrbuf_dlen; + } slv_wrbuf_dlen; union { struct { uint32_t bit_len: 24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; - }slv_rdbuf_dlen; + } slv_rdbuf_dlen; union { struct { uint32_t req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ @@ -263,7 +263,7 @@ typedef volatile struct { uint32_t reserved4: 28; /*reserved*/ }; uint32_t val; - }cache_fctrl; + } cache_fctrl; union { struct { uint32_t reserved0: 1; /*reserved*/ @@ -279,7 +279,7 @@ typedef volatile struct { uint32_t reserved29: 3; /*reserved*/ }; uint32_t val; - }cache_sctrl; + } cache_sctrl; union { struct { uint32_t dio: 1; /*For SPI0 SRAM DIO mode enable . SRAM DIO enable command will be send when the bit is set. The bit will be cleared once the operation done.*/ @@ -289,7 +289,7 @@ typedef volatile struct { uint32_t reserved5:27; /*reserved*/ }; uint32_t val; - }sram_cmd; + } sram_cmd; union { struct { uint32_t usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for SRAM.*/ @@ -297,7 +297,7 @@ typedef volatile struct { uint32_t usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; uint32_t val; - }sram_drd_cmd; + } sram_drd_cmd; union { struct { uint32_t usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for SRAM.*/ @@ -305,14 +305,14 @@ typedef volatile struct { uint32_t usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for SRAM. The register value shall be (bit_num-1).*/ }; uint32_t val; - }sram_dwr_cmd; + } sram_dwr_cmd; union { struct { uint32_t slv_rdata_bit:24; /*In the slave mode it is the bit length of read data. The value is the length - 1.*/ uint32_t reserved24: 8; /*reserved*/ }; uint32_t val; - }slv_rd_bit; + } slv_rd_bit; uint32_t reserved_68; uint32_t reserved_6c; uint32_t reserved_70; @@ -341,7 +341,7 @@ typedef volatile struct { uint32_t t_pp_ena: 1; /*page program delay enable.*/ }; uint32_t val; - }ext0; + } ext0; union { struct { uint32_t t_erase_time: 12; /*erase flash delay time by system clock.*/ @@ -351,21 +351,21 @@ typedef volatile struct { uint32_t t_erase_ena: 1; /*erase flash delay enable.*/ }; uint32_t val; - }ext1; + } ext1; union { struct { uint32_t st: 3; /*The status of spi state machine .*/ uint32_t reserved3: 29; /*reserved*/ }; uint32_t val; - }ext2; + } ext2; union { struct { uint32_t int_hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at ,idle, phase 2: hold at ,prepare, phase.*/ uint32_t reserved2: 30; /*reserved*/ }; uint32_t val; - }ext3; + } ext3; union { struct { uint32_t reserved0: 2; /*reserved*/ @@ -387,7 +387,7 @@ typedef volatile struct { uint32_t reserved17: 15; /*reserved*/ }; uint32_t val; - }dma_conf; + } dma_conf; union { struct { uint32_t addr: 20; /*The address of the first outlink descriptor.*/ @@ -398,7 +398,7 @@ typedef volatile struct { uint32_t reserved31: 1; /*reserved*/ }; uint32_t val; - }dma_out_link; + } dma_out_link; union { struct { uint32_t addr: 20; /*The address of the first inlink descriptor.*/ @@ -410,7 +410,7 @@ typedef volatile struct { uint32_t reserved31: 1; /*reserved*/ }; uint32_t val; - }dma_in_link; + } dma_in_link; union { struct { uint32_t rx_en: 1; /*spi dma read data status bit.*/ @@ -418,7 +418,7 @@ typedef volatile struct { uint32_t reserved2: 30; /*spi dma read data from memory count.*/ }; uint32_t val; - }dma_status; + } dma_status; union { struct { uint32_t inlink_dscr_empty: 1; /*The enable bit for lack of enough inlink descriptors.*/ @@ -433,7 +433,7 @@ typedef volatile struct { uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; - }dma_int_ena; + } dma_int_ena; union { struct { uint32_t inlink_dscr_empty: 1; /*The raw bit for lack of enough inlink descriptors.*/ @@ -448,7 +448,7 @@ typedef volatile struct { uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; - }dma_int_raw; + } dma_int_raw; union { struct { uint32_t inlink_dscr_empty: 1; /*The status bit for lack of enough inlink descriptors.*/ @@ -463,7 +463,7 @@ typedef volatile struct { uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; - }dma_int_st; + } dma_int_st; union { struct { uint32_t inlink_dscr_empty: 1; /*The clear bit for lack of enough inlink descriptors.*/ @@ -478,7 +478,7 @@ typedef volatile struct { uint32_t reserved9: 23; /*reserved*/ }; uint32_t val; - }dma_int_clr; + } dma_int_clr; uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ @@ -668,7 +668,7 @@ typedef volatile struct { uint32_t reserved28: 4; /*reserved*/ }; uint32_t val; - }date; + } date; } spi_dev_t; extern spi_dev_t SPI0; /* SPI0 IS FOR INTERNAL USE*/ extern spi_dev_t SPI1; diff --git a/components/esp32/include/soc/timer_group_struct.h b/components/esp32/include/soc/timer_group_struct.h index 8f25ce9b62..696b439d61 100644 --- a/components/esp32/include/soc/timer_group_struct.h +++ b/components/esp32/include/soc/timer_group_struct.h @@ -27,7 +27,7 @@ typedef volatile struct { uint32_t enable: 1; /*When set timer 0/1 time-base counter is enabled*/ }; uint32_t val; - }config; + } config; uint32_t cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/ uint32_t cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/ uint32_t update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/ @@ -36,7 +36,7 @@ typedef volatile struct { uint32_t load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/ uint32_t load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/ uint32_t reload; /*Write any value will trigger timer 0 time-base counter reload*/ - }hw_timer[2]; + } hw_timer[2]; union { struct { uint32_t reserved0: 14; @@ -52,14 +52,14 @@ typedef volatile struct { uint32_t en: 1; /*When set SWDT is enabled*/ }; uint32_t val; - }wdt_config0; + } wdt_config0; union { struct { uint32_t reserved0: 16; uint32_t clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/ }; uint32_t val; - }wdt_config1; + } wdt_config1; uint32_t wdt_config2; /*Stage 0 timeout value in SWDT clock cycles*/ uint32_t wdt_config3; /*Stage 1 timeout value in SWDT clock cycles*/ uint32_t wdt_config4; /*Stage 2 timeout value in SWDT clock cycles*/ @@ -76,14 +76,14 @@ typedef volatile struct { uint32_t start: 1; }; uint32_t val; - }rtc_cali_cfg; + } rtc_cali_cfg; union { struct { uint32_t reserved0: 7; uint32_t value:25; }; uint32_t val; - }rtc_cali_cfg1; + } rtc_cali_cfg1; union { struct { uint32_t reserved0: 7; @@ -99,14 +99,14 @@ typedef volatile struct { uint32_t en: 1; }; uint32_t val; - }lactconfig; + } lactconfig; union { struct { uint32_t reserved0: 6; uint32_t step_len:26; }; uint32_t val; - }lactrtc; + } lactrtc; uint32_t lactlo; /**/ uint32_t lacthi; /**/ uint32_t lactupdate; /**/ @@ -124,7 +124,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t t0: 1; /*interrupt when timer0 alarm*/ @@ -134,7 +134,7 @@ typedef volatile struct { uint32_t reserved4:28; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t t0: 1; /*interrupt when timer0 alarm*/ @@ -144,7 +144,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }int_st_timers; + } int_st_timers; union { struct { uint32_t t0: 1; /*interrupt when timer0 alarm*/ @@ -154,7 +154,7 @@ typedef volatile struct { uint32_t reserved4: 28; }; uint32_t val; - }int_clr_timers; + } int_clr_timers; uint32_t reserved_a8; uint32_t reserved_ac; uint32_t reserved_b0; @@ -181,14 +181,14 @@ typedef volatile struct { uint32_t reserved28: 4; }; uint32_t val; - }timg_date; + } timg_date; union { struct { uint32_t reserved0: 31; uint32_t en: 1; /*Force clock enable for this regfile*/ }; uint32_t val; - }clk; + } clk; } timg_dev_t; extern timg_dev_t TIMERG0; extern timg_dev_t TIMERG1; diff --git a/components/esp32/include/soc/uart_struct.h b/components/esp32/include/soc/uart_struct.h index 54baf4f0e5..115ada40f9 100644 --- a/components/esp32/include/soc/uart_struct.h +++ b/components/esp32/include/soc/uart_struct.h @@ -20,7 +20,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }fifo; + } fifo; union { struct { uint32_t rxfifo_full: 1; /*This interrupt raw bit turns to high level when receiver receives more data than (rx_flow_thrhd_h3 rx_flow_thrhd).*/ @@ -45,7 +45,7 @@ typedef volatile struct { uint32_t reserved19: 13; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t rxfifo_full: 1; /*This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.*/ @@ -70,7 +70,7 @@ typedef volatile struct { uint32_t reserved19: 13; }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t rxfifo_full: 1; /*This is the enable bit for rxfifo_full_int_st register.*/ @@ -95,7 +95,7 @@ typedef volatile struct { uint32_t reserved19: 13; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t rxfifo_full: 1; /*Set this bit to clear the rxfifo_full_int_raw interrupt.*/ @@ -120,7 +120,7 @@ typedef volatile struct { uint32_t reserved19: 13; }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t div_int: 20; /*The register value is the integer part of the frequency divider's factor.*/ @@ -128,7 +128,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }clk_div; + } clk_div; union { struct { uint32_t en: 1; /*This is the enable bit for detecting baudrate.*/ @@ -137,7 +137,7 @@ typedef volatile struct { uint32_t reserved16: 16; }; uint32_t val; - }auto_baud; + } auto_baud; union { struct { uint32_t rxfifo_cnt: 8; /*(rx_mem_cnt rxfifo_cnt) stores the byte number of valid data in receiver's fifo. rx_mem_cnt register stores the 3 most significant bits rxfifo_cnt stores the 8 least significant bits.*/ @@ -154,7 +154,7 @@ typedef volatile struct { uint32_t txd: 1; /*This register represent the level value of the internal uart rxd signal.*/ }; uint32_t val; - }status; + } status; union { struct { uint32_t parity: 1; /*This register is used to configure the parity check mode. 0:even 1:odd*/ @@ -186,7 +186,7 @@ typedef volatile struct { uint32_t reserved28: 4; }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t rxfifo_full_thrhd: 7; /*When receiver receives more data than its threshold value,receiver will produce rxfifo_full_int_raw interrupt.the threshold value is (rx_flow_thrhd_h3 rxfifo_full_thrhd).*/ @@ -199,28 +199,28 @@ typedef volatile struct { uint32_t rx_tout_en: 1; /*This is the enable bit for uart receiver's timeout function.*/ }; uint32_t val; - }conf1; + } conf1; union { struct { uint32_t min_cnt: 20; /*This register stores the value of the minimum duration time for the low level pulse, it is used in baudrate-detect process.*/ uint32_t reserved20: 12; }; uint32_t val; - }lowpulse; + } lowpulse; union { struct { uint32_t min_cnt: 20; /*This register stores the value of the maximum duration time for the high level pulse, it is used in baudrate-detect process.*/ uint32_t reserved20: 12; }; uint32_t val; - }highpulse; + } highpulse; union { struct { uint32_t edge_cnt: 10; /*This register stores the count of rxd edge change, it is used in baudrate-detect process.*/ uint32_t reserved10: 22; }; uint32_t val; - }rxd_cnt; + } rxd_cnt; union { struct { uint32_t sw_flow_con_en: 1; /*Set this bit to enable software flow control. it is used with register sw_xon or sw_xoff .*/ @@ -232,14 +232,14 @@ typedef volatile struct { uint32_t reserved6: 26; }; uint32_t val; - }flow_conf; + } flow_conf; union { struct { uint32_t active_threshold:10; /*When the input rxd edge changes more than this register value, the uart is active from light sleeping mode.*/ uint32_t reserved10: 22; }; uint32_t val; - }sleep_conf; + } sleep_conf; union { struct { uint32_t xon_threshold: 8; /*when the data amount in receiver's fifo is more than this register value, it will send a xoff char with uart_sw_flow_con_en set to 1.*/ @@ -248,7 +248,7 @@ typedef volatile struct { uint32_t xoff_char: 8; /*This register stores the xoff flow control char.*/ }; uint32_t val; - }swfc_conf; + } swfc_conf; union { struct { uint32_t rx_idle_thrhd:10; /*when receiver takes more time than this register value to receive a byte data, it will produce frame end signal for uhci to stop receiving data.*/ @@ -257,7 +257,7 @@ typedef volatile struct { uint32_t reserved28: 4; }; uint32_t val; - }idle_conf; + } idle_conf; union { struct { uint32_t en: 1; /*Set this bit to choose rs485 mode.*/ @@ -270,28 +270,28 @@ typedef volatile struct { uint32_t reserved10: 22; }; uint32_t val; - }rs485_conf; + } rs485_conf; union { struct { uint32_t pre_idle_num:24; /*This register is used to configure the idle duration time before the first at_cmd is received by receiver, when the the duration is less than this register value it will not take the next data received as at_cmd char.*/ uint32_t reserved24: 8; }; uint32_t val; - }at_cmd_precnt; + } at_cmd_precnt; union { struct { uint32_t post_idle_num:24; /*This register is used to configure the duration time between the last at_cmd and the next data, when the duration is less than this register value it will not take the previous data as at_cmd char.*/ uint32_t reserved24: 8; }; uint32_t val; - }at_cmd_postcnt; + } at_cmd_postcnt; union { struct { uint32_t rx_gap_tout:24; /*This register is used to configure the duration time between the at_cmd chars, when the duration time is less than this register value it will not take the data as continous at_cmd chars.*/ uint32_t reserved24: 8; }; uint32_t val; - }at_cmd_gaptout; + } at_cmd_gaptout; union { struct { uint32_t data: 8; /*This register is used to configure the content of at_cmd char.*/ @@ -299,7 +299,7 @@ typedef volatile struct { uint32_t reserved16: 16; }; uint32_t val; - }at_cmd_char; + } at_cmd_char; union { struct { uint32_t mem_pd: 1; /*Set this bit to power down memory,when reg_mem_pd registers in the 3 uarts are all set to 1 memory will enter low power mode.*/ @@ -317,21 +317,21 @@ typedef volatile struct { uint32_t reserved31: 1; }; uint32_t val; - }mem_conf; + } mem_conf; union { struct { uint32_t status:24; uint32_t reserved24: 8; }; uint32_t val; - }mem_tx_status; + } mem_tx_status; union { struct { uint32_t status:24; uint32_t reserved24: 8; }; uint32_t val; - }mem_rx_status; + } mem_rx_status; union { struct { uint32_t rx_cnt: 3; /*refer to the rxfifo_cnt's description.*/ @@ -339,21 +339,21 @@ typedef volatile struct { uint32_t reserved6: 26; }; uint32_t val; - }mem_cnt_status; + } mem_cnt_status; union { struct { uint32_t min_cnt: 20; /*This register stores the count of rxd pos-edge edge, it is used in baudrate-detect process.*/ uint32_t reserved20: 12; }; uint32_t val; - }pospulse; + } pospulse; union { struct { uint32_t min_cnt: 20; /*This register stores the count of rxd neg-edge edge, it is used in baudrate-detect process.*/ uint32_t reserved20: 12; }; uint32_t val; - }negpulse; + } negpulse; uint32_t reserved_70; uint32_t reserved_74; uint32_t date; /**/ diff --git a/components/esp32/include/soc/uhci_struct.h b/components/esp32/include/soc/uhci_struct.h index 58e18d0ea5..0c939796af 100644 --- a/components/esp32/include/soc/uhci_struct.h +++ b/components/esp32/include/soc/uhci_struct.h @@ -43,7 +43,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }conf0; + } conf0; union { struct { uint32_t rx_start: 1; /*when a separator char has been send it will produce uhci_rx_start_int interrupt.*/ @@ -66,7 +66,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_raw; + } int_raw; union { struct { uint32_t rx_start: 1; @@ -89,7 +89,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_st; + } int_st; union { struct { uint32_t rx_start: 1; @@ -112,7 +112,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_ena; + } int_ena; union { struct { uint32_t rx_start: 1; @@ -135,7 +135,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }int_clr; + } int_clr; union { struct { uint32_t full: 1; /*1:DMA out link descriptor's fifo is full.*/ @@ -143,7 +143,7 @@ typedef volatile struct { uint32_t reserved2: 30; }; uint32_t val; - }dma_out_status; + } dma_out_status; union { struct { uint32_t fifo_wdata: 9; /*This is the data need to be pushed into out link descriptor's fifo.*/ @@ -152,7 +152,7 @@ typedef volatile struct { uint32_t reserved17:15; }; uint32_t val; - }dma_out_push; + } dma_out_push; union { struct { uint32_t full: 1; @@ -162,7 +162,7 @@ typedef volatile struct { uint32_t reserved7: 25; }; uint32_t val; - }dma_in_status; + } dma_in_status; union { struct { uint32_t fifo_rdata: 12; /*This register stores the data pop from in link descriptor's fifo.*/ @@ -171,7 +171,7 @@ typedef volatile struct { uint32_t reserved17: 15; }; uint32_t val; - }dma_in_pop; + } dma_in_pop; union { struct { uint32_t addr: 20; /*This register stores the least 20 bits of the first out link descriptor's address.*/ @@ -182,7 +182,7 @@ typedef volatile struct { uint32_t park: 1; /*1: the out link descriptor's fsm is in idle state. 0:the out link descriptor's fsm is working.*/ }; uint32_t val; - }dma_out_link; + } dma_out_link; union { struct { uint32_t addr: 20; /*This register stores the least 20 bits of the first in link descriptor's address.*/ @@ -194,7 +194,7 @@ typedef volatile struct { uint32_t park: 1; /*1:the in link descriptor's fsm is in idle state. 0:the in link descriptor's fsm is working*/ }; uint32_t val; - }dma_in_link; + } dma_in_link; union { struct { uint32_t check_sum_en: 1; /*Set this bit to enable decoder to check check_sum in packet header.*/ @@ -210,7 +210,7 @@ typedef volatile struct { uint32_t reserved21: 11; }; uint32_t val; - }conf1; + } conf1; uint32_t state0; /**/ uint32_t state1; /**/ uint32_t dma_out_eof_des_addr; /*This register stores the address of out link description when eof bit in this descriptor is 1.*/ @@ -225,7 +225,7 @@ typedef volatile struct { uint32_t reserved6: 26; }; uint32_t val; - }ahb_test; + } ahb_test; uint32_t dma_in_dscr; /*The content of current in link descriptor's third dword*/ uint32_t dma_in_dscr_bf0; /*The content of current in link descriptor's first dword*/ uint32_t dma_in_dscr_bf1; /*The content of current in link descriptor's second dword*/ @@ -245,7 +245,7 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }escape_conf; + } escape_conf; union { struct { uint32_t txfifo_timeout: 8; /*This register stores the timeout value.when DMA takes more time than this register value to receive a data it will produce uhci_tx_hung_int interrupt.*/ @@ -257,7 +257,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }hung_conf; + } hung_conf; uint32_t ack_num; /**/ uint32_t rx_head; /*This register stores the packet header received by DMA*/ union { @@ -269,10 +269,10 @@ typedef volatile struct { uint32_t reserved8: 24; }; uint32_t val; - }quick_sent; + } quick_sent; struct{ uint32_t w_data[2]; /*This register stores the content of short packet's dword*/ - }q_data[7]; + } q_data[7]; union { struct { uint32_t seper_char: 8; /*This register stores the separator char separator char is used to separate the data frame.*/ @@ -281,7 +281,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }esc_conf0; + } esc_conf0; union { struct { uint32_t seq0: 8; /*This register stores the first substitute char used to replace the separate char.*/ @@ -290,7 +290,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }esc_conf1; + } esc_conf1; union { struct { uint32_t seq1: 8; /*This register stores the flow control char to turn on the flow_control*/ @@ -299,7 +299,7 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }esc_conf2; + } esc_conf2; union { struct { uint32_t seq2: 8; /*This register stores the flow_control char to turn off the flow_control*/ @@ -308,14 +308,14 @@ typedef volatile struct { uint32_t reserved24: 8; }; uint32_t val; - }esc_conf3; + } esc_conf3; union { struct { uint32_t thrs: 13; /*when the amount of packet payload is larger than this value the process of receiving data is done.*/ uint32_t reserved13:19; }; uint32_t val; - }pkt_thres; + } pkt_thres; uint32_t reserved_c4; uint32_t reserved_c8; uint32_t reserved_cc; From 948be5c0c4a86ba044bfa157137a6b8020fd1e41 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Mon, 19 Sep 2016 17:50:18 +0800 Subject: [PATCH 030/179] modify typo --- components/driver/gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index b621e3ffc4..8bf58a14b5 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -211,11 +211,11 @@ static esp_err_t gpio_output_disable(gpio_num_t gpio_num) static esp_err_t gpio_output_enable(gpio_num_t gpio_num) { if(gpio_num >= 34) { - GPIO_ERROR("io_num=%d only input\n",gpio_num); + GPIO_ERROR("io_num=%d can only be input\n",gpio_num); return ESP_ERR_INVALID_ARG; } if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { - GPIO_ERROR("io_num=%d not exits\n",gpio_num); + GPIO_ERROR("io_num=%d does not exist\n",gpio_num); return ESP_ERR_INVALID_ARG; } if(gpio_num < 32) { @@ -316,7 +316,7 @@ esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_direction_t direction) gpio_output_disable(gpio_num); break; default: - GPIO_ERROR("Unkown direction type,gpio_num=%u,direction=%u\n",gpio_num,direction); + GPIO_ERROR("Unknown direction type,gpio_num=%u,direction=%u\n",gpio_num,direction); ret = ESP_ERR_INVALID_ARG; break; } @@ -397,7 +397,7 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) } PIN_FUNC_SELECT(io_reg, GPIO_FUNC_SEL); /*function number 2 is GPIO_FUNC for each pin */ } else if(bit_valid && (io_reg == 0)) { - GPIO_WARNING("io_num=%d not exits\n",io_num); + GPIO_WARNING("io_num=%d does not exist\n",io_num); } io_num++; } while(io_num < GPIO_PIN_COUNT); From e8ae38024d5a13c3090f1ad500e48fb2143da3e8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 19 Sep 2016 19:28:36 +0800 Subject: [PATCH 031/179] components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr Default _cleanup_r doesn't do that, which leaks these three file descriptors. --- components/esp32/syscalls.c | 17 +++++++++++++++++ components/freertos/tasks.c | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/components/esp32/syscalls.c b/components/esp32/syscalls.c index 1aff0167aa..350f5f4105 100644 --- a/components/esp32/syscalls.c +++ b/components/esp32/syscalls.c @@ -367,6 +367,23 @@ void IRAM_ATTR _lock_release_recursive(_lock_t *lock) { lock_release_generic(lock, queueQUEUE_TYPE_RECURSIVE_MUTEX); } +// This function is not part on newlib API, it is defined in libc/stdio/local.h +// It is called as part of _reclaim_reent via a pointer in __cleanup member +// of struct _reent. +// This function doesn't call _fclose_r for _stdin, _stdout, _stderr members +// of struct reent. Not doing so causes a memory leak each time a task is +// terminated. We replace __cleanup member with _extra_cleanup_r (below) to work +// around this. +extern void _cleanup_r(struct _reent* r); + +void _extra_cleanup_r(struct _reent* r) +{ + _cleanup_r(r); + _fclose_r(r, r->_stdout); + _fclose_r(r, r->_stderr); + _fclose_r(r, r->_stdin); +} + static struct _reent s_reent; /* diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index a4595154ed..ff3a0530d6 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -85,6 +85,7 @@ task.h is included from an application file. */ #include "StackMacros.h" #include "portmacro.h" #include "semphr.h" +#include "sys/reent.h" /* Lint e961 and e750 are suppressed as a MISRA exception justified because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the @@ -3489,6 +3490,9 @@ TCB_t *pxNewTCB; #if ( INCLUDE_vTaskDelete == 1 ) + // TODO: move this to newlib component and provide a header file + extern void _extra_cleanup_r(struct _reent* r); + static void prvDeleteTCB( TCB_t *pxTCB ) { /* This call is required specifically for the TriCore port. It must be @@ -3500,6 +3504,7 @@ TCB_t *pxNewTCB; to the task to free any memory allocated at the application level. */ #if ( configUSE_NEWLIB_REENTRANT == 1 ) { + pxTCB->xNewLib_reent.__cleanup = &_extra_cleanup_r; _reclaim_reent( &( pxTCB->xNewLib_reent ) ); } #endif /* configUSE_NEWLIB_REENTRANT */ From f5f625ead5b4e145c94b8afca45e22d6d8de7aa1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 11:20:31 +0800 Subject: [PATCH 032/179] kconfig: fix build on macOS macOS version of sed doesn't recognize \r as special character. Replacing with \x0D substitution which works everywhere. --- tools/kconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 65b236d34a..fee5a69316 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -302,7 +302,7 @@ zconf.lex.c: zconf.l zconf.hash.c: zconf.gperf # strip CRs on Windows systems where gperf will otherwise barf on them - sed -E "s/\r//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t + sed -E "s/\\x0D$$//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.tab.c: zconf.y bison -t -l -p zconf -o zconf.tab.c zconf.y From dcf34b1be1ba8d614aefb3b6e70f762767d89997 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 14:18:23 +0800 Subject: [PATCH 033/179] bootloader: remove trailing newlines from log messages --- components/bootloader/src/main/flash_encrypt.c | 10 +++++----- components/bootloader/src/main/secure_boot.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/bootloader/src/main/flash_encrypt.c b/components/bootloader/src/main/flash_encrypt.c index 4b5674f213..26e66aa039 100644 --- a/components/bootloader/src/main/flash_encrypt.c +++ b/components/bootloader/src/main/flash_encrypt.c @@ -106,7 +106,7 @@ bool flash_encrypt(bootloader_state_t *bs) uint32_t flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0_REG, EFUSE_FLASH_CRYPT_CNT); uint8_t count = bitcount(flash_crypt_cnt); int i = 0; - ESP_LOGD(TAG, "flash encrypt cnt %x, bitcount %d\n", flash_crypt_cnt, count); + ESP_LOGD(TAG, "flash encrypt cnt %x, bitcount %d", flash_crypt_cnt, count); if ((count % 2) == 0) { boot_cache_redirect( 0, 64*1024); @@ -135,7 +135,7 @@ bool flash_encrypt(bootloader_state_t *bs) /* encrypt write factory bin */ if(bs->factory.offset != 0x00) { - ESP_LOGD(TAG, "have factory bin\n"); + ESP_LOGD(TAG, "have factory bin"); boot_cache_redirect(bs->factory.offset, bs->factory.size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->factory.offset&0xffff)); if(bin_len != 0) { @@ -147,7 +147,7 @@ bool flash_encrypt(bootloader_state_t *bs) } /* encrypt write test bin */ if(bs->test.offset != 0x00) { - ESP_LOGD(TAG, "have test bin\n"); + ESP_LOGD(TAG, "have test bin"); boot_cache_redirect(bs->test.offset, bs->test.size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->test.offset&0xffff)); if(bin_len != 0) { @@ -160,7 +160,7 @@ bool flash_encrypt(bootloader_state_t *bs) /* encrypt write ota bin */ for (i = 0;i<16;i++) { if(bs->ota[i].offset != 0x00) { - ESP_LOGD(TAG, "have ota[%d] bin\n",i); + ESP_LOGD(TAG, "have ota[%d] bin",i); boot_cache_redirect(bs->ota[i].offset, bs->ota[i].size); bin_len = get_bin_len((uint32_t)MEM_CACHE(bs->ota[i].offset&0xffff)); if(bin_len != 0) { @@ -180,7 +180,7 @@ bool flash_encrypt(bootloader_state_t *bs) REG_WRITE(EFUSE_CONF_REG, 0x5A5A); /* efuse_pgm_op_ena, force no rd/wr disable */ REG_WRITE(EFUSE_CMD_REG, 0x02); /* efuse_pgm_cmd */ while (REG_READ(EFUSE_CMD_REG)); /* wait for efuse_pagm_cmd=0 */ - ESP_LOGW(TAG, "burn flash_crypt_cnt\n"); + ESP_LOGW(TAG, "burn flash_crypt_cnt"); REG_WRITE(EFUSE_CONF_REG, 0x5AA5); /* efuse_read_op_ena, release force */ REG_WRITE(EFUSE_CMD_REG, 0x01); /* efuse_read_cmd */ while (REG_READ(EFUSE_CMD_REG)); /* wait for efuse_read_cmd=0 */ diff --git a/components/bootloader/src/main/secure_boot.c b/components/bootloader/src/main/secure_boot.c index 64332ff4e9..3dfdbd1412 100644 --- a/components/bootloader/src/main/secure_boot.c +++ b/components/bootloader/src/main/secure_boot.c @@ -117,11 +117,11 @@ bool secure_boot(void){ REG_WRITE(EFUSE_CONF_REG, 0x5A5A); /* efuse_pgm_op_ena, force no rd/wr disable */ REG_WRITE(EFUSE_CMD_REG, 0x02); /* efuse_pgm_cmd */ while (REG_READ(EFUSE_CMD_REG)); /* wait for efuse_pagm_cmd=0 */ - ESP_LOGW(TAG, "burn abstract_done_0\n"); + ESP_LOGW(TAG, "burn abstract_done_0"); REG_WRITE(EFUSE_CONF_REG, 0x5AA5); /* efuse_read_op_ena, release force */ REG_WRITE(EFUSE_CMD_REG, 0x01); /* efuse_read_cmd */ while (REG_READ(EFUSE_CMD_REG)); /* wait for efuse_read_cmd=0 */ - ESP_LOGI(TAG, "read EFUSE_BLK0_RDATA6 %x\n", REG_READ(EFUSE_BLK0_RDATA6_REG)); + ESP_LOGI(TAG, "read EFUSE_BLK0_RDATA6 %x", REG_READ(EFUSE_BLK0_RDATA6_REG)); return true; } From 50c7583f4dca95a2bc0f0e3a30b9120da7c33cc2 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Tue, 20 Sep 2016 14:51:03 +0800 Subject: [PATCH 034/179] lwip: add debug code to show udp/tcp pcbs --- components/lwip/api/lwip_debug.c | 115 +++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 components/lwip/api/lwip_debug.c diff --git a/components/lwip/api/lwip_debug.c b/components/lwip/api/lwip_debug.c new file mode 100644 index 0000000000..6a8f91c40f --- /dev/null +++ b/components/lwip/api/lwip_debug.c @@ -0,0 +1,115 @@ +#ifndef _LWIP_DEBUG_ +#define _LWIP_DEBUG_ + +#include "lwip/api.h" +#include "lwip/netbuf.h" +#include "lwip/tcp.h" +#include "lwip/udp.h" +#include "lwip/priv/tcp_priv.h" + +#define DBG_LWIP_IP_SHOW(info, ip) printf("%s type=%d ip=%x\n", (info), (ip).type, (ip).u_addr.ip4.addr) +#define DBG_LWIP_IP_PCB_SHOW(pcb) \ + DBG_LWIP_IP_SHOW("local ip", (pcb)->local_ip);\ + DBG_LWIP_IP_SHOW("remote ip", (pcb)->local_ip);\ + printf("so_options=%x, tos=%d ttl=%d\n", (pcb)->so_options, (pcb)->tos, (pcb)->ttl) + +#define DBG_LWIP_SEG_SHOW(seg) while(seg) { printf("\tseg=%p next=%p pbuf=%p flags=%x\n", (seg), (seg)->next, (seg)->p, (seg)->flags); (seg)=(seg)->next;} + + +static void dbg_lwip_tcp_pcb_one_show(struct tcp_pcb* pcb) +{ + struct tcp_seg *seg = NULL; + + if (!pcb) { + return; + } + + printf("\npcb=%p next=%p cb_arg=%p\n", pcb, pcb->next, pcb->callback_arg); + DBG_LWIP_IP_PCB_SHOW(pcb); + printf("state=%x\n", pcb->state); + printf("prio=%d\n", pcb->prio); + printf("local_port=%d, remote_port=%d\n", pcb->local_port, pcb->remote_port); + printf("flags=%x\n", pcb->flags); + printf("pooltmr=%d pollinterval=%d, last_tmr=%d tmr=%d rtmer=%d\n", pcb->polltmr, pcb->pollinterval, pcb->last_timer, pcb->tmr, pcb->rtime); + printf("recv_nxt=%d recv_wnd=%d recv_ann_wnd=%d recv_ann_right_edge=%d\n", pcb->rcv_nxt, pcb->rcv_wnd, pcb->rcv_ann_wnd, pcb->rcv_ann_right_edge); + printf("mss=%d\n", pcb->mss); + printf("rttest=%d rtseq=%d sa=%d sv=%d\n", pcb->rttest, pcb->rtseq, pcb->sa, pcb->sv); + printf("rto=%d nrtx=%d\n", pcb->rto, pcb->nrtx); + printf("dupacks=%d lastack=%d\n", pcb->dupacks, pcb->lastack); + printf("cwnd=%d ssthreash=%d\n", pcb->cwnd, pcb->ssthresh); + printf("snd_next=%d snd_wl1=%d snd_wl2=%d\n", pcb->snd_nxt, pcb->snd_wl1, pcb->snd_wl2); + printf("snd_lbb=%d snd_wnd=%d snd_wnd_max=%d\n", pcb->snd_lbb, pcb->snd_wnd, pcb->snd_wnd_max); + printf("acked=%d\n", pcb->acked); + printf("snd_buf=%d snd_queuelen=%d\n", pcb->snd_buf, pcb->snd_queuelen); + printf("unsent_oversize=%d\n", pcb->unsent_oversize); + printf("keep_idle=%d keep_intvl=%d keep_cnt=%d\n", pcb->keep_idle, pcb->keep_intvl, pcb->keep_cnt); + printf("persist_cnt=%d persist_backoff=%d\n", pcb->persist_cnt, pcb->persist_backoff); + printf("keep_cnt_sent=%d\n", pcb->keep_cnt_sent); + + printf("unsent segments:\n"); + seg = pcb->unsent; + DBG_LWIP_SEG_SHOW(seg) + + printf("unacked segments:\n"); + seg = pcb->unacked; + DBG_LWIP_SEG_SHOW(seg); + + printf("ooseg semengts:\n"); + seg = pcb->ooseq; + DBG_LWIP_SEG_SHOW(seg); + + printf("refused data=%p\n", pcb->refused_data); +} + +static void dbg_lwip_tcp_pcb_list_show(struct tcp_pcb* pcb) +{ + while(pcb){ + dbg_lwip_tcp_pcb_one_show(pcb); + pcb = pcb->next; + } +} + +extern struct tcp_pcb *tcp_bound_pcbs; +extern struct tcp_pcb *tcp_active_pcbs; +extern struct tcp_pcb *tcp_tw_pcbs; +void dbg_lwip_tcp_pcb_show(void) +{ + printf("-------------active pcbs------------\n"); + dbg_lwip_tcp_pcb_list_show(tcp_active_pcbs); + printf("-------------bound pcbs-------------\n"); + dbg_lwip_tcp_pcb_list_show(tcp_bound_pcbs); + printf("-------------tw pcbs------------\n"); + dbg_lwip_tcp_pcb_list_show(tcp_tw_pcbs); +} + +void dbg_lwip_udp_pcb_one_show(struct udp_pcb *pcb) +{ + printf("pcb=%p next=%p\n", pcb, (void*)pcb->next); + DBG_LWIP_IP_PCB_SHOW(pcb); + printf("flags=%x\n", pcb->flags); + printf("local_port=%d remote_port=%d\n", pcb->local_port, pcb->remote_port); + printf("recv cb=%p recv_arg=%p\n", pcb->recv, pcb->recv_arg); +} + +extern struct udp_pcb *udp_pcbs; +void dbg_lwip_udp_pcb_show(void) +{ + struct udp_pcb *pcb = udp_pcbs; + + while (pcb){ + dbg_lwip_udp_pcb_one_show(pcb); + pcb = pcb->next; + } +} + +void dbg_lwip_tcp_rxtx_show(void) +{ + printf("TBC\n"); +} + +void dbg_lwip_udp_rxtx_show(void) +{ + printf("TBC\n"); +} + +#endif From f64e1c54b706b21ac319e6b80113092b564a92e3 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Tue, 20 Sep 2016 15:36:49 +0800 Subject: [PATCH 035/179] lwip: add license and add lwip_debug.h --- components/lwip/api/lwip_debug.c | 17 ++++++++++--- .../lwip/include/lwip/lwip/lwip_debug.h | 24 +++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 components/lwip/include/lwip/lwip/lwip_debug.h diff --git a/components/lwip/api/lwip_debug.c b/components/lwip/api/lwip_debug.c index 6a8f91c40f..1e5fed40d3 100644 --- a/components/lwip/api/lwip_debug.c +++ b/components/lwip/api/lwip_debug.c @@ -1,6 +1,18 @@ -#ifndef _LWIP_DEBUG_ -#define _LWIP_DEBUG_ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include "lwip/lwip_debug.h" #include "lwip/api.h" #include "lwip/netbuf.h" #include "lwip/tcp.h" @@ -112,4 +124,3 @@ void dbg_lwip_udp_rxtx_show(void) printf("TBC\n"); } -#endif diff --git a/components/lwip/include/lwip/lwip/lwip_debug.h b/components/lwip/include/lwip/lwip/lwip_debug.h new file mode 100644 index 0000000000..abfcd2c1c3 --- /dev/null +++ b/components/lwip/include/lwip/lwip/lwip_debug.h @@ -0,0 +1,24 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _LWIP_DEBUG_H +#define _LWIP_DEBUG_H + +void dbg_lwip_tcp_pcb_show(void); +void dbg_lwip_udp_pcb_show(void); +void dbg_lwip_tcp_rxtx_show(void); +void dbg_lwip_udp_rxtx_show(void); + +#endif From 316d3f9c4a82d2511521946533f0497215036f28 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 15:36:55 +0800 Subject: [PATCH 036/179] components/lwip: make SO_REUSE configurable via menuconfig Not all environments need or can work with SO_REUSE enabled, so making this option configurable. --- components/lwip/Kconfig | 7 +++++++ components/lwip/include/lwip/port/lwipopts.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 8f38ba9310..911db6fff4 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -16,6 +16,13 @@ config LWIP_THREAD_LOCAL_STORAGE_INDEX Specify the thread-local-storage-pointer index for lwip use. +config LWIP_SO_REUSE + bool "Enable SO_REUSEADDR option" + default 0 + help + Enabling this option allows to bind to a port which remains in + TIME_WAIT. + endmenu diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index 99520f1cd9..2c24b2be92 100755 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -34,6 +34,7 @@ #include #include "esp_task.h" +#include "sdkconfig.h" /* Enable all Espressif-only options */ #define LWIP_ESP8266 @@ -404,8 +405,9 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void); /** * SO_REUSE==1: Enable SO_REUSEADDR option. + * This option is set via menuconfig. */ -#define SO_REUSE 1 +#define SO_REUSE CONFIG_LWIP_SO_REUSE /* ---------------------------------------- From 3b22173a938926a5d60a561e1e80ba6029012cf4 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 16:53:56 +0800 Subject: [PATCH 037/179] components/lwip: fix grammar --- components/lwip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 911db6fff4..ceb1453f9a 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -20,7 +20,7 @@ config LWIP_SO_REUSE bool "Enable SO_REUSEADDR option" default 0 help - Enabling this option allows to bind to a port which remains in + Enabling this option allows binding to a port which remains in TIME_WAIT. endmenu From f7b10745be1ba4830fb1dd4aaac4ec2f615db47a Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Wed, 21 Sep 2016 09:51:37 +0800 Subject: [PATCH 038/179] Remove mutex from GPIO driver code. Replace uint8_t/uint16_t with uint32_t --- components/driver/gpio.c | 305 ++++++++---------------- components/driver/include/driver/gpio.h | 108 ++++++--- 2 files changed, 178 insertions(+), 235 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index 8bf58a14b5..2cf1907170 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -16,7 +16,6 @@ #include "esp_err.h" #include "esp_intr.h" #include "freertos/FreeRTOS.h" -#include "freertos/semphr.h" #include "freertos/xtensa_api.h" #include "soc/soc.h" #include "driver/gpio.h" @@ -49,7 +48,7 @@ #define GPIO_ERROR(...) #endif -const uint32_t GPIO_PIN_MUX_REG[40] = { +const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT] = { GPIO_PIN_REG_0, GPIO_PIN_REG_1, GPIO_PIN_REG_2, @@ -92,8 +91,7 @@ const uint32_t GPIO_PIN_MUX_REG[40] = { GPIO_PIN_REG_39 }; -static SemaphoreHandle_t gpio_mutex = NULL; - +#define IS_VALID_GPIO(gpio_num) ( (gpio_num < GPIO_PIN_COUNT && GPIO_PIN_MUX_REG[gpio_num] != 0)) static int is_valid_gpio(int gpio_num) { if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { @@ -103,17 +101,7 @@ static int is_valid_gpio(int gpio_num) return 1; } -static esp_err_t gpio_mutex_init() -{ - if(gpio_mutex == NULL) { - gpio_mutex = xSemaphoreCreateRecursiveMutex(); - if(gpio_mutex == NULL) - return ESP_FAIL; - } - return ESP_OK; -} - -static esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, uint8_t intr_type) +esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; @@ -121,79 +109,28 @@ static esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, uint8_t intr_type) GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); return ESP_ERR_INVALID_ARG; } - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - GPIO.pin[gpio_num].int_type = intr_type; - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } + GPIO.pin[gpio_num].int_type = intr_type; + return ESP_OK; } -static esp_err_t gpio_intr_enable(gpio_num_t gpio_num) +esp_err_t gpio_intr_enable(gpio_num_t gpio_num) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - if(xPortGetCoreID() == 0) { - GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr - } else { - GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr - } - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; + if(xPortGetCoreID() == 0) { + GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; + GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr } + return ESP_OK; } -static esp_err_t gpio_intr_disable(gpio_num_t gpio_num) +esp_err_t gpio_intr_disable(gpio_num_t gpio_num) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } -} - -static esp_err_t gpio_input_enable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) - return ESP_ERR_INVALID_ARG; - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } -} - -static esp_err_t gpio_input_disable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) - return ESP_ERR_INVALID_ARG; - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]); - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } + GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr + return ESP_OK; } static esp_err_t gpio_output_disable(gpio_num_t gpio_num) @@ -214,10 +151,8 @@ static esp_err_t gpio_output_enable(gpio_num_t gpio_num) GPIO_ERROR("io_num=%d can only be input\n",gpio_num); return ESP_ERR_INVALID_ARG; } - if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { - GPIO_ERROR("io_num=%d does not exist\n",gpio_num); + if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; - } if(gpio_num < 32) { GPIO.enable_w1ts = (0x1 << gpio_num); } else { @@ -228,7 +163,7 @@ static esp_err_t gpio_output_enable(gpio_num_t gpio_num) esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) { - if(!is_valid_gpio(gpio_num)) + if(!IS_VALID_GPIO(gpio_num)) return ESP_ERR_INVALID_ARG; if(level) { if(gpio_num < 32) @@ -255,127 +190,108 @@ int gpio_get_level(gpio_num_t gpio_num) esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) { - if(gpio_mutex != NULL) { - if(!is_valid_gpio(gpio_num)) - return ESP_ERR_INVALID_ARG; - - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - esp_err_t ret = ESP_OK; - switch(pull) { - case GPIO_PULLUP_ONLY: - PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_PULLDOWN_ONLY: - PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_PULLUP_PULLDOWN: - PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_FLOATING: - PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); - break; - default: - GPIO_ERROR("Unknown pull up/down mode,gpio_num=%u,pull=%u\n",gpio_num,pull); - ret = ESP_ERR_INVALID_ARG; - break; - } - xSemaphoreGiveRecursive(gpio_mutex); - return ret; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + esp_err_t ret = ESP_OK; + switch(pull) { + case GPIO_PULLUP_ONLY: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLDOWN_ONLY: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLUP_PULLDOWN: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_FLOATING: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + default: + GPIO_ERROR("Unknown pull up/down mode,gpio_num=%u,pull=%u\n",gpio_num,pull); + ret = ESP_ERR_INVALID_ARG; + break; } + return ret; } -esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_direction_t direction) +esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode) { - if(gpio_mutex != NULL) { - if(!is_valid_gpio(gpio_num)) - return ESP_ERR_INVALID_ARG; - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - esp_err_t ret = ESP_OK; - switch(direction) { - case GPIO_DIR_OUTPUT_ONLY: - gpio_input_disable(gpio_num); - gpio_output_enable(gpio_num); - break; - case GPIO_DIR_INPUT_ONLY: - gpio_input_enable(gpio_num); - gpio_output_disable(gpio_num); - break; - case GPIO_DIR_INPUT_AND_OUTPUT: - gpio_input_enable(gpio_num); - gpio_output_enable(gpio_num); - break; - case GPIO_DIR_DISABLE_IO: - gpio_input_disable(gpio_num); - gpio_output_disable(gpio_num); - break; - default: - GPIO_ERROR("Unknown direction type,gpio_num=%u,direction=%u\n",gpio_num,direction); - ret = ESP_ERR_INVALID_ARG; - break; - } - xSemaphoreGiveRecursive(gpio_mutex); - return ret; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + if(gpio_num >= 34 && (mode & (GPIO_MODE_DEF_OUTPUT))) { + GPIO_ERROR("io_num=%d can only be input\n",gpio_num); + return ESP_ERR_INVALID_ARG; } + esp_err_t ret = ESP_OK; + if(mode & GPIO_MODE_DEF_INPUT) { + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); + } else { + PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]); + } + if(mode & GPIO_MODE_DEF_OUTPUT) { + if(gpio_num < 32) { + GPIO.enable_w1ts = (0x1 << gpio_num); + } else { + GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); + } + } else { + if(gpio_num < 32) { + GPIO.enable_w1tc = (0x1 << gpio_num); + } else { + GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); + } + } + if(mode & GPIO_MODE_DEF_OD) { + GPIO.pin[gpio_num].pad_driver = 1; + } else { + GPIO.pin[gpio_num].pad_driver = 0; + } + return ret; } esp_err_t gpio_config(gpio_config_t *pGPIOConfig) { - if(gpio_mutex == NULL) { - gpio_mutex = xSemaphoreCreateRecursiveMutex(); - if(gpio_mutex == NULL) { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } - } uint64_t gpio_pin_mask = (pGPIOConfig->pin_bit_mask); uint32_t io_reg = 0; - uint8_t io_num = 0; + uint32_t io_num = 0; uint64_t bit_valid = 0; - if(pGPIOConfig->pin_bit_mask == 0) { - GPIO_ERROR("GPIO_PIN = 0 \n"); + if(pGPIOConfig->pin_bit_mask == 0 || pGPIOConfig->pin_bit_mask >= (((uint64_t) 1) << GPIO_PIN_COUNT)) { + GPIO_ERROR("GPIO_PIN mask error \n"); return ESP_ERR_INVALID_ARG; } - if((pGPIOConfig->mode) & (BIT1)) { + if((pGPIOConfig->mode) & (GPIO_MODE_DEF_OUTPUT)) { //GPIO 34/35/36/37/38/39 can only be used as input mode; if((gpio_pin_mask & ( GPIO_SEL_34 | GPIO_SEL_35 | GPIO_SEL_36 | GPIO_SEL_37 | GPIO_SEL_38 | GPIO_SEL_39))) { GPIO_ERROR("GPIO34-39 can only be used as input mode\n"); return ESP_ERR_INVALID_ARG; } } - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); do { io_reg = GPIO_PIN_MUX_REG[io_num]; if(((gpio_pin_mask >> io_num) & BIT(0)) && io_reg) { GPIO_INFO("Gpio%02d |Mode:",io_num); - if((pGPIOConfig->mode) & GPIO_MODE_INPUT) { + if((pGPIOConfig->mode) & GPIO_MODE_DEF_INPUT) { GPIO_INFO("INPUT "); - gpio_input_enable(io_num); + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[io_num]); } else { - gpio_input_disable(io_num); + PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[io_num]); } - if((pGPIOConfig->mode) & BIT2) { + if((pGPIOConfig->mode) & GPIO_MODE_DEF_OD) { GPIO_INFO("OD "); GPIO.pin[io_num].pad_driver = 1; /*0x01 Open-drain */ } else { GPIO.pin[io_num].pad_driver = 0; /*0x00 Normal gpio output */ } - if((pGPIOConfig->mode) & GPIO_MODE_OUTPUT) { + if((pGPIOConfig->mode) & GPIO_MODE_DEF_OUTPUT) { GPIO_INFO("OUTPUT "); gpio_output_enable(io_num); } else { gpio_output_disable(io_num); - } - GPIO_INFO("|"); + }GPIO_INFO("|"); if(pGPIOConfig->pull_up_en) { GPIO_INFO("PU "); PIN_PULLUP_EN(io_reg); @@ -401,57 +317,40 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) } io_num++; } while(io_num < GPIO_PIN_COUNT); - xSemaphoreGiveRecursive(gpio_mutex); return ESP_OK; } -esp_err_t gpio_intr_handler_register(uint8_t gpio_intr_num, void (*fn)(void*), void * arg) +esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) { - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - ESP_INTR_DISABLE(gpio_intr_num); - intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); - xt_set_interrupt_handler(gpio_intr_num, fn, arg); - ESP_INTR_ENABLE(gpio_intr_num); - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } + if(fn == NULL) + return ESP_ERR_INVALID_ARG; + ESP_INTR_DISABLE(gpio_intr_num); + intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); + xt_set_interrupt_handler(gpio_intr_num, fn, arg); + ESP_INTR_ENABLE(gpio_intr_num); + return ESP_OK; } /*only level interrupt can be used for wake-up function*/ esp_err_t gpio_pin_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) { - if(gpio_mutex != NULL) { - esp_err_t ret = ESP_OK; - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - if((intr_type == GPIO_PIN_INTR_LOW_LEVEL) || (intr_type == GPIO_PIN_INTR_HIGH_LEVEL)) { - GPIO.pin[gpio_num].int_type = intr_type; - GPIO.pin[gpio_num].wakeup_enable = 0x1; - } else { - GPIO_ERROR("GPIO wakeup only support Level mode,but edge mode set. gpio_num:%u\n",gpio_num); - ret = ESP_ERR_INVALID_ARG; - } - xSemaphoreGiveRecursive(gpio_mutex); - return ret; + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + esp_err_t ret = ESP_OK; + if((intr_type == GPIO_PIN_INTR_LOW_LEVEL) || (intr_type == GPIO_PIN_INTR_HIGH_LEVEL)) { + GPIO.pin[gpio_num].int_type = intr_type; + GPIO.pin[gpio_num].wakeup_enable = 0x1; } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; + GPIO_ERROR("GPIO wakeup only support Level mode,but edge mode set. gpio_num:%u\n",gpio_num); + ret = ESP_ERR_INVALID_ARG; } + return ret; } esp_err_t gpio_pin_wakeup_disable(gpio_num_t gpio_num) { - if(gpio_mutex != NULL) { - xSemaphoreTakeRecursive(gpio_mutex, portMAX_DELAY); - GPIO.pin[gpio_num].wakeup_enable = 0; - xSemaphoreGiveRecursive(gpio_mutex); - return ESP_OK; - } else { - GPIO_ERROR("Mutex null\n"); - return ESP_FAIL; - } - + if(!is_valid_gpio(gpio_num)) + return ESP_ERR_INVALID_ARG; + GPIO.pin[gpio_num].wakeup_enable = 0; + return ESP_OK; } diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index 9bc62adc8d..de04a4209d 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -26,8 +26,6 @@ extern "C" { #endif -extern const uint32_t GPIO_PIN_MUX_REG[40]; - #define GPIO_SEL_0 (BIT(0)) /* Pin 0 selected */ #define GPIO_SEL_1 (BIT(1)) /* Pin 1 selected */ #define GPIO_SEL_2 (BIT(2)) /* Pin 2 selected */ @@ -115,6 +113,12 @@ extern const uint32_t GPIO_PIN_MUX_REG[40]; #define GPIO_ID_PIN(n) (GPIO_ID_PIN0 + (n)) #define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i * 4) +#define GPIO_MODE_DEF_INPUT (BIT0) +#define GPIO_MODE_DEF_OUTPUT (BIT1) +#define GPIO_MODE_DEF_OD (BIT2) + +extern const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT]; + typedef enum { GPIO_NUM_0 = 0, GPIO_NUM_1 = 1, @@ -166,11 +170,11 @@ typedef enum { } gpio_int_type_t; typedef enum { - GPIO_MODE_INPUT = (BIT0), /* GPIO mode : input only */ - GPIO_MODE_OUTPUT = (BIT1), /* GPIO mode : output only mode */ - GPIO_MODE_OUTPUT_OD = ((BIT1)|(BIT2)), /* GPIO mode : output only with open-drain mode */ - GPIO_MODE_INPUT_OUTPUT_OD = ((BIT0)|(BIT1)|(BIT2)), /* GPIO mode : output and input with open-drain mode*/ - GPIO_MODE_INPUT_OUTPUT = ((BIT0)|(BIT1)), /* GPIO mode : output and input mode */ + GPIO_MODE_INPUT = GPIO_MODE_DEF_INPUT, /* GPIO mode : input only */ + GPIO_MODE_OUTPUT = GPIO_MODE_DEF_OUTPUT, /* GPIO mode : output only mode */ + GPIO_MODE_OUTPUT_OD = ((GPIO_MODE_DEF_OUTPUT)|(GPIO_MODE_DEF_OD)), /* GPIO mode : output only with open-drain mode */ + GPIO_MODE_INPUT_OUTPUT_OD = ((GPIO_MODE_DEF_INPUT)|(GPIO_MODE_DEF_OUTPUT)|(GPIO_MODE_DEF_OD)), /* GPIO mode : output and input with open-drain mode*/ + GPIO_MODE_INPUT_OUTPUT = ((GPIO_MODE_DEF_INPUT)|(GPIO_MODE_DEF_OUTPUT)), /* GPIO mode : output and input mode */ } gpio_mode_t; typedef enum { @@ -191,13 +195,6 @@ typedef struct { gpio_int_type_t intr_type; /* GPIO interrupt type */ } gpio_config_t; -typedef enum { - GPIO_DIR_OUTPUT_ONLY, /* GPIO output */ - GPIO_DIR_INPUT_ONLY, /* GPIO input */ - GPIO_DIR_INPUT_AND_OUTPUT, /* GPIO input + output */ - GPIO_DIR_DISABLE_IO, /* GPIO disable */ -} gpio_direction_t; - typedef enum { GPIO_LOW_LEVEL = 0, GPIO_HIGH_LEVEL = 1, @@ -242,21 +239,59 @@ typedef void (*gpio_event_callback)(gpio_num_t gpio_intr_num); * pGPIOConfig.pull_down_en : Enable or Disable pull-down * pGPIOConfig.intr_type : Configure GPIO interrupt trigger type * @return ESP_OK: success ; - * ESP_ERR_INVALID_ARG: parameters error - * ESP_FAIL : GPIO mutex error + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL : GPIO error * */ esp_err_t gpio_config(gpio_config_t *pGPIOConfig); + +/** + * @brief GPIO set interrupt trigger type + * + * @parameter[in] gpio_num : GPIO number. + * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] intr_type: interrupt type, select from gpio_int_type_t + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG: parameter error + * + */ +esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type); + +/** + * @brief enable GPIO module interrupt signal + * + * @parameter[in] gpio_num : GPIO number. + * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG: parameter error + * + */ +esp_err_t gpio_intr_enable(gpio_num_t gpio_num); + +/** + * @brief disable GPIO module interrupt signal + * + * @parameter[in] gpio_num : GPIO number. + * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG: parameter error + * + */ +esp_err_t gpio_intr_disable(gpio_num_t gpio_num); + /** * @brief GPIO set output level * * @parameter[in] gpio_num : GPIO number. - * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * If you want to set output level of GPIO16, gpio_num should be GPIO_NUM_16 (16); * @parameter[in] level : Output level. 0: low ; 1: high * * @return ESP_OK : success - * ESP_FAIL : GPIO mutex error + * ESP_FAIL : GPIO error * */ esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level); @@ -265,7 +300,7 @@ esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level); * @brief GPIO get input level * * @parameter[in] gpio_num : GPIO number. - * If you want to get level of pin GPIO16, gpio_num should be GPIO_NUM_16 (16); + * If you want to get level of pin GPIO16, gpio_num should be GPIO_NUM_16 (16); * * @return 0 : the GPIO input level is 0 * 1 : the GPIO input level is 1 @@ -278,29 +313,29 @@ int gpio_get_level(gpio_num_t gpio_num); * * Configure GPIO direction,such as output_only,input_only,output_and_input * - * @parameter[in] gpio_num : Configure GPIO pins number,it should GPIO number. - * If you want to set direction of GPIO16, gpio_num should be GPIO_NUM_16 (16); - * @parameter[in] direction: Configure GPIO direction,such as output_only,input_only,... + * @parameter[in] gpio_num : Configure GPIO pins number,it should be GPIO number. + * If you want to set direction of GPIO16, gpio_num should be GPIO_NUM_16 (16); + * @parameter[in] mode : Configure GPIO direction,such as output_only,input_only,... * * @return ESP_OK : success * ESP_ERR_INVALID_ARG : fail - * ESP_FAIL : GPIO mutex error + * ESP_FAIL : GPIO error * */ -esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_direction_t direction); +esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode); /** * @brief GPIO set pull * * User this Function,configure GPIO pull mode,such as pull-up,pull-down * - * @parameter[in] gpio_num : Configure GPIO pins number,it should GPIO number. + * @parameter[in] gpio_num : Configure GPIO pins number,it should be GPIO number. * If you want to set pull up or down mode for GPIO16,gpio_num should be GPIO_NUM_16 (16); * @parameter[in] pull : Configure GPIO pull up/down mode,such as pullup_only,pulldown_only,pullup_and_pulldown,... * * @return ESP_OK : success * ESP_ERR_INVALID_ARG : fail - * ESP_FAIL : GPIO mutex error + * ESP_FAIL : GPIO error * */ esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); @@ -313,7 +348,7 @@ esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); * Second , enable the GPIO input,if you use pin_func_as_gpio,you can use gpio_set_direction function * Third , call gpio_matrix_in function * - * @parameter[in] GPIO : Configure GPIO pins number,it should GPIO number. + * @parameter[in] GPIO : Configure GPIO pins number,it should be GPIO number. * If you want to configure GPIO16, gpio_num should be GPIO_NUM_16 (16); * @parameter[in] signal_idx : the signal_idx,find the signal index from gpio_sig_map.h * @@ -351,19 +386,30 @@ void gpio_matrix_out(uint32_t GPIO, uint32_t signal_idx, bool out_inv, bool oen_ * Users should know that which CPU is running and then pick a INUM that is not used by system. * We can find the information of INUM and interrupt level in soc.h. * TODO: to move INUM options to menu_config - * @parameter uint8_t gpio_intr_num : GPIO interrupt number,check the info in soc.h, and please see the core-isa.h for more details + * @parameter uint32_t gpio_intr_num : GPIO interrupt number,check the info in soc.h, and please see the core-isa.h for more details * @parameter void (* fn)(void* ) : interrupt handler function. * Note that the handler function MUST be defined with attribution of "IRAM_ATTR". * @parameter void * arg : parameter for handler function * * @return ESP_OK : success ; - * ESP_FAIL: gpio_mutex error + * ESP_FAIL: gpio_ error */ -esp_err_t gpio_intr_handler_register(uint8_t gpio_intr_num, void (*fn)(void*), void * arg); +esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg); +/** + * *************** ATTENTION ********************/ +/** + * + * Each GPIO have their separated registers, so we don't have to use + * lock for multi-task issues. + * Please make sure that there would be no such situation, in which, + * different tasks read-then-write the same GPIO register. + */ + + /*----------EXAMPLE TO CONIFGURE GPIO AS OUTPUT ------------ */ /* gpio_config_t io_conf; * io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt @@ -425,8 +471,6 @@ esp_err_t gpio_intr_handler_register(uint8_t gpio_intr_num, void (*fn)(void*), v * */ - - /** * @} */ From 4f93b49e0a08ad2885d0a758ef66ddfa27d2b832 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 21 Sep 2016 11:37:10 +0800 Subject: [PATCH 039/179] esp32/lib: update to 9403d944 --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 3372298fe2..9403d944b6 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 3372298fe2ff517858bdc8c64f76540b9ac7d7d5 +Subproject commit 9403d944b6cfe682025e2ed9eef7e5d0841c6592 From 92569082c6fb89b6fcc34c05804674a3e5119ee7 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Wed, 21 Sep 2016 12:08:42 +0800 Subject: [PATCH 040/179] Remove some macros and declarations that are already in rom/gpio.h --- components/driver/gpio.c | 13 ++- components/driver/include/driver/gpio.h | 106 +++++++++--------------- 2 files changed, 47 insertions(+), 72 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index 2cf1907170..a7db2bde2f 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. #include -#include "rom/ets_sys.h" #include "esp_err.h" #include "esp_intr.h" #include "freertos/FreeRTOS.h" #include "freertos/xtensa_api.h" -#include "soc/soc.h" #include "driver/gpio.h" +#include "soc/soc.h" //TODO: move debug options to menuconfig #define GPIO_DBG_ENABLE (0) @@ -105,7 +104,7 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; - if(intr_type >= GPIO_PIN_INTR_MAX) { + if(intr_type >= GPIO_INTR_MAX) { GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); return ESP_ERR_INVALID_ARG; } @@ -320,7 +319,7 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) return ESP_OK; } -esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) +esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) { if(fn == NULL) return ESP_ERR_INVALID_ARG; @@ -332,12 +331,12 @@ esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), } /*only level interrupt can be used for wake-up function*/ -esp_err_t gpio_pin_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) +esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; esp_err_t ret = ESP_OK; - if((intr_type == GPIO_PIN_INTR_LOW_LEVEL) || (intr_type == GPIO_PIN_INTR_HIGH_LEVEL)) { + if((intr_type == GPIO_INTR_LOW_LEVEL) || (intr_type == GPIO_INTR_HIGH_LEVEL)) { GPIO.pin[gpio_num].int_type = intr_type; GPIO.pin[gpio_num].wakeup_enable = 0x1; } else { @@ -347,7 +346,7 @@ esp_err_t gpio_pin_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) return ret; } -esp_err_t gpio_pin_wakeup_disable(gpio_num_t gpio_num) +esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) { if(!is_valid_gpio(gpio_num)) return ESP_ERR_INVALID_ARG; diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index de04a4209d..d0ed5c9d79 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -20,6 +20,7 @@ #include "soc/gpio_struct.h" #include "soc/rtc_io_reg.h" #include "soc/io_mux_reg.h" +#include "rom/gpio.h" #include "esp_attr.h" #ifdef __cplusplus @@ -108,15 +109,11 @@ extern "C" { #define GPIO_PRO_CPU_NMI_INTR_ENA (BIT(3)) #define GPIO_SDIO_EXT_INTR_ENA (BIT(4)) -#define GPIO_PIN_COUNT 40 -#define GPIO_ID_PIN0 0 -#define GPIO_ID_PIN(n) (GPIO_ID_PIN0 + (n)) -#define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i * 4) - #define GPIO_MODE_DEF_INPUT (BIT0) #define GPIO_MODE_DEF_OUTPUT (BIT1) #define GPIO_MODE_DEF_OD (BIT2) +#define GPIO_PIN_COUNT 40 extern const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT]; typedef enum { @@ -160,13 +157,13 @@ typedef enum { } gpio_num_t; typedef enum { - GPIO_PIN_INTR_DISABLE = 0, /* disable GPIO interrupt */ - GPIO_PIN_INTR_POSEDGE = 1, /* GPIO interrupt type : rising edge */ - GPIO_PIN_INTR_NEGEDGE = 2, /* GPIO interrupt type : falling edge */ - GPIO_PIN_INTR_ANYEDGE = 3, /* GPIO interrupt type : both rising and falling edge */ - GPIO_PIN_INTR_LOW_LEVEL = 4, /* GPIO interrupt type : input low level trigger */ - GPIO_PIN_INTR_HIGH_LEVEL = 5, /* GPIO interrupt type : input high level trigger */ - GPIO_PIN_INTR_MAX, + GPIO_INTR_DISABLE = 0, /* disable GPIO interrupt */ + GPIO_INTR_POSEDGE = 1, /* GPIO interrupt type : rising edge */ + GPIO_INTR_NEGEDGE = 2, /* GPIO interrupt type : falling edge */ + GPIO_INTR_ANYEDGE = 3, /* GPIO interrupt type : both rising and falling edge */ + GPIO_INTR_LOW_LEVEL = 4, /* GPIO interrupt type : input low level trigger */ + GPIO_INTR_HIGH_LEVEL = 5, /* GPIO interrupt type : input high level trigger */ + GPIO_INTR_MAX, } gpio_int_type_t; typedef enum { @@ -341,44 +338,26 @@ esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode); esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); /** - * @brief bind input signal to the GPIO - * - * bind input signal to the GPIO,when you want to bind the signal to the GPIO - * First , configure the pad as GPIO,use the gpio_config function or pin_func_as_gpio function - * Second , enable the GPIO input,if you use pin_func_as_gpio,you can use gpio_set_direction function - * Third , call gpio_matrix_in function - * - * @parameter[in] GPIO : Configure GPIO pins number,it should be GPIO number. - * If you want to configure GPIO16, gpio_num should be GPIO_NUM_16 (16); - * @parameter[in] signal_idx : the signal_idx,find the signal index from gpio_sig_map.h - * - * @parameter[in] inverse : the signal input inverse, default inverse=0 - * - * @return None - * - */ -void gpio_matrix_in(uint32_t GPIO, uint32_t signal_idx, bool inverse) ROMFN_ATTR; + * @brief enable GPIO wake-up function. + * + * @param gpio_num_t gpio_num : GPIO number. + * + * @param gpio_int_type_t intr_type : only GPIO_INTR_LOLEVEL\GPIO_INTR_HILEVEL can be used + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + */ +esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type); /** - * @brief bind output signal to the GPIO - * - * bind output signal to the GPIO,when you want to bind the signal to the GPIO - * First , configure the pad as GPIO,use the gpio_config function or pin_func_as_gpio function - * Second , enable the GPIO output,if you use pin_func_as_gpio,you can use gpio_set_direction function - * Third , call gpio_matrix_out function - * - * @parameter[in] GPIO : Configure GPIO pins number,it should GPIO number. - * If you want to configure GPIO16,gpio_num should be GPIO_NUM_16 (16); - * @parameter[in] signal_idx : the signal_idx,find the signal index from gpio_sig_map.h - * - * @parameter[in] out_inv : the signal output inverse, default out_inv=0 - * - * @parameter[in] oen_inv : the signal output enable inverse, default oen_inv=0 - * - * @return None - * - */ -void gpio_matrix_out(uint32_t GPIO, uint32_t signal_idx, bool out_inv, bool oen_inv) ROMFN_ATTR; + * @brief disable GPIO wake-up function. + * + * @param gpio_num_t gpio_num: GPIO number + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + */ +esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num); /** * @brief register GPIO interrupt handler, the handler is an ISR. @@ -392,27 +371,24 @@ void gpio_matrix_out(uint32_t GPIO, uint32_t signal_idx, bool out_inv, bool oen_ * @parameter void * arg : parameter for handler function * * @return ESP_OK : success ; - * ESP_FAIL: gpio_ error + * ESP_FAIL: gpio error */ -esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg); - - - +esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg); /** * *************** ATTENTION ********************/ /** * - * Each GPIO have their separated registers, so we don't have to use - * lock for multi-task issues. - * Please make sure that there would be no such situation, in which, - * different tasks read-then-write the same GPIO register. + * Each GPIO has its own separate configuration register, so we do not use + * a lock to serialize access to them. This works under the assumption that + * no situation will occur where two tasks try to configure the same GPIO + * pin simultaneously. It is up to the application developer to guarantee this. */ /*----------EXAMPLE TO CONIFGURE GPIO AS OUTPUT ------------ */ /* gpio_config_t io_conf; - * io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt + * io_conf.intr_type = GPIO_INTR_DISABLE; //disable interrupt * io_conf.mode = GPIO_MODE_OUTPUT; //set as output mode * io_conf.pin_bit_mask = GPIO_SEL_18 | GPIO_SEL_19; //bit mask of the pins that you want to set,e.g.GPIO18/19 * io_conf.pull_down_en = 0; //disable pull-down mode @@ -420,14 +396,14 @@ esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), * gpio_config(&io_conf); //configure GPIO with the given settings **/ /*----------EXAMPLE TO CONIFGURE GPIO AS OUTPUT ------------ */ -/* io_conf.intr_type = GPIO_PIN_INTR_POSEDGE; //set posedge interrupt +/* io_conf.intr_type = GPIO_INTR_POSEDGE; //set posedge interrupt * io_conf.mode = GPIO_MODE_INPUT; //set as input * io_conf.pin_bit_mask = GPIO_SEL_4 | GPIO_SEL_5; //bit mask of the pins that you want to set, e.g.,GPIO4/5 * io_conf.pull_down_en = 0; //disable pull-down mode * io_conf.pull_up_en = 1; //enable pull-up mode * gpio_config(&io_conf); //configure GPIO with the given settings *----------EXAMPLE TO SET ISR HANDLER ----------------------*/ -/* gpio_intr_handler_register(18,gpio_intr_test,NULL); //hook the isr handler for GPIO interrupt +/* gpio_isr_register(18,gpio_intr_test,NULL); //hook the isr handler for GPIO interrupt * //the first parameter is INUM, you can pick one form interrupt level 1/2 which is not used by the system. * //NOTE1:user should arrange the INUMs that used, better not to use a same INUM for different interrupt. * //NOTE2:do not pick the INUM that already occupied by the system. @@ -446,20 +422,20 @@ esp_err_t gpio_intr_handler_register(uint32_t gpio_intr_num, void (*fn)(void*), * do { * if(gpio_num < 32) { * if(gpio_intr_status & BIT(gpio_num)) { //gpio0-gpio31 - * ets_printf("Intr Gpio%d ,val: %d\n",gpio_num,gpio_get_level(gpio_num)); - * //This is a 'isr' handler, you should post an event to process it in RTOS queue. + * ets_printf("Intr GPIO%d ,val: %d\n",gpio_num,gpio_get_level(gpio_num)); + * //This is an isr handler, you should post an event to process it in RTOS queue. * } * } else { * if(gpio_intr_status_h & BIT(gpio_num - 32)) { - * ets_printf("Intr Gpio%d, val : %d\n",gpio_num,gpio_get_level(gpio_num)); - * //This is a 'isr' handler, you should post an event to process it in RTOS queue. + * ets_printf("Intr GPIO%d, val : %d\n",gpio_num,gpio_get_level(gpio_num)); + * //This is an isr handler, you should post an event to process it in RTOS queue. * } * } * } while(++gpio_num < GPIO_PIN_COUNT); *} *----EXAMPLE OF I2C CONFIG AND PICK SIGNAL FOR IO MATRIX---*/ /* gpio_config_t io_conf; - * io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt + * io_conf.intr_type = GPIO_INTR_DISABLE; //disable interrupt * io_conf.mode = GPIO_MODE_INPUT_OUTPUT_OD; //set as output mode * io_conf.pin_bit_mask = GPIO_SEL_21 | GPIO_SEL_22; //bit mask of the pins that you want to set,e.g.GPIO21/22 * io_conf.pull_down_en = 0; //disable pull-down mode From 835cc551384b47f9e5147236817f69804f9e3bf6 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 21 Sep 2016 16:15:42 +0800 Subject: [PATCH 041/179] esp32: wait uart tx finish before cpu freq change --- components/esp32/cpu_freq.c | 13 ++++++++++++- components/esp32/include/soc/cpu.h | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/esp32/cpu_freq.c b/components/esp32/cpu_freq.c index c4bca44f0e..327ea63867 100644 --- a/components/esp32/cpu_freq.c +++ b/components/esp32/cpu_freq.c @@ -14,6 +14,7 @@ #include #include "rom/ets_sys.h" +#include "rom/uart.h" #include "sdkconfig.h" typedef enum{ @@ -42,10 +43,15 @@ extern void rtc_set_cpu_freq(xtal_freq_t xtal_freq, cpu_freq_t cpu_freq); * components which want to be notified of CPU frequency * changes. */ -void esp_set_cpu_freq() +void esp_set_cpu_freq(void) { uint32_t freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; phy_get_romfunc_addr(); + + // freq will be changed to 40MHz in rtc_init_lite, + // wait uart tx finish, otherwise some uart output will be lost + uart_tx_wait_idle(0); + rtc_init_lite(); cpu_freq_t freq = CPU_80M; switch(freq_mhz) { @@ -62,6 +68,11 @@ void esp_set_cpu_freq() freq = CPU_80M; break; } + + // freq will be changed to freq in rtc_set_cpu_freq, + // wait uart tx finish, otherwise some uart output will be lost + uart_tx_wait_idle(0); + rtc_set_cpu_freq(XTAL_AUTO, freq); ets_update_cpu_frequency(freq_mhz); } diff --git a/components/esp32/include/soc/cpu.h b/components/esp32/include/soc/cpu.h index 9943a2783e..c74ba317c8 100644 --- a/components/esp32/include/soc/cpu.h +++ b/components/esp32/include/soc/cpu.h @@ -76,6 +76,6 @@ static inline void cpu_configure_region_protection() * This is a temporary function which will be replaced once dynamic * CPU frequency changing is implemented. */ -void esp_set_cpu_freq(); +void esp_set_cpu_freq(void); #endif From 134649141c683380ad0a96a39eef72a8d382fde3 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 21 Sep 2016 16:49:30 +0800 Subject: [PATCH 042/179] esp32/lib: update to 9f26b9a1 1. Fix reboot halt bug, TW7355 2. Fix system crash when calling system_deep_sleep(), TW7356 --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 9403d944b6..9f26b9a190 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 9403d944b6cfe682025e2ed9eef7e5d0841c6592 +Subproject commit 9f26b9a190e6a6ca42656685df9287253badfa46 From f06ebeba8644b8bc34a23c5036ac963d9e947dc8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 18:00:49 +0800 Subject: [PATCH 043/179] components/nvs: avoid reading just-erased page --- components/nvs_flash/include/nvs.h | 2 +- components/nvs_flash/src/nvs_page.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/nvs_flash/include/nvs.h b/components/nvs_flash/include/nvs.h index 6fff2dabf6..dbcd837e17 100644 --- a/components/nvs_flash/include/nvs.h +++ b/components/nvs_flash/include/nvs.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include "esp_err.h" #ifdef __cplusplus extern "C" { diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index cddb69393b..3478ded461 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -671,7 +671,12 @@ esp_err_t Page::erase() mState = PageState::INVALID; return rc; } - return load(sector); + mUsedEntryCount = 0; + mErasedEntryCount = 0; + mFirstUsedEntry = INVALID_ENTRY; + mNextFreeEntry = INVALID_ENTRY; + mState = PageState::UNINITIALIZED; + return ESP_OK; } esp_err_t Page::markFreeing() From 12a0786e2abca8c7129e7b751e234536fcdbf9c1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Sep 2016 22:40:12 +0800 Subject: [PATCH 044/179] components/nvs: maintain item hash list at page level --- components/nvs_flash/README.rst | 8 ++ .../nvs_flash/src/nvs_item_hash_list.cpp | 99 +++++++++++++++++++ .../nvs_flash/src/nvs_item_hash_list.hpp | 69 +++++++++++++ components/nvs_flash/src/nvs_page.cpp | 56 ++++++++--- components/nvs_flash/src/nvs_page.hpp | 2 + components/nvs_flash/src/nvs_types.cpp | 12 ++- components/nvs_flash/src/nvs_types.hpp | 20 +++- components/nvs_flash/test/Makefile | 1 + 8 files changed, 252 insertions(+), 15 deletions(-) create mode 100644 components/nvs_flash/src/nvs_item_hash_list.cpp create mode 100644 components/nvs_flash/src/nvs_item_hash_list.hpp diff --git a/components/nvs_flash/README.rst b/components/nvs_flash/README.rst index ee8ee0b262..2f1c469135 100644 --- a/components/nvs_flash/README.rst +++ b/components/nvs_flash/README.rst @@ -217,3 +217,11 @@ As mentioned above, each key-value pair belongs to one of the namespaces. Namesp +-------------------------------------------+ +Item hash list +~~~~~~~~~~~~~~ + +To reduce the number of reads performed from flash memory, each member of Page class maintains a list of pairs: (item index; item hash). This list makes searches much quicker. Instead of iterating over all entries, reading them from flash one at a time, ``Page::findItem`` first performs search for item hash in the hash list. This gives the item index within the page, if such an item exists. Due to a hash collision it is possible that a different item will be found. This is handled by falling back to iteration over items in flash. + +Each node in hash list contains a 24-bit hash and 8-bit item index. Hash is calculated based on item namespace and key name. CRC32 is used for calculation, result is truncated to 24 bits. To reduce overhead of storing 32-bit entries in a linked list, list is implemented as a doubly-linked list of arrays. Each array holds 29 entries, for the total size of 128 bytes, together with linked list pointers and 32-bit count field. Minimal amount of extra RAM useage per page is therefore 128 bytes, maximum is 640 bytes. + + diff --git a/components/nvs_flash/src/nvs_item_hash_list.cpp b/components/nvs_flash/src/nvs_item_hash_list.cpp new file mode 100644 index 0000000000..1d5a6ae06a --- /dev/null +++ b/components/nvs_flash/src/nvs_item_hash_list.cpp @@ -0,0 +1,99 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include "nvs_item_hash_list.hpp" + +namespace nvs +{ + +HashList::~HashList() +{ + for (auto it = mBlockList.begin(); it != mBlockList.end();) { + auto tmp = it; + ++it; + mBlockList.erase(tmp); + delete static_cast(tmp); + } +} + +HashList::HashListBlock::HashListBlock() +{ + static_assert(sizeof(HashListBlock) == HashListBlock::BYTE_SIZE, + "cache block size calculation incorrect"); +} + +void HashList::insert(const Item& item, size_t index) +{ + const uint32_t hash_24 = item.calculateCrc32WithoutValue() & 0xffffff; + // add entry to the end of last block if possible + if (mBlockList.size()) { + auto& block = mBlockList.back(); + if (block.mCount < HashListBlock::ENTRY_COUNT) { + block.mNodes[block.mCount++] = HashListNode(hash_24, index); + return; + } + } + // if the above failed, create a new block and add entry to it + HashListBlock* newBlock = new HashListBlock; + mBlockList.push_back(newBlock); + newBlock->mNodes[0] = HashListNode(hash_24, index); + newBlock->mCount++; +} + +void HashList::erase(size_t index) +{ + for (auto it = std::begin(mBlockList); it != std::end(mBlockList);) + { + bool haveEntries = false; + for (size_t i = 0; i < it->mCount; ++i) { + if (it->mNodes[i].mIndex == index) { + it->mNodes[i].mIndex = 0xff; + return; + } + if (it->mNodes[i].mIndex != 0xff) { + haveEntries = true; + } + } + if (!haveEntries) { + auto tmp = it; + ++it; + mBlockList.erase(tmp); + delete static_cast(tmp); + } + else { + ++it; + } + } + assert(false && "item should have been present in cache"); +} + +size_t HashList::find(size_t start, const Item& item) +{ + const uint32_t hash_24 = item.calculateCrc32WithoutValue() & 0xffffff; + for (auto it = std::begin(mBlockList); it != std::end(mBlockList); ++it) + { + for (size_t index = 0; index < it->mCount; ++index) { + HashListNode& e = it->mNodes[index]; + if (e.mIndex >= start && + e.mHash == hash_24 && + e.mIndex != 0xff) { + return e.mIndex; + } + } + } + return SIZE_MAX; +} + + +} // namespace nvs diff --git a/components/nvs_flash/src/nvs_item_hash_list.hpp b/components/nvs_flash/src/nvs_item_hash_list.hpp new file mode 100644 index 0000000000..0139c1bbd6 --- /dev/null +++ b/components/nvs_flash/src/nvs_item_hash_list.hpp @@ -0,0 +1,69 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 nvs_item_hash_list_h +#define nvs_item_hash_list_h + +#include "nvs.h" +#include "nvs_types.hpp" +#include "intrusive_list.h" + +namespace nvs +{ + +class HashList +{ +public: + ~HashList(); + void insert(const Item& item, size_t index); + void erase(const size_t index); + size_t find(size_t start, const Item& item); + +protected: + + struct HashListNode { + HashListNode() : + mIndex(0xff), mHash(0) + { + } + + HashListNode(uint32_t hash, size_t index) : + mIndex((uint32_t) index), mHash(hash) + { + } + + uint32_t mIndex : 8; + uint32_t mHash : 24; + }; + + struct HashListBlock : public intrusive_list_node + { + HashListBlock(); + + static const size_t BYTE_SIZE = 128; + static const size_t ENTRY_COUNT = (BYTE_SIZE - sizeof(intrusive_list_node) - sizeof(size_t)) / 4; + + size_t mCount = 0; + HashListNode mNodes[ENTRY_COUNT]; + }; + + + typedef intrusive_list TBlockList; + TBlockList mBlockList; +}; // class HashList + +} // namespace nvs + + +#endif /* nvs_item_hash_list_h */ diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index 3478ded461..ae067078c6 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -148,17 +148,10 @@ esp_err_t Page::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, c // write first item - item.nsIndex = nsIndex; - item.datatype = datatype; - item.span = (totalSize + ENTRY_SIZE - 1) / ENTRY_SIZE; - item.reserved = 0xff; - - std::fill_n(reinterpret_cast(item.key), sizeof(item.key) / 4, 0xffffffff); - std::fill_n(reinterpret_cast(item.data), sizeof(item.data) / 4, 0xffffffff); - - strncpy(item.key, key, sizeof(item.key) - 1); - item.key[sizeof(item.key) - 1] = 0; - + size_t span = (totalSize + ENTRY_SIZE - 1) / ENTRY_SIZE; + item = Item(nsIndex, datatype, span, key); + mHashList.insert(item, mNextFreeEntry); + if (datatype != ItemType::SZ && datatype != ItemType::BLOB) { memcpy(item.data, data, dataSize); item.crc32 = item.calculateCrc32(); @@ -277,7 +270,8 @@ esp_err_t Page::eraseEntryAndSpan(size_t index) { auto state = mEntryTable.get(index); assert(state == EntryState::WRITTEN || state == EntryState::EMPTY); - + mHashList.erase(index); + size_t span = 1; if (state == EntryState::WRITTEN) { Item item; @@ -360,6 +354,7 @@ esp_err_t Page::moveItem(Page& other) if (err != ESP_OK) { return err; } + other.mHashList.insert(entry, other.mNextFreeEntry); err = other.writeEntry(entry); if (err != ESP_OK) { return err; @@ -479,6 +474,8 @@ esp_err_t Page::mLoadEntryTable() } continue; } + + mHashList.insert(item, i); if (item.datatype != ItemType::BLOB && item.datatype != ItemType::SZ) { continue; @@ -514,6 +511,28 @@ esp_err_t Page::mLoadEntryTable() } } } + else if (mState == PageState::FULL || mState == PageState::FREEING) { + // We have already filled mHashList for page in active state. + // Do the same for the case when page is in full or freeing state. + Item item; + for (size_t i = mFirstUsedEntry; i < ENTRY_COUNT; ++i) { + if (mEntryTable.get(i) != EntryState::WRITTEN) { + continue; + } + + auto err = readEntry(i, item); + if (err != ESP_OK) { + mState = PageState::INVALID; + return err; + } + + mHashList.insert(item, i); + + size_t span = item.span; + i += span - 1; + } + + } return ESP_OK; } @@ -598,7 +617,17 @@ esp_err_t Page::findItem(uint8_t nsIndex, ItemType datatype, const char* key, si if (end > ENTRY_COUNT) { end = ENTRY_COUNT; } - + + if (nsIndex != NS_ANY && datatype != ItemType::ANY && key != NULL) { + size_t cachedIndex = mHashList.find(start, Item(nsIndex, datatype, 0, key)); + if (cachedIndex < ENTRY_COUNT) { + start = cachedIndex; + } + else { + return ESP_ERR_NVS_NOT_FOUND; + } + } + size_t next; for (size_t i = start; i < end; i = next) { next = i + 1; @@ -676,6 +705,7 @@ esp_err_t Page::erase() mFirstUsedEntry = INVALID_ENTRY; mNextFreeEntry = INVALID_ENTRY; mState = PageState::UNINITIALIZED; + mHashList = HashList(); return ESP_OK; } diff --git a/components/nvs_flash/src/nvs_page.hpp b/components/nvs_flash/src/nvs_page.hpp index 9afc6ff216..9598263539 100644 --- a/components/nvs_flash/src/nvs_page.hpp +++ b/components/nvs_flash/src/nvs_page.hpp @@ -23,6 +23,7 @@ #include "esp_spi_flash.h" #include "compressed_enum_table.hpp" #include "intrusive_list.h" +#include "nvs_item_hash_list.hpp" namespace nvs { @@ -229,6 +230,7 @@ protected: uint16_t mErasedEntryCount = 0; CachedFindInfo mFindInfo; + HashList mHashList; static const uint32_t HEADER_OFFSET = 0; static const uint32_t ENTRY_TABLE_OFFSET = HEADER_OFFSET + 32; diff --git a/components/nvs_flash/src/nvs_types.cpp b/components/nvs_flash/src/nvs_types.cpp index 9884b276b8..d44d8b29f9 100644 --- a/components/nvs_flash/src/nvs_types.cpp +++ b/components/nvs_flash/src/nvs_types.cpp @@ -21,7 +21,7 @@ namespace nvs { -uint32_t Item::calculateCrc32() +uint32_t Item::calculateCrc32() const { uint32_t result = 0xffffffff; const uint8_t* p = reinterpret_cast(this); @@ -32,6 +32,16 @@ uint32_t Item::calculateCrc32() return result; } +uint32_t Item::calculateCrc32WithoutValue() const +{ + uint32_t result = 0xffffffff; + const uint8_t* p = reinterpret_cast(this); + result = crc32_le(result, p + offsetof(Item, nsIndex), + offsetof(Item, datatype) - offsetof(Item, nsIndex)); + result = crc32_le(result, p + offsetof(Item, key), sizeof(key)); + return result; +} + uint32_t Item::calculateCrc32(const uint8_t* data, size_t size) { uint32_t result = 0xffffffff; diff --git a/components/nvs_flash/src/nvs_types.hpp b/components/nvs_flash/src/nvs_types.hpp index cc1f86940f..23b4ba7f74 100644 --- a/components/nvs_flash/src/nvs_types.hpp +++ b/components/nvs_flash/src/nvs_types.hpp @@ -76,8 +76,26 @@ public: }; static const size_t MAX_KEY_LENGTH = sizeof(key) - 1; + + Item(uint8_t nsIndex, ItemType datatype, uint8_t span, const char* key_) + : nsIndex(nsIndex), datatype(datatype), span(span), reserved(0xff) + { + std::fill_n(reinterpret_cast(key), sizeof(key) / 4, 0xffffffff); + std::fill_n(reinterpret_cast(data), sizeof(data) / 4, 0xffffffff); + if (key_) { + strncpy(key, key_, sizeof(key) - 1); + key[sizeof(key) - 1] = 0; + } else { + key[0] = 0; + } + } + + Item() + { + } - uint32_t calculateCrc32(); + uint32_t calculateCrc32() const; + uint32_t calculateCrc32WithoutValue() const; static uint32_t calculateCrc32(const uint8_t* data, size_t size); void getKey(char* dst, size_t dstSize) diff --git a/components/nvs_flash/test/Makefile b/components/nvs_flash/test/Makefile index d14dbaa3c9..6006213961 100644 --- a/components/nvs_flash/test/Makefile +++ b/components/nvs_flash/test/Makefile @@ -8,6 +8,7 @@ SOURCE_FILES = \ nvs_page.cpp \ nvs_pagemanager.cpp \ nvs_storage.cpp \ + nvs_item_hash_list.cpp \ ) \ spi_flash_emulation.cpp \ test_compressed_enum_table.cpp \ From d2420b667c0074dc2183bd0c572cafaea42e6410 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Thu, 22 Sep 2016 09:05:39 +0800 Subject: [PATCH 045/179] use uint8_t for fifo struct in uart and i2c --- components/esp32/include/soc/i2c_struct.h | 4 ++-- components/esp32/include/soc/uart_struct.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp32/include/soc/i2c_struct.h b/components/esp32/include/soc/i2c_struct.h index d6917e7fdc..8111b2cba0 100644 --- a/components/esp32/include/soc/i2c_struct.h +++ b/components/esp32/include/soc/i2c_struct.h @@ -97,8 +97,8 @@ typedef volatile struct { }fifo_conf; union { struct { - uint32_t data: 8; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ - uint32_t reserved8: 24; + uint8_t data; /*The register represent the byte data read from rx_fifo when use apb fifo access*/ + uint8_t reserved[3]; }; uint32_t val; }fifo_data; diff --git a/components/esp32/include/soc/uart_struct.h b/components/esp32/include/soc/uart_struct.h index 54baf4f0e5..78331e7035 100644 --- a/components/esp32/include/soc/uart_struct.h +++ b/components/esp32/include/soc/uart_struct.h @@ -16,8 +16,8 @@ typedef volatile struct { union { struct { - uint32_t rw_byte: 8; /*This register stores one byte data read by rx fifo.*/ - uint32_t reserved8: 24; + uint8_t rw_byte; /*This register stores one byte data read by rx fifo.*/ + uint8_t reserved[3]; }; uint32_t val; }fifo; From ba75f837b84a9d6aaf0a668cf01a42240be2c42b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Sep 2016 16:40:05 +0800 Subject: [PATCH 046/179] components/spi_flash: add performance counters --- components/spi_flash/esp_spi_flash.c | 53 +++++++++++++++++++- components/spi_flash/include/esp_spi_flash.h | 5 ++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/components/spi_flash/esp_spi_flash.c b/components/spi_flash/esp_spi_flash.c index 191dd758a3..28623df1b5 100644 --- a/components/spi_flash/esp_spi_flash.c +++ b/components/spi_flash/esp_spi_flash.c @@ -14,6 +14,9 @@ #include #include +#include +#include + #include #include #include @@ -71,6 +74,20 @@ static bool s_flash_op_can_start = false; static bool s_flash_op_complete = false; #endif //CONFIG_FREERTOS_UNICORE +typedef struct { + uint32_t count; + uint32_t time; +} counter_t; + +typedef struct { + counter_t read; + counter_t write; + counter_t erase; + counter_t read_inner; + counter_t write_inner; +} spi_flash_counters_t; + +static spi_flash_counters_t s_flash_stats; #ifndef CONFIG_FREERTOS_UNICORE @@ -177,6 +194,9 @@ static void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu() #endif // CONFIG_FREERTOS_UNICORE +#define COUNTER_START() uint32_t ts_begin = xthal_get_ccount() +#define COUNTER_STOP(counter) do{ (counter)->count++; (counter)->time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); } while(0) + SpiFlashOpResult IRAM_ATTR spi_flash_unlock() { @@ -193,6 +213,7 @@ SpiFlashOpResult IRAM_ATTR spi_flash_unlock() esp_err_t IRAM_ATTR spi_flash_erase_sector(uint16_t sec) { + COUNTER_START(); spi_flash_disable_interrupts_caches_and_other_cpu(); SpiFlashOpResult rc; rc = spi_flash_unlock(); @@ -200,27 +221,38 @@ esp_err_t IRAM_ATTR spi_flash_erase_sector(uint16_t sec) rc = SPIEraseSector(sec); } spi_flash_enable_interrupts_caches_and_other_cpu(); + COUNTER_STOP(&s_flash_stats.erase); return spi_flash_translate_rc(rc); } esp_err_t IRAM_ATTR spi_flash_write(uint32_t dest_addr, const uint32_t *src, uint32_t size) { + COUNTER_START(); spi_flash_disable_interrupts_caches_and_other_cpu(); SpiFlashOpResult rc; rc = spi_flash_unlock(); if (rc == SPI_FLASH_RESULT_OK) { + COUNTER_START(); rc = SPIWrite(dest_addr, src, (int32_t) size); + COUNTER_STOP(&s_flash_stats.write_inner); } spi_flash_enable_interrupts_caches_and_other_cpu(); + COUNTER_STOP(&s_flash_stats.write); return spi_flash_translate_rc(rc); } esp_err_t IRAM_ATTR spi_flash_read(uint32_t src_addr, uint32_t *dest, uint32_t size) { + COUNTER_START(); spi_flash_disable_interrupts_caches_and_other_cpu(); SpiFlashOpResult rc; - rc = SPIRead(src_addr, dest, (int32_t) size); + { + COUNTER_START(); + rc = SPIRead(src_addr, dest, (int32_t) size); + COUNTER_STOP(&s_flash_stats.read_inner); + } spi_flash_enable_interrupts_caches_and_other_cpu(); + COUNTER_STOP(&s_flash_stats.read); return spi_flash_translate_rc(rc); } @@ -270,3 +302,22 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL1_REG, cache_mask, saved_state, 0); } } + +static void dump_counter(counter_t* counter, const char* name) +{ + printf("%s count=%8d\ttime=%8dms\n", name, counter->count, counter->time/1000); +} + +void spi_flash_reset_stats() +{ + memset(&s_flash_stats, 0, sizeof(s_flash_stats)); +} + +void spi_flash_dump_stats() +{ + dump_counter(&s_flash_stats.read, "read "); + dump_counter(&s_flash_stats.write, "write "); + dump_counter(&s_flash_stats.read_inner, "read_inner "); + dump_counter(&s_flash_stats.write_inner, "write_inner"); + dump_counter(&s_flash_stats.erase, "erase "); +} diff --git a/components/spi_flash/include/esp_spi_flash.h b/components/spi_flash/include/esp_spi_flash.h index da6b03c0d1..7169555d30 100644 --- a/components/spi_flash/include/esp_spi_flash.h +++ b/components/spi_flash/include/esp_spi_flash.h @@ -69,6 +69,11 @@ esp_err_t spi_flash_write(uint32_t des_addr, const uint32_t *src_addr, uint32_t esp_err_t spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size); +void spi_flash_reset_stats(); + +void spi_flash_dump_stats(); + + #ifdef __cplusplus } #endif From 67e8b3bcaf272b1b4afba412eecdc6d380ddd2a8 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Thu, 22 Sep 2016 11:49:37 +0800 Subject: [PATCH 047/179] tcpip_adapter: set sta ip to IP_ADDR_ANY when sta disconnect from ap When sta is disconnected from AP, set sta ip to IP_ADDR_ANY to trigger lwip to clean up all TCP/UDP pcbs. --- components/tcpip_adapter/tcpip_adapter_lwip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index 0f681d9135..78fecf2cbf 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -161,6 +161,9 @@ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if) ip4_addr_set_zero(&esp_ip[tcpip_if].netmask); } + /* Modify ip address to trigger tcp/udp pcb cleanup */ + netif_set_addr(esp_netif[tcpip_if], IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); + netif_set_down(esp_netif[tcpip_if]); } From 28be72dbc73044babfbe35c6bd21f68a83f2543a Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Thu, 22 Sep 2016 16:30:34 +0800 Subject: [PATCH 048/179] esp32/lib: update to f6d55836 1. Fix reboot halt bug when 240MHz, TW7355 2. Disable long rate code --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 9f26b9a190..f6d558367a 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 9f26b9a190e6a6ca42656685df9287253badfa46 +Subproject commit f6d558367a08b6c9b18c2de515bd0a6740d2c45c From 993287af6132924f952d2368d45fec2882e79a8b Mon Sep 17 00:00:00 2001 From: snake Date: Thu, 22 Sep 2016 16:40:31 +0800 Subject: [PATCH 049/179] add btdm_controller 1st --- components/bt/bt.c | 117 +++++++++++++++++++++++++++++ components/bt/component.mk | 25 ++++++ components/bt/include/bt.h | 30 ++++++++ components/bt/lib/libbtdm_app.a | Bin 0 -> 61822 bytes components/esp32/cpu_start.c | 8 +- components/esp32/include/soc/soc.h | 6 +- components/esp32/lib | 2 +- 7 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 components/bt/bt.c create mode 100644 components/bt/component.mk create mode 100644 components/bt/include/bt.h create mode 100644 components/bt/lib/libbtdm_app.a diff --git a/components/bt/bt.c b/components/bt/bt.c new file mode 100644 index 0000000000..4b623ca20f --- /dev/null +++ b/components/bt/bt.c @@ -0,0 +1,117 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/xtensa_api.h" +#include "freertos/portmacro.h" +#include "esp_types.h" +#include "esp_system.h" +#include "esp_intr.h" +#include "esp_attr.h" +#include "bt.h" + +#if CONFIG_BT_ENABLED + +static bt_app_startup_cb_t app_startup_cb; +static void *app_startup_ctx; + +#define BT_DEBUG(...) +#define BT_API_CALL_CHECK(info, api_call, ret) \ +do{\ + esp_err_t __err = (api_call);\ + if ((ret) != __err) {\ + BT_DEBUG("%s %d %s ret=%d\n", __FUNCTION__, __LINE__, (info), __err);\ + return __err;\ + }\ +} while(0) + +extern void btdm_controller_init(void); +extern void API_osi_funcs_register(void *osi_funcs); + +struct osi_funcs_t { + xt_handler (*_set_isr)(int n, xt_handler f, void *arg); + void (*_ints_on)(unsigned int mask); + void (*_interrupt_disable)(void); + void (*_interrupt_restore)(void); + void (*_task_yield)(void); + void *(*_semphr_create)(uint32_t max, uint32_t init); + void *(*_semphr_give_from_isr)(void *semphr, void *hptw); + void *(*_semphr_take)(void *semphr, uint32_t block_time); + esp_err_t (* _read_efuse_mac)(uint8_t mac[6]); +}; + +static portMUX_TYPE global_int_mux = portMUX_INITIALIZER_UNLOCKED; + +static inline void IRAM_ATTR interrupt_disable(void) +{ + portENTER_CRITICAL(&global_int_mux); +} + +static inline void IRAM_ATTR interrupt_restore(void) +{ + portEXIT_CRITICAL(&global_int_mux); +} + +static inline void *IRAM_ATTR semphr_take_wrapped(void *semphr, uint32_t block_time) +{ + return (void *)xSemaphoreTake(semphr, block_time); +} + +static struct osi_funcs_t osi_funcs = { + ._set_isr = xt_set_interrupt_handler, + ._ints_on = xt_ints_on, + ._interrupt_disable = interrupt_disable, + ._interrupt_restore = interrupt_restore, + ._task_yield = vPortYield, + ._semphr_create = xQueueCreateCountingSemaphore, + ._semphr_give_from_isr = (void *)xQueueGiveFromISR, + ._semphr_take = semphr_take_wrapped, + ._read_efuse_mac = system_efuse_read_mac, +}; + +static void bt_controller_task(void *pvParam) +{ + API_osi_funcs_register(&osi_funcs); + btdm_controller_init(); +} + + +static void bt_init_task(void *pvParameters) +{ + xTaskCreatePinnedToCore(bt_controller_task, "btControllerTask", BT_CONTROLLER_TASK_STACK_SIZE, NULL, BT_CONTROLLER_TASK_PRIO, NULL, 0); + + if (app_startup_cb) + app_startup_cb(app_startup_ctx); + + vTaskDelete(NULL); +} + + +esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx) +{ + app_startup_cb = cb; + app_startup_ctx = ctx; + + xTaskCreatePinnedToCore(bt_init_task, "btInitTask", BT_INIT_TASK_STACK_SIZE, NULL, BT_INIT_TASK_PRIO, NULL, 0); + + return ESP_OK; +} +#endif diff --git a/components/bt/component.mk b/components/bt/component.mk new file mode 100644 index 0000000000..110d022672 --- /dev/null +++ b/components/bt/component.mk @@ -0,0 +1,25 @@ +# +# Component Makefile +# + +#COMPONENT_ADD_INCLUDEDIRS := + +CURRENT_DIR=$(IDF_PATH)/components/bt + +COMPONENT_ADD_INCLUDEDIRS := ./include + +CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses + +LIBS := btdm_app + +COMPONENT_ADD_LDFLAGS := -lbt -L$(abspath lib) \ + $(addprefix -l,$(LIBS)) \ + $(LINKER_SCRIPTS) + + +ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) +$(COMPONENT_LIBRARY): $(ALL_LIB_FILES) + +COMPONENT_SRCDIRS := ./ + +include $(IDF_PATH)/make/component_common.mk diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h new file mode 100644 index 0000000000..04bb466c45 --- /dev/null +++ b/components/bt/include/bt.h @@ -0,0 +1,30 @@ +#ifndef __BT_H__ +#define __BT_H__ + +#include "freertos/FreeRTOS.h" +#include "esp_err.h" + +#define BT_TASK_PRIO_MAX (configMAX_PRIORITIES) +#define BT_TASK_PRIO_MIN (0) + +/* bt init */ +#define BT_INIT_TASK_PRIO (BT_TASK_PRIO_MAX-1) +#define BT_INIT_TASK_STACK_SIZE (2048) +/* controller */ +#define BT_CONTROLLER_TASK_PRIO (BT_TASK_PRIO_MAX-3) +#define BT_CONTROLLER_TASK_STACK_SIZE (4096) + +typedef void (* bt_app_startup_cb_t)(void *param); + +esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx); + +typedef struct vhci_host_callback { + void (*notify_host_send_available)(void); + int (*notify_host_recv)(uint8_t *data, uint16_t len); +} vhci_host_callback_t; + +extern bool API_vhci_host_check_send_available(void); +extern void API_vhci_host_send_packet(uint8_t *data, uint16_t len); +extern void API_vhci_host_register_callback(const vhci_host_callback_t *callback); + +#endif /* __BT_H__ */ diff --git a/components/bt/lib/libbtdm_app.a b/components/bt/lib/libbtdm_app.a new file mode 100644 index 0000000000000000000000000000000000000000..4c93a93b0fcdbb1548a7bf6b00c616a3a645a944 GIT binary patch literal 61822 zcmY$iNi0gvu;bEKKm~>-<|d}briO-w3JL~bDP&SX!O+au0xYbMz{SA8;LE_kwu*XK zn~8zJM2UgHauRMF)W^U8!twVQ7(h6+kAWfc6az!G%SB1QQi1yGUHqN03|!-~q| za}zW3AbOJX^Gb^Hb8=FPAliz`GYdej%dL!0%Fi!hNX<-(Pb|n}D2fNmfVkG5f$dCA34HxZcwE@7N5$VtJjB{x1JITM#u zX-Ou!tJ8DxlM-{{GxJK~i%SxVN*IdbQH1gfP(@NQixZP_KyiemtSGg(B)cXjtHYtjx_%Da}bOhWZ2~ zQjn8|jR#7_X&}Rrph>YPz6i|ENrgoRgb&W(&=4<5Gm1|wE+|SZF3yCR3dwXu@x_(J z$$2H9AjvFYC`-#pEY66}O$B9l2peopQ9P8BlA2eNnO4aF6G$yeECvMxL>iW!Av|zG zF9XF-acW))1DI8mnp_59K{8KT8Zr-5YJinNEd{eNvQbeySR9lqKqU{DlaXIs0?8Qh zAj{$t%Mvqlz%hra1T0yQn4Fzj0*)$#W>{3kCnx6QBqb(iGl1$Ta51Bo53a0WHI#t` zY7J#*U|?oqqM%@D1R_CoR03DMtB)HaBO?P0Ffzn3Ab1Q6YZMq57?>FtOuz~>7{nNa z8O$6Rc$j2AfJHz=Km$WUNCQKHM*~9wh!4YNjtqg{|MT!fu&!keQcZQ(qHy4j!UI-@ ziJ$*BEx*7cbwGh(B`0@BEN7U-|Hk+KYhE5uVDRKYa!e#g<8Kh{$4J;f$@db)EkU78qPXrsW zg2TYz%Y<116DEVy&*W(Q{-4Ja90wC-K}05g23ZC6(hLqBB?V28uqFq{U`9qz+EDxl zjR7-923^L+zyB394k##m0Vx25JOe{?R8*9$jg1Y6XXeOY`0IZMbBDwO4h9Qmi_Z_3 z84SPw=aIBv=Hbv}HvIbE%E+LzxuK!t%nQTM|E-i1I-AdUG=2odJ;Fo=h8YYDAiEV7 zl+3A8(-Kwu{r}+a{~Am@+!{%j7Ttcp1WvJvU%)OyPTwFmfUsk5uxn6AylYU9hH9~< zjzVUhf@-lsVu?adW?rg-Y6^o>h>Nd6kiV}&m}^k5r@x#$2ACM3P_(>1s8*AF+)g3X0bwMu>!bEQYgv?wOF{2@^&&@ zMNwidT>b#V2m3P&AMAOAm=nw#87BVuU-RRD0z)U~#9yFj>f~(v3CUP1I3~;jrHGl} zm|{=_d721pL4+D)C1!~XjbA{K)A$)g?&Vte^nc?g5EBw-ijV(maw$IguPFs0v>M-n zq!b_gU&++?8qB=^eOpQ-La!~Tte_gH)j*gB!D^^rJ;9&S; z)loEwgH?OxBo9^)i(wH5>m(1>MIH>3I2adkuuSq`S>(YuiGyho2lFHk=0zS%Zp;h} z3@eIwxOs9KFMzzY+(-CJxp^94wbOm>+R4ed1u$WNbVIl7^77AHanhQdtS{ z_ka6OpFVwpup#7vHq;bm=E$(|)BlAZ{x|*t8Rz)nKM%JC3y+jW&;uq0!?*tzB{M8q z01Y-(1_s5~{{vtC&t>jlGJN@8lQovb@#TN>8LXWwY>W&HJj|9XJj^^&mQ0N=L53+l z{%^r#arpr=g9Ve3vLKWe1LdN-|2HlF)4|N+)uiF~fP9PAkwEEpUZKG^^N{{MeH zR8JF>CYCaD1QquOAOGL9fI;ER0fj{hjUT{a@bG`rYEWvQ!NkMW&1Ij`W!$5^wCsX5XkPHvk!PEaQ zp8mg=%ZJa#zVSLp%!lvbiT@W*{O95N%eR-S@iIuP@!0=~$3Rvi@*JoXW@=jh4&s!i zByfbE1S{VAUvba>9UN38*ytI6V&|ueiN2g$apU@E3cpuLY*C0oqU|Rz&M<-8P11<&z4yZnmBS89VKnak6 zf#Con1A_nq1A_z;Bzje#v;`9bg9rlyLk|-J*iMk!L3V=*kq8C`h8#vvGGJh6U}9j% z0ZBqJiw1V^3mq_=~S zfx!&w&V5K~U||AMbAge8!5ykb9ApX999VdP)W|SF{05Q+g&)YNAa{b;pezGYqrn6T zXOJ3D*uvC+*r4zSsquh@J;*6OObiU5S{0RgBt%Z4!A1-N*D+MW_V_Wh%ti;4G0@VGBa>8 z@PZidtji7MK`3ShbUw0cKwS@L+(48wFvCrQ2rx77K^RbynSme5f>6v1f(%j+CfKDy z49pB#P(FwPWg}3Q0kJ{JS&)GhG-L zU;t%xJE(nc86d?iD60uEa55lAAjti~NI?qXtDx}>(fFXO2Xhigy$zbY7b7IAg4_YJ zF9uCM7meSE#$SoXhZUnBJ3;o{K$Cxm#^*sw5+L=$XnZv^zB#mrgoGbEgDn#S1E`2N z4-P+026r^|aZHF}0OUVd@c?sQ4HE+ctOx+fgNjs;90-HlGat>om1z8}Xna@^3)6oI zP5ueg{UEbJ=@Vo(sOVM$yPuiiH&i{$e>|Y}EyyrvdJ;q9E1>ap(fBBxj-tfe_~MeH z_>$D(5(e~f*`j##@gOWCwWtF`&|zHAxNT}laeP5hW?l(sC=x18)(~!dQgJb2m@E}M zWJdmIE@FTsBeS5)JiZ{Kk|C)iJ}C)2ZWW)LTaZ)1P!yku7#1roO3X`PfDrMBLA3(N zurJEMFnFA_2s|7OHV&!;GAs>J2_2RO4N=47GII;^i%LMlX9XFR;IX#&0u*_OOHc)o zBL-Cl79a5i@$lj7B8UU>3raHc^B}H+Sdp8W3sM9fpFAM*w|7Bt#go|%>j zN++rD`FS~@piIe)M;{6Y#~^6%4LtIlQkn}J6L(Hb&Pa_9N=;0OcYzLZ1_yYC=7DDc zAd+r5rNtQxxw)l~08Iw#0QaKfL4qLXLllBdam@pdwt)uMi5Y7LkGmlT13|-br~`pu z1@JLKhAB)842;k!asr4g1j&e?GJ??>!nOg4gW4Vp3=E*A93xZ>sOiTj2~l$Z)a-zY zuK=+HA>yEBEF-8OfHq-adcjR(sJ)zxLJ`QDr+y$x+KGBCV>vQIEFF#LnE&oDAD$b-5mOpxx2E|d)ldw(b!6ekH#HYl#Lp=<{x28IeK z+l7gNVKI~qisxleHYol<&1aC`L2(`k^&_Z@0_wgnf&!L-fuRj54iW>gxuN27q2i$N zEKt1;G6&Q}DTBHn)I}+S+68LjgSt{6H6S*qD*&o08yFcJnxJYxVjwoCl?4)?2Nego zaRCw=RCh3f8Wf-=Iw-x_L(&^4eK3L&3$!j_bcBfS0i|JRdfNeFgAy781H%>&8!Fxc zVnfq2$eoO!Haw`A4{DNw5*w(i2x3FiIjGIVs1Gq86yJ={JW>HtqX!W$0kM@KY*6zb zme)XIGca}x$o)_?pl&BDkATuSBd9+F?JhDx2f=(m>Y?rd#S&h1+^C$%O85E~S(AZtKuP!KHy#V;GA3k1poAaRg+TcP40 zdv-zDAp4I(*&ugafU-gEy$WT6y1lodY>@vRLfIgHg9fEQ=7Yk+1eAW*7#LhZT~jC< z6lTkz>;gsxhE-5DC|ox~*`V+~2xWuf0i4&^7#Ki#5S-W87#Kitbr-4zlpmi!*`W9Y z=Rr0GhA*Im2}*Bl3=BPt3=C3G_5?--hEOPb3L^tU0hA5up1p^%LFwodlnqKpEX)iH zAb)|?KSL46RW13MK}I zDNyzrCI*J-Q1%8U28M%BHYn{MfwDnq|00wP${(PvEhBW8Y%(-nKw=;^H&h%{#xjB$ zatsU%GoflgVjwm*R2(!^0xLH_|BnD!0L&d>$0UHAYsC&-@O*0^N3rH`hU(dk6U=I}siGkSMQ1K3s8fcjr z2UPOY0;;DNbs=Gr0#ySN1F^ZG;-FyzSlF(GssV|C*f4YEfXW<0h&iXAYCvKj zHaAop)V~t}73K^K49}rzK*J3SKzcz100RTVFQ_<348-P!iYGzSHYm-PgV?eVyQ)BJ z0|*;5{J;qH`#+F48v_GK48(?o$q`U_3ms=MgQi1}7>Lac6+Zz|0~)_#U|_I;ssV|C z*xXR@Gaxlk^)65~ATbadX3hnW8gq!-e4uJTVjwm*RQw7^4XA)*U|>jtssV|C*xXR@ z8z4275Ob=aYCvKjHaArK4w9Nas2Y$Mhz(Qo0HnqWV$N=;8ju)>%?%X?^`l^MeHy9; zBnD!`;`#;19B8__4pjpZ1F>Oh?t;Xj@dC0DR{n$8(7qU`tY?I>K~)Qk4Qfll*q~|# z#s+0S7#n0Xj13AV7#mbKFhc7WP<;SngX#bn8&vMY*vRey*W*z4AiDvSWMSqb+Y73b zVB%oApn5@d3``tUf56zF@(9KTl@~BJDBr@^pm7iw8#D$2V}sg@FgB_13qI6!$2s#gSwt$@VVL1J4Vv0aeZ0Z44nm)sZkZsLq42LFEgK4H}1lu{VIsf%e7sAhAL1S6G~00f|G?zyl;UsGfzX`GF+P z0!q(N^#Vw2(D)NfJ!qI2#x_Ax18VQW#6jatFgB>1g0WMO)Pw47m^f&R1jYu{(=axu zK8CSD^)8GJs$XGjP@M{6gUT;PP-X%pW+E}DSOqmVpx%bAT|j6CwaGv{Q1g-)b)b3_ zT^;h64a_`H)dymO@+rvt0AU6OkY7N>2`E}Ya-e(&Dvm(rfy6-SzJSVe5Ce)q>Of3T z5e#C(%;OMaU;yP&ka?gcHb@R+9!MS(L@@I>m?2XOATvN1qz**8g7O3d1A`HW18V0p zGcbVqTTm`|m>lG;NT@nk_#I$oV0ZvC96A;W(gP|BKxTvN2k|Y$7#KL%AyYu0A#{)& z$bDH*^I%3SV24cOfb@VcNF9hyg_;dB&p{S4t_kulsQ&^|2Qse=Y91&oK>C)jGcZ8A zB_J-`AE0?g*i;fo;wd|%-3?-cFvzbUdLq<35F3PLIT%nDvcS}V+72K$z})8}3mFFm zxewI#2g!llHxJFcS`G#VP~8YJ8-!uzf!cT=Juvg`$U@YC%ma1bL2@ATKx|mpf%N-w zL#9bUY!HT-2cn_H97veq3pWFU0t*9!C<6m{R2*a;s4fD<4YGM60t^h+NCF^pKn5TW z`hb=e5n5MdWMpmzT2-W=KzLnI4=8aVtt;Y(PZ)x1CJuwvt$rkRjtm?)hvLQCJ6b4JLi5HyDaN_il6LohP~sPuxcK_oLc$AVZ8%*+5v91u2$ zBs|B&1)h$Eg_IBj69csS57G{n1NEiB9OyVk6pRDqm!t7PQ^GJIP@Vy`QIPqEU>vCa zn`r#6Xna9XR6@l-=4qhuLG28vG}yhc^{LHe1PxJfL&ZU>Dj)_1hJ2_RkQj)~4HXAKiW`n{JCXTCL15!^6 zCbm5Y8U_JnUsx#xS{n;1nL+k|(g=tKg$0NWtKS!}Fff4H_@HC~Dj`8~AoqiYJVEBc zs$k^#V30W=IS>tM4}#JbA$73!C8#_E=>wUEt$pN-wA2Qq4m4f}>TiPBAPloN6qKew z0#K~Qh}yn{sRQ*xL4JbyH-HV&egpXzB9zl9w=Ebl< z)Pc+cEz<$Xfy@IXYgm|o%t&HnV8{kBpcv*p5Df}3Ce;n^FY}My?x}s z%)k&2(hSuIW2WY2f|^B;CXa%G0=#`>iGAI*p|P7Anl{y z_6(pwG{{=lgMa@o{QaMYyYbH;Xu*Ku0UA6Euoes`&Oyt7Kr|?>K;Z^b2P!^5@cJCtNgY<#eAdR3nfYo>6&@vVz24chNJCHh9S&GaCxdkSUtBeJeH83?Gy~JQj%3E04 z0oeocD~LufZ$aY}pm8ivc>#(=kUEfG(97FkkY*$dOAqMfEiQHFC-r-5)&xYKtKC zM}-*#7*rU(+N&@$fSPg)42K}D2$}H3K4HQadxkAXSVS1U+A}zOwbya@YMVa3;%%k)=n($Vroj=PnOV zl#F!aGf*`kqa`EF!_)W##CE*;-)IqNS4;;B5060ycquc>T^<=L8STcqAO$j2GTJ;m zkj2f8r~WTI3vx*Z%fxg44J<&aEmvBHWv?0!#!yHo&OC?K#R1&+h9Dnc#NUSxr~;8Tx-c? zxbeT!LXZki=FXr_Cd2jr73YF%v4re8g2c;zd(eJ|fBzv{U}i$LH8999e6^PWg}cL7 zP`E3IfY{)8{BN%TW;cNJDSrLm!L&l-0T;u@&;S2|wi|VD^Ds3ul&H^eyZGThkLCdd zh7R889G1uU85kadcl^BIYwy!Kpuq5g`@w_KJO3WO1i9!1-}FBHHWmhuyES;HH`ypY z0|{&L@i2ApcUU~&V37TA@DX$+`U{?RzD;gF|0~}A|L`_M8E9V+w}L`RSkRxgcOW4R zp7y3)JVM9b{|7C12Bn_{Xu4tnrzuc+1Njl;FOdI#{BQjBex>8{14mwG4aEH9?%;26`T#LKq^*pE(H5-2KR&srD2{R%`>>#Io}}f ztpRmEK=lM@TosgzL45^=5C8xF|Ig0=3RCD(6wtnaJ3@({{xAIeKZ9-Kr~esYhZYt+ zU}Lx=ocQ+t!uKG-w_w3ykf2H8i~kE>|4&k5*!bdqk{auwg(VNz7!qIn=i&AYbA0}v z=ZwP=g`hMx$UcVy3Jeitnr(`Y{u>xpZw3NGN(!Uoz##in@Y zzk)KzZ<=ffU!eN|R6hRa2QQU$0Qo}&nqENuGjn9PBb4~@|H4loCw~MxxeMfE;lwxp z7rp}tz5xq%KVV}BGhs}8{(s>skmz%WKYBp^cn)%?C!6E5|2*7lS$NJwiXl9rrfKG& zENJ-Pzk#U$bVryP$mwbbr>iO6`k#0k&0{xEJ(g6OR!~x;plGY$7wY2!*{Z9T%ut+J zl?oCxV1Vrq1o6O13>Y{ZzS;{w{0j0acq|wcHlTf2KSANC!7LWU*7zO7)Z}PS(rWzr ze+I`2iJqH0+&eioWiUSAWMBgg-!y*szwqP#4vvi<{&z$iT6pFG2ZMXkZpBysJAzgu z_3Yr`-Wjwr=>Z2r+spr;T^kFZ{nudH`1HR<(4mD-9xyQ+d;FhafCt?`Q)Qs37*J9G zb<05AQqb}OP&XIU^aeF)KvVmWCO88FsObX^Gte+KNHGHg19)mo144tEW}r#}WUe1{ zz-}1>1H*ghD)XrzNzkx6bhSFjUQqKGG#w1m3u>Z(+ySx!w7MO{23Z4A16mRbYPNvX zu!E*tK<0oj69agt3$&^QbTk0S3Xr)v&}CjA^`I#oQ1uN`V+UQ`4r0TWy@J$(*q~}1 zq#o340=t2MfdRw@RmC9ng&;|goeT^NAU3F(0TQo+i9=V+gTfEwW>E9N6B-ULnIOZ^ zAoZXrYq0qs&oM(+)oU;?fR=24nk*nc7%)S^8)UQxGeU1HGXn#tC<2*N!i?DU0g5M> znIJYO?m%w%!VIpD!ClH9NM;H^hs8nWsInl;v|(XjNQB1MT##d+{soy0!Ym-iffz_> z0F*93c7bS6Hx%S%P}3GPgaI-iwi5&t&YwOpk+BAJs>t{83xE`kQ&gi2WZp- zB;E~eo`J+c(+?oCLE?Q-H-N4GAQ6yyP;Uvs29cQi50GsKsRsoiNF@X_gE#y@*dP*fKLV)5 z3zC6g(0&6@zY4;Gtp5k~J3yJQGgLoFA1JXeg{}|Z1RWOy&6^2< zdfSkObTR|@oQTxCGKM11`dqYq{a{6qCAH}VnfdX#i6upu74i9{B@D>?Ow?l~Ks)1M z3yh273m}zJJbZmDF-J~7JF^h`VLSC9JkVBp28KJ#3=E9W%y|QeeFemZCXWk9>@!I0 z6G&`OLBR;hjiB%Wi9^j4L1GJl*ibV;>*`_i(x5q37#p-64aNpl956FM1vrciig%cs zL75gd9t>JT0qUcJtOkv(g4m$wOhf9UgVt7o#6c;s87dAk57d_eiGzkylS7qor>qy|*Efhs!?8???BqzA+Xjq`ay)q~au zgV!4}F))DCgDNC!>plne3vW2oi z>COwv2BkG$C>xYE!Rs7B6+dXa5-JW-lLTdh(sBlr4KfE*fr8usO7GQBaS3JyhRIMi zXg%e8C>ykAWI2?r!py+19m>{VW?=XWWrOk)0}EswHz=R6LfN4FCj@1K)QCdapgbxC zWrNgcK-nNQ+E6wqPa8nlAT^*08suhBzITC&gUW+=C>yj+p$N);!py)>3uV7xW?*Q5 zvfnT>Fie25KQJ>efYu^`%mkI2;Ptso3=AMPxN!%{XbcPt>!A4vBnD!`=378(abaui z!RvOJ7#KieAU15i1ytU{=54@hb(tUy7Z4j}4rna}%$(;?yFg+fHq0E*8d{J$LFo`Q z)&^sP*7d;H($KU7QlkoGgVMMmlnrXQ1wq-M`~+Lu4$3#Mb>$%TN2nT5!|f*$+ZY;;#%paPZwvgK0*+GGGNuLZF|QlL5; z#0IGam0ut>sDTD*uz}bh^FZ+mVuS1f&AEZtAp7G%@x>0A6DfqUK@C7qLk^?{q!+X% z4#WoO12HLD;tNIhuI8pH-Q^gzqqL2Qs4KxHn74RQ;J4`PGVgX;)(1_qEl zpmG+JCO|aE4=^^!J{TKRH^A7Sav#P9mHRL@sGeYih7ZUrm^jD}FgCI|pgIO74%Q1Q zyP)HXFmX_xfw4hp8pa0IeK0nt%>!eD!V1P7T|Wql1<0CtSeSt7P8b_w{U9{_L3Jcd z4X8eYu|f45j168t2vrYWKL}-m*AId+1*nt5#J~Vc51?`e#s;q+gr*Zv{RN$$4S4+^lnpA6U}{p3%m=R@gsK6rAB3_&^(ag|Bs2(dS!K0P;6T?tu^k1ITY6_kr96k^|A8@)f2B zq|Tj<0lY^K#0FuQ9H?Cl(gQQkL>QtDWFBa~0wf1A55$MX1xWvG4h9C$`auvIgkk1^ zXlQl<2{YtyGBAMpe4xG~%sf!pj6T=Q!_C0353B=1fXo50K&R~?O??oYYc@7EfuBN2 z=!`EJ(C84_+y}@`7zWi-p!x>ne^B^<1}k84AR2To%a{KhOdS$;G#WpHhJQOaHh%u! zq``V%ZjxOlR8VjzbAbuevw@xOzEhiB0OR#{pJ^-uX=>jWRw2%R+My8ub1~RG9!L;!PM2!^qL>nG0@EKZ& zpNfXvolQo6*gq$Kx%i9z-QXisrwUP*C$eja=*7n~xJ89-8? zUACEdC819q1|hM*7Fff_f^^ASLUbRhFU zZ5EI@p!N!g2AKmZH$elhFn5B~gVH-pJ!tP1Og+e6kaZySF#mwmgYpKb?g6Qr3LX3e znLiz*800q4;4idn1*r%1JwRItLFz$$29PpP`AYeq9_WA($nYQJln}I0K1v7mpaYX2 z_ku7v<9Z-{FbrDb3Gz26en9PVCI)u!@hqV5hw(uJ;GpmYwUa^eFufoebj}EfhGEP# zrJxXo$%4iKL4_VNAG+udD#VPo9vL+5hdz!68svv62d~)#^#hRkpmd4M2i0w$bPPJ; z1~hKh4wHnA+kw&uEIkN;PAh?Came|q@tMU%@#RH{1qG=o3}7M9Nt!5PpiS+ls*nyT zz}T-}gmP2?=$KpBk(;1nJwbLuM*lMNN{V2kf1u6uV7o!5=z>P$Kx0X;{ZHV20d)8l zRA<1%LG>IXsG@`ALns>*-!O4dIRNXgfr16LJ`oh>p#C684BQWbo`nHw7lFhu|a+UZG{7|L1hi7 z{|;h<@;s;vVg#)f03BxqwF@K$>c7C&GlI$sm>STYCy-u{7>Es111gqaYCwCQKx#l@ zAT~@5$ZfE31MnUcP~!n=FKny;RQABa4KyAH3pY?$!PJ1tGnhG`@PerUhdHQ00}5PF zeg*{;sLciP7c?G0TMG2Z@8+0$NiIVuRcW zIui%P28B~6)O?ViKx5Y+agbj@wY4C-c3 zT*AabaRXx`>jk9)m^one(Bc8)N0>Os9WXY?KQJ~%e->&lxGfB2gZv4z7u=tPii7*J zP&Oz%z|?^9J&X-nYYt zy+6ecG8|+86vMcnas!lZKzcz^xYU8xW`p#={0j;*Sp5vr2eKDLgUTKd8$^TnJ3#xN z7$N;VP=5y`2XY@MkATdBwKG7=iEKd{pco_v!r(N7)Svp#NL+sk)Yk^(d8l#V2~Q9k zROf)q1+hW6f(f*m6vTpHm>hb4>I?_uC^=9#gWM1E2YP=BG%p3(QwcE*a?~1#jozQ) z;ACI`sRNk@>;Hhv1@U2V0n)dHnYjLx2MYrOXzebjNCXvIAoqc2P}PEL-VRpi8Hymo zL1i42&Q3+{O(Ct_HOIAf*OKV9WT0_#(6~FOYy^ciXzecgnaQBNOMm}Q{QJLyV^W6o z0Iq}pWd;z2h6{Z0E-3MW%0v(ik^?n#LFzyl)Nlm_HVA{%fC^c#8W1sX3wdE_8RQDg z_9)1qAQ=c|22E5zm|&6?dy-&f2Pgv*9<-(dSdK?mAL0HQ${B+rnYss~!ui*|rM z=Hx7NV+-2G9&n455!$Q;M-#M33!35twJ$(opoIk>HYo3b90IG;kl7$Pm^i6*Bgh2_W-87}Q<@r2~-JAPj2DU@NadZB~$akQxv^ z3+gk17*Gt81GPy(euDWIbcO@Se<1&Y+zpZg@zK}*g3gTrwO^pd!Rrb1wZEYGNsu~_ zd7vZ(GY`GImL+oSFKBKUbbbw}?1z~LO84mHHE3)Yv~UyMeV}U^z!yb8i*4B2Ujs87 z<+Xv439)-E6hH|CY5a?affKZraR3WtnD1dDBA|vF$dMo#BnOINd?N(#1wW9kKhax1 zu^tZ!Pa`0k374y|90O7f>Su#e4ulONG5h5(KY?UH>R~w@#%G70_z6-8E+-L*0lqO3 zE(AUw4|XjI#0*$j2FedGHgdTJQAL;}w#)*RMWB2N^9iWT0=XS#11v;9ZCj8!Scrl4 z6~fejXpkI;29;x=7$>9-RAzznfYgKZfy~2J7J-iWLN1Fy=bBeY*2Vyrh+WkHtH^RyXPrEGpI}fwF&55R)EI&AihHMTXT}*L0iw^1qQsGfvaC=UJ15@g&f-5u@eC;4L>mbr&ctAlev^#DFL^z}e{3rZs(3@;d)XK{TlE4$2#_aSr6M3y?fW4n%|83JMEC>d?nS zK<0rk$P5q$nFqq?1s%u~bmH z1Eo#c>6e@dJB{ukjo9!A_II44 z03YxTYi1zkUT~HdqjR>yrMv)*fq~LEQab~Z7!Z>$IbZ>dR>o-m1Qc!{3~H}~F#0$s zwablx9M8ZyXPX1LGyqm`z{fLit_vG2H-<~O0ctCN(mqPL0lGl~c~AqAJTOWQSQ`Um z28=!0-T;Lr1P`Zj1N%5Ati%AV5k=ZNWPzi9Vs1+GI4J0hD&%oc=-#1*1P0j;W{wOE zNuX0xL1#!iGBp1C&%@Ng(WJqIbXEaqU(vt+9URcJhe7Mu8y+!>&Gi-Od^%6E`nm^~mh zp#9dM^KC(DKzsjS=78qoK=X$nanODPklmpDr=Y_+!D>Lnz-?uM_k}^uAiQoC6e1v% z5KPOxOrUTA%}0X{g$1!e7{rHO=?ZoLD2_nu!eH?Ok_YXThs6bm4?61*6bGR88;H-4 zlLMa4PS43tO3aDR%qxj6E=epZVJM165y}VcO$VKM0U2%v@sQ+GpjX7BXevrAF3B%S zWhja-PXir8!vIPjuzP(#ZiTTy`?Emv5FjzoJ|Perq}B#0uO04P}G(7DL(Ky~R*AcyBS3 z4c=P}WrN&F3?_DNAKU&cSRMk|15248zk}GYJpwJvko~2gbpRlzf#g8p1`2mjTNIQx zLHa@aS3xukgXBPL(A+*K{0XT;-=76C58GTG`u;4?SpeA90HE*B`T{+>0punShPe;4 zcLL-mn14ZcD1zDuApe5g4Uz--7kz&g=zw9+{%??3APh4PeSa3{{6mmBka?i-ewcaa zYYNs7xjzfM#*mSLfzbXe(D{(yOayWq(tg_fVjOqj;HndiO^9C01iF70y-oyKZ|2C* zW7PQfzb5GH|AD-|4;1(y2Z1nb%N9rsQ~`l#Py~SzIVf;JG^nBh6*3_8pu|Abv_KK) zKo=7CbLC`~FzA6b;#zbKOJ5+T42F6JH2wz)G7uJIUYV%fD8hqVNm=qFo4gQ29^0BVURmOY*3Ve z_^@&qnGJFiOdOQAVQf%Y2V*0b^B}#%U`onfSh51y0}3|~4RQ~N4J(U4XX}B)KxGFg zIfCRsenBsLLFZtC^usVLt)Q2^Aa&qm3{?m+55z<-dqL`mDSKOqyccILk$Yo7XB2?^ z2l6k-ognvt_~>QtQRumqAh&}s%)jVmFX*mfP@N4j50rFZ=AoCpj6{~bIgAVp#O#d) z-HU^MW(3Hc@bk8z-4fV12CjQ?jEsrj8*2i}2x#j_L3Yv=4`kU6@+fkd4rb%&7(hyB zaG6WtQZWL309fh-IS{mO7L=1AY!FHKd;{3dIFM?Pe#AaoPa^0~3QA#3(QcDuOp(r!5nCtYBr1m<%8Ng zFd>ls?Jy2h9+ZD!LLm8zFb-7yF&ZD#c7q9l)c=EVpz1+qq{D&+ zLF0qYOh;B9j3%Fe#?MCMgU(h*)(_f4kIaW%C;}1#*$+Bf9mED<5Fd1wI*1LzAU^2K z84w$UL3{>8!2vpU0_m(U%p)hzj|YQmMem^D>a&s7ODl>`EG|whDv3`mDq?_h3KEMF za}nI~#3Imj11Y7s1@Yj#RurF}3hp;1XUCToC#Hk?d<8j)C29FZxzLqKpu@}Ja}zT` z8jH#^3*td%rlqHX`kAS@nUDj|isH*Ml2O@dnR%JT8Sy1WiFw6osYS&MFg3*>=ONBY z0~wzLI~%Pi9<(AG%i`>!_~Odqvl%a00OkWWds#8(6eS4L5&{<1_n@Dff2ev6Wk{T9Yn?eIa{3(y4VQR$6|zD1PJac zgB%FDv<4Iopo6Fw7#Kk3Wix`>+YFF9-5EiL2Qn})fP#w=+Mgh`NBKv^1A(t^$bK-LA41MxxDf!HwPLFzzfqk-f=7*xiB zXpomcY*;()3@ZZzXe~IX4FW3tL2@8>g5m(w&ViY?1eyjwW`HnA9f$^&%4nb@X2AKh(L1*Q`*dRXWY!GOagShbe3^YCfas$jCGVGAc zen9>J*#nXT`2&;$VSWG^V9LnA0P25(*dPqE3q*tb4-y069!3TR&{@);tN;oJka?iA z4q7XZY~CMc28Qz>%^*#nxQ5b2Y4NGW1x2aF#hGcKCKbFrWq^Hr*UZ9<==Jd`pa4N? zPYE*cfyQWgKsVc&IYI_^LF1KXjtmM4B@_StS7>%rP*Bm*RAORK(72#<=zxMk3G^&m zGe?Gl|NirE@OZ~?o?5ZVi$S_$`i!r#A6VpmgYLLfP$*Gons8u-;H-{`zyB{<&oH55 z!XycX2@}37m?^;HwO}UbjUn2|NH-; z!NLHVAFL5zU?>py4mH2=$NvpVjO|P!jo<$-{Qkd5gJC0xWIgx|biH8XxBnAA{6C<; z0J@G&V1g3JK5$hL1iB>80AeO+OuG`Q1Ed^$tslrgzEDR%!bQPp!T}XQ zEf>X~{}=xJui!GlNQ8k$$iP6wV6#Fa*zRq?s!bvclMerDX!rv1`h=1N9RdxVATygn z7>o}8;{4F_W%Eb?w@M{hv)zQ`~Pcz#r}hi`O_)^vmg9t zU|?b>5&CY=An@Iu0hD1tWgI9mL&NaJe;!Gc@B(utJ_cR*xA5_QNF+nA0i3jsal$Nt zMGNkrh)%o(R(lJicHvD>bj{>wd;yNX>;ETS2MK`VZ{bytiUSG^Fw@pEfK6+Hnbvsj z|HN}}%@`yrwWRtrp+1rnOc(YX8n#62KUkkJq!h@sp6!<0byTTuBmoD*gV@SK7<1Qthg zK=A~Qk0gfw4FCT#1TZiZ2!Y~g|NjP1_%oz1{Qv(S)MOQ55c+P99zURYmv^wZ*!T`^ zXXC5?6JJ4`sk3LoDuE4@jl3a z6C4}%fNnY5$MYw3=`Tvs^d;rVA z0&C)F=>4B3I5(UTSa1duq$fEio&;HSf^)+jfd#8ULMuUcdamH8>4aS<2?{`H{qhAw zGeXXF2c269Y94^fVjV`v+3cY4=>-CydpUpGgU$wZVEAnh>gz+Z9tvglkfHI_|BYY& zcQ!S?{J-$a|ISH`FaCE1@pv>j=`=q3-?<1xFo6gm5K+|l^na%kh%f>XP9P#FN2AF} zw`u)`CMUh7^~;)^^dVP9b}%(GJlO!g549=Ek%edeH(mfS zprHcs5-4rJ&-x3M{h*g2rcj3@Z%|=i zU}OLSnwko>wh9IeD78~ELrFzJc~N|3Ub2E}3Kx`@k_zD&8XD**7#bVsD3};=F}V6F zI5`HpDySM*RB$l_xhZ(&WtJ%Tdvh^xva>QX{{Qx8Re4EaUUqoRI8fbhP%#Ip zyFu+C5DjYYfoRZt2B;bZoo@=_gT~B3v;rgKzWD|yeTNa!{%c@{v?mX+K+@q2R>)l~ zQ18O$Awg{qP&)!dgXBPSiJ13DKK)Wip=k%y)jkY7M?0dg0}91YMtUeNXxs4M`Tg$hz%%LuC77#Kiq zs7KNZia(fMP@flU7X#!D6wnRdphx)u@F0IforvXLN04t|vY@zv1|n1lG)E0eTOckdzcDc|F@X9vpm+xb0f-Me zD;Lxj24O}9b_URyyr6J}62g+xlbPduEiVs9SVqyTDT?@)T zFnN$(7-nW*V*rgef$|7wY!{>-blw?A9%lau1_lO1o?v3Q1By#V$mO9R^)DD07(nS8 zbpJbu54w8~RR4kIzCnDDSuhMb?;gem(U|ArfkFZ#1HqW*+k<*b5IGPDIM>H8>zXC?ek7(bF$J#K{My zrnopWJ~=Mj$0y#?IUqj7(aFaZrX&@7SUuPdNF|w@SP_pdmRt-PGlFUX zSH|&)>B;e_d5K9msWAIPBH{zWG7_6XdP@N09gBGM7{OjWzT>KT!P$ zy9*F>7Z~X5Rgm5%j0_B*OPxXN7mN%Hpt~+XY|vS4T~NKC@CKc+3layNt1=rZ4qD?2 zyB8C54&-sDIOr^bQ&2YOPS0CVHs}t*A5bo-KuV7|iNQbi5Ff%X|LD?Ia85mljY|z>09Z>cjW(J1YP&R07i8!du z!NkA-$`evh_6HUQ26-qOly8)vY*5}+hq6I=%Mi*2xa5{h@4784vg2sUu7#Kk3+k@N&5(BZhq2l{M zdZFXz2SIG;_&E>Ad{9G+fq~%&NSuj*0VD=ub3?@iKx&}jb{47zBnD!`+z)DFz{*}w zO9jRTm5DGmsGS94gPa9pgVxl+*r2gz7#q}fgR#MFY-pVV9{-23L1imU4XFJGVgo%UhTY#}abpwnIYNNu~7NEKks@DaH4VqVgsR7-$0b^$% zsR6b3VB(-U2F3=pd0}k2+*Jv6Kd4@T*$b*aU~Eu50b_&e0~i~WZ((fE{TVPe_^wK* znV>omCJw%<5-JXwUx0~&*3-b);JYfJYCv~8!^A;rP+)BdP+BDhgR&r~NsVj%2-c&* zwgwZ{j|ABRQwK`_AT}s(fy9sSF)*mGF))DoHy|g2KR+uL=vl z7a|M{pmnyO@B{V6VBuE@9qWMUU&GG809rEy1VCGebLezoG1H}VK4n(8R zgGF#LFo4deLN^a&E-dUoa(B2G7(nS7R3?MktRVA1Z1j0B8D0j4PGczJQ;~($hOhEzyP|5 z5)>3*3=0?N0w#EVAXGOP8jRklFkJS|g4Wf55(8+Q9z3oKOAMf)O(+{YA_-CiYEM85 zVNjV0YY!v$%b>~#QiSR+Ph%N&!QiK;3h^~B|swv)TRKfL@Gy zlN!O?9#CMI;l;i!5}yM{jV^gWDy6)Sr!?k>9fRUNO&!tzKeg62E(QW|5q)BtY1RbhN@>T zD@d0RL>Ko84jv|$9^^#_a6Owq_N)cznGMpjdHQbd9UMGNyEa4Y0qYsCb~giL;U8$> zASkY;KqCt@(FWp!1~x!6BpxO0GiZ=nGI48 z8qfi4pa7|XbwELCK=y*oLB5=u0Wx_GDkMPaK?C<78Z?m$av#VFkX{fQrWZ7D17$p$13x?dVJ7X#|k zfcT(sLD1eEP%;7W^I)2x`ayjdP!z%B8K8w>G6T3!j8Dxgg9^pxrh?YCBTo&&mVU$L z`@oZz(BVehnlJ%Fdgi zc7fQSIR%*BeNb_b7>Eti`v@uy%FZv5*r03=TOIcV-M?baZrK;1rCvz*tRFOu~=BK4YCSmEhx-EY}nWzXufO%BLn!ZLr`%Kk^{vT z`dDldv@){cM_Kru)ShzVMc4`YM)cNsygFc1rZVRE2xVUQbO{$*iD?EeS38zcwvFK7-O zrUzsKD-#0)Xzl{U24R>S`kqV&c8EIA8a+^*0y7W2&8y1Hz<|6D4Q3vQ28BDw4iE;- z@j5{F!-I-Aka?i|hCX%*nkU6J77N-zglO?1&WORaC)3ozlISyHVnBr&+8zScV(|J; zu(hCJkQ9(Z8BqJ~W{wPszy7aCig2n3660dADB82xW0Sdwa>k(@i_S7^$5LSV21k=CCY$^MB);|A!VdG`6Pto3Tcp^Y7Ym>K=V95)WN=u)$xWg0IY^1)!~Y&E zYo>UJtO-$Aq+qb&%L5jMJFAS?On8J8logcROcZba=Mg@jz+lNF`+-OL0Sm}u&@ckI ze+$$D=iEUzhzyx-U z5r+wn6Uen5CW`kEuEp3R0&*|Nxga-#+WLR~^GGiI^M8_u!XyvHiNF4@oWaAja>vXS zp!PjTElAD3|4kffGl|i^=?3Bg6shmWgvHfnpL18%^%b>gZ3Ig#V|+?)SCcpfdiQX(gR|H)Pls* zK!PCk8j!7V;HH8G0|Tfz1}XwU=7XlaKvg10&uS#|!ObfM$g*6}ls3pHkoh1s%-$Ot30gPM9EdqK++Vd_C_(2xyC9Mlv7*#lyO!WgVZgMk6WhPe$?RD=8va+?o)NhSkB zGHALQb44yLZ~>14Raf4>Kbf5bh$C8*$%RI8+5ra$S*q>8NkOS1XH6px_c8&Ihzcx z7+`(`O?89BL3-nuAje^V*y&7=DG-qU3?{^q?JST1AbT|!7+`4|WIkwW98_h3q^m&$ zR1GNIgUkS_0WB#5G?5aS$6OeiJ6H!N35^ zPayLjFhQ;#21&mH5l}Pn^^`M<5_1jp;QeK!DL=@PX}#i-B11hx=z%H_)sX%)jR90hfiikCc&#!U1880kmgzw9b)a>Wj0~V1(tWDx%@0|Nsnp@Q56;)B*=!V(#X&j4+C zfhb6)9<+tLC^fk(J~b}|EE`{vpAny&n4FOc;b!C)m&7M0K{#neFga+S9cfuG*vw+M zF(5;snsV~XRwS)mx26oa;d~#w=PEulWHY8KR#tuLQ0E`VPFkoy@;RIuY3ON`XwDuIn z2CYeju|b6;j16AD1WKf!J?5ao9?AyY84gne>T@%KN?lMKgVaFT;Iq@9>OpHUVCq3> z3C0Gm4S}i$RrD}(Kq(x?1{nckgVHNZFKAzk2&hD5U|;~{GY}i37Sv|~u|Z}eg2oHj z7#KkGOeh;<4`_@Dqy}U^Xw4Xi4Wic}so4l+gVcb|!U3rP(TAYoAag)xVt~X!YCz{< zfY=}!RPln?Aiq9@st1JuXnzAp927R9pbC?XfuV+hfgupe235KtP&O!BL38CG^&mP8 zDh^VU31x%SltS4cx(dn$sR6CU1nC8->4b`dXiy~#5(mZMY^b;iBLf4d4+;_o#ra{V zIOxoc_fR${U4YgigVcc1%U`HCC>;rd)@rgrDp6@D8$@eE*`PEC+7|@U3tB%6TI&U3 zgDS{ks2Wh3oeyP$((+*_yMc*;;W3mAs)Rt}FCe|3MiuB-0T>%JHUMIS8e!nZ3aAif zU;v+^0ul#_f%@m%P;t`#*9GwmOOty2=71V%pgl4$^`J9WK;j@V5F4f*qz)twN=Kl5H8Az3q2`0cKx~-$ z`%rOE!w$5Lml5j6cTjPV7>Et?`%kDisPXp~i49uc2(lL>?hlP$&=>}&0SI$L6jU4} z24ch908$6i3u^Fz*E&MS=JKKHL1G{_Og%^)NIfV$dVtCesQPB8dXN~14O2f8Dh_HO zu7a{b4a9XwY)NQ30X5Xjplnd1$_dH_HNyOm*dRX04WI^DG*lc^Z-e+CaZvh9L=p$D z$!CK!p5{WuK@F*;P&TOX1ZsT2!hZu)93%!}!@?h2jzP;VP&vg2WrNZgj16vlL&ZU9 z9wrXz48ho-aV8iW-1dN~2aN;4#KCrf3PxCG2FeDT4`qWoRlCDcst+Fd9c zG-eMoA2db}V}r^;7#mc^!Pubm4P%4a889}e9EPz$uYaC(X;I+F@aZuiYiG#{>7#q~C zgRw#7IE)Qy-@(}6wYyMrz-xD*Y|uJRn3^4+juBM+2on1O5*t(>z|@1zv4pX|AgKW@ zZ-R+~_PM~=ptCk%Y!zk(1{m7_iEV?#_CR8XAh8pW*r2>d3j<6D zY{>u{T)?FcWClnVsFMj|!+I|0=7Hou>OgrLRNf$~n*$xo1j)nf1&w!u^nm7eK;j_t zKpkQb8-zh}APnkQf@qlgKy@mtLkLm_GY=#VVuQ*hkoXxc$leOjT3nD`kQ}If2DRNl z=7HP^Qm4m^eeH1^bX*an288pOA?G51*dPot14M(`UobX^znqzY0aT8G*dPp(1C3dO z+yHZ5ivZ-TB9Qx#$GdBxgDW7tApD-0fguMLm`HMz>% literal 0 HcmV?d00001 diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 85f4ace512..45a4bcec3c 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -48,6 +48,9 @@ static void IRAM_ATTR call_user_start_cpu1(); static void IRAM_ATTR user_start_cpu1(void); extern void ets_setup_syscalls(void); extern esp_err_t app_main(void *ctx); +#if CONFIG_BT_ENABLED +extern void bt_app_main(void *param); +#endif extern int _bss_start; extern int _bss_end; @@ -161,7 +164,10 @@ void user_start_cpu0(void) #if CONFIG_WIFI_ENABLED && CONFIG_WIFI_AUTO_STARTUP #include "esp_wifi.h" - esp_wifi_startup(app_main, NULL); + esp_wifi_startup(app_main, NULL); +#elif CONFIG_BT_ENABLED +#include "bt.h" + esp_bt_startup(bt_app_main, NULL); #else app_main(NULL); #endif diff --git a/components/esp32/include/soc/soc.h b/components/esp32/include/soc/soc.h index 0b8cdfecba..4ffdfb069e 100755 --- a/components/esp32/include/soc/soc.h +++ b/components/esp32/include/soc/soc.h @@ -260,14 +260,14 @@ /************************************************************************************************************* * Intr num Level Type PRO CPU usage APP CPU uasge * 0 1 extern level WMAC Reserved - * 1 1 extern level BT/BLE Host Reserved + * 1 1 extern level BT/BLE Host VHCI Reserved * 2 1 extern level FROM_CPU FROM_CPU * 3 1 extern level TG0_WDT Reserved * 4 1 extern level WBB - * 5 1 extern level Reserved + * 5 1 extern level BT Controller * 6 1 timer FreeRTOS Tick(L1) FreeRTOS Tick(L1) * 7 1 software Reserved Reserved - * 8 1 extern level Reserved + * 8 1 extern level BLE Controller * 9 1 extern level * 10 1 extern edge Internal Timer * 11 3 profiling diff --git a/components/esp32/lib b/components/esp32/lib index 9f26b9a190..ab3c510e51 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 9f26b9a190e6a6ca42656685df9287253badfa46 +Subproject commit ab3c510e51f312d919df6830efbc04c6de9cfd2a From db407074f12923e70297ffca52a523e080b824b4 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 22 Sep 2016 17:52:07 +0800 Subject: [PATCH 050/179] components/bt: remove binary library --- components/bt/lib/libbtdm_app.a | Bin 61822 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 components/bt/lib/libbtdm_app.a diff --git a/components/bt/lib/libbtdm_app.a b/components/bt/lib/libbtdm_app.a deleted file mode 100644 index 4c93a93b0fcdbb1548a7bf6b00c616a3a645a944..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 61822 zcmY$iNi0gvu;bEKKm~>-<|d}briO-w3JL~bDP&SX!O+au0xYbMz{SA8;LE_kwu*XK zn~8zJM2UgHauRMF)W^U8!twVQ7(h6+kAWfc6az!G%SB1QQi1yGUHqN03|!-~q| za}zW3AbOJX^Gb^Hb8=FPAliz`GYdej%dL!0%Fi!hNX<-(Pb|n}D2fNmfVkG5f$dCA34HxZcwE@7N5$VtJjB{x1JITM#u zX-Ou!tJ8DxlM-{{GxJK~i%SxVN*IdbQH1gfP(@NQixZP_KyiemtSGg(B)cXjtHYtjx_%Da}bOhWZ2~ zQjn8|jR#7_X&}Rrph>YPz6i|ENrgoRgb&W(&=4<5Gm1|wE+|SZF3yCR3dwXu@x_(J z$$2H9AjvFYC`-#pEY66}O$B9l2peopQ9P8BlA2eNnO4aF6G$yeECvMxL>iW!Av|zG zF9XF-acW))1DI8mnp_59K{8KT8Zr-5YJinNEd{eNvQbeySR9lqKqU{DlaXIs0?8Qh zAj{$t%Mvqlz%hra1T0yQn4Fzj0*)$#W>{3kCnx6QBqb(iGl1$Ta51Bo53a0WHI#t` zY7J#*U|?oqqM%@D1R_CoR03DMtB)HaBO?P0Ffzn3Ab1Q6YZMq57?>FtOuz~>7{nNa z8O$6Rc$j2AfJHz=Km$WUNCQKHM*~9wh!4YNjtqg{|MT!fu&!keQcZQ(qHy4j!UI-@ ziJ$*BEx*7cbwGh(B`0@BEN7U-|Hk+KYhE5uVDRKYa!e#g<8Kh{$4J;f$@db)EkU78qPXrsW zg2TYz%Y<116DEVy&*W(Q{-4Ja90wC-K}05g23ZC6(hLqBB?V28uqFq{U`9qz+EDxl zjR7-923^L+zyB394k##m0Vx25JOe{?R8*9$jg1Y6XXeOY`0IZMbBDwO4h9Qmi_Z_3 z84SPw=aIBv=Hbv}HvIbE%E+LzxuK!t%nQTM|E-i1I-AdUG=2odJ;Fo=h8YYDAiEV7 zl+3A8(-Kwu{r}+a{~Am@+!{%j7Ttcp1WvJvU%)OyPTwFmfUsk5uxn6AylYU9hH9~< zjzVUhf@-lsVu?adW?rg-Y6^o>h>Nd6kiV}&m}^k5r@x#$2ACM3P_(>1s8*AF+)g3X0bwMu>!bEQYgv?wOF{2@^&&@ zMNwidT>b#V2m3P&AMAOAm=nw#87BVuU-RRD0z)U~#9yFj>f~(v3CUP1I3~;jrHGl} zm|{=_d721pL4+D)C1!~XjbA{K)A$)g?&Vte^nc?g5EBw-ijV(maw$IguPFs0v>M-n zq!b_gU&++?8qB=^eOpQ-La!~Tte_gH)j*gB!D^^rJ;9&S; z)loEwgH?OxBo9^)i(wH5>m(1>MIH>3I2adkuuSq`S>(YuiGyho2lFHk=0zS%Zp;h} z3@eIwxOs9KFMzzY+(-CJxp^94wbOm>+R4ed1u$WNbVIl7^77AHanhQdtS{ z_ka6OpFVwpup#7vHq;bm=E$(|)BlAZ{x|*t8Rz)nKM%JC3y+jW&;uq0!?*tzB{M8q z01Y-(1_s5~{{vtC&t>jlGJN@8lQovb@#TN>8LXWwY>W&HJj|9XJj^^&mQ0N=L53+l z{%^r#arpr=g9Ve3vLKWe1LdN-|2HlF)4|N+)uiF~fP9PAkwEEpUZKG^^N{{MeH zR8JF>CYCaD1QquOAOGL9fI;ER0fj{hjUT{a@bG`rYEWvQ!NkMW&1Ij`W!$5^wCsX5XkPHvk!PEaQ zp8mg=%ZJa#zVSLp%!lvbiT@W*{O95N%eR-S@iIuP@!0=~$3Rvi@*JoXW@=jh4&s!i zByfbE1S{VAUvba>9UN38*ytI6V&|ueiN2g$apU@E3cpuLY*C0oqU|Rz&M<-8P11<&z4yZnmBS89VKnak6 zf#Con1A_nq1A_z;Bzje#v;`9bg9rlyLk|-J*iMk!L3V=*kq8C`h8#vvGGJh6U}9j% z0ZBqJiw1V^3mq_=~S zfx!&w&V5K~U||AMbAge8!5ykb9ApX999VdP)W|SF{05Q+g&)YNAa{b;pezGYqrn6T zXOJ3D*uvC+*r4zSsquh@J;*6OObiU5S{0RgBt%Z4!A1-N*D+MW_V_Wh%ti;4G0@VGBa>8 z@PZidtji7MK`3ShbUw0cKwS@L+(48wFvCrQ2rx77K^RbynSme5f>6v1f(%j+CfKDy z49pB#P(FwPWg}3Q0kJ{JS&)GhG-L zU;t%xJE(nc86d?iD60uEa55lAAjti~NI?qXtDx}>(fFXO2Xhigy$zbY7b7IAg4_YJ zF9uCM7meSE#$SoXhZUnBJ3;o{K$Cxm#^*sw5+L=$XnZv^zB#mrgoGbEgDn#S1E`2N z4-P+026r^|aZHF}0OUVd@c?sQ4HE+ctOx+fgNjs;90-HlGat>om1z8}Xna@^3)6oI zP5ueg{UEbJ=@Vo(sOVM$yPuiiH&i{$e>|Y}EyyrvdJ;q9E1>ap(fBBxj-tfe_~MeH z_>$D(5(e~f*`j##@gOWCwWtF`&|zHAxNT}laeP5hW?l(sC=x18)(~!dQgJb2m@E}M zWJdmIE@FTsBeS5)JiZ{Kk|C)iJ}C)2ZWW)LTaZ)1P!yku7#1roO3X`PfDrMBLA3(N zurJEMFnFA_2s|7OHV&!;GAs>J2_2RO4N=47GII;^i%LMlX9XFR;IX#&0u*_OOHc)o zBL-Cl79a5i@$lj7B8UU>3raHc^B}H+Sdp8W3sM9fpFAM*w|7Bt#go|%>j zN++rD`FS~@piIe)M;{6Y#~^6%4LtIlQkn}J6L(Hb&Pa_9N=;0OcYzLZ1_yYC=7DDc zAd+r5rNtQxxw)l~08Iw#0QaKfL4qLXLllBdam@pdwt)uMi5Y7LkGmlT13|-br~`pu z1@JLKhAB)842;k!asr4g1j&e?GJ??>!nOg4gW4Vp3=E*A93xZ>sOiTj2~l$Z)a-zY zuK=+HA>yEBEF-8OfHq-adcjR(sJ)zxLJ`QDr+y$x+KGBCV>vQIEFF#LnE&oDAD$b-5mOpxx2E|d)ldw(b!6ekH#HYl#Lp=<{x28IeK z+l7gNVKI~qisxleHYol<&1aC`L2(`k^&_Z@0_wgnf&!L-fuRj54iW>gxuN27q2i$N zEKt1;G6&Q}DTBHn)I}+S+68LjgSt{6H6S*qD*&o08yFcJnxJYxVjwoCl?4)?2Nego zaRCw=RCh3f8Wf-=Iw-x_L(&^4eK3L&3$!j_bcBfS0i|JRdfNeFgAy781H%>&8!Fxc zVnfq2$eoO!Haw`A4{DNw5*w(i2x3FiIjGIVs1Gq86yJ={JW>HtqX!W$0kM@KY*6zb zme)XIGca}x$o)_?pl&BDkATuSBd9+F?JhDx2f=(m>Y?rd#S&h1+^C$%O85E~S(AZtKuP!KHy#V;GA3k1poAaRg+TcP40 zdv-zDAp4I(*&ugafU-gEy$WT6y1lodY>@vRLfIgHg9fEQ=7Yk+1eAW*7#LhZT~jC< z6lTkz>;gsxhE-5DC|ox~*`V+~2xWuf0i4&^7#Ki#5S-W87#Kitbr-4zlpmi!*`W9Y z=Rr0GhA*Im2}*Bl3=BPt3=C3G_5?--hEOPb3L^tU0hA5up1p^%LFwodlnqKpEX)iH zAb)|?KSL46RW13MK}I zDNyzrCI*J-Q1%8U28M%BHYn{MfwDnq|00wP${(PvEhBW8Y%(-nKw=;^H&h%{#xjB$ zatsU%GoflgVjwm*R2(!^0xLH_|BnD!0L&d>$0UHAYsC&-@O*0^N3rH`hU(dk6U=I}siGkSMQ1K3s8fcjr z2UPOY0;;DNbs=Gr0#ySN1F^ZG;-FyzSlF(GssV|C*f4YEfXW<0h&iXAYCvKj zHaAop)V~t}73K^K49}rzK*J3SKzcz100RTVFQ_<348-P!iYGzSHYm-PgV?eVyQ)BJ z0|*;5{J;qH`#+F48v_GK48(?o$q`U_3ms=MgQi1}7>Lac6+Zz|0~)_#U|_I;ssV|C z*xXR@Gaxlk^)65~ATbadX3hnW8gq!-e4uJTVjwm*RQw7^4XA)*U|>jtssV|C*xXR@ z8z4275Ob=aYCvKjHaArK4w9Nas2Y$Mhz(Qo0HnqWV$N=;8ju)>%?%X?^`l^MeHy9; zBnD!`;`#;19B8__4pjpZ1F>Oh?t;Xj@dC0DR{n$8(7qU`tY?I>K~)Qk4Qfll*q~|# z#s+0S7#n0Xj13AV7#mbKFhc7WP<;SngX#bn8&vMY*vRey*W*z4AiDvSWMSqb+Y73b zVB%oApn5@d3``tUf56zF@(9KTl@~BJDBr@^pm7iw8#D$2V}sg@FgB_13qI6!$2s#gSwt$@VVL1J4Vv0aeZ0Z44nm)sZkZsLq42LFEgK4H}1lu{VIsf%e7sAhAL1S6G~00f|G?zyl;UsGfzX`GF+P z0!q(N^#Vw2(D)NfJ!qI2#x_Ax18VQW#6jatFgB>1g0WMO)Pw47m^f&R1jYu{(=axu zK8CSD^)8GJs$XGjP@M{6gUT;PP-X%pW+E}DSOqmVpx%bAT|j6CwaGv{Q1g-)b)b3_ zT^;h64a_`H)dymO@+rvt0AU6OkY7N>2`E}Ya-e(&Dvm(rfy6-SzJSVe5Ce)q>Of3T z5e#C(%;OMaU;yP&ka?gcHb@R+9!MS(L@@I>m?2XOATvN1qz**8g7O3d1A`HW18V0p zGcbVqTTm`|m>lG;NT@nk_#I$oV0ZvC96A;W(gP|BKxTvN2k|Y$7#KL%AyYu0A#{)& z$bDH*^I%3SV24cOfb@VcNF9hyg_;dB&p{S4t_kulsQ&^|2Qse=Y91&oK>C)jGcZ8A zB_J-`AE0?g*i;fo;wd|%-3?-cFvzbUdLq<35F3PLIT%nDvcS}V+72K$z})8}3mFFm zxewI#2g!llHxJFcS`G#VP~8YJ8-!uzf!cT=Juvg`$U@YC%ma1bL2@ATKx|mpf%N-w zL#9bUY!HT-2cn_H97veq3pWFU0t*9!C<6m{R2*a;s4fD<4YGM60t^h+NCF^pKn5TW z`hb=e5n5MdWMpmzT2-W=KzLnI4=8aVtt;Y(PZ)x1CJuwvt$rkRjtm?)hvLQCJ6b4JLi5HyDaN_il6LohP~sPuxcK_oLc$AVZ8%*+5v91u2$ zBs|B&1)h$Eg_IBj69csS57G{n1NEiB9OyVk6pRDqm!t7PQ^GJIP@Vy`QIPqEU>vCa zn`r#6Xna9XR6@l-=4qhuLG28vG}yhc^{LHe1PxJfL&ZU>Dj)_1hJ2_RkQj)~4HXAKiW`n{JCXTCL15!^6 zCbm5Y8U_JnUsx#xS{n;1nL+k|(g=tKg$0NWtKS!}Fff4H_@HC~Dj`8~AoqiYJVEBc zs$k^#V30W=IS>tM4}#JbA$73!C8#_E=>wUEt$pN-wA2Qq4m4f}>TiPBAPloN6qKew z0#K~Qh}yn{sRQ*xL4JbyH-HV&egpXzB9zl9w=Ebl< z)Pc+cEz<$Xfy@IXYgm|o%t&HnV8{kBpcv*p5Df}3Ce;n^FY}My?x}s z%)k&2(hSuIW2WY2f|^B;CXa%G0=#`>iGAI*p|P7Anl{y z_6(pwG{{=lgMa@o{QaMYyYbH;Xu*Ku0UA6Euoes`&Oyt7Kr|?>K;Z^b2P!^5@cJCtNgY<#eAdR3nfYo>6&@vVz24chNJCHh9S&GaCxdkSUtBeJeH83?Gy~JQj%3E04 z0oeocD~LufZ$aY}pm8ivc>#(=kUEfG(97FkkY*$dOAqMfEiQHFC-r-5)&xYKtKC zM}-*#7*rU(+N&@$fSPg)42K}D2$}H3K4HQadxkAXSVS1U+A}zOwbya@YMVa3;%%k)=n($Vroj=PnOV zl#F!aGf*`kqa`EF!_)W##CE*;-)IqNS4;;B5060ycquc>T^<=L8STcqAO$j2GTJ;m zkj2f8r~WTI3vx*Z%fxg44J<&aEmvBHWv?0!#!yHo&OC?K#R1&+h9Dnc#NUSxr~;8Tx-c? zxbeT!LXZki=FXr_Cd2jr73YF%v4re8g2c;zd(eJ|fBzv{U}i$LH8999e6^PWg}cL7 zP`E3IfY{)8{BN%TW;cNJDSrLm!L&l-0T;u@&;S2|wi|VD^Ds3ul&H^eyZGThkLCdd zh7R889G1uU85kadcl^BIYwy!Kpuq5g`@w_KJO3WO1i9!1-}FBHHWmhuyES;HH`ypY z0|{&L@i2ApcUU~&V37TA@DX$+`U{?RzD;gF|0~}A|L`_M8E9V+w}L`RSkRxgcOW4R zp7y3)JVM9b{|7C12Bn_{Xu4tnrzuc+1Njl;FOdI#{BQjBex>8{14mwG4aEH9?%;26`T#LKq^*pE(H5-2KR&srD2{R%`>>#Io}}f ztpRmEK=lM@TosgzL45^=5C8xF|Ig0=3RCD(6wtnaJ3@({{xAIeKZ9-Kr~esYhZYt+ zU}Lx=ocQ+t!uKG-w_w3ykf2H8i~kE>|4&k5*!bdqk{auwg(VNz7!qIn=i&AYbA0}v z=ZwP=g`hMx$UcVy3Jeitnr(`Y{u>xpZw3NGN(!Uoz##in@Y zzk)KzZ<=ffU!eN|R6hRa2QQU$0Qo}&nqENuGjn9PBb4~@|H4loCw~MxxeMfE;lwxp z7rp}tz5xq%KVV}BGhs}8{(s>skmz%WKYBp^cn)%?C!6E5|2*7lS$NJwiXl9rrfKG& zENJ-Pzk#U$bVryP$mwbbr>iO6`k#0k&0{xEJ(g6OR!~x;plGY$7wY2!*{Z9T%ut+J zl?oCxV1Vrq1o6O13>Y{ZzS;{w{0j0acq|wcHlTf2KSANC!7LWU*7zO7)Z}PS(rWzr ze+I`2iJqH0+&eioWiUSAWMBgg-!y*szwqP#4vvi<{&z$iT6pFG2ZMXkZpBysJAzgu z_3Yr`-Wjwr=>Z2r+spr;T^kFZ{nudH`1HR<(4mD-9xyQ+d;FhafCt?`Q)Qs37*J9G zb<05AQqb}OP&XIU^aeF)KvVmWCO88FsObX^Gte+KNHGHg19)mo144tEW}r#}WUe1{ zz-}1>1H*ghD)XrzNzkx6bhSFjUQqKGG#w1m3u>Z(+ySx!w7MO{23Z4A16mRbYPNvX zu!E*tK<0oj69agt3$&^QbTk0S3Xr)v&}CjA^`I#oQ1uN`V+UQ`4r0TWy@J$(*q~}1 zq#o340=t2MfdRw@RmC9ng&;|goeT^NAU3F(0TQo+i9=V+gTfEwW>E9N6B-ULnIOZ^ zAoZXrYq0qs&oM(+)oU;?fR=24nk*nc7%)S^8)UQxGeU1HGXn#tC<2*N!i?DU0g5M> znIJYO?m%w%!VIpD!ClH9NM;H^hs8nWsInl;v|(XjNQB1MT##d+{soy0!Ym-iffz_> z0F*93c7bS6Hx%S%P}3GPgaI-iwi5&t&YwOpk+BAJs>t{83xE`kQ&gi2WZp- zB;E~eo`J+c(+?oCLE?Q-H-N4GAQ6yyP;Uvs29cQi50GsKsRsoiNF@X_gE#y@*dP*fKLV)5 z3zC6g(0&6@zY4;Gtp5k~J3yJQGgLoFA1JXeg{}|Z1RWOy&6^2< zdfSkObTR|@oQTxCGKM11`dqYq{a{6qCAH}VnfdX#i6upu74i9{B@D>?Ow?l~Ks)1M z3yh273m}zJJbZmDF-J~7JF^h`VLSC9JkVBp28KJ#3=E9W%y|QeeFemZCXWk9>@!I0 z6G&`OLBR;hjiB%Wi9^j4L1GJl*ibV;>*`_i(x5q37#p-64aNpl956FM1vrciig%cs zL75gd9t>JT0qUcJtOkv(g4m$wOhf9UgVt7o#6c;s87dAk57d_eiGzkylS7qor>qy|*Efhs!?8???BqzA+Xjq`ay)q~au zgV!4}F))DCgDNC!>plne3vW2oi z>COwv2BkG$C>xYE!Rs7B6+dXa5-JW-lLTdh(sBlr4KfE*fr8usO7GQBaS3JyhRIMi zXg%e8C>ykAWI2?r!py+19m>{VW?=XWWrOk)0}EswHz=R6LfN4FCj@1K)QCdapgbxC zWrNgcK-nNQ+E6wqPa8nlAT^*08suhBzITC&gUW+=C>yj+p$N);!py)>3uV7xW?*Q5 zvfnT>Fie25KQJ>efYu^`%mkI2;Ptso3=AMPxN!%{XbcPt>!A4vBnD!`=378(abaui z!RvOJ7#KieAU15i1ytU{=54@hb(tUy7Z4j}4rna}%$(;?yFg+fHq0E*8d{J$LFo`Q z)&^sP*7d;H($KU7QlkoGgVMMmlnrXQ1wq-M`~+Lu4$3#Mb>$%TN2nT5!|f*$+ZY;;#%paPZwvgK0*+GGGNuLZF|QlL5; z#0IGam0ut>sDTD*uz}bh^FZ+mVuS1f&AEZtAp7G%@x>0A6DfqUK@C7qLk^?{q!+X% z4#WoO12HLD;tNIhuI8pH-Q^gzqqL2Qs4KxHn74RQ;J4`PGVgX;)(1_qEl zpmG+JCO|aE4=^^!J{TKRH^A7Sav#P9mHRL@sGeYih7ZUrm^jD}FgCI|pgIO74%Q1Q zyP)HXFmX_xfw4hp8pa0IeK0nt%>!eD!V1P7T|Wql1<0CtSeSt7P8b_w{U9{_L3Jcd z4X8eYu|f45j168t2vrYWKL}-m*AId+1*nt5#J~Vc51?`e#s;q+gr*Zv{RN$$4S4+^lnpA6U}{p3%m=R@gsK6rAB3_&^(ag|Bs2(dS!K0P;6T?tu^k1ITY6_kr96k^|A8@)f2B zq|Tj<0lY^K#0FuQ9H?Cl(gQQkL>QtDWFBa~0wf1A55$MX1xWvG4h9C$`auvIgkk1^ zXlQl<2{YtyGBAMpe4xG~%sf!pj6T=Q!_C0353B=1fXo50K&R~?O??oYYc@7EfuBN2 z=!`EJ(C84_+y}@`7zWi-p!x>ne^B^<1}k84AR2To%a{KhOdS$;G#WpHhJQOaHh%u! zq``V%ZjxOlR8VjzbAbuevw@xOzEhiB0OR#{pJ^-uX=>jWRw2%R+My8ub1~RG9!L;!PM2!^qL>nG0@EKZ& zpNfXvolQo6*gq$Kx%i9z-QXisrwUP*C$eja=*7n~xJ89-8? zUACEdC819q1|hM*7Fff_f^^ASLUbRhFU zZ5EI@p!N!g2AKmZH$elhFn5B~gVH-pJ!tP1Og+e6kaZySF#mwmgYpKb?g6Qr3LX3e znLiz*800q4;4idn1*r%1JwRItLFz$$29PpP`AYeq9_WA($nYQJln}I0K1v7mpaYX2 z_ku7v<9Z-{FbrDb3Gz26en9PVCI)u!@hqV5hw(uJ;GpmYwUa^eFufoebj}EfhGEP# zrJxXo$%4iKL4_VNAG+udD#VPo9vL+5hdz!68svv62d~)#^#hRkpmd4M2i0w$bPPJ; z1~hKh4wHnA+kw&uEIkN;PAh?Came|q@tMU%@#RH{1qG=o3}7M9Nt!5PpiS+ls*nyT zz}T-}gmP2?=$KpBk(;1nJwbLuM*lMNN{V2kf1u6uV7o!5=z>P$Kx0X;{ZHV20d)8l zRA<1%LG>IXsG@`ALns>*-!O4dIRNXgfr16LJ`oh>p#C684BQWbo`nHw7lFhu|a+UZG{7|L1hi7 z{|;h<@;s;vVg#)f03BxqwF@K$>c7C&GlI$sm>STYCy-u{7>Es111gqaYCwCQKx#l@ zAT~@5$ZfE31MnUcP~!n=FKny;RQABa4KyAH3pY?$!PJ1tGnhG`@PerUhdHQ00}5PF zeg*{;sLciP7c?G0TMG2Z@8+0$NiIVuRcW zIui%P28B~6)O?ViKx5Y+agbj@wY4C-c3 zT*AabaRXx`>jk9)m^one(Bc8)N0>Os9WXY?KQJ~%e->&lxGfB2gZv4z7u=tPii7*J zP&Oz%z|?^9J&X-nYYt zy+6ecG8|+86vMcnas!lZKzcz^xYU8xW`p#={0j;*Sp5vr2eKDLgUTKd8$^TnJ3#xN z7$N;VP=5y`2XY@MkATdBwKG7=iEKd{pco_v!r(N7)Svp#NL+sk)Yk^(d8l#V2~Q9k zROf)q1+hW6f(f*m6vTpHm>hb4>I?_uC^=9#gWM1E2YP=BG%p3(QwcE*a?~1#jozQ) z;ACI`sRNk@>;Hhv1@U2V0n)dHnYjLx2MYrOXzebjNCXvIAoqc2P}PEL-VRpi8Hymo zL1i42&Q3+{O(Ct_HOIAf*OKV9WT0_#(6~FOYy^ciXzecgnaQBNOMm}Q{QJLyV^W6o z0Iq}pWd;z2h6{Z0E-3MW%0v(ik^?n#LFzyl)Nlm_HVA{%fC^c#8W1sX3wdE_8RQDg z_9)1qAQ=c|22E5zm|&6?dy-&f2Pgv*9<-(dSdK?mAL0HQ${B+rnYss~!ui*|rM z=Hx7NV+-2G9&n455!$Q;M-#M33!35twJ$(opoIk>HYo3b90IG;kl7$Pm^i6*Bgh2_W-87}Q<@r2~-JAPj2DU@NadZB~$akQxv^ z3+gk17*Gt81GPy(euDWIbcO@Se<1&Y+zpZg@zK}*g3gTrwO^pd!Rrb1wZEYGNsu~_ zd7vZ(GY`GImL+oSFKBKUbbbw}?1z~LO84mHHE3)Yv~UyMeV}U^z!yb8i*4B2Ujs87 z<+Xv439)-E6hH|CY5a?affKZraR3WtnD1dDBA|vF$dMo#BnOINd?N(#1wW9kKhax1 zu^tZ!Pa`0k374y|90O7f>Su#e4ulONG5h5(KY?UH>R~w@#%G70_z6-8E+-L*0lqO3 zE(AUw4|XjI#0*$j2FedGHgdTJQAL;}w#)*RMWB2N^9iWT0=XS#11v;9ZCj8!Scrl4 z6~fejXpkI;29;x=7$>9-RAzznfYgKZfy~2J7J-iWLN1Fy=bBeY*2Vyrh+WkHtH^RyXPrEGpI}fwF&55R)EI&AihHMTXT}*L0iw^1qQsGfvaC=UJ15@g&f-5u@eC;4L>mbr&ctAlev^#DFL^z}e{3rZs(3@;d)XK{TlE4$2#_aSr6M3y?fW4n%|83JMEC>d?nS zK<0rk$P5q$nFqq?1s%u~bmH z1Eo#c>6e@dJB{ukjo9!A_II44 z03YxTYi1zkUT~HdqjR>yrMv)*fq~LEQab~Z7!Z>$IbZ>dR>o-m1Qc!{3~H}~F#0$s zwablx9M8ZyXPX1LGyqm`z{fLit_vG2H-<~O0ctCN(mqPL0lGl~c~AqAJTOWQSQ`Um z28=!0-T;Lr1P`Zj1N%5Ati%AV5k=ZNWPzi9Vs1+GI4J0hD&%oc=-#1*1P0j;W{wOE zNuX0xL1#!iGBp1C&%@Ng(WJqIbXEaqU(vt+9URcJhe7Mu8y+!>&Gi-Od^%6E`nm^~mh zp#9dM^KC(DKzsjS=78qoK=X$nanODPklmpDr=Y_+!D>Lnz-?uM_k}^uAiQoC6e1v% z5KPOxOrUTA%}0X{g$1!e7{rHO=?ZoLD2_nu!eH?Ok_YXThs6bm4?61*6bGR88;H-4 zlLMa4PS43tO3aDR%qxj6E=epZVJM165y}VcO$VKM0U2%v@sQ+GpjX7BXevrAF3B%S zWhja-PXir8!vIPjuzP(#ZiTTy`?Emv5FjzoJ|Perq}B#0uO04P}G(7DL(Ky~R*AcyBS3 z4c=P}WrN&F3?_DNAKU&cSRMk|15248zk}GYJpwJvko~2gbpRlzf#g8p1`2mjTNIQx zLHa@aS3xukgXBPL(A+*K{0XT;-=76C58GTG`u;4?SpeA90HE*B`T{+>0punShPe;4 zcLL-mn14ZcD1zDuApe5g4Uz--7kz&g=zw9+{%??3APh4PeSa3{{6mmBka?i-ewcaa zYYNs7xjzfM#*mSLfzbXe(D{(yOayWq(tg_fVjOqj;HndiO^9C01iF70y-oyKZ|2C* zW7PQfzb5GH|AD-|4;1(y2Z1nb%N9rsQ~`l#Py~SzIVf;JG^nBh6*3_8pu|Abv_KK) zKo=7CbLC`~FzA6b;#zbKOJ5+T42F6JH2wz)G7uJIUYV%fD8hqVNm=qFo4gQ29^0BVURmOY*3Ve z_^@&qnGJFiOdOQAVQf%Y2V*0b^B}#%U`onfSh51y0}3|~4RQ~N4J(U4XX}B)KxGFg zIfCRsenBsLLFZtC^usVLt)Q2^Aa&qm3{?m+55z<-dqL`mDSKOqyccILk$Yo7XB2?^ z2l6k-ognvt_~>QtQRumqAh&}s%)jVmFX*mfP@N4j50rFZ=AoCpj6{~bIgAVp#O#d) z-HU^MW(3Hc@bk8z-4fV12CjQ?jEsrj8*2i}2x#j_L3Yv=4`kU6@+fkd4rb%&7(hyB zaG6WtQZWL309fh-IS{mO7L=1AY!FHKd;{3dIFM?Pe#AaoPa^0~3QA#3(QcDuOp(r!5nCtYBr1m<%8Ng zFd>ls?Jy2h9+ZD!LLm8zFb-7yF&ZD#c7q9l)c=EVpz1+qq{D&+ zLF0qYOh;B9j3%Fe#?MCMgU(h*)(_f4kIaW%C;}1#*$+Bf9mED<5Fd1wI*1LzAU^2K z84w$UL3{>8!2vpU0_m(U%p)hzj|YQmMem^D>a&s7ODl>`EG|whDv3`mDq?_h3KEMF za}nI~#3Imj11Y7s1@Yj#RurF}3hp;1XUCToC#Hk?d<8j)C29FZxzLqKpu@}Ja}zT` z8jH#^3*td%rlqHX`kAS@nUDj|isH*Ml2O@dnR%JT8Sy1WiFw6osYS&MFg3*>=ONBY z0~wzLI~%Pi9<(AG%i`>!_~Odqvl%a00OkWWds#8(6eS4L5&{<1_n@Dff2ev6Wk{T9Yn?eIa{3(y4VQR$6|zD1PJac zgB%FDv<4Iopo6Fw7#Kk3Wix`>+YFF9-5EiL2Qn})fP#w=+Mgh`NBKv^1A(t^$bK-LA41MxxDf!HwPLFzzfqk-f=7*xiB zXpomcY*;()3@ZZzXe~IX4FW3tL2@8>g5m(w&ViY?1eyjwW`HnA9f$^&%4nb@X2AKh(L1*Q`*dRXWY!GOagShbe3^YCfas$jCGVGAc zen9>J*#nXT`2&;$VSWG^V9LnA0P25(*dPqE3q*tb4-y069!3TR&{@);tN;oJka?iA z4q7XZY~CMc28Qz>%^*#nxQ5b2Y4NGW1x2aF#hGcKCKbFrWq^Hr*UZ9<==Jd`pa4N? zPYE*cfyQWgKsVc&IYI_^LF1KXjtmM4B@_StS7>%rP*Bm*RAORK(72#<=zxMk3G^&m zGe?Gl|NirE@OZ~?o?5ZVi$S_$`i!r#A6VpmgYLLfP$*Gons8u-;H-{`zyB{<&oH55 z!XycX2@}37m?^;HwO}UbjUn2|NH-; z!NLHVAFL5zU?>py4mH2=$NvpVjO|P!jo<$-{Qkd5gJC0xWIgx|biH8XxBnAA{6C<; z0J@G&V1g3JK5$hL1iB>80AeO+OuG`Q1Ed^$tslrgzEDR%!bQPp!T}XQ zEf>X~{}=xJui!GlNQ8k$$iP6wV6#Fa*zRq?s!bvclMerDX!rv1`h=1N9RdxVATygn z7>o}8;{4F_W%Eb?w@M{hv)zQ`~Pcz#r}hi`O_)^vmg9t zU|?b>5&CY=An@Iu0hD1tWgI9mL&NaJe;!Gc@B(utJ_cR*xA5_QNF+nA0i3jsal$Nt zMGNkrh)%o(R(lJicHvD>bj{>wd;yNX>;ETS2MK`VZ{bytiUSG^Fw@pEfK6+Hnbvsj z|HN}}%@`yrwWRtrp+1rnOc(YX8n#62KUkkJq!h@sp6!<0byTTuBmoD*gV@SK7<1Qthg zK=A~Qk0gfw4FCT#1TZiZ2!Y~g|NjP1_%oz1{Qv(S)MOQ55c+P99zURYmv^wZ*!T`^ zXXC5?6JJ4`sk3LoDuE4@jl3a z6C4}%fNnY5$MYw3=`Tvs^d;rVA z0&C)F=>4B3I5(UTSa1duq$fEio&;HSf^)+jfd#8ULMuUcdamH8>4aS<2?{`H{qhAw zGeXXF2c269Y94^fVjV`v+3cY4=>-CydpUpGgU$wZVEAnh>gz+Z9tvglkfHI_|BYY& zcQ!S?{J-$a|ISH`FaCE1@pv>j=`=q3-?<1xFo6gm5K+|l^na%kh%f>XP9P#FN2AF} zw`u)`CMUh7^~;)^^dVP9b}%(GJlO!g549=Ek%edeH(mfS zprHcs5-4rJ&-x3M{h*g2rcj3@Z%|=i zU}OLSnwko>wh9IeD78~ELrFzJc~N|3Ub2E}3Kx`@k_zD&8XD**7#bVsD3};=F}V6F zI5`HpDySM*RB$l_xhZ(&WtJ%Tdvh^xva>QX{{Qx8Re4EaUUqoRI8fbhP%#Ip zyFu+C5DjYYfoRZt2B;bZoo@=_gT~B3v;rgKzWD|yeTNa!{%c@{v?mX+K+@q2R>)l~ zQ18O$Awg{qP&)!dgXBPSiJ13DKK)Wip=k%y)jkY7M?0dg0}91YMtUeNXxs4M`Tg$hz%%LuC77#Kiq zs7KNZia(fMP@flU7X#!D6wnRdphx)u@F0IforvXLN04t|vY@zv1|n1lG)E0eTOckdzcDc|F@X9vpm+xb0f-Me zD;Lxj24O}9b_URyyr6J}62g+xlbPduEiVs9SVqyTDT?@)T zFnN$(7-nW*V*rgef$|7wY!{>-blw?A9%lau1_lO1o?v3Q1By#V$mO9R^)DD07(nS8 zbpJbu54w8~RR4kIzCnDDSuhMb?;gem(U|ArfkFZ#1HqW*+k<*b5IGPDIM>H8>zXC?ek7(bF$J#K{My zrnopWJ~=Mj$0y#?IUqj7(aFaZrX&@7SUuPdNF|w@SP_pdmRt-PGlFUX zSH|&)>B;e_d5K9msWAIPBH{zWG7_6XdP@N09gBGM7{OjWzT>KT!P$ zy9*F>7Z~X5Rgm5%j0_B*OPxXN7mN%Hpt~+XY|vS4T~NKC@CKc+3layNt1=rZ4qD?2 zyB8C54&-sDIOr^bQ&2YOPS0CVHs}t*A5bo-KuV7|iNQbi5Ff%X|LD?Ia85mljY|z>09Z>cjW(J1YP&R07i8!du z!NkA-$`evh_6HUQ26-qOly8)vY*5}+hq6I=%Mi*2xa5{h@4784vg2sUu7#Kk3+k@N&5(BZhq2l{M zdZFXz2SIG;_&E>Ad{9G+fq~%&NSuj*0VD=ub3?@iKx&}jb{47zBnD!`+z)DFz{*}w zO9jRTm5DGmsGS94gPa9pgVxl+*r2gz7#q}fgR#MFY-pVV9{-23L1imU4XFJGVgo%UhTY#}abpwnIYNNu~7NEKks@DaH4VqVgsR7-$0b^$% zsR6b3VB(-U2F3=pd0}k2+*Jv6Kd4@T*$b*aU~Eu50b_&e0~i~WZ((fE{TVPe_^wK* znV>omCJw%<5-JXwUx0~&*3-b);JYfJYCv~8!^A;rP+)BdP+BDhgR&r~NsVj%2-c&* zwgwZ{j|ABRQwK`_AT}s(fy9sSF)*mGF))DoHy|g2KR+uL=vl z7a|M{pmnyO@B{V6VBuE@9qWMUU&GG809rEy1VCGebLezoG1H}VK4n(8R zgGF#LFo4deLN^a&E-dUoa(B2G7(nS7R3?MktRVA1Z1j0B8D0j4PGczJQ;~($hOhEzyP|5 z5)>3*3=0?N0w#EVAXGOP8jRklFkJS|g4Wf55(8+Q9z3oKOAMf)O(+{YA_-CiYEM85 zVNjV0YY!v$%b>~#QiSR+Ph%N&!QiK;3h^~B|swv)TRKfL@Gy zlN!O?9#CMI;l;i!5}yM{jV^gWDy6)Sr!?k>9fRUNO&!tzKeg62E(QW|5q)BtY1RbhN@>T zD@d0RL>Ko84jv|$9^^#_a6Owq_N)cznGMpjdHQbd9UMGNyEa4Y0qYsCb~giL;U8$> zASkY;KqCt@(FWp!1~x!6BpxO0GiZ=nGI48 z8qfi4pa7|XbwELCK=y*oLB5=u0Wx_GDkMPaK?C<78Z?m$av#VFkX{fQrWZ7D17$p$13x?dVJ7X#|k zfcT(sLD1eEP%;7W^I)2x`ayjdP!z%B8K8w>G6T3!j8Dxgg9^pxrh?YCBTo&&mVU$L z`@oZz(BVehnlJ%Fdgi zc7fQSIR%*BeNb_b7>Eti`v@uy%FZv5*r03=TOIcV-M?baZrK;1rCvz*tRFOu~=BK4YCSmEhx-EY}nWzXufO%BLn!ZLr`%Kk^{vT z`dDldv@){cM_Kru)ShzVMc4`YM)cNsygFc1rZVRE2xVUQbO{$*iD?EeS38zcwvFK7-O zrUzsKD-#0)Xzl{U24R>S`kqV&c8EIA8a+^*0y7W2&8y1Hz<|6D4Q3vQ28BDw4iE;- z@j5{F!-I-Aka?i|hCX%*nkU6J77N-zglO?1&WORaC)3ozlISyHVnBr&+8zScV(|J; zu(hCJkQ9(Z8BqJ~W{wPszy7aCig2n3660dADB82xW0Sdwa>k(@i_S7^$5LSV21k=CCY$^MB);|A!VdG`6Pto3Tcp^Y7Ym>K=V95)WN=u)$xWg0IY^1)!~Y&E zYo>UJtO-$Aq+qb&%L5jMJFAS?On8J8logcROcZba=Mg@jz+lNF`+-OL0Sm}u&@ckI ze+$$D=iEUzhzyx-U z5r+wn6Uen5CW`kEuEp3R0&*|Nxga-#+WLR~^GGiI^M8_u!XyvHiNF4@oWaAja>vXS zp!PjTElAD3|4kffGl|i^=?3Bg6shmWgvHfnpL18%^%b>gZ3Ig#V|+?)SCcpfdiQX(gR|H)Pls* zK!PCk8j!7V;HH8G0|Tfz1}XwU=7XlaKvg10&uS#|!ObfM$g*6}ls3pHkoh1s%-$Ot30gPM9EdqK++Vd_C_(2xyC9Mlv7*#lyO!WgVZgMk6WhPe$?RD=8va+?o)NhSkB zGHALQb44yLZ~>14Raf4>Kbf5bh$C8*$%RI8+5ra$S*q>8NkOS1XH6px_c8&Ihzcx z7+`(`O?89BL3-nuAje^V*y&7=DG-qU3?{^q?JST1AbT|!7+`4|WIkwW98_h3q^m&$ zR1GNIgUkS_0WB#5G?5aS$6OeiJ6H!N35^ zPayLjFhQ;#21&mH5l}Pn^^`M<5_1jp;QeK!DL=@PX}#i-B11hx=z%H_)sX%)jR90hfiikCc&#!U1880kmgzw9b)a>Wj0~V1(tWDx%@0|Nsnp@Q56;)B*=!V(#X&j4+C zfhb6)9<+tLC^fk(J~b}|EE`{vpAny&n4FOc;b!C)m&7M0K{#neFga+S9cfuG*vw+M zF(5;snsV~XRwS)mx26oa;d~#w=PEulWHY8KR#tuLQ0E`VPFkoy@;RIuY3ON`XwDuIn z2CYeju|b6;j16AD1WKf!J?5ao9?AyY84gne>T@%KN?lMKgVaFT;Iq@9>OpHUVCq3> z3C0Gm4S}i$RrD}(Kq(x?1{nckgVHNZFKAzk2&hD5U|;~{GY}i37Sv|~u|Z}eg2oHj z7#KkGOeh;<4`_@Dqy}U^Xw4Xi4Wic}so4l+gVcb|!U3rP(TAYoAag)xVt~X!YCz{< zfY=}!RPln?Aiq9@st1JuXnzAp927R9pbC?XfuV+hfgupe235KtP&O!BL38CG^&mP8 zDh^VU31x%SltS4cx(dn$sR6CU1nC8->4b`dXiy~#5(mZMY^b;iBLf4d4+;_o#ra{V zIOxoc_fR${U4YgigVcc1%U`HCC>;rd)@rgrDp6@D8$@eE*`PEC+7|@U3tB%6TI&U3 zgDS{ks2Wh3oeyP$((+*_yMc*;;W3mAs)Rt}FCe|3MiuB-0T>%JHUMIS8e!nZ3aAif zU;v+^0ul#_f%@m%P;t`#*9GwmOOty2=71V%pgl4$^`J9WK;j@V5F4f*qz)twN=Kl5H8Az3q2`0cKx~-$ z`%rOE!w$5Lml5j6cTjPV7>Et?`%kDisPXp~i49uc2(lL>?hlP$&=>}&0SI$L6jU4} z24ch908$6i3u^Fz*E&MS=JKKHL1G{_Og%^)NIfV$dVtCesQPB8dXN~14O2f8Dh_HO zu7a{b4a9XwY)NQ30X5Xjplnd1$_dH_HNyOm*dRX04WI^DG*lc^Z-e+CaZvh9L=p$D z$!CK!p5{WuK@F*;P&TOX1ZsT2!hZu)93%!}!@?h2jzP;VP&vg2WrNZgj16vlL&ZU9 z9wrXz48ho-aV8iW-1dN~2aN;4#KCrf3PxCG2FeDT4`qWoRlCDcst+Fd9c zG-eMoA2db}V}r^;7#mc^!Pubm4P%4a889}e9EPz$uYaC(X;I+F@aZuiYiG#{>7#q~C zgRw#7IE)Qy-@(}6wYyMrz-xD*Y|uJRn3^4+juBM+2on1O5*t(>z|@1zv4pX|AgKW@ zZ-R+~_PM~=ptCk%Y!zk(1{m7_iEV?#_CR8XAh8pW*r2>d3j<6D zY{>u{T)?FcWClnVsFMj|!+I|0=7Hou>OgrLRNf$~n*$xo1j)nf1&w!u^nm7eK;j_t zKpkQb8-zh}APnkQf@qlgKy@mtLkLm_GY=#VVuQ*hkoXxc$leOjT3nD`kQ}If2DRNl z=7HP^Qm4m^eeH1^bX*an288pOA?G51*dPot14M(`UobX^znqzY0aT8G*dPp(1C3dO z+yHZ5ivZ-TB9Qx#$GdBxgDW7tApD-0fguMLm`HMz>% From bc256cc36d2d5cf9f3a2a5968063db2d8160a30b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 22 Sep 2016 17:54:19 +0800 Subject: [PATCH 051/179] components/bt: add library as submodule --- .gitmodules | 3 +++ components/bt/lib | 1 + 2 files changed, 4 insertions(+) create mode 160000 components/bt/lib diff --git a/.gitmodules b/.gitmodules index 1a0e6b94f1..df40848261 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "components/esptool_py/esptool"] path = components/esptool_py/esptool url = https://github.com/themadinventor/esptool.git +[submodule "components/bt/lib"] + path = components/bt/lib + url = https://github.com/espressif/esp32-bt-lib.git diff --git a/components/bt/lib b/components/bt/lib new file mode 160000 index 0000000000..3bee5393a9 --- /dev/null +++ b/components/bt/lib @@ -0,0 +1 @@ +Subproject commit 3bee5393a9dd84f53b7b28d5cb2479649f2cf838 From c6e1d0b30a0ded74459b211cf14772cbab9904a5 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 22 Sep 2016 18:36:23 +0800 Subject: [PATCH 052/179] Kconfig: make WiFi and BT mutually exclusive Also move memory map options from top-level Kconfig to esp32/Kconfig. --- Kconfig | 32 ---------------------- components/bt/Kconfig | 26 +++++++++--------- components/esp32/Kconfig | 58 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 68 insertions(+), 48 deletions(-) diff --git a/Kconfig b/Kconfig index 58ce77b2b5..73770a79a6 100644 --- a/Kconfig +++ b/Kconfig @@ -19,38 +19,6 @@ config PYTHON help The executable name/path that is used to run python. On some systems Python 2.x may need to be invoked as python2. - -config MEMMAP_BT - bool "Reserve space for Bluetooth stack" - default "n" - help - The Bluetooth stack uses memory that cannot be used as generic memory anymore. This - reserves the space for that within the memory map of the compiled binary. - -config MEMMAP_SMP - bool "Reserve memory for two cores" - default "y" - help - The ESP32 contains two cores. If you plan to only use one, you can disable this item - to save some memory. (ToDo: Make this automatically depend on unicore support) - -config MEMMAP_TRACEMEM - bool "Use TRAX tracing feature" - default "n" - help - The ESP32 contains a feature which allows you to trace the execution path the processor - has taken through the program. This is stored in a chunk of 32K (16K for single-processor) - of memory that can't be used for general purposes anymore. Disable this if you do not know - what this is. - -config MEMMAP_SPISRAM - bool "Use external SPI SRAM chip as main memory" - default "n" - help - The ESP32 can control an external SPI SRAM chip, adding the memory it contains to the - main memory map. Enable this if you have this hardware and want to use it in the same - way as on-chip RAM. - endmenu source "$COMPONENT_KCONFIGS_PROJBUILD" diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 90ef1f3eb6..ab163efc61 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -3,21 +3,21 @@ visible if MEMMAP_BT config BT_ENABLED - bool "Enable low-level BT stack" - depends on MEMMAP_BT + bool + depends on ESP32_ENABLE_STACK_BT help This compiles in the low-level BT stack. -config BT_BTLE - bool "Enable BTLE" - depends on BT_ENABLED - help - This compiles BTLE support - -config BT_BT - bool "Enable classic BT" - depends on BT_ENABLED - help - This enables classic BT support +#config BT_BTLE +# bool "Enable BTLE" +# depends on BT_ENABLED +# help +# This compiles BTLE support +# +#config BT_BT +# bool "Enable classic BT" +# depends on BT_ENABLED +# help +# This enables classic BT support endmenu diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 0ad32756e8..c649a0e317 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -20,13 +20,65 @@ config ESP32_DEFAULT_CPU_FREQ_MHZ default 160 if ESP32_DEFAULT_CPU_FREQ_160 default 240 if ESP32_DEFAULT_CPU_FREQ_240 -config WIFI_ENABLED - bool "Enable low-level WiFi stack" +choice ESP32_WIFI_OR_BT + prompt "Select stack to enable (WiFi or BT)" + default ESP32_ENABLE_WIFI + help + Temporarily, WiFi and BT stacks can not be used at the same time. + Select which stack to enable. + +config ESP32_ENABLE_STACK_WIFI + bool "WiFi" + select WIFI_ENABLED if ESP32_ENABLE_STACK_WIFI +config ESP32_ENABLE_STACK_BT + bool "BT" + select MEMMAP_BT if ESP32_ENABLE_STACK_BT + select BT_ENABLED if ESP32_ENABLE_STACK_BT +config ESP32_ENABLE_STACK_NONE + bool "None" +endchoice + +config MEMMAP_BT + bool + depends on ESP32_ENABLE_STACK_BT + help + The Bluetooth stack uses memory that cannot be used as generic memory anymore. This + reserves the space for that within the memory map of the compiled binary. + This option is required to enable BT stack. + Temporarily, this option is not compatible with WiFi stack. + +config MEMMAP_SMP + bool "Reserve memory for two cores" default "y" + help + The ESP32 contains two cores. If you plan to only use one, you can disable this item + to save some memory. (ToDo: Make this automatically depend on unicore support) + +config MEMMAP_TRACEMEM + bool "Use TRAX tracing feature" + default "n" + help + The ESP32 contains a feature which allows you to trace the execution path the processor + has taken through the program. This is stored in a chunk of 32K (16K for single-processor) + of memory that can't be used for general purposes anymore. Disable this if you do not know + what this is. + +config MEMMAP_SPISRAM + bool "Use external SPI SRAM chip as main memory" + default "n" + help + The ESP32 can control an external SPI SRAM chip, adding the memory it contains to the + main memory map. Enable this if you have this hardware and want to use it in the same + way as on-chip RAM. + +config WIFI_ENABLED + bool + default "y" + depends on ESP32_ENABLE_STACK_WIFI help This compiles in the low-level WiFi stack. - Temporarily, this option requires that FreeRTOS runs in single core mode. + Temporarily, this option is not compatible with BT stack. config WIFI_AUTO_STARTUP bool "Start WiFi with system startup" From 076141aab9eab081d6d06cde42695bb095a57607 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 22 Sep 2016 11:42:55 +0800 Subject: [PATCH 053/179] components/nvs: batch writes when possible Introduces new internal function, Page::alterEntryRangeState, which gathers changes to multiple elements of entry state table into a single write, provided that these changes fall into a single word. This allows changing state of up to 16 entries in a single write. Also adds new function, writeEntryData, which writes the whole payload of SZ and BLOB type entries in one go, instead of splitting it into multiple 32-byte writes. This reduces number of writes required for SZ and BLOB entries. --- components/nvs_flash/src/nvs_page.cpp | 99 +++++++++++++---- components/nvs_flash/src/nvs_page.hpp | 4 + components/nvs_flash/src/nvs_storage.cpp | 3 + components/nvs_flash/test/test_nvs.cpp | 132 ++++++++++++++++++++++- 4 files changed, 210 insertions(+), 28 deletions(-) diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index ae067078c6..c20a23677a 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -108,6 +108,27 @@ esp_err_t Page::writeEntry(const Item& item) return ESP_OK; } + +esp_err_t Page::writeEntryData(const uint8_t* data, size_t size) +{ + assert(size % ENTRY_SIZE == 0); + assert(mNextFreeEntry != INVALID_ENTRY); + assert(mFirstUsedEntry != INVALID_ENTRY); + const uint16_t count = size / ENTRY_SIZE; + + auto rc = spi_flash_write(getEntryAddress(mNextFreeEntry), reinterpret_cast(data), static_cast(size)); + if (rc != ESP_OK) { + mState = PageState::INVALID; + return rc; + } + auto err = alterEntryRangeState(mNextFreeEntry, mNextFreeEntry + count, EntryState::WRITTEN); + if (err != ESP_OK) { + return err; + } + mUsedEntryCount += count; + mNextFreeEntry += count; + return ESP_OK; +} esp_err_t Page::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, const void* data, size_t dataSize) { @@ -170,13 +191,18 @@ esp_err_t Page::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, c return err; } - size_t left = dataSize; - while (left != 0) { - size_t willWrite = Page::ENTRY_SIZE; - willWrite = (left < willWrite)?left:willWrite; - memcpy(item.rawData, src, willWrite); - src += willWrite; - left -= willWrite; + size_t left = dataSize / ENTRY_SIZE * ENTRY_SIZE; + if (left > 0) { + err = writeEntryData(static_cast(data), left); + if (err != ESP_OK) { + return err; + } + } + + size_t tail = dataSize - left; + if (tail > 0) { + std::fill_n(item.rawData, ENTRY_SIZE / 4, 0xffffffff); + memcpy(item.rawData, static_cast(data) + left, tail); err = writeEntry(item); if (err != ESP_OK) { return err; @@ -290,12 +316,16 @@ esp_err_t Page::eraseEntryAndSpan(size_t index) if (mEntryTable.get(i) == EntryState::WRITTEN) { --mUsedEntryCount; } - rc = alterEntryState(i, EntryState::ERASED); - if (rc != ESP_OK) { - return rc; - } ++mErasedEntryCount; } + if (span == 1) { + rc = alterEntryState(index, EntryState::ERASED); + } else { + rc = alterEntryRangeState(index, index + span, EntryState::ERASED); + } + if (rc != ESP_OK) { + return rc; + } } } else { @@ -372,17 +402,7 @@ esp_err_t Page::moveItem(Page& other) return err; } } - for (size_t i = mFirstUsedEntry; i < end; ++i) { - err = eraseEntry(i); - if (err != ESP_OK) { - return err; - } - } - updateFirstUsedEntry(mFirstUsedEntry, span); - mErasedEntryCount += span; - mUsedEntryCount -= span; - - return ESP_OK; + return eraseEntryAndSpan(mFirstUsedEntry); } esp_err_t Page::mLoadEntryTable() @@ -427,7 +447,7 @@ esp_err_t Page::mLoadEntryTable() // but before the entry state table was altered, the entry locacted via // entry state table may actually be half-written. // this is easy to check by reading EntryHeader (i.e. first word) - if (mNextFreeEntry != INVALID_ENTRY) { + while (mNextFreeEntry < ENTRY_COUNT) { uint32_t entryAddress = getEntryAddress(mNextFreeEntry); uint32_t header; auto rc = spi_flash_read(entryAddress, &header, sizeof(header)); @@ -436,12 +456,20 @@ esp_err_t Page::mLoadEntryTable() return rc; } if (header != 0xffffffff) { + auto oldState = mEntryTable.get(mNextFreeEntry); auto err = alterEntryState(mNextFreeEntry, EntryState::ERASED); if (err != ESP_OK) { mState = PageState::INVALID; return err; } ++mNextFreeEntry; + if (oldState == EntryState::WRITTEN) { + --mUsedEntryCount; + } + ++mErasedEntryCount; + } + else { + break; } } @@ -573,6 +601,31 @@ esp_err_t Page::alterEntryState(size_t index, EntryState state) return ESP_OK; } +esp_err_t Page::alterEntryRangeState(size_t begin, size_t end, EntryState state) +{ + assert(end <= ENTRY_COUNT); + assert(end > begin); + size_t wordIndex = mEntryTable.getWordIndex(end - 1); + for (ptrdiff_t i = end - 1; i >= static_cast(begin); --i) { + mEntryTable.set(i, state); + size_t nextWordIndex; + if (i == static_cast(begin)) { + nextWordIndex = (size_t) -1; + } else { + nextWordIndex = mEntryTable.getWordIndex(i - 1); + } + if (nextWordIndex != wordIndex) { + uint32_t word = mEntryTable.data()[wordIndex]; + auto rc = spi_flash_write(mBaseAddress + ENTRY_TABLE_OFFSET + static_cast(wordIndex) * 4, &word, 4); + if (rc != ESP_OK) { + return rc; + } + } + wordIndex = nextWordIndex; + } + return ESP_OK; +} + esp_err_t Page::alterPageState(PageState state) { auto rc = spi_flash_write(mBaseAddress, reinterpret_cast(&state), sizeof(state)); diff --git a/components/nvs_flash/src/nvs_page.hpp b/components/nvs_flash/src/nvs_page.hpp index 9598263539..d6fb68f760 100644 --- a/components/nvs_flash/src/nvs_page.hpp +++ b/components/nvs_flash/src/nvs_page.hpp @@ -194,11 +194,15 @@ protected: esp_err_t alterEntryState(size_t index, EntryState state); + esp_err_t alterEntryRangeState(size_t begin, size_t end, EntryState state); + esp_err_t alterPageState(PageState state); esp_err_t readEntry(size_t index, Item& dst) const; esp_err_t writeEntry(const Item& item); + + esp_err_t writeEntryData(const uint8_t* data, size_t size); esp_err_t eraseEntry(size_t index); diff --git a/components/nvs_flash/src/nvs_storage.cpp b/components/nvs_flash/src/nvs_storage.cpp index 9be6580a1d..e60b1df551 100644 --- a/components/nvs_flash/src/nvs_storage.cpp +++ b/components/nvs_flash/src/nvs_storage.cpp @@ -234,6 +234,7 @@ void Storage::debugCheck() for (auto p = mPageManager.begin(); p != mPageManager.end(); ++p) { size_t itemIndex = 0; + size_t usedCount = 0; Item item; while (p->findItem(Page::NS_ANY, ItemType::ANY, nullptr, itemIndex, item) == ESP_OK) { std::stringstream keyrepr; @@ -246,7 +247,9 @@ void Storage::debugCheck() } keys.insert(std::make_pair(keystr, static_cast(p))); itemIndex += item.span; + usedCount += item.span; } + assert(usedCount == p->getUsedEntryCount()); } } #endif //ESP_PLATFORM diff --git a/components/nvs_flash/test/test_nvs.cpp b/components/nvs_flash/test/test_nvs.cpp index 325cdcf45b..c496a09fd4 100644 --- a/components/nvs_flash/test/test_nvs.cpp +++ b/components/nvs_flash/test/test_nvs.cpp @@ -443,18 +443,140 @@ TEST_CASE("wifi test", "[nvs]") SpiFlashEmulator emu(10); emu.randomize(10); - nvs_handle handle; + const uint32_t NVS_FLASH_SECTOR = 5; const uint32_t NVS_FLASH_SECTOR_COUNT_MIN = 3; emu.setBounds(NVS_FLASH_SECTOR, NVS_FLASH_SECTOR + NVS_FLASH_SECTOR_COUNT_MIN); TEST_ESP_OK(nvs_flash_init(NVS_FLASH_SECTOR, NVS_FLASH_SECTOR_COUNT_MIN)); - TEST_ESP_OK(nvs_open("nvs.net80211", NVS_READWRITE, &handle)); + nvs_handle misc_handle; + TEST_ESP_OK(nvs_open("nvs.net80211", NVS_READWRITE, &misc_handle)); + char log[33]; + size_t log_size = sizeof(log); + TEST_ESP_ERR(nvs_get_str(misc_handle, "log", log, &log_size), ESP_ERR_NVS_NOT_FOUND); + strcpy(log, "foobarbazfizzz"); + TEST_ESP_OK(nvs_set_str(misc_handle, "log", log)); + + nvs_handle net80211_handle; + TEST_ESP_OK(nvs_open("nvs.net80211", NVS_READWRITE, &net80211_handle)); uint8_t opmode = 2; - if (nvs_get_u8(handle, "wifi.opmode", &opmode) != ESP_OK) { - TEST_ESP_OK(nvs_set_u8(handle, "wifi.opmode", opmode)); - } + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "wifi.opmode", &opmode), ESP_ERR_NVS_NOT_FOUND); + + TEST_ESP_OK(nvs_set_u8(net80211_handle, "wifi.opmode", opmode)); + + uint8_t country = 0; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "wifi.country", &opmode), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "wifi.country", opmode)); + + char ssid[36]; + size_t size = sizeof(ssid); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.ssid", ssid, &size), ESP_ERR_NVS_NOT_FOUND); + strcpy(ssid, "my android AP"); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.ssid", ssid, size)); + + char mac[6]; + size = sizeof(mac); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.mac", mac, &size), ESP_ERR_NVS_NOT_FOUND); + memset(mac, 0xab, 6); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.mac", mac, size)); + + uint8_t authmode = 1; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "sta.authmode", &authmode), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "sta.authmode", authmode)); + + char pswd[65]; + size = sizeof(pswd); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.pswd", pswd, &size), ESP_ERR_NVS_NOT_FOUND); + strcpy(pswd, "`123456788990-="); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.pswd", pswd, size)); + + char pmk[32]; + size = sizeof(pmk); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.pmk", pmk, &size), ESP_ERR_NVS_NOT_FOUND); + memset(pmk, 1, size); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.pmk", pmk, size)); + + uint8_t chan = 1; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "sta.chan", &chan), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "sta.chan", chan)); + + uint8_t autoconn = 1; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "auto.conn", &autoconn), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "auto.conn", autoconn)); + + uint8_t bssid_set = 1; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "bssid.set", &bssid_set), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "bssid.set", bssid_set)); + + char bssid[6]; + size = sizeof(bssid); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.bssid", bssid, &size), ESP_ERR_NVS_NOT_FOUND); + memset(mac, 0xcd, 6); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.bssid", bssid, size)); + + uint8_t phym = 3; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "sta.phym", &phym), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "sta.phym", phym)); + + uint8_t phybw = 2; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "sta.phybw", &phybw), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "sta.phybw", phybw)); + + char apsw[2]; + size = sizeof(apsw); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.apsw", apsw, &size), ESP_ERR_NVS_NOT_FOUND); + memset(apsw, 0x2, size); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.apsw", apsw, size)); + + char apinfo[700]; + size = sizeof(apinfo); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "sta.apinfo", apinfo, &size), ESP_ERR_NVS_NOT_FOUND); + memset(apinfo, 0, size); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "sta.apinfo", apinfo, size)); + + size = sizeof(ssid); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "ap.ssid", ssid, &size), ESP_ERR_NVS_NOT_FOUND); + strcpy(ssid, "ESP_A2F340"); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "ap.ssid", ssid, size)); + + size = sizeof(mac); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "ap.mac", mac, &size), ESP_ERR_NVS_NOT_FOUND); + memset(mac, 0xac, 6); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "ap.mac", mac, size)); + + size = sizeof(pswd); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "ap.passwd", pswd, &size), ESP_ERR_NVS_NOT_FOUND); + strcpy(pswd, ""); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "ap.passwd", pswd, size)); + + size = sizeof(pmk); + TEST_ESP_ERR(nvs_get_blob(net80211_handle, "ap.pmk", pmk, &size), ESP_ERR_NVS_NOT_FOUND); + memset(pmk, 1, size); + TEST_ESP_OK(nvs_set_blob(net80211_handle, "ap.pmk", pmk, size)); + + chan = 6; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "ap.chan", &chan), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "ap.chan", chan)); + + authmode = 0; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "ap.authmode", &authmode), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "ap.authmode", authmode)); + + uint8_t hidden = 0; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "ap.hidden", &hidden), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "ap.hidden", hidden)); + + uint8_t max_conn = 4; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "ap.max.conn", &max_conn), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "ap.max.conn", max_conn)); + + uint8_t bcn_interval = 2; + TEST_ESP_ERR(nvs_get_u8(net80211_handle, "bcn_interval", &bcn_interval), ESP_ERR_NVS_NOT_FOUND); + TEST_ESP_OK(nvs_set_u8(net80211_handle, "bcn_interval", bcn_interval)); + + s_perf << "Time to simulate nvs init with wifi libs: " << emu.getTotalTime() << " us (" << emu.getEraseOps() << "E " << emu.getWriteOps() << "W " << emu.getReadOps() << "R " << emu.getWriteBytes() << "Wb " << emu.getReadBytes() << "Rb)" << std::endl; + } From e87d80d4785998a04c6d70efa766928451f08407 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 22 Sep 2016 21:05:47 +0800 Subject: [PATCH 054/179] components/nvs: fix formatting --- components/nvs_flash/src/nvs_api.cpp | 18 ++--- .../nvs_flash/src/nvs_item_hash_list.cpp | 21 +++--- .../nvs_flash/src/nvs_item_hash_list.hpp | 23 +++--- components/nvs_flash/src/nvs_page.cpp | 73 +++++++++---------- components/nvs_flash/src/nvs_page.hpp | 18 +++-- components/nvs_flash/src/nvs_pagemanager.cpp | 19 +++-- components/nvs_flash/src/nvs_pagemanager.hpp | 2 +- components/nvs_flash/src/nvs_storage.cpp | 9 +-- components/nvs_flash/src/nvs_storage.hpp | 2 +- components/nvs_flash/src/nvs_types.hpp | 6 +- 10 files changed, 89 insertions(+), 102 deletions(-) diff --git a/components/nvs_flash/src/nvs_api.cpp b/components/nvs_flash/src/nvs_api.cpp index f9292e680e..fb9faf984a 100644 --- a/components/nvs_flash/src/nvs_api.cpp +++ b/components/nvs_flash/src/nvs_api.cpp @@ -20,15 +20,15 @@ class HandleEntry : public intrusive_list_node { public: - HandleEntry(){} - + HandleEntry() {} + HandleEntry(nvs_handle handle, bool readOnly, uint8_t nsIndex) : - mHandle(handle), - mReadOnly(readOnly), - mNsIndex(nsIndex) + mHandle(handle), + mReadOnly(readOnly), + mNsIndex(nsIndex) { } - + nvs_handle mHandle; uint8_t mReadOnly; uint8_t mNsIndex; @@ -263,12 +263,10 @@ static esp_err_t nvs_get_str_or_blob(nvs_handle handle, nvs::ItemType type, cons if (length == nullptr) { return ESP_ERR_NVS_INVALID_LENGTH; - } - else if (out_value == nullptr) { + } else if (out_value == nullptr) { *length = dataSize; return ESP_OK; - } - else if (*length < dataSize) { + } else if (*length < dataSize) { *length = dataSize; return ESP_ERR_NVS_INVALID_LENGTH; } diff --git a/components/nvs_flash/src/nvs_item_hash_list.cpp b/components/nvs_flash/src/nvs_item_hash_list.cpp index 1d5a6ae06a..7fa019dffe 100644 --- a/components/nvs_flash/src/nvs_item_hash_list.cpp +++ b/components/nvs_flash/src/nvs_item_hash_list.cpp @@ -16,7 +16,7 @@ namespace nvs { - + HashList::~HashList() { for (auto it = mBlockList.begin(); it != mBlockList.end();) { @@ -26,13 +26,13 @@ HashList::~HashList() delete static_cast(tmp); } } - + HashList::HashListBlock::HashListBlock() { static_assert(sizeof(HashListBlock) == HashListBlock::BYTE_SIZE, "cache block size calculation incorrect"); } - + void HashList::insert(const Item& item, size_t index) { const uint32_t hash_24 = item.calculateCrc32WithoutValue() & 0xffffff; @@ -53,8 +53,7 @@ void HashList::insert(const Item& item, size_t index) void HashList::erase(size_t index) { - for (auto it = std::begin(mBlockList); it != std::end(mBlockList);) - { + for (auto it = std::begin(mBlockList); it != std::end(mBlockList);) { bool haveEntries = false; for (size_t i = 0; i < it->mCount; ++i) { if (it->mNodes[i].mIndex == index) { @@ -70,8 +69,7 @@ void HashList::erase(size_t index) ++it; mBlockList.erase(tmp); delete static_cast(tmp); - } - else { + } else { ++it; } } @@ -81,13 +79,12 @@ void HashList::erase(size_t index) size_t HashList::find(size_t start, const Item& item) { const uint32_t hash_24 = item.calculateCrc32WithoutValue() & 0xffffff; - for (auto it = std::begin(mBlockList); it != std::end(mBlockList); ++it) - { + for (auto it = std::begin(mBlockList); it != std::end(mBlockList); ++it) { for (size_t index = 0; index < it->mCount; ++index) { HashListNode& e = it->mNodes[index]; if (e.mIndex >= start && - e.mHash == hash_24 && - e.mIndex != 0xff) { + e.mHash == hash_24 && + e.mIndex != 0xff) { return e.mIndex; } } @@ -95,5 +92,5 @@ size_t HashList::find(size_t start, const Item& item) return SIZE_MAX; } - + } // namespace nvs diff --git a/components/nvs_flash/src/nvs_item_hash_list.hpp b/components/nvs_flash/src/nvs_item_hash_list.hpp index 0139c1bbd6..b40a53d615 100644 --- a/components/nvs_flash/src/nvs_item_hash_list.hpp +++ b/components/nvs_flash/src/nvs_item_hash_list.hpp @@ -29,36 +29,35 @@ public: void insert(const Item& item, size_t index); void erase(const size_t index); size_t find(size_t start, const Item& item); - + protected: - + struct HashListNode { HashListNode() : - mIndex(0xff), mHash(0) + mIndex(0xff), mHash(0) { } - + HashListNode(uint32_t hash, size_t index) : - mIndex((uint32_t) index), mHash(hash) + mIndex((uint32_t) index), mHash(hash) { } - + uint32_t mIndex : 8; uint32_t mHash : 24; }; - - struct HashListBlock : public intrusive_list_node - { + + struct HashListBlock : public intrusive_list_node { HashListBlock(); - + static const size_t BYTE_SIZE = 128; static const size_t ENTRY_COUNT = (BYTE_SIZE - sizeof(intrusive_list_node) - sizeof(size_t)) / 4; - + size_t mCount = 0; HashListNode mNodes[ENTRY_COUNT]; }; - + typedef intrusive_list TBlockList; TBlockList mBlockList; }; // class HashList diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index c20a23677a..fed45d34da 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -29,7 +29,7 @@ uint32_t Page::Header::calculateCrc32() reinterpret_cast(this) + offsetof(Header, mSeqNumber), offsetof(Header, mCrc32) - offsetof(Header, mSeqNumber)); } - + esp_err_t Page::load(uint32_t sectorNumber) { mBaseAddress = sectorNumber * SEC_SIZE; @@ -59,15 +59,13 @@ esp_err_t Page::load(uint32_t sectorNumber) break; } } - } - else if (header.mCrc32 != header.calculateCrc32()) { + } else if (header.mCrc32 != header.calculateCrc32()) { header.mState = PageState::CORRUPT; - } - else { + } else { mState = header.mState; mSeqNumber = header.mSeqNumber; } - + switch (mState) { case PageState::UNINITIALIZED: break; @@ -172,7 +170,7 @@ esp_err_t Page::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, c size_t span = (totalSize + ENTRY_SIZE - 1) / ENTRY_SIZE; item = Item(nsIndex, datatype, span, key); mHashList.insert(item, mNextFreeEntry); - + if (datatype != ItemType::SZ && datatype != ItemType::BLOB) { memcpy(item.data, data, dataSize); item.crc32 = item.calculateCrc32(); @@ -208,6 +206,7 @@ esp_err_t Page::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, c return err; } } + } return ESP_OK; } @@ -283,21 +282,21 @@ esp_err_t Page::eraseEntry(size_t index) { auto state = mEntryTable.get(index); assert(state == EntryState::WRITTEN || state == EntryState::EMPTY); - + auto rc = alterEntryState(index, EntryState::ERASED); if (rc != ESP_OK) { return rc; } - + return ESP_OK; } - + esp_err_t Page::eraseEntryAndSpan(size_t index) { auto state = mEntryTable.get(index); assert(state == EntryState::WRITTEN || state == EntryState::EMPTY); mHashList.erase(index); - + size_t span = 1; if (state == EntryState::WRITTEN) { Item item; @@ -327,8 +326,7 @@ esp_err_t Page::eraseEntryAndSpan(size_t index) return rc; } } - } - else { + } else { auto rc = alterEntryState(index, EntryState::ERASED); if (rc != ESP_OK) { return rc; @@ -338,7 +336,7 @@ esp_err_t Page::eraseEntryAndSpan(size_t index) if (index == mFirstUsedEntry) { updateFirstUsedEntry(index, span); } - + if (index + span > mNextFreeEntry) { mNextFreeEntry = index + span; } @@ -361,7 +359,7 @@ void Page::updateFirstUsedEntry(size_t index, size_t span) } } } - + esp_err_t Page::moveItem(Page& other) { if (mFirstUsedEntry == INVALID_ENTRY) { @@ -371,7 +369,7 @@ esp_err_t Page::moveItem(Page& other) if (mFindInfo.itemIndex() == mFirstUsedEntry) { invalidateCache(); } - + if (other.mState == PageState::UNINITIALIZED) { auto err = other.initialize(); if (err != ESP_OK) { @@ -392,9 +390,9 @@ esp_err_t Page::moveItem(Page& other) size_t span = entry.span; size_t end = mFirstUsedEntry + span; - + assert(mFirstUsedEntry != INVALID_ENTRY || span == 1); - + for (size_t i = mFirstUsedEntry + 1; i < end; ++i) { readEntry(i, entry); err = other.writeEntry(entry); @@ -485,7 +483,7 @@ esp_err_t Page::mLoadEntryTable() lastItemIndex = INVALID_ENTRY; continue; } - + lastItemIndex = i; auto err = readEntry(i, item); @@ -502,7 +500,7 @@ esp_err_t Page::mLoadEntryTable() } continue; } - + mHashList.insert(item, i); if (item.datatype != ItemType::BLOB && item.datatype != ItemType::SZ) { @@ -523,7 +521,7 @@ esp_err_t Page::mLoadEntryTable() } i += span - 1; } - + // check that last item is not duplicate if (lastItemIndex != INVALID_ENTRY) { size_t findItemIndex = 0; @@ -538,8 +536,7 @@ esp_err_t Page::mLoadEntryTable() } } } - } - else if (mState == PageState::FULL || mState == PageState::FREEING) { + } else if (mState == PageState::FULL || mState == PageState::FREEING) { // We have already filled mHashList for page in active state. // Do the same for the case when page is in full or freeing state. Item item; @@ -547,15 +544,15 @@ esp_err_t Page::mLoadEntryTable() if (mEntryTable.get(i) != EntryState::WRITTEN) { continue; } - + auto err = readEntry(i, item); if (err != ESP_OK) { mState = PageState::INVALID; return err; } - + mHashList.insert(item, i); - + size_t span = item.span; i += span - 1; } @@ -574,7 +571,7 @@ esp_err_t Page::initialize() header.mState = mState; header.mSeqNumber = mSeqNumber; header.mCrc32 = header.calculateCrc32(); - + auto rc = spi_flash_write(mBaseAddress, reinterpret_cast(&header), sizeof(header)); if (rc != ESP_OK) { mState = PageState::INVALID; @@ -651,7 +648,7 @@ esp_err_t Page::findItem(uint8_t nsIndex, ItemType datatype, const char* key, si if (mState == PageState::CORRUPT || mState == PageState::INVALID || mState == PageState::UNINITIALIZED) { return ESP_ERR_NVS_NOT_FOUND; } - + if (itemIndex >= ENTRY_COUNT) { return ESP_ERR_NVS_NOT_FOUND; } @@ -665,22 +662,21 @@ esp_err_t Page::findItem(uint8_t nsIndex, ItemType datatype, const char* key, si if (itemIndex > mFirstUsedEntry && itemIndex < ENTRY_COUNT) { start = itemIndex; } - + size_t end = mNextFreeEntry; if (end > ENTRY_COUNT) { end = ENTRY_COUNT; } - + if (nsIndex != NS_ANY && datatype != ItemType::ANY && key != NULL) { size_t cachedIndex = mHashList.find(start, Item(nsIndex, datatype, 0, key)); if (cachedIndex < ENTRY_COUNT) { start = cachedIndex; - } - else { + } else { return ESP_ERR_NVS_NOT_FOUND; } } - + size_t next; for (size_t i = start; i < end; i = next) { next = i + 1; @@ -783,7 +779,7 @@ void Page::invalidateCache() { mFindInfo = CachedFindInfo(); } - + void Page::debugDump() const { printf("state=%x addr=%x seq=%d\nfirstUsed=%d nextFree=%d used=%d erased=%d\n", mState, mBaseAddress, mSeqNumber, static_cast(mFirstUsedEntry), static_cast(mNextFreeEntry), mUsedEntryCount, mErasedEntryCount); @@ -793,18 +789,15 @@ void Page::debugDump() const EntryState state = mEntryTable.get(i); if (state == EntryState::EMPTY) { printf("E\n"); - } - else if (state == EntryState::ERASED) { + } else if (state == EntryState::ERASED) { printf("X\n"); - } - else if (state == EntryState::WRITTEN) { + } else if (state == EntryState::WRITTEN) { Item item; readEntry(i, item); if (skip == 0) { printf("W ns=%2u type=%2u span=%3u key=\"%s\"\n", item.nsIndex, static_cast(item.datatype), item.span, item.key); skip = item.span - 1; - } - else { + } else { printf("D\n"); skip--; } diff --git a/components/nvs_flash/src/nvs_page.hpp b/components/nvs_flash/src/nvs_page.hpp index d6fb68f760..63b1c4033a 100644 --- a/components/nvs_flash/src/nvs_page.hpp +++ b/components/nvs_flash/src/nvs_page.hpp @@ -162,25 +162,27 @@ public: esp_err_t erase(); void invalidateCache(); - + void debugDump() const; protected: - class Header { + class Header + { public: - Header() { + Header() + { std::fill_n(mReserved, sizeof(mReserved)/sizeof(mReserved[0]), UINT32_MAX); } - + PageState mState; // page state uint32_t mSeqNumber; // sequence number of this page uint32_t mReserved[5]; // unused, must be 0xffffffff uint32_t mCrc32; // crc of everything except mState - + uint32_t calculateCrc32(); }; - + enum class EntryState { EMPTY = 0x3, // 0b11, default state after flash erase WRITTEN = EMPTY & ~ESB_WRITTEN, // entry was written @@ -205,9 +207,9 @@ protected: esp_err_t writeEntryData(const uint8_t* data, size_t size); esp_err_t eraseEntry(size_t index); - + esp_err_t eraseEntryAndSpan(size_t index); - + void updateFirstUsedEntry(size_t index, size_t span); static constexpr size_t getAlignmentForType(ItemType type) diff --git a/components/nvs_flash/src/nvs_pagemanager.cpp b/components/nvs_flash/src/nvs_pagemanager.cpp index c0e904e35c..790ab7e19f 100644 --- a/components/nvs_flash/src/nvs_pagemanager.cpp +++ b/components/nvs_flash/src/nvs_pagemanager.cpp @@ -47,13 +47,12 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount) if (mPageList.empty()) { mSeqNumber = 0; return activatePage(); - } - else { + } else { uint32_t lastSeqNo; assert(mPageList.back().getSeqNumber(lastSeqNo) == ESP_OK); mSeqNumber = lastSeqNo + 1; } - + // if power went out after a new item for the given key was written, // but before the old one was erased, we end up with a duplicate item Page& lastPage = back(); @@ -64,7 +63,7 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount) itemIndex += item.span; lastItemIndex = itemIndex; } - + if (lastItemIndex != SIZE_MAX) { auto last = PageManager::TPageListIterator(&lastPage); for (auto it = begin(); it != last; ++it) { @@ -78,7 +77,7 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount) for (auto it = begin(); it!= end(); ++it) { if (it->state() == Page::PageState::FREEING) { Page* newPage = &mPageList.back(); - if(newPage->state() != Page::PageState::ACTIVE) { + if (newPage->state() != Page::PageState::ACTIVE) { auto err = activatePage(); if (err != ESP_OK) { return err; @@ -93,12 +92,12 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount) return err; } } - + auto err = it->erase(); if (err != ESP_OK) { return err; } - + Page* p = static_cast(it); mPageList.erase(it); mFreePageList.push_back(p); @@ -139,7 +138,7 @@ esp_err_t PageManager::requestNewPage() if (err != ESP_OK) { return err; } - + Page* newPage = &mPageList.back(); Page* erasedPage = maxErasedItemsPageIt; @@ -161,7 +160,7 @@ esp_err_t PageManager::requestNewPage() if (err != ESP_OK) { return err; } - + assert(usedEntries == newPage->getUsedEntryCount()); mPageList.erase(maxErasedItemsPageIt); @@ -188,5 +187,5 @@ esp_err_t PageManager::activatePage() ++mSeqNumber; return ESP_OK; } - + } // namespace nvs diff --git a/components/nvs_flash/src/nvs_pagemanager.hpp b/components/nvs_flash/src/nvs_pagemanager.hpp index 3484e70a18..10c545f0ff 100644 --- a/components/nvs_flash/src/nvs_pagemanager.hpp +++ b/components/nvs_flash/src/nvs_pagemanager.hpp @@ -52,7 +52,7 @@ public: protected: friend class Iterator; - + esp_err_t activatePage(); TPageList mPageList; diff --git a/components/nvs_flash/src/nvs_storage.cpp b/components/nvs_flash/src/nvs_storage.cpp index e60b1df551..7415ed62c3 100644 --- a/components/nvs_flash/src/nvs_storage.cpp +++ b/components/nvs_flash/src/nvs_storage.cpp @@ -51,7 +51,7 @@ esp_err_t Storage::init(uint32_t baseSector, uint32_t sectorCount) Page& p = *it; size_t itemIndex = 0; Item item; - while(p.findItem(Page::NS_INDEX, ItemType::U8, nullptr, itemIndex, item) == ESP_OK) { + while (p.findItem(Page::NS_INDEX, ItemType::U8, nullptr, itemIndex, item) == ESP_OK) { NamespaceEntry* entry = new NamespaceEntry; item.getKey(entry->mName, sizeof(entry->mName) - 1); item.getValue(entry->mIndex); @@ -103,14 +103,13 @@ esp_err_t Storage::writeItem(uint8_t nsIndex, ItemType datatype, const char* key if (err != ESP_OK) { return err; } - } - else if (err != ESP_OK) { + } else if (err != ESP_OK) { return err; } if (findPage) { if (findPage->state() == Page::PageState::UNINITIALIZED || - findPage->state() == Page::PageState::INVALID) { + findPage->state() == Page::PageState::INVALID) { auto err = findItem(nsIndex, datatype, key, findPage, item); assert(err == ESP_OK); } @@ -158,7 +157,7 @@ esp_err_t Storage::createOrOpenNamespace(const char* nsName, bool canCreate, uin } mNamespaceUsage.set(ns, true); nsIndex = ns; - + NamespaceEntry* entry = new NamespaceEntry; entry->mIndex = ns; strncpy(entry->mName, nsName, sizeof(entry->mName) - 1); diff --git a/components/nvs_flash/src/nvs_storage.hpp b/components/nvs_flash/src/nvs_storage.hpp index 3a05c32668..f99e6fbbc9 100644 --- a/components/nvs_flash/src/nvs_storage.hpp +++ b/components/nvs_flash/src/nvs_storage.hpp @@ -74,7 +74,7 @@ public: { return eraseItem(nsIndex, itemTypeOf(), key); } - + void debugDump(); void debugCheck(); diff --git a/components/nvs_flash/src/nvs_types.hpp b/components/nvs_flash/src/nvs_types.hpp index 23b4ba7f74..5306744b5f 100644 --- a/components/nvs_flash/src/nvs_types.hpp +++ b/components/nvs_flash/src/nvs_types.hpp @@ -76,9 +76,9 @@ public: }; static const size_t MAX_KEY_LENGTH = sizeof(key) - 1; - + Item(uint8_t nsIndex, ItemType datatype, uint8_t span, const char* key_) - : nsIndex(nsIndex), datatype(datatype), span(span), reserved(0xff) + : nsIndex(nsIndex), datatype(datatype), span(span), reserved(0xff) { std::fill_n(reinterpret_cast(key), sizeof(key) / 4, 0xffffffff); std::fill_n(reinterpret_cast(data), sizeof(data) / 4, 0xffffffff); @@ -89,7 +89,7 @@ public: key[0] = 0; } } - + Item() { } From 5383af1e2edc4ae955d84e25c4da81d3904fbf88 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Thu, 22 Sep 2016 21:15:54 +0800 Subject: [PATCH 055/179] BLE ADV Demo --- examples/04_ble_adv/LICENSE | 202 +++++++++++++++++++++++++ examples/04_ble_adv/Makefile | 9 ++ examples/04_ble_adv/README.rst | 6 + examples/04_ble_adv/main/app_bt.c | 203 ++++++++++++++++++++++++++ examples/04_ble_adv/main/component.mk | 10 ++ 5 files changed, 430 insertions(+) create mode 100644 examples/04_ble_adv/LICENSE create mode 100644 examples/04_ble_adv/Makefile create mode 100644 examples/04_ble_adv/README.rst create mode 100755 examples/04_ble_adv/main/app_bt.c create mode 100644 examples/04_ble_adv/main/component.mk diff --git a/examples/04_ble_adv/LICENSE b/examples/04_ble_adv/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/examples/04_ble_adv/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/examples/04_ble_adv/Makefile b/examples/04_ble_adv/Makefile new file mode 100644 index 0000000000..cea72c6f02 --- /dev/null +++ b/examples/04_ble_adv/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := ble_adv + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/04_ble_adv/README.rst b/examples/04_ble_adv/README.rst new file mode 100644 index 0000000000..5e9ff15c5c --- /dev/null +++ b/examples/04_ble_adv/README.rst @@ -0,0 +1,6 @@ +ESP-IDF ble_advertising app +==================== + +This is a BLE advertising demo with virtual HCI interface. Send Reset/ADV_PARAM/ADV_DATA/ADV_ENABLE HCI command for BLE advertising. + + diff --git a/examples/04_ble_adv/main/app_bt.c b/examples/04_ble_adv/main/app_bt.c new file mode 100755 index 0000000000..8449accd64 --- /dev/null +++ b/examples/04_ble_adv/main/app_bt.c @@ -0,0 +1,203 @@ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "bt.h" +#include + +#define HCI_H4_CMD_PREAMBLE_SIZE (4) + +/* HCI Command opcode group field(OGF) */ +#define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10) /* 0x0C00 */ +#define HCI_GRP_BLE_CMDS (0x08 << 10) + +#define HCI_RESET (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS) +#define HCI_BLE_WRITE_ADV_ENABLE (0x000A | HCI_GRP_BLE_CMDS) +#define HCI_BLE_WRITE_ADV_PARAMS (0x0006 | HCI_GRP_BLE_CMDS) +#define HCI_BLE_WRITE_ADV_DATA (0x0008 | HCI_GRP_BLE_CMDS) + +#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE (1) +#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS (15) +#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA (31) + +#define BD_ADDR_LEN (6) /* Device address length */ +typedef uint8_t bd_addr_t[BD_ADDR_LEN]; /* Device address */ + +#define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);} +#define UINT8_TO_STREAM(p, u8) {*(p)++ = (uint8_t)(u8);} +#define BDADDR_TO_STREAM(p, a) {int ijk; for (ijk = 0; ijk < BD_ADDR_LEN; ijk++) *(p)++ = (uint8_t) a[BD_ADDR_LEN - 1 - ijk];} +#define ARRAY_TO_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (uint8_t) a[ijk];} + +enum { + H4_TYPE_COMMAND = 1, + H4_TYPE_ACL = 2, + H4_TYPE_SCO = 3, + H4_TYPE_EVENT = 4 +}; + +static uint8_t hci_cmd_buf[128]; + +/* + * @brief: BT controller callback function, used to notify the upper layer that + * controller is ready to receive command + */ +static void controller_rcv_pkt_ready(void) +{ + printf("controller rcv pkt ready\n"); +} + +/* + * @brief: BT controller callback function, to transfer data packet to upper + * controller is ready to receive command + */ +static int host_rcv_pkt(uint8_t *data, uint16_t len) +{ + printf("host rcv pkt: "); + for (uint16_t i=0; i 0) { + if (data_len > HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA) + data_len = HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA; + + UINT8_TO_STREAM (buf, data_len); + + ARRAY_TO_STREAM (buf, p_data, data_len); + } + return HCI_H4_CMD_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1; +} + +static void hci_cmd_send_reset(void) +{ + uint16_t sz = make_cmd_reset (hci_cmd_buf); + API_vhci_host_send_packet(hci_cmd_buf, sz); +} + +static void hci_cmd_send_ble_adv_start(void) +{ + uint16_t sz = make_cmd_ble_set_adv_enable (hci_cmd_buf, 1); + API_vhci_host_send_packet(hci_cmd_buf, sz); +} + +static void hci_cmd_send_ble_set_adv_param(void) +{ + uint16_t adv_intv_min = 256; // 160ms + uint16_t adv_intv_max = 256; // 160ms + uint8_t adv_type = 0; // connectable undirected advertising (ADV_IND) + uint8_t own_addr_type = 0; // Public Device Address + uint8_t peer_addr_type = 0; // Public Device Address + uint8_t peer_addr[6] = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85}; + uint8_t adv_chn_map = 0x07; // 37, 38, 39 + uint8_t adv_filter_policy = 0; // Process All Conn and Scan + + uint16_t sz = make_cmd_ble_set_adv_param(hci_cmd_buf, + adv_intv_min, + adv_intv_max, + adv_type, + own_addr_type, + peer_addr_type, + peer_addr, + adv_chn_map, + adv_filter_policy); + API_vhci_host_send_packet(hci_cmd_buf, sz); +} + +static void hci_cmd_send_ble_set_adv_data(void) +{ + char *adv_name = "ESP-BLE-HELLO"; + uint8_t name_len = (uint8_t)strlen(adv_name); + uint8_t adv_data[31] = {0x02, 0x01, 0x06, 0x0, 0x09}; + uint8_t adv_data_len; + + adv_data[3] = name_len + 1; + for (int i=0; i Date: Fri, 23 Sep 2016 00:36:53 +0800 Subject: [PATCH 056/179] components/nvs: add erase function This change exposes functions to erase single key and to erase all keys from namespace. TW6769, TW6839 --- components/nvs_flash/include/nvs.h | 35 ++++++++++++++++++++++++ components/nvs_flash/src/nvs_api.cpp | 30 ++++++++++++++++++++ components/nvs_flash/src/nvs_page.cpp | 13 --------- components/nvs_flash/src/nvs_page.hpp | 2 -- components/nvs_flash/src/nvs_storage.cpp | 34 +++++++++++++++++++++++ components/nvs_flash/src/nvs_storage.hpp | 20 ++++---------- components/nvs_flash/test/test_nvs.cpp | 21 ++++++++++++++ 7 files changed, 125 insertions(+), 30 deletions(-) diff --git a/components/nvs_flash/include/nvs.h b/components/nvs_flash/include/nvs.h index dbcd837e17..bfcebc2e59 100644 --- a/components/nvs_flash/include/nvs.h +++ b/components/nvs_flash/include/nvs.h @@ -180,6 +180,41 @@ esp_err_t nvs_get_u64 (nvs_handle handle, const char* key, uint64_t* out_value); esp_err_t nvs_get_str (nvs_handle handle, const char* key, char* out_value, size_t* length); esp_err_t nvs_get_blob(nvs_handle handle, const char* key, void* out_value, size_t* length); +/** + * @brief Erase key-value pair with given key name. + * + * Note that actual storage may not be updated until nvs_commit function is called. + * + * @param[in] handle Storage handle obtained with nvs_open. If handle has to be + * opened as not read only for this call to succeed. + * + * @param[in] key Key name. Maximal length is determined by the underlying + * implementation, but is guaranteed to be at least + * 16 characters. Shouldn't be empty. + * + * @return - ESP_OK if erase operation was successful + * - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL + * - ESP_ERR_NVS_READ_ONLY if handle was opened as read only + * - ESP_ERR_NVS_NOT_FOUND if the requested key doesn't exist + * - other error codes from the underlying storage driver + */ +esp_err_t nvs_erase_key(nvs_handle handle, const char* key); + +/** + * @brief Erase all key-value pairs in a namespace + * + * Note that actual storage may not be updated until nvs_commit function is called. + * + * @param[in] handle Storage handle obtained with nvs_open. If handle has to be + * opened as not read only for this call to succeed. + * + * @return - ESP_OK if erase operation was successful + * - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL + * - ESP_ERR_NVS_READ_ONLY if handle was opened as read only + * - other error codes from the underlying storage driver + */ +esp_err_t nvs_erase_all(nvs_handle handle); + /** * @brief Write any pending changes to non-volatile storage * diff --git a/components/nvs_flash/src/nvs_api.cpp b/components/nvs_flash/src/nvs_api.cpp index fb9faf984a..daa23325d2 100644 --- a/components/nvs_flash/src/nvs_api.cpp +++ b/components/nvs_flash/src/nvs_api.cpp @@ -103,6 +103,36 @@ extern "C" void nvs_close(nvs_handle handle) s_nvs_handles.erase(it); } +extern "C" esp_err_t nvs_erase_key(nvs_handle handle, const char* key) +{ + Lock lock; + NVS_DEBUGV("%s %s\r\n", __func__, key); + HandleEntry entry; + auto err = nvs_find_ns_handle(handle, entry); + if (err != ESP_OK) { + return err; + } + if (entry.mReadOnly) { + return ESP_ERR_NVS_READ_ONLY; + } + return s_nvs_storage.eraseItem(entry.mNsIndex, key); +} + +extern "C" esp_err_t nvs_erase_all(nvs_handle handle) +{ + Lock lock; + NVS_DEBUGV("%s\r\n", __func__); + HandleEntry entry; + auto err = nvs_find_ns_handle(handle, entry); + if (err != ESP_OK) { + return err; + } + if (entry.mReadOnly) { + return ESP_ERR_NVS_READ_ONLY; + } + return s_nvs_storage.eraseNamespace(entry.mNsIndex); +} + template static esp_err_t nvs_set(nvs_handle handle, const char* key, T value) { diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index fed45d34da..4f6a198c61 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -278,19 +278,6 @@ esp_err_t Page::findItem(uint8_t nsIndex, ItemType datatype, const char* key) return findItem(nsIndex, datatype, key, index, item); } -esp_err_t Page::eraseEntry(size_t index) -{ - auto state = mEntryTable.get(index); - assert(state == EntryState::WRITTEN || state == EntryState::EMPTY); - - auto rc = alterEntryState(index, EntryState::ERASED); - if (rc != ESP_OK) { - return rc; - } - - return ESP_OK; -} - esp_err_t Page::eraseEntryAndSpan(size_t index) { auto state = mEntryTable.get(index); diff --git a/components/nvs_flash/src/nvs_page.hpp b/components/nvs_flash/src/nvs_page.hpp index 63b1c4033a..c1f430cae5 100644 --- a/components/nvs_flash/src/nvs_page.hpp +++ b/components/nvs_flash/src/nvs_page.hpp @@ -206,8 +206,6 @@ protected: esp_err_t writeEntryData(const uint8_t* data, size_t size); - esp_err_t eraseEntry(size_t index); - esp_err_t eraseEntryAndSpan(size_t index); void updateFirstUsedEntry(size_t index, size_t span); diff --git a/components/nvs_flash/src/nvs_storage.cpp b/components/nvs_flash/src/nvs_storage.cpp index 7415ed62c3..4a217ebe18 100644 --- a/components/nvs_flash/src/nvs_storage.cpp +++ b/components/nvs_flash/src/nvs_storage.cpp @@ -69,6 +69,19 @@ esp_err_t Storage::init(uint32_t baseSector, uint32_t sectorCount) return ESP_OK; } +esp_err_t Storage::findItem(uint8_t nsIndex, ItemType datatype, const char* key, Page* &page, Item& item) +{ + size_t itemIndex = 0; + for (auto it = std::begin(mPageManager); it != std::end(mPageManager); ++it) { + auto err = it->findItem(nsIndex, datatype, key, itemIndex, item); + if (err == ESP_OK) { + page = it; + return ESP_OK; + } + } + return ESP_ERR_NVS_NOT_FOUND; +} + esp_err_t Storage::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, const void* data, size_t dataSize) { if (mState != StorageState::ACTIVE) { @@ -202,6 +215,27 @@ esp_err_t Storage::eraseItem(uint8_t nsIndex, ItemType datatype, const char* key return findPage->eraseItem(nsIndex, datatype, key); } +esp_err_t Storage::eraseNamespace(uint8_t nsIndex) +{ + if (mState != StorageState::ACTIVE) { + return ESP_ERR_NVS_NOT_INITIALIZED; + } + + for (auto it = std::begin(mPageManager); it != std::end(mPageManager); ++it) { + while (true) { + auto err = it->eraseItem(nsIndex, ItemType::ANY, nullptr); + if (err == ESP_ERR_NVS_NOT_FOUND) { + break; + } + else if (err != ESP_OK) { + return err; + } + } + } + return ESP_OK; + +} + esp_err_t Storage::getItemDataSize(uint8_t nsIndex, ItemType datatype, const char* key, size_t& dataSize) { if (mState != StorageState::ACTIVE) { diff --git a/components/nvs_flash/src/nvs_storage.hpp b/components/nvs_flash/src/nvs_storage.hpp index f99e6fbbc9..f8cee9f2a9 100644 --- a/components/nvs_flash/src/nvs_storage.hpp +++ b/components/nvs_flash/src/nvs_storage.hpp @@ -69,13 +69,15 @@ public: return readItem(nsIndex, itemTypeOf(value), key, &value, sizeof(value)); } - template esp_err_t eraseItem(uint8_t nsIndex, const char* key) { - return eraseItem(nsIndex, itemTypeOf(), key); + return eraseItem(nsIndex, ItemType::ANY, key); } + + esp_err_t eraseNamespace(uint8_t nsIndex); void debugDump(); + void debugCheck(); @@ -88,19 +90,7 @@ protected: void clearNamespaces(); - esp_err_t findItem(uint8_t nsIndex, ItemType datatype, const char* key, Page* &page, Item& item) - { - size_t itemIndex = 0; - for (auto it = std::begin(mPageManager); it != std::end(mPageManager); ++it) { - auto err = it->findItem(nsIndex, datatype, key, itemIndex, item); - if (err == ESP_OK) { - page = it; - return ESP_OK; - } - } - return ESP_ERR_NVS_NOT_FOUND; - } - + esp_err_t findItem(uint8_t nsIndex, ItemType datatype, const char* key, Page* &page, Item& item); protected: size_t mPageCount; diff --git a/components/nvs_flash/test/test_nvs.cpp b/components/nvs_flash/test/test_nvs.cpp index c496a09fd4..540d977b4c 100644 --- a/components/nvs_flash/test/test_nvs.cpp +++ b/components/nvs_flash/test/test_nvs.cpp @@ -386,6 +386,27 @@ TEST_CASE("can modify an item on a page which will be erased", "[nvs]") } +TEST_CASE("can erase items", "[nvs]") +{ + SpiFlashEmulator emu(3); + Storage storage; + CHECK(storage.init(0, 3) == ESP_OK); + for (size_t i = 0; i < Page::ENTRY_COUNT * 2 - 3; ++i) { + char name[Item::MAX_KEY_LENGTH + 1]; + snprintf(name, sizeof(name), "key%05d", static_cast(i)); + REQUIRE(storage.writeItem(3, name, static_cast(i)) == ESP_OK); + } + CHECK(storage.writeItem(1, "foo", 32) == ESP_OK); + CHECK(storage.writeItem(2, "foo", 64) == ESP_OK); + CHECK(storage.eraseItem(2, "foo") == ESP_OK); + int val; + CHECK(storage.readItem(1, "foo", val) == ESP_OK); + CHECK(val == 32); + CHECK(storage.eraseNamespace(3) == ESP_OK); + CHECK(storage.readItem(2, "foo", val) == ESP_ERR_NVS_NOT_FOUND); + CHECK(storage.readItem(3, "key00222", val) == ESP_ERR_NVS_NOT_FOUND); +} + #define TEST_ESP_ERR(rc, res) CHECK((rc) == (res)) #define TEST_ESP_OK(rc) CHECK((rc) == ESP_OK) From f2149eabeebe06cb742cd4720deb9a854b78659e Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 23 Sep 2016 08:44:45 +0800 Subject: [PATCH 057/179] components/spi_flash: add flash operation counters option to Kconfig --- components/spi_flash/Kconfig | 16 +++++ components/spi_flash/esp_spi_flash.c | 76 +++++++++++--------- components/spi_flash/include/esp_spi_flash.h | 37 +++++++++- 3 files changed, 93 insertions(+), 36 deletions(-) create mode 100644 components/spi_flash/Kconfig diff --git a/components/spi_flash/Kconfig b/components/spi_flash/Kconfig new file mode 100644 index 0000000000..c344a6b748 --- /dev/null +++ b/components/spi_flash/Kconfig @@ -0,0 +1,16 @@ +menu "SPI Flash driver" + +config SPI_FLASH_ENABLE_COUNTERS + bool "Enable operation counters" + default 0 + help + This option enables the following APIs: + spi_flash_reset_counters + spi_flash_dump_counters + spi_flash_get_counters + These APIs may be used to collect performance data for spi_flash APIs + and to help understand behaviour of libraries which use SPI flash. + +endmenu + + diff --git a/components/spi_flash/esp_spi_flash.c b/components/spi_flash/esp_spi_flash.c index 28623df1b5..a9da316abf 100644 --- a/components/spi_flash/esp_spi_flash.c +++ b/components/spi_flash/esp_spi_flash.c @@ -28,7 +28,7 @@ #include "esp_ipc.h" #include "esp_attr.h" #include "esp_spi_flash.h" - +#include "esp_log.h" /* Driver for SPI flash read/write/erase operations @@ -74,21 +74,20 @@ static bool s_flash_op_can_start = false; static bool s_flash_op_complete = false; #endif //CONFIG_FREERTOS_UNICORE -typedef struct { - uint32_t count; - uint32_t time; -} counter_t; - -typedef struct { - counter_t read; - counter_t write; - counter_t erase; - counter_t read_inner; - counter_t write_inner; -} spi_flash_counters_t; - +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS +static const char* TAG = "spi_flash"; static spi_flash_counters_t s_flash_stats; +#define COUNTER_START() uint32_t ts_begin = xthal_get_ccount() +#define COUNTER_STOP(counter) do{ s_flash_stats.counter.count++; s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); } while(0) +#define COUNTER_ADD_BYTES(counter, size) do { s_flash_stats.counter.bytes += size; } while (0) +#else +#define COUNTER_START() +#define COUNTER_STOP(counter) +#define COUNTER_ADD_BYTES(counter, size) + +#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS + #ifndef CONFIG_FREERTOS_UNICORE static void IRAM_ATTR spi_flash_op_block_func(void* arg) @@ -112,6 +111,10 @@ static void IRAM_ATTR spi_flash_op_block_func(void* arg) void spi_flash_init() { s_flash_op_mutex = xSemaphoreCreateMutex(); + +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS + spi_flash_reset_counters(); +#endif } static void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu() @@ -177,7 +180,9 @@ static void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu() void spi_flash_init() { - // No-op in single core mode +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS + spi_flash_reset_counters(); +#endif } static void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu() @@ -194,9 +199,6 @@ static void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu() #endif // CONFIG_FREERTOS_UNICORE -#define COUNTER_START() uint32_t ts_begin = xthal_get_ccount() -#define COUNTER_STOP(counter) do{ (counter)->count++; (counter)->time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); } while(0) - SpiFlashOpResult IRAM_ATTR spi_flash_unlock() { @@ -221,7 +223,7 @@ esp_err_t IRAM_ATTR spi_flash_erase_sector(uint16_t sec) rc = SPIEraseSector(sec); } spi_flash_enable_interrupts_caches_and_other_cpu(); - COUNTER_STOP(&s_flash_stats.erase); + COUNTER_STOP(erase); return spi_flash_translate_rc(rc); } @@ -232,12 +234,11 @@ esp_err_t IRAM_ATTR spi_flash_write(uint32_t dest_addr, const uint32_t *src, uin SpiFlashOpResult rc; rc = spi_flash_unlock(); if (rc == SPI_FLASH_RESULT_OK) { - COUNTER_START(); rc = SPIWrite(dest_addr, src, (int32_t) size); - COUNTER_STOP(&s_flash_stats.write_inner); + COUNTER_ADD_BYTES(write, size); } spi_flash_enable_interrupts_caches_and_other_cpu(); - COUNTER_STOP(&s_flash_stats.write); + COUNTER_STOP(write); return spi_flash_translate_rc(rc); } @@ -247,12 +248,11 @@ esp_err_t IRAM_ATTR spi_flash_read(uint32_t src_addr, uint32_t *dest, uint32_t s spi_flash_disable_interrupts_caches_and_other_cpu(); SpiFlashOpResult rc; { - COUNTER_START(); rc = SPIRead(src_addr, dest, (int32_t) size); - COUNTER_STOP(&s_flash_stats.read_inner); + COUNTER_ADD_BYTES(read, size); } spi_flash_enable_interrupts_caches_and_other_cpu(); - COUNTER_STOP(&s_flash_stats.read); + COUNTER_STOP(read); return spi_flash_translate_rc(rc); } @@ -303,21 +303,29 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta } } -static void dump_counter(counter_t* counter, const char* name) +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS + +static inline void dump_counter(spi_flash_counter_t* counter, const char* name) { - printf("%s count=%8d\ttime=%8dms\n", name, counter->count, counter->time/1000); + ESP_LOGI(TAG, "%s count=%8d time=%8dms bytes=%8d\n", name, + counter->count, counter->time, counter->bytes); } -void spi_flash_reset_stats() +const spi_flash_counters_t* spi_flash_get_counters() +{ + return &s_flash_stats; +} + +void spi_flash_reset_counters() { memset(&s_flash_stats, 0, sizeof(s_flash_stats)); } -void spi_flash_dump_stats() +void spi_flash_dump_counters() { - dump_counter(&s_flash_stats.read, "read "); - dump_counter(&s_flash_stats.write, "write "); - dump_counter(&s_flash_stats.read_inner, "read_inner "); - dump_counter(&s_flash_stats.write_inner, "write_inner"); - dump_counter(&s_flash_stats.erase, "erase "); + dump_counter(&s_flash_stats.read, "read "); + dump_counter(&s_flash_stats.write, "write"); + dump_counter(&s_flash_stats.erase, "erase"); } + +#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS diff --git a/components/spi_flash/include/esp_spi_flash.h b/components/spi_flash/include/esp_spi_flash.h index 7169555d30..6d635880eb 100644 --- a/components/spi_flash/include/esp_spi_flash.h +++ b/components/spi_flash/include/esp_spi_flash.h @@ -17,6 +17,7 @@ #include #include "esp_err.h" +#include "sdkconfig.h" #ifdef __cplusplus extern "C" { @@ -69,10 +70,42 @@ esp_err_t spi_flash_write(uint32_t des_addr, const uint32_t *src_addr, uint32_t esp_err_t spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size); -void spi_flash_reset_stats(); +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS -void spi_flash_dump_stats(); +/** + * Structure holding statistics for one type of operation + */ +typedef struct { + uint32_t count; // number of times operation was executed + uint32_t time; // total time taken, in microseconds + uint32_t bytes; // total number of bytes, for read and write operations +} spi_flash_counter_t; +typedef struct { + spi_flash_counter_t read; + spi_flash_counter_t write; + spi_flash_counter_t erase; +} spi_flash_counters_t; + +/** + * @brief Reset SPI flash operation counters + */ +void spi_flash_reset_counters(); + +/** + * @brief Print SPI flash operation counters + */ +void spi_flash_dump_counters(); + +/** + * @brief Return current SPI flash operation counters + * + * @return pointer to the spi_flash_counters_t structure holding values + * of the operation counters + */ +const spi_flash_counters_t* spi_flash_get_counters(); + +#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS #ifdef __cplusplus } From 1c7508885cb083fcc55871601f12648ccbe13040 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 23 Sep 2016 09:00:28 +0800 Subject: [PATCH 058/179] components/nvs: fix build, use log library instead of printf --- components/nvs_flash/src/nvs_api.cpp | 29 +++++++++++++++-------- components/nvs_flash/src/nvs_platform.hpp | 6 ----- components/nvs_flash/test/sdkconfig.h | 0 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 components/nvs_flash/test/sdkconfig.h diff --git a/components/nvs_flash/src/nvs_api.cpp b/components/nvs_flash/src/nvs_api.cpp index daa23325d2..00a279d2b5 100644 --- a/components/nvs_flash/src/nvs_api.cpp +++ b/components/nvs_flash/src/nvs_api.cpp @@ -17,6 +17,15 @@ #include "intrusive_list.h" #include "nvs_platform.hpp" +#ifdef ESP_PLATFORM +// Uncomment this line to force output from this module +// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG +#include "esp_log.h" +static const char* TAG = "nvs"; +#else +#define ESP_LOGD(...) +#endif + class HandleEntry : public intrusive_list_node { public: @@ -55,7 +64,7 @@ extern "C" esp_err_t nvs_flash_init(uint32_t baseSector, uint32_t sectorCount) { Lock::init(); Lock lock; - NVS_DEBUGV("%s %d %d\r\n", __func__, baseSector, sectorCount); + ESP_LOGD(TAG, "init start=%d count=%d", baseSector, sectorCount); s_nvs_handles.clear(); return s_nvs_storage.init(baseSector, sectorCount); } @@ -75,7 +84,7 @@ static esp_err_t nvs_find_ns_handle(nvs_handle handle, HandleEntry& entry) extern "C" esp_err_t nvs_open(const char* name, nvs_open_mode open_mode, nvs_handle *out_handle) { Lock lock; - NVS_DEBUGV("%s %s %d\r\n", __func__, name, open_mode); + ESP_LOGD(TAG, "%s %s %d", __func__, name, open_mode); uint8_t nsIndex; esp_err_t err = s_nvs_storage.createOrOpenNamespace(name, open_mode == NVS_READWRITE, nsIndex); if (err != ESP_OK) { @@ -93,7 +102,7 @@ extern "C" esp_err_t nvs_open(const char* name, nvs_open_mode open_mode, nvs_han extern "C" void nvs_close(nvs_handle handle) { Lock lock; - NVS_DEBUGV("%s %d\r\n", __func__, handle); + ESP_LOGD(TAG, "%s %d", __func__, handle); auto it = find_if(begin(s_nvs_handles), end(s_nvs_handles), [=](HandleEntry& e) -> bool { return e.mHandle == handle; }); @@ -106,7 +115,7 @@ extern "C" void nvs_close(nvs_handle handle) extern "C" esp_err_t nvs_erase_key(nvs_handle handle, const char* key) { Lock lock; - NVS_DEBUGV("%s %s\r\n", __func__, key); + ESP_LOGD(TAG, "%s %s\r\n", __func__, key); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -121,7 +130,7 @@ extern "C" esp_err_t nvs_erase_key(nvs_handle handle, const char* key) extern "C" esp_err_t nvs_erase_all(nvs_handle handle) { Lock lock; - NVS_DEBUGV("%s\r\n", __func__); + ESP_LOGD(TAG, "%s\r\n", __func__); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -137,7 +146,7 @@ template static esp_err_t nvs_set(nvs_handle handle, const char* key, T value) { Lock lock; - NVS_DEBUGV("%s %s %d %d\r\n", __func__, key, sizeof(T), (uint32_t) value); + ESP_LOGD(TAG, "%s %s %d %d", __func__, key, sizeof(T), (uint32_t) value); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -200,7 +209,7 @@ extern "C" esp_err_t nvs_commit(nvs_handle handle) extern "C" esp_err_t nvs_set_str(nvs_handle handle, const char* key, const char* value) { Lock lock; - NVS_DEBUGV("%s %s %s\r\n", __func__, key, value); + ESP_LOGD(TAG, "%s %s %s", __func__, key, value); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -212,7 +221,7 @@ extern "C" esp_err_t nvs_set_str(nvs_handle handle, const char* key, const char* extern "C" esp_err_t nvs_set_blob(nvs_handle handle, const char* key, const void* value, size_t length) { Lock lock; - NVS_DEBUGV("%s %s %d\r\n", __func__, key, length); + ESP_LOGD(TAG, "%s %s %d", __func__, key, length); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -226,7 +235,7 @@ template static esp_err_t nvs_get(nvs_handle handle, const char* key, T* out_value) { Lock lock; - NVS_DEBUGV("%s %s %d\r\n", __func__, key, sizeof(T)); + ESP_LOGD(TAG, "%s %s %d", __func__, key, sizeof(T)); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { @@ -278,7 +287,7 @@ extern "C" esp_err_t nvs_get_u64 (nvs_handle handle, const char* key, uint64_t* static esp_err_t nvs_get_str_or_blob(nvs_handle handle, nvs::ItemType type, const char* key, void* out_value, size_t* length) { Lock lock; - NVS_DEBUGV("%s %s\r\n", __func__, key); + ESP_LOGD(TAG, "%s %s", __func__, key); HandleEntry entry; auto err = nvs_find_ns_handle(handle, entry); if (err != ESP_OK) { diff --git a/components/nvs_flash/src/nvs_platform.hpp b/components/nvs_flash/src/nvs_platform.hpp index d0bcae90cf..374dbca6cc 100644 --- a/components/nvs_flash/src/nvs_platform.hpp +++ b/components/nvs_flash/src/nvs_platform.hpp @@ -61,7 +61,6 @@ public: } // namespace nvs #else // ESP_PLATFORM -#define NVS_DEBUGV(...) printf(__VA_ARGS__) namespace nvs { class Lock @@ -75,10 +74,5 @@ public: } // namespace nvs #endif // ESP_PLATFORM -#ifndef CONFIG_NVS_DEBUG -#undef NVS_DEBUGV -#define NVS_DEBUGV(...) -#endif - #endif /* nvs_platform_h */ diff --git a/components/nvs_flash/test/sdkconfig.h b/components/nvs_flash/test/sdkconfig.h new file mode 100644 index 0000000000..e69de29bb2 From 85cd269ef804d1565eb3591ca92ecc26d789fd42 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Fri, 23 Sep 2016 09:21:37 +0800 Subject: [PATCH 059/179] add ledc driver code --- components/driver/include/driver/ledc.h | 301 +++++++++++++++++++ components/driver/ledc.c | 368 ++++++++++++++++++++++++ 2 files changed, 669 insertions(+) create mode 100644 components/driver/include/driver/ledc.h create mode 100644 components/driver/ledc.c diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h new file mode 100644 index 0000000000..728fad460d --- /dev/null +++ b/components/driver/include/driver/ledc.h @@ -0,0 +1,301 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _DRIVER_LEDC_H_ +#define _DRIVER_LEDC_H_ +#include "esp_err.h" +#include "soc/soc.h" +#include "soc/ledc_reg.h" +#include "soc/ledc_reg.h" +#include "soc/ledc_struct.h" +#include "driver/gpio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LEDC_APB_CLK_HZ (APB_CLK_FREQ) +#define LEDC_REF_CLK_HZ (1*1000000) + +typedef enum { + LEDC_HIGH_SPEED_MODE = 0, /*LEDC high speed speed_mode */ + //in this version, we only support high speed speed_mode. We will access low speed speed_mode later + //LEDC_LOW_SPEED_MODE, /*LEDC low speed speed_mode */ + LEDC_SPEED_MODE_MAX, +} ledc_mode_t; +typedef enum { + LEDC_INTR_DISABLE = 0, /*Disable LEDC interrupt */ + LEDC_INTR_FADE_END, /*Enable LEDC interrupt */ +} ledc_intr_type_t; +typedef enum { + LEDC_DUTY_DIR_DECREASE = 0, /*LEDC duty decrease direction */ + LEDC_DUTY_DIR_INCREASE = 1, /*LEDC duty increase direction */ +} ledc_duty_direction_t; +typedef enum { + LEDC_REF_TICK = 0, // 1MhZ + LEDC_APB_CLK, //80Mhz +}ledc_timer_src_t; +typedef enum { + LEDC_TIMER0 = 0, /*LEDC source time TIME0 */ + LEDC_TIMER1, /*LEDC source time TIME1 */ + LEDC_TIMER2, /*LEDC source time TIME2 */ + LEDC_TIMER3, /*LEDC source time TIME3 */ +} ledc_timer_source_t; +typedef enum { + LEDC_CHANNEL_0 = 0, /*LEDC channel 0 */ + LEDC_CHANNEL_1, /*LEDC channel 1 */ + LEDC_CHANNEL_2, /*LEDC channel 2 */ + LEDC_CHANNEL_3, /*LEDC channel 3 */ + LEDC_CHANNEL_4, /*LEDC channel 4 */ + LEDC_CHANNEL_5, /*LEDC channel 5 */ + LEDC_CHANNEL_6, /*LEDC channel 6 */ + LEDC_CHANNEL_7, /*LEDC channel 7 */ +} ledc_channel_t; +typedef enum { + LEDC_DUTY_DEPTH_10_BIT = 10, /*LEDC PWM depth 10Bit */ + LEDC_DUTY_DEPTH_11_BIT = 11, /*LEDC PWM depth 11Bit */ + LEDC_DUTY_DEPTH_12_BIT = 12, /*LEDC PWM depth 12Bit */ + LEDC_DUTY_DEPTH_13_BIT = 13, /*LEDC PWM depth 13Bit */ + LEDC_DUTY_DEPTH_14_BIT = 14, /*LEDC PWM depth 14Bit */ + LEDC_DUTY_DEPTH_15_BIT = 15, /*LEDC PWM depth 15Bit */ +} ledc_duty_depth_t; + +typedef struct ledc_channel_t_config { + int gpio_num; /*the LEDC output gpio_num, if you want to use gpio16, ledc_config_t.gpio_num = 16*/ + ledc_mode_t speed_mode; /*LEDC speed speed_mode*/ + ledc_channel_t channel; /*LEDC channel(0 - 7)*/ + ledc_intr_type_t intr_type; /*configure interrupt , Fade interrupt enable or Fade interrupt disable*/ + ledc_timer_source_t timer_src; /*Select the timer source of channel (0 - 3)*/ + uint32_t freq_hz; /*LEDC channel frequency(Hz)*/ + uint32_t duty; /*LEDC channel duty,the duty range is [0,(2**duty_depth) - 1],*/ + ledc_duty_depth_t duty_depth; /*LEDC channel duty depth*/ +} ledc_config_t; + +/** + * @brief LEDC common configuration + * + * User this Function,configure LEDC with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth + * + * @param[in] ledc_config_t + * ledc_config_t.speed_mode : LEDC speed speed_mode + * ledc_config_t.gpio_num : LEDC output gpio_num, if you want to use gpio16, ledc_config_t.gpio_num = 16 + * ledc_config_t.channel : LEDC channel(0 - 7) + * ledc_config_t.intr_type : configure interrupt , Fade interrupt enable or Fade interrupt disable + * ledc_config_t.timer_src : Select the timer source of channel (0 - 3) + * When different channel ,select same timer ,their freq_hz and duty_depth must be the same + * ledc_config_t.freq_hz : LEDC channel frequency(Hz), + * When different channel ,select same time ,their freq_hz and duty_depth must be same + * ledc_config_t.duty : LEDC channel duty,the duty range is [0,(2**duty_depth) - 1], + * ledc_config_t.duty_depth : LEDC channel duty depth + * When different channel ,select same time ,their freq_hz and duty_depth must be same + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL: spin_lock error + * + */ +esp_err_t ledc_config(ledc_config_t* ledc_conf); + +/** + * @brief LEDC start + * + * Call this function to activate the LEDC updated parameters. + * After ledc_set_duty,ledc_set_fade, we need to call this function to update the settings. + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL: spin_lock error + * + */ +esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); + +/** + * @brief LEDC stop + * + * Disable LEDC output,and set idle level + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL: spin_lock error + */ +esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level); + +/** + * @brief LEDC set channel frequency(Hz) + * + * Set LEDC frequency(Hz) + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : current channel(0-7) + * + * @param[in] freq_hz : set the LEDC frequency + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL: spin_lock error + */ +esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz); + +/** + * @brief LEDC get channel frequency(Hz) + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * @return 0 : error + * others : current LEDC frequency + * + */ +uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel); + +/** + * @brief LEDC set duty + * + * Set LEDC duty ,After the function calls the ledc_update function, the function can take effect. + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * @param[in] duty : set the LEDC duty ,the duty range is [0,(2**duty_depth) - 1] + * + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * ESP_FAIL: spin_lock error + */ +esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty); + +/** + * @brief LEDC get duty + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * + * @return current LEDC duty + * + */ +uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); + +/** + * @brief LEDC set gradient + * + * Set LEDC gradient , After the function calls the ledc_update function , the function can take effect. + * + * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * + * @param[in] channel : LEDC channel(0-7) + * + * @param[in] duty : set the start of the gradient duty , the duty range is [0,(2**duty_depth) - 1] + * + * @param[in] gradule_direction : set the direction of the gradient + * + * @param[in] step_num : set the number of the gradient + * + * @param[in] duty_cyle_num : set how many LEDC tick each time the gradient lasts + * + * @param[in] duty_scale : set gradient change amplitude + * + * @return ESP_OK : success + * ESP_ERR_INVALID_ARG : parameter error + * ESP_FAIL : spin_lock error + */ +esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, ledc_duty_direction_t gradule_direction, + uint32_t step_num, uint32_t duty_cyle_num, uint32_t duty_scale); + +/** + * @brief register LEDC interrupt handler, the handler is an ISR. + * The handler will be attached to the same CPU core that this function is running on. + * Users should know that which CPU is running and then pick a INUM that is not used by system. + * We can find the information of INUM and interrupt level in soc.h. + * TODO: to move INUM options to menu_config + * @parameter uint32_t ledc_intr_num : LEDC interrupt number,check the info in soc.h, and please see the core-isa.h for more details + * @parameter void (* fn)(void* ) : interrupt handler function. + * Note that the handler function MUST be defined with attribution of "IRAM_ATTR". + * @parameter void * arg : parameter for handler function + * + * @return ESP_OK : success ; + * ESP_ERR_INVALID_ARG : fucntion ptr error. + * ESP_FAIL : spin_lock error + */ +esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * arg); + + + + + +/***************************EXAMPLE********************************** + * + * + * ----------------EXAMPLE OF LEDC SETTING --------------------- + * ledc_config_t ledc_conf = { + * .channel = LEDC_CHANNEL_0; //set LEDC channel 0 + * .duty = 1000; //set the duty for initialization.(duty range is 0 ~ ((2**duty_depth)-1) + * .freq_hz = 1000; //set frequency , e.g.,1KHz + * .gpio_num = 16; //GPIO number + * .intr_type = LEDC_INTR_FADE_END; //GPIO INTR TYPE, as an example,we enable fade_end interrupt here. + * .duty_depth = LEDC_DUTY_DEPTH_12_BIT; //set duty_depth , (duty range is 0 ~ ((2**duty_depth)-1) + * .speed_mode = LEDC_HIGH_SPEED_MODE; //set LEDC mode, from ledc_mode_t + * .timer_src = LEDC_TIMER0; //set LEDC timer source, if different channel use one timer, the frequency and duty_depth of these channels should be the same + * } + * ledc_config(&ledc_conf); //setup the configuration + * ----------------EXAMPLE OF SETTING DUTY --- ----------------- + * uint32_t ledc_channel = LEDC_CHANNEL_0; //LEDC channel(0-73) + * uint32_t duty = 2000; //duty range is 0 ~ ((2**duty_depth)-1) + * LEDC_set_duty(LEDC_HIGH_SPEED_MODE,ledc_channel,duty); //set speed mode, channel, and duty. + * ledc_update(LEDC_HIGH_SPEED_MODE,ledc_channel); //after set duty, we need to call ledc_update to update the settings. + * + * + * ----------------EXAMPLE OF LEDC INTERRUPT ------------------ + * //we have fade_end interrupt and counter overflow interrupt. we just give an example of fade_end interrupt here. + * ledc_isr_register(18, ledc_isr_handler, NULL); //hook the isr handler for LEDC interrupt + * //the first parameter is INUM, you can pick one form interrupt level 1/2 which is not used by the system. + * //NOTE1:user should arrange the INUMs that used, better not to use a same INUM for different interrupt source. + * //NOTE2:do not pick the INUM that already occupied by the system. + * //NOTE3:refer to soc.h to check which INUMs that can be used. + * ----------------EXAMPLE OF INTERRUPT HANDLER --------------- + * #include "esp_attr.h" + * void IRAM_ATTR ledc_isr_handler(void* arg) //we should add 'IRAM_ATTR' attribution when we declare the isr function + * { + * uint32_t intr_st = LEDC.int_st.val; //read LEDC interrupt status. + * + * //you will find which channels have triggered fade_end interrupt here, + * //then , you can post some event to RTOS queue to process the event. + * //later we will add a queue in the driver code. + * + * LEDC.int_clr.val = intr_st; //clear LEDC interrupt status. + * } + * + * + *--------------------------END OF EXAMPLE -------------------------- + */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* _DRIVER_LEDC_H_ */ diff --git a/components/driver/ledc.c b/components/driver/ledc.c new file mode 100644 index 0000000000..7b7920f53a --- /dev/null +++ b/components/driver/ledc.c @@ -0,0 +1,368 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. +#include +#include "esp_intr.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/xtensa_api.h" +#include "soc/dport_reg.h" +#include "soc/gpio_sig_map.h" +#include "driver/ledc.h" + +//TODO: Move these debug options to menuconfig +#define LEDC_DBG_WARING_ENABLE (0) +#define LEDC_DBG_ERROR_ENABLE (0) +#define LEDC_INFO_ENABLE (0) +#define LEDC_DBG_ENABLE (0) + +//DBG INFOR +#if LEDC_DBG_ENABLE +#define LEDC_DBG(format,...) do{\ + ets_printf("[dbg][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define LEDC_DBG(...) +#endif + +#if LEDC_INFO_ENABLE +#define LEDC_INFO(format,...) do{\ + ets_printf("[info][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define LEDC_INFO(...) +#endif + +#if LEDC_DBG_WARING_ENABLE +#define LEDC_WARING(format,...) do{\ + ets_printf("[waring][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define LEDC_WARING(...) +#endif +#if LEDC_DBG_ERROR_ENABLE +#define LEDC_ERROR(format,...) do{\ + ets_printf("[error][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define LEDC_ERROR(...) +#endif + +static portMUX_TYPE ledc_spinlock = portMUX_INITIALIZER_UNLOCKED; + +static int ledc_is_valid_channel(uint32_t channel) +{ + if(channel > LEDC_CHANNEL_7) { + LEDC_ERROR("LEDC CHANNEL ERR: %d\n",channel); + return 0; + } + return 1; +} + +static int ledc_is_valid_mode(uint32_t mode) +{ + if(mode >= LEDC_SPEED_MODE_MAX) { + LEDC_ERROR("LEDC MODE ERR: %d\n",mode); + return 0; + } + return 1; +} + + +static esp_err_t ledc_timer_config(ledc_mode_t speed_mode, uint32_t timer_sel, uint32_t div_num, uint32_t timer_lim,ledc_timer_source_t clk) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_timer[timer_sel].conf.div_num = div_num; + LEDC.high_speed_timer[timer_sel].conf.tick_sel = clk; + LEDC.high_speed_timer[timer_sel].conf.timer_lim = timer_lim; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +static esp_err_t ledc_duty_config(ledc_mode_t speed_mode, uint32_t channel_num, uint32_t hpoint_val, uint32_t duty_val, + uint32_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_channel[channel_num].hpoint.hpoint = hpoint_val; + LEDC.high_speed_channel[channel_num].duty.duty = duty_val; + LEDC.high_speed_channel[channel_num].conf1.duty_inc = duty_direction; + LEDC.high_speed_channel[channel_num].conf1.duty_num = duty_num; + LEDC.high_speed_channel[channel_num].conf1.duty_cycle = duty_cycle; + LEDC.high_speed_channel[channel_num].conf1.duty_scale = duty_scale; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +static esp_err_t ledc_set_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint32_t timer_idx) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_channel[channel].conf0.timer_sel = timer_idx; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +static esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_timer[timer_sel].conf.rst = 1; + LEDC.high_speed_timer[timer_sel].conf.rst = 0; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} +static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, ledc_intr_type_t type) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + uint32_t value; + uint32_t intr_type = type; + portENTER_CRITICAL(&ledc_spinlock); + value = LEDC.int_ena.val; + if(intr_type & LEDC_INTR_FADE_END) { + LEDC.int_ena.val = value | BIT(8 + channel); + } else { + LEDC.int_ena.val = (value & (~(BIT(8 + channel)))); + } + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * arg) +{ + if(fn == NULL) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + ESP_INTR_DISABLE(ledc_intr_num); + intr_matrix_set(xPortGetCoreID(), ETS_LEDC_INTR_SOURCE, ledc_intr_num); + xt_set_interrupt_handler(ledc_intr_num, fn, arg); + ESP_INTR_ENABLE(ledc_intr_num); + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +esp_err_t ledc_config(ledc_config_t* ledc_conf) +{ + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST); + + uint32_t speed_mode = ledc_conf->speed_mode; + uint32_t gpio_num = ledc_conf->gpio_num; + uint32_t ledc_channel = ledc_conf->channel; + uint32_t freq_hz = ledc_conf->freq_hz; + uint32_t timer_select = ledc_conf->timer_src; + uint32_t duty_depth = ledc_conf->duty_depth; + uint32_t intr_type = ledc_conf->intr_type; + uint32_t duty = ledc_conf->duty; + uint64_t div_param = 0; + uint32_t precision = 0; + if(!ledc_is_valid_channel(ledc_channel)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(gpio_num >= GPIO_NUM_34 || gpio_num == 20 || gpio_num == 24 || gpio_num == 28 || gpio_num == 29 || gpio_num == 30 + || gpio_num == 31) { + LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(gpio_num >= GPIO_PIN_COUNT || 0 == GPIO_PIN_MUX_REG[gpio_num]) { + LEDC_ERROR("io_num=%d does not exist\n", gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(freq_hz == 0 || duty_depth == 0 || duty_depth > LEDC_DUTY_DEPTH_15_BIT) { + LEDC_ERROR("freq_hz=%u duty_depth=%u\n", div_param, duty_depth); + return ESP_ERR_INVALID_ARG; + } + if(timer_select > LEDC_TIMER3) { + LEDC_ERROR("Time Select %u\n", timer_select); + return ESP_ERR_INVALID_ARG; + } + portENTER_CRITICAL(&ledc_spinlock); + esp_err_t ret = ESP_OK; + /*gpio matrix ledc pwm signal*/ + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], 2); + gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); + gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); + /*configure ledc param*/ + /*calculate the div_param and select which base clock and first we will select the apb_clk */ + precision = (0x1 << duty_depth); //2**depth + div_param = (uint64_t) LEDC_APB_CLK_HZ * 256 / freq_hz / precision; //8bit fragment + /*Fail ,because the div num overflow or too small*/ + if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0) { //REF TICK + /*Selet the reference tick*/ + div_param = (uint64_t) LEDC_REF_CLK_HZ * 256 / freq_hz / precision; + if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0_V) { + LEDC_ERROR("div param err,div_param=%u\n", div_param); + ret = ESP_FAIL; + } + ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, LEDC_REF_TICK); + ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); + } else { //APB TICK + ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, LEDC_APB_CLK); + ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); + } + ledc_timer_rst(speed_mode, timer_select); + ledc_set_duty(speed_mode, ledc_channel, duty); + ledc_enable_intr_type(speed_mode, ledc_channel, intr_type); + LEDC_INFO("LEDC_PWM CHANNEL %1u|GPIO %02u|FreHz %05u|Duty %04u|Depth %04u|Time %01u|SourceClk %01u|Divparam %u\n", + ledc_channel, gpio_num, freq_hz, duty, duty_depth, timer_select, timer_source_clk_flag, div_param + ); + ledc_update(speed_mode, ledc_channel); + portEXIT_CRITICAL(&ledc_spinlock); + return ret; +} + +esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_channel[channel].conf0.sig_out_en = 1; + LEDC.high_speed_channel[channel].conf1.duty_start = 1; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + LEDC.high_speed_channel[channel].conf0.idle_lv = idle_level; + LEDC.high_speed_channel[channel].conf0.sig_out_en = 0; + LEDC.high_speed_channel[channel].conf1.duty_start = 0; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} +esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, ledc_duty_direction_t fade_direction, + uint32_t step_num, uint32_t duty_cyle_num, uint32_t duty_scale) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + if(fade_direction > LEDC_DUTY_DIR_INCREASE) { + LEDC_ERROR("Duty direction err\n"); + return ESP_ERR_INVALID_ARG; + } + if(step_num > 0X3FF || duty_cyle_num > 0X3FF || duty_scale > 0X3FF) { + LEDC_ERROR("step_num=%u duty_cyle_num=%u duty_scale=%u\n", step_num, duty_cyle_num, duty_scale); + return ESP_ERR_INVALID_ARG; + } + portENTER_CRITICAL(&ledc_spinlock); + ledc_duty_config(speed_mode, + channel, //uint32_t chan_num, + 0, //uint32_t hpoint_val, + duty << 4, //uint32_t duty_val,the least 4 bits are decimal part + fade_direction, //uint32_t increase, + step_num, //uint32_t duty_num, + duty_cyle_num, //uint32_t duty_cycle, + duty_scale //uint32_t duty_scale + ); + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + ledc_duty_config(speed_mode, + channel, //uint32_t chan_num, + 0, //uint32_t hpoint_val, + duty << 4, //uint32_t duty_val,the least 4 bits are decimal part + 1, //uint32_t increase, + 1, //uint32_t duty_num, + 1, //uint32_t duty_cycle, + 0 //uint32_t duty_scale + ); + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + uint32_t duty = 0; + duty = (LEDC.high_speed_channel[channel].duty_rd.duty_read >> 4); + return duty; +} + +esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz) +{ + if(!ledc_is_valid_mode(speed_mode)) + return ESP_ERR_INVALID_ARG; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + esp_err_t ret = ESP_OK; + uint32_t div_num = 0; + /*Select timer*/ + uint32_t timer_select = LEDC.high_speed_channel[channel].conf0.timer_sel; + /*Get timer limit*/ + uint32_t duty_depth = LEDC.high_speed_timer[timer_select].conf.timer_lim; + uint32_t timer_source_clk = LEDC.high_speed_timer[timer_select].conf.tick_sel; + uint32_t precision = (0x1 << duty_depth); + if(timer_source_clk == LEDC_APB_CLK) { + div_num = (uint64_t) LEDC_APB_CLK_HZ * 256 / freq_hz / precision; + } else { + div_num = (uint64_t) LEDC_REF_CLK_HZ * 256 / freq_hz / precision; + } + if(div_num <= 256 || div_num > LEDC_DIV_NUM_HSTIMER0) { + LEDC_ERROR("channel %u,div param err,div_param=%u\n", channel, div_num); + ret = ESP_FAIL; + } + LEDC.high_speed_timer[timer_select].conf.div_num = div_num; + portEXIT_CRITICAL(&ledc_spinlock); + return ret; +} + +uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel) +{ + if(!ledc_is_valid_mode(speed_mode)) + return 0; + if(!ledc_is_valid_channel(channel)) + return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&ledc_spinlock); + uint32_t freq = 0; + uint32_t timer_select = LEDC.high_speed_channel[channel].conf0.timer_sel; + uint32_t timer_source_clk = LEDC.high_speed_timer[timer_select].conf.tick_sel; + uint32_t duty_depth = LEDC.high_speed_timer[timer_select].conf.timer_lim; + uint32_t div_num = LEDC.high_speed_timer[timer_select].conf.div_num; + uint32_t precision = (0x1 << duty_depth); + if(timer_source_clk == LEDC_APB_CLK) { + freq = ((uint64_t) LEDC_APB_CLK_HZ) * 256 / precision / div_num; + } else { + freq = ((uint64_t) LEDC_REF_CLK_HZ) * 256 / precision / div_num; + } + portEXIT_CRITICAL(&ledc_spinlock); + return freq; +} From 95c48d4b8417ffab16831f860749b55a2a298f3e Mon Sep 17 00:00:00 2001 From: snake Date: Fri, 23 Sep 2016 10:48:55 +0800 Subject: [PATCH 060/179] 1. clean up the macro. 2. change component/bt/lib url to use new lib --- components/bt/bt.c | 28 ++-- components/bt/include/bt.h | 39 ++++-- components/bt/lib | 2 +- components/esp32/include/esp_task.h | 8 +- examples/04_ble_adv/LICENSE | 202 ---------------------------- examples/04_ble_adv/main/app_bt.c | 3 +- 6 files changed, 52 insertions(+), 230 deletions(-) delete mode 100644 examples/04_ble_adv/LICENSE diff --git a/components/bt/bt.c b/components/bt/bt.c index 4b623ca20f..efb6d34ee3 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -24,12 +24,18 @@ #include "freertos/portmacro.h" #include "esp_types.h" #include "esp_system.h" +#include "esp_task.h" #include "esp_intr.h" #include "esp_attr.h" #include "bt.h" #if CONFIG_BT_ENABLED +/* not for user call, so don't put to include file */ +extern void btdm_osi_funcs_register(void *osi_funcs); +extern void btdm_controller_init(void); + + static bt_app_startup_cb_t app_startup_cb; static void *app_startup_ctx; @@ -43,9 +49,6 @@ do{\ }\ } while(0) -extern void btdm_controller_init(void); -extern void API_osi_funcs_register(void *osi_funcs); - struct osi_funcs_t { xt_handler (*_set_isr)(int n, xt_handler f, void *arg); void (*_ints_on)(unsigned int mask); @@ -60,17 +63,17 @@ struct osi_funcs_t { static portMUX_TYPE global_int_mux = portMUX_INITIALIZER_UNLOCKED; -static inline void IRAM_ATTR interrupt_disable(void) +static void IRAM_ATTR interrupt_disable(void) { portENTER_CRITICAL(&global_int_mux); } -static inline void IRAM_ATTR interrupt_restore(void) +static void IRAM_ATTR interrupt_restore(void) { portEXIT_CRITICAL(&global_int_mux); } -static inline void *IRAM_ATTR semphr_take_wrapped(void *semphr, uint32_t block_time) +static void * IRAM_ATTR semphr_take_wrapper(void *semphr, uint32_t block_time) { return (void *)xSemaphoreTake(semphr, block_time); } @@ -83,23 +86,24 @@ static struct osi_funcs_t osi_funcs = { ._task_yield = vPortYield, ._semphr_create = xQueueCreateCountingSemaphore, ._semphr_give_from_isr = (void *)xQueueGiveFromISR, - ._semphr_take = semphr_take_wrapped, + ._semphr_take = semphr_take_wrapper, ._read_efuse_mac = system_efuse_read_mac, }; static void bt_controller_task(void *pvParam) { - API_osi_funcs_register(&osi_funcs); + btdm_osi_funcs_register(&osi_funcs); btdm_controller_init(); } static void bt_init_task(void *pvParameters) { - xTaskCreatePinnedToCore(bt_controller_task, "btControllerTask", BT_CONTROLLER_TASK_STACK_SIZE, NULL, BT_CONTROLLER_TASK_PRIO, NULL, 0); + xTaskCreatePinnedToCore(bt_controller_task, "btControllerTask", ESP_TASK_BT_CONTROLLER_STACK, NULL, ESP_TASK_BT_CONTROLLER_PRIO, NULL, 0); - if (app_startup_cb) - app_startup_cb(app_startup_ctx); + if (app_startup_cb) { + app_startup_cb(app_startup_ctx); + } vTaskDelete(NULL); } @@ -110,7 +114,7 @@ esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx) app_startup_cb = cb; app_startup_ctx = ctx; - xTaskCreatePinnedToCore(bt_init_task, "btInitTask", BT_INIT_TASK_STACK_SIZE, NULL, BT_INIT_TASK_PRIO, NULL, 0); + xTaskCreatePinnedToCore(bt_init_task, "btInitTask", ESP_TASK_BT_INIT_STACK, NULL, ESP_TASK_BT_INIT_PRIO, NULL, 0); return ESP_OK; } diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index 04bb466c45..991b9a13f5 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -4,27 +4,40 @@ #include "freertos/FreeRTOS.h" #include "esp_err.h" -#define BT_TASK_PRIO_MAX (configMAX_PRIORITIES) -#define BT_TASK_PRIO_MIN (0) - -/* bt init */ -#define BT_INIT_TASK_PRIO (BT_TASK_PRIO_MAX-1) -#define BT_INIT_TASK_STACK_SIZE (2048) -/* controller */ -#define BT_CONTROLLER_TASK_PRIO (BT_TASK_PRIO_MAX-3) -#define BT_CONTROLLER_TASK_STACK_SIZE (4096) - typedef void (* bt_app_startup_cb_t)(void *param); esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx); +/* @breif: vhci_host_callback + * used for vhci call host function to notify what host need to do + * + * notify_host_send_available: notify host can send packet to controller + * notify_host_recv: notify host that controller has packet send to host + */ typedef struct vhci_host_callback { + void (*notify_host_send_available)(void); int (*notify_host_recv)(uint8_t *data, uint16_t len); } vhci_host_callback_t; -extern bool API_vhci_host_check_send_available(void); -extern void API_vhci_host_send_packet(uint8_t *data, uint16_t len); -extern void API_vhci_host_register_callback(const vhci_host_callback_t *callback); +/* @breif: API_vhci_host_check_send_available + * used for check actively if the host can send packet to controller or not. + * return true for ready to send, false means cannot send packet + */ +bool API_vhci_host_check_send_available(void); + +/* @breif: API_vhci_host_send_packet + * host send packet to controller + * param data is the packet point, the param len is the packet length + * return void + */ +void API_vhci_host_send_packet(uint8_t *data, uint16_t len); + +/* @breif: API_vhci_host_register_callback + * register the vhci referece callback, the call back + * struct defined by vhci_host_callback structure. + * param is the vhci_host_callback type variable + */ +void API_vhci_host_register_callback(const vhci_host_callback_t *callback); #endif /* __BT_H__ */ diff --git a/components/bt/lib b/components/bt/lib index 3bee5393a9..6c9a6de656 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 3bee5393a9dd84f53b7b28d5cb2479649f2cf838 +Subproject commit 6c9a6de656262113a0aab63907d6871a64e00fae diff --git a/components/esp32/include/esp_task.h b/components/esp32/include/esp_task.h index 6d98bf1983..58458106fa 100644 --- a/components/esp32/include/esp_task.h +++ b/components/esp32/include/esp_task.h @@ -43,6 +43,11 @@ #define ESP_TASK_WPS_PRIO (ESP_TASK_PRIO_MIN + 2) #define ESP_TASK_WPS_STACK 2048 +/* Bt contoller Task */ +/* controller */ +#define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 1) +#define ESP_TASK_BT_CONTROLLER_STACK 4096 + /* idf task */ #define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5) #define ESP_TASKD_EVENT_STACK CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE @@ -50,5 +55,6 @@ #define ESP_TASK_WIFI_STARTUP_STACK 4096 #define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7) #define ESP_TASK_TCPIP_STACK 2048 - +#define ESP_TASK_BT_INIT_PRIO (ESP_TASK_PRIO_MAX - 7) +#define ESP_TASK_BT_INIT_STACK 2048 #endif diff --git a/examples/04_ble_adv/LICENSE b/examples/04_ble_adv/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/examples/04_ble_adv/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/examples/04_ble_adv/main/app_bt.c b/examples/04_ble_adv/main/app_bt.c index 8449accd64..011cf0c715 100755 --- a/examples/04_ble_adv/main/app_bt.c +++ b/examples/04_ble_adv/main/app_bt.c @@ -110,8 +110,9 @@ static uint16_t make_cmd_ble_set_adv_data(uint8_t *buf, uint8_t data_len, uint8_ memset(buf, 0, HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA); if (p_data != NULL && data_len > 0) { - if (data_len > HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA) + if (data_len > HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA) { data_len = HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA; + } UINT8_TO_STREAM (buf, data_len); From 7b79e4c9ae3ee550868c578e63aa1b1cb0e8e005 Mon Sep 17 00:00:00 2001 From: snake Date: Fri, 23 Sep 2016 11:02:46 +0800 Subject: [PATCH 061/179] add .h license header --- components/bt/include/bt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index 991b9a13f5..f8b7a8a0fd 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -1,3 +1,17 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __BT_H__ #define __BT_H__ From 5e6b2e9c4557a8d9a4e57866a5d0c152aa6a8229 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 23 Sep 2016 14:46:39 +0800 Subject: [PATCH 062/179] clean up warnings For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign). In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions. Only remaining warning is in FreeRTOS queue.c, and it may be a useful one. --- components/esp32/event.c | 84 ++++++++++++++++------------------- components/expat/component.mk | 2 +- components/lwip/component.mk | 2 +- 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/components/esp32/event.c b/components/esp32/event.c index c1d9d4e73b..b26a4ea304 100644 --- a/components/esp32/event.c +++ b/components/esp32/event.c @@ -27,22 +27,22 @@ #include "freertos/semphr.h" #include "tcpip_adapter.h" +#include "esp_log.h" #define ESP32_WORKAROUND 1 #if CONFIG_WIFI_ENABLED +static const char* TAG = "event"; static bool event_init_flag = false; static xQueueHandle g_event_handler = NULL; - static system_event_cb_t g_event_handler_cb; static void *g_event_ctx; -#define WIFI_DEBUG(...) #define WIFI_API_CALL_CHECK(info, api_call, ret) \ do{\ esp_err_t __err = (api_call);\ if ((ret) != __err) {\ - WIFI_DEBUG("%s %d %s ret=%d\n", __FUNCTION__, __LINE__, (info), __err);\ + ESP_LOGE(TAG, "%s %d %s ret=%d", __FUNCTION__, __LINE__, (info), __err);\ return __err;\ }\ } while(0) @@ -71,7 +71,7 @@ static system_event_handle_t g_system_event_handle_table[] = { {SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default}, {SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default}, {SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL}, - {SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default}, + {SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default}, {SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default}, {SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default}, {SYSTEM_EVENT_AP_STACONNECTED, NULL}, @@ -85,7 +85,7 @@ static esp_err_t system_event_sta_got_ip_default(system_event_t *event) extern esp_err_t esp_wifi_set_sta_ip(void); WIFI_API_CALL_CHECK("esp_wifi_set_sta_ip", esp_wifi_set_sta_ip(), ESP_OK); - printf("ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR "\n", + ESP_LOGI(TAG, "ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip), IP2STR(&event->event_info.got_ip.ip_info.netmask), IP2STR(&event->event_info.got_ip.ip_info.gw)); @@ -161,7 +161,7 @@ esp_err_t system_event_sta_connected_handle_default(system_event_t *event) esp_event_send(&evt); } else { - WIFI_DEBUG("invalid static ip\n"); + ESP_LOGE(TAG, "invalid static ip"); } } @@ -187,92 +187,86 @@ static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) static esp_err_t esp_system_event_debug(system_event_t *event) { if (event == NULL) { - printf("Error: event is null!\n"); + ESP_LOGE(TAG, "event is null!"); return ESP_FAIL; } - WIFI_DEBUG("received event: "); switch (event->event_id) { case SYSTEM_EVENT_WIFI_READY: { - WIFI_DEBUG("SYSTEM_EVENT_WIFI_READY\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_WIFI_READY"); break; } case SYSTEM_EVENT_SCAN_DONE: { - system_event_sta_scan_done_t *scan_done; - scan_done = &event->event_info.scan_done; - WIFI_DEBUG("SYSTEM_EVENT_SCAN_DONE\nstatus:%d, number:%d\n", scan_done->status, scan_done->number); + system_event_sta_scan_done_t *scan_done = &event->event_info.scan_done; + ESP_LOGD(TAG, "SYSTEM_EVENT_SCAN_DONE, status:%d, number:%d", scan_done->status, scan_done->number); break; } case SYSTEM_EVENT_STA_START: { - WIFI_DEBUG("SYSTEM_EVENT_STA_START\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_START"); break; } case SYSTEM_EVENT_STA_STOP: { - WIFI_DEBUG("SYSTEM_EVENT_STA_STOP\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_STOP"); break; } case SYSTEM_EVENT_STA_CONNECTED: { - system_event_sta_connected_t *connected; - connected = &event->event_info.connected; - WIFI_DEBUG("SYSTEM_EVENT_STA_CONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d\n", \ + system_event_sta_connected_t *connected = &event->event_info.connected; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_CONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d", \ connected->ssid, connected->ssid_len, connected->bssid[0], connected->bssid[0], connected->bssid[1], \ connected->bssid[3], connected->bssid[4], connected->bssid[5], connected->channel, connected->authmode); break; } case SYSTEM_EVENT_STA_DISCONNECTED: { - system_event_sta_disconnected_t *disconnected; - disconnected = &event->event_info.disconnected; - WIFI_DEBUG("SYSTEM_EVENT_STA_DISCONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d\n", \ + system_event_sta_disconnected_t *disconnected = &event->event_info.disconnected; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_DISCONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d", \ disconnected->ssid, disconnected->ssid_len, disconnected->bssid[0], disconnected->bssid[0], disconnected->bssid[1], \ disconnected->bssid[3], disconnected->bssid[4], disconnected->bssid[5], disconnected->reason); break; } case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: { - system_event_sta_authmode_change_t *auth_change; - auth_change = &event->event_info.auth_change; - WIFI_DEBUG("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode); + system_event_sta_authmode_change_t *auth_change = &event->event_info.auth_change; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_AUTHMODE_CHNAGE, old_mode:%d, new_mode:%d", auth_change->old_mode, auth_change->new_mode); break; } case SYSTEM_EVENT_STA_GOT_IP: { - system_event_sta_got_ip_t *got_ip; - got_ip = &event->event_info.got_ip; - WIFI_DEBUG("SYSTEM_EVENT_STA_GOTIP\n"); + system_event_sta_got_ip_t *got_ip = &event->event_info.got_ip; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_GOTIP, ip:" IPSTR ", mask:" IPSTR ", gw:" IPSTR, + IP2STR(&got_ip->ip_info.ip), + IP2STR(&got_ip->ip_info.netmask), + IP2STR(&got_ip->ip_info.gw)); break; } case SYSTEM_EVENT_AP_START: { - WIFI_DEBUG("SYSTEM_EVENT_AP_START\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_START"); break; } case SYSTEM_EVENT_AP_STOP: { - WIFI_DEBUG("SYSTEM_EVENT_AP_STOP\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STOP"); break; } case SYSTEM_EVENT_AP_STACONNECTED: { - system_event_ap_staconnected_t *staconnected; - staconnected = &event->event_info.sta_connected; - WIFI_DEBUG("SYSTEM_EVENT_AP_STACONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \ + system_event_ap_staconnected_t *staconnected = &event->event_info.sta_connected; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STACONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \ staconnected->mac[0], staconnected->mac[0], staconnected->mac[1], \ staconnected->mac[3], staconnected->mac[4], staconnected->mac[5], staconnected->aid); break; } case SYSTEM_EVENT_AP_STADISCONNECTED: { - system_event_ap_stadisconnected_t *stadisconnected; - stadisconnected = &event->event_info.sta_disconnected; - WIFI_DEBUG("SYSTEM_EVENT_AP_STADISCONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \ + system_event_ap_stadisconnected_t *stadisconnected = &event->event_info.sta_disconnected; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STADISCONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \ stadisconnected->mac[0], stadisconnected->mac[0], stadisconnected->mac[1], \ stadisconnected->mac[3], stadisconnected->mac[4], stadisconnected->mac[5], stadisconnected->aid); break; } case SYSTEM_EVENT_AP_PROBEREQRECVED: { - system_event_ap_probe_req_rx_t *ap_probereqrecved; - ap_probereqrecved = &event->event_info.ap_probereqrecved; - WIFI_DEBUG("SYSTEM_EVENT_AP_PROBEREQRECVED\nrssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x\n", \ + system_event_ap_probe_req_rx_t *ap_probereqrecved = &event->event_info.ap_probereqrecved; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_PROBEREQRECVED, rssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x", \ ap_probereqrecved->rssi, ap_probereqrecved->mac[0], ap_probereqrecved->mac[0], ap_probereqrecved->mac[1], \ ap_probereqrecved->mac[3], ap_probereqrecved->mac[4], ap_probereqrecved->mac[5]); break; } default: { - printf("Error: no such kind of event!\n"); + ESP_LOGW(TAG, "no such kind of event!"); break; } } @@ -283,19 +277,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event) static esp_err_t esp_system_event_handler(system_event_t *event) { if (event == NULL) { - printf("Error: event is null!\n"); + ESP_LOGE(TAG, "Error: event is null!"); return ESP_FAIL; } esp_system_event_debug(event); if ((event->event_id < SYSTEM_EVENT_MAX) && (event->event_id == g_system_event_handle_table[event->event_id].event_id)) { if (g_system_event_handle_table[event->event_id].event_handle) { - WIFI_DEBUG("enter default callback\n"); + ESP_LOGV(TAG, "enter default callback"); g_system_event_handle_table[event->event_id].event_handle(event); - WIFI_DEBUG("exit default callback\n"); + ESP_LOGV(TAG, "exit default callback"); } } else { - printf("mismatch or invalid event, id=%d\n", event->event_id); + ESP_LOGE(TAG, "mismatch or invalid event, id=%d", event->event_id); } return esp_wifi_post_event_to_user(event); @@ -310,7 +304,7 @@ static void esp_system_event_task(void *pvParameters) if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) { ret = esp_system_event_handler(&evt); if (ret == ESP_FAIL) { - printf("esp wifi post event to user fail!\n"); + ESP_LOGE(TAG, "post event to user fail!"); } } } @@ -334,9 +328,9 @@ esp_err_t esp_event_send(system_event_t *event) if (pdPASS != ret) { if (event) { - printf("e=%d f\n", event->event_id); + ESP_LOGE(TAG, "e=%d f", event->event_id); } else { - printf("e null\n"); + ESP_LOGE(TAG, "e null"); } return ESP_FAIL; } diff --git a/components/expat/component.mk b/components/expat/component.mk index 69595d7b27..907b358a87 100644 --- a/components/expat/component.mk +++ b/components/expat/component.mk @@ -10,6 +10,6 @@ COMPONENT_ADD_INCLUDEDIRS := port/include include/expat COMPONENT_SRCDIRS := library port -CFLAGS += -Wno-error=address -Waddress -DHAVE_EXPAT_CONFIG_H +CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H include $(IDF_PATH)/make/component_common.mk diff --git a/components/lwip/component.mk b/components/lwip/component.mk index 3e6b26c0f5..5d15020047 100644 --- a/components/lwip/component.mk +++ b/components/lwip/component.mk @@ -6,6 +6,6 @@ COMPONENT_ADD_INCLUDEDIRS := include/lwip include/lwip/port include/lwip/posix COMPONENT_SRCDIRS := api apps/sntp apps core/ipv4 core/ipv6 core netif port/freertos port/netif port -CFLAGS += -Wno-error=address -Waddress +CFLAGS += -Wno-address -Wno-unused-variable -Wno-unused-but-set-variable include $(IDF_PATH)/make/component_common.mk From 3f1c5c4d5b9713287423433ba07f647bb8053af0 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Fri, 23 Sep 2016 14:52:26 +0800 Subject: [PATCH 063/179] 1. add a macro 'GPIO_IS_VALID_OUTPUT_GPIO' and 'GPIO_IS_VALID_OUTPUT_GPIO' in gpio.h 2. add PIN_FUNC_GPIO in io_mux_reg.h, put the io_mux_regs in order 3. use braces around single line if statements in ledc.c and gpio.c --- components/driver/gpio.c | 49 ++-- components/driver/include/driver/gpio.h | 4 +- components/driver/include/driver/ledc.h | 14 +- components/driver/ledc.c | 111 +++++---- components/esp32/include/soc/io_mux_reg.h | 268 +++++++++++----------- 5 files changed, 237 insertions(+), 209 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index a7db2bde2f..320533e8d4 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -90,7 +90,6 @@ const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT] = { GPIO_PIN_REG_39 }; -#define IS_VALID_GPIO(gpio_num) ( (gpio_num < GPIO_PIN_COUNT && GPIO_PIN_MUX_REG[gpio_num] != 0)) static int is_valid_gpio(int gpio_num) { if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { @@ -102,8 +101,9 @@ static int is_valid_gpio(int gpio_num) esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(intr_type >= GPIO_INTR_MAX) { GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); return ESP_ERR_INVALID_ARG; @@ -114,8 +114,9 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) esp_err_t gpio_intr_enable(gpio_num_t gpio_num) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(xPortGetCoreID() == 0) { GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr } else { @@ -126,16 +127,18 @@ esp_err_t gpio_intr_enable(gpio_num_t gpio_num) esp_err_t gpio_intr_disable(gpio_num_t gpio_num) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr return ESP_OK; } static esp_err_t gpio_output_disable(gpio_num_t gpio_num) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(gpio_num < 32) { GPIO.enable_w1tc = (0x1 << gpio_num); } else { @@ -150,8 +153,9 @@ static esp_err_t gpio_output_enable(gpio_num_t gpio_num) GPIO_ERROR("io_num=%d can only be input\n",gpio_num); return ESP_ERR_INVALID_ARG; } - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(gpio_num < 32) { GPIO.enable_w1ts = (0x1 << gpio_num); } else { @@ -162,18 +166,21 @@ static esp_err_t gpio_output_enable(gpio_num_t gpio_num) esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) { - if(!IS_VALID_GPIO(gpio_num)) + if(!GPIO_IS_VALID_GPIO(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(level) { - if(gpio_num < 32) + if(gpio_num < 32) { GPIO.out_w1ts = (1 << gpio_num); - else + } else { GPIO.out1_w1ts.data = (1 << (gpio_num - 32)); + } } else { - if(gpio_num < 32) + if(gpio_num < 32) { GPIO.out_w1tc = (1 << gpio_num); - else + } else { GPIO.out1_w1tc.data = (1 << (gpio_num - 32)); + } } return ESP_OK; } @@ -189,8 +196,9 @@ int gpio_get_level(gpio_num_t gpio_num) esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } esp_err_t ret = ESP_OK; switch(pull) { case GPIO_PULLUP_ONLY: @@ -219,8 +227,9 @@ esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } if(gpio_num >= 34 && (mode & (GPIO_MODE_DEF_OUTPUT))) { GPIO_ERROR("io_num=%d can only be input\n",gpio_num); return ESP_ERR_INVALID_ARG; @@ -290,7 +299,8 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) gpio_output_enable(io_num); } else { gpio_output_disable(io_num); - }GPIO_INFO("|"); + } + GPIO_INFO("|"); if(pGPIOConfig->pull_up_en) { GPIO_INFO("PU "); PIN_PULLUP_EN(io_reg); @@ -310,7 +320,7 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) } else { gpio_intr_disable(io_num); } - PIN_FUNC_SELECT(io_reg, GPIO_FUNC_SEL); /*function number 2 is GPIO_FUNC for each pin */ + PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO); /*function number 2 is GPIO_FUNC for each pin */ } else if(bit_valid && (io_reg == 0)) { GPIO_WARNING("io_num=%d does not exist\n",io_num); } @@ -321,8 +331,9 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig) esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) { - if(fn == NULL) + if(fn == NULL) { return ESP_ERR_INVALID_ARG; + } ESP_INTR_DISABLE(gpio_intr_num); intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); xt_set_interrupt_handler(gpio_intr_num, fn, arg); @@ -333,8 +344,9 @@ esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * ar /*only level interrupt can be used for wake-up function*/ esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } esp_err_t ret = ESP_OK; if((intr_type == GPIO_INTR_LOW_LEVEL) || (intr_type == GPIO_INTR_HIGH_LEVEL)) { GPIO.pin[gpio_num].int_type = intr_type; @@ -348,8 +360,9 @@ esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) { - if(!is_valid_gpio(gpio_num)) + if(!is_valid_gpio(gpio_num)) { return ESP_ERR_INVALID_ARG; + } GPIO.pin[gpio_num].wakeup_enable = 0; return ESP_OK; } diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index d0ed5c9d79..862d4e5927 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -65,8 +65,6 @@ extern "C" { #define GPIO_SEL_38 ((uint64_t)(((uint64_t)1)<<38)) /* Pin 38 selected */ #define GPIO_SEL_39 ((uint64_t)(((uint64_t)1)<<39)) /* Pin 39 selected */ -#define GPIO_FUNC_SEL 2 - #define GPIO_PIN_REG_0 PERIPHS_IO_MUX_GPIO0_U #define GPIO_PIN_REG_1 PERIPHS_IO_MUX_U0TXD_U #define GPIO_PIN_REG_2 PERIPHS_IO_MUX_GPIO2_U @@ -115,6 +113,8 @@ extern "C" { #define GPIO_PIN_COUNT 40 extern const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT]; +#define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num < GPIO_PIN_COUNT && GPIO_PIN_MUX_REG[gpio_num] != 0)) //to decide whether it is a valid GPIO number +#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((GPIO_IS_VALID_GPIO(gpio_num)) && (gpio_num < 34)) //to decide whether it can be a valid GPIO number of output mode typedef enum { GPIO_NUM_0 = 0, diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 728fad460d..e8c03fd81c 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -101,7 +101,7 @@ typedef struct ledc_channel_t_config { * When different channel ,select same time ,their freq_hz and duty_depth must be same * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: spin_lock error + * ESP_FAIL: Can not find a proper pre-devider number base on the given frequency and the current duty_depth. * */ esp_err_t ledc_config(ledc_config_t* ledc_conf); @@ -118,7 +118,6 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf); * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: spin_lock error * */ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); @@ -134,7 +133,6 @@ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: spin_lock error */ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level); @@ -151,7 +149,7 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: spin_lock error + * ESP_FAIL: Can not find a proper pre-devider number base on the given frequency and the current duty_depth. */ esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz); @@ -181,7 +179,6 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel); * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: spin_lock error */ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty); @@ -193,10 +190,11 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t * @param[in] channel : LEDC channel(0-7) * * - * @return current LEDC duty + * @return -1: parameter error + * other value: current LEDC duty * */ -uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); +int ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); /** * @brief LEDC set gradient @@ -219,7 +217,6 @@ uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); * * @return ESP_OK : success * ESP_ERR_INVALID_ARG : parameter error - * ESP_FAIL : spin_lock error */ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, ledc_duty_direction_t gradule_direction, uint32_t step_num, uint32_t duty_cyle_num, uint32_t duty_scale); @@ -237,7 +234,6 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, * * @return ESP_OK : success ; * ESP_ERR_INVALID_ARG : fucntion ptr error. - * ESP_FAIL : spin_lock error */ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * arg); diff --git a/components/driver/ledc.c b/components/driver/ledc.c index 7b7920f53a..68e87c9884 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -82,11 +82,11 @@ static int ledc_is_valid_mode(uint32_t mode) return 1; } - static esp_err_t ledc_timer_config(ledc_mode_t speed_mode, uint32_t timer_sel, uint32_t div_num, uint32_t timer_lim,ledc_timer_source_t clk) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_timer[timer_sel].conf.div_num = div_num; LEDC.high_speed_timer[timer_sel].conf.tick_sel = clk; @@ -98,8 +98,9 @@ static esp_err_t ledc_timer_config(ledc_mode_t speed_mode, uint32_t timer_sel, u static esp_err_t ledc_duty_config(ledc_mode_t speed_mode, uint32_t channel_num, uint32_t hpoint_val, uint32_t duty_val, uint32_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_channel[channel_num].hpoint.hpoint = hpoint_val; LEDC.high_speed_channel[channel_num].duty.duty = duty_val; @@ -113,8 +114,9 @@ static esp_err_t ledc_duty_config(ledc_mode_t speed_mode, uint32_t channel_num, static esp_err_t ledc_set_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint32_t timer_idx) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_channel[channel].conf0.timer_sel = timer_idx; portEXIT_CRITICAL(&ledc_spinlock); @@ -123,8 +125,9 @@ static esp_err_t ledc_set_channel_timer(ledc_mode_t speed_mode, uint32_t channel static esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_timer[timer_sel].conf.rst = 1; LEDC.high_speed_timer[timer_sel].conf.rst = 0; @@ -133,8 +136,9 @@ static esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel) } static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, ledc_intr_type_t type) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; + } uint32_t value; uint32_t intr_type = type; portENTER_CRITICAL(&ledc_spinlock); @@ -150,8 +154,9 @@ static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * arg) { - if(fn == NULL) + if(fn == NULL) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); ESP_INTR_DISABLE(ledc_intr_num); intr_matrix_set(xPortGetCoreID(), ETS_LEDC_INTR_SOURCE, ledc_intr_num); @@ -174,19 +179,17 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) uint32_t duty_depth = ledc_conf->duty_depth; uint32_t intr_type = ledc_conf->intr_type; uint32_t duty = ledc_conf->duty; - uint64_t div_param = 0; + uint32_t div_param = 0; uint32_t precision = 0; - if(!ledc_is_valid_channel(ledc_channel)) - return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_mode(speed_mode)) - return ESP_ERR_INVALID_ARG; - if(gpio_num >= GPIO_NUM_34 || gpio_num == 20 || gpio_num == 24 || gpio_num == 28 || gpio_num == 29 || gpio_num == 30 - || gpio_num == 31) { - LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); + int timer_clk_src = 0; + if(!ledc_is_valid_channel(ledc_channel)) { return ESP_ERR_INVALID_ARG; } - if(gpio_num >= GPIO_PIN_COUNT || 0 == GPIO_PIN_MUX_REG[gpio_num]) { - LEDC_ERROR("io_num=%d does not exist\n", gpio_num); + if(!ledc_is_valid_mode(speed_mode)) { + return ESP_ERR_INVALID_ARG; + } + if(!GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) { + LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); return ESP_ERR_INVALID_ARG; } if(freq_hz == 0 || duty_depth == 0 || duty_depth > LEDC_DUTY_DEPTH_15_BIT) { @@ -200,32 +203,34 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) portENTER_CRITICAL(&ledc_spinlock); esp_err_t ret = ESP_OK; /*gpio matrix ledc pwm signal*/ - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], 2); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); /*configure ledc param*/ /*calculate the div_param and select which base clock and first we will select the apb_clk */ precision = (0x1 << duty_depth); //2**depth - div_param = (uint64_t) LEDC_APB_CLK_HZ * 256 / freq_hz / precision; //8bit fragment + div_param = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; //8bit fragment /*Fail ,because the div num overflow or too small*/ - if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0) { //REF TICK + if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0_V) { //REF TICK /*Selet the reference tick*/ - div_param = (uint64_t) LEDC_REF_CLK_HZ * 256 / freq_hz / precision; + div_param = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0_V) { LEDC_ERROR("div param err,div_param=%u\n", div_param); ret = ESP_FAIL; } - ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, LEDC_REF_TICK); + timer_clk_src = LEDC_REF_TICK; + ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, timer_clk_src); ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); } else { //APB TICK - ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, LEDC_APB_CLK); + timer_clk_src = LEDC_APB_CLK; + ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, timer_clk_src); ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); } ledc_timer_rst(speed_mode, timer_select); ledc_set_duty(speed_mode, ledc_channel, duty); ledc_enable_intr_type(speed_mode, ledc_channel, intr_type); LEDC_INFO("LEDC_PWM CHANNEL %1u|GPIO %02u|FreHz %05u|Duty %04u|Depth %04u|Time %01u|SourceClk %01u|Divparam %u\n", - ledc_channel, gpio_num, freq_hz, duty, duty_depth, timer_select, timer_source_clk_flag, div_param + ledc_channel, gpio_num, freq_hz, duty, duty_depth, timer_select, timer_clk_src, div_param ); ledc_update(speed_mode, ledc_channel); portEXIT_CRITICAL(&ledc_spinlock); @@ -234,10 +239,12 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_channel(channel)) + } + if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_channel[channel].conf0.sig_out_en = 1; LEDC.high_speed_channel[channel].conf1.duty_start = 1; @@ -247,10 +254,12 @@ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel) esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idle_level) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_channel(channel)) + } + if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); LEDC.high_speed_channel[channel].conf0.idle_lv = idle_level; LEDC.high_speed_channel[channel].conf0.sig_out_en = 0; @@ -261,15 +270,17 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, ledc_duty_direction_t fade_direction, uint32_t step_num, uint32_t duty_cyle_num, uint32_t duty_scale) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_channel(channel)) + } + if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; + } if(fade_direction > LEDC_DUTY_DIR_INCREASE) { LEDC_ERROR("Duty direction err\n"); return ESP_ERR_INVALID_ARG; } - if(step_num > 0X3FF || duty_cyle_num > 0X3FF || duty_scale > 0X3FF) { + if(step_num > LEDC_DUTY_NUM_HSCH0_V || duty_cyle_num > LEDC_DUTY_CYCLE_HSCH0_V || duty_scale > LEDC_DUTY_SCALE_HSCH0_V) { LEDC_ERROR("step_num=%u duty_cyle_num=%u duty_scale=%u\n", step_num, duty_cyle_num, duty_scale); return ESP_ERR_INVALID_ARG; } @@ -289,10 +300,12 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_channel(channel)) + } + if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); ledc_duty_config(speed_mode, channel, //uint32_t chan_num, @@ -307,21 +320,23 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t return ESP_OK; } -uint32_t ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel) +int ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel) { - if(!ledc_is_valid_mode(speed_mode)) - return ESP_ERR_INVALID_ARG; - uint32_t duty = 0; - duty = (LEDC.high_speed_channel[channel].duty_rd.duty_read >> 4); + if(!ledc_is_valid_mode(speed_mode)) { + return -1; + } + uint32_t duty = (LEDC.high_speed_channel[channel].duty_rd.duty_read >> 4); return duty; } esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; - if(!ledc_is_valid_channel(channel)) + } + if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); esp_err_t ret = ESP_OK; uint32_t div_num = 0; @@ -332,9 +347,9 @@ esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t uint32_t timer_source_clk = LEDC.high_speed_timer[timer_select].conf.tick_sel; uint32_t precision = (0x1 << duty_depth); if(timer_source_clk == LEDC_APB_CLK) { - div_num = (uint64_t) LEDC_APB_CLK_HZ * 256 / freq_hz / precision; + div_num = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; } else { - div_num = (uint64_t) LEDC_REF_CLK_HZ * 256 / freq_hz / precision; + div_num = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; } if(div_num <= 256 || div_num > LEDC_DIV_NUM_HSTIMER0) { LEDC_ERROR("channel %u,div param err,div_param=%u\n", channel, div_num); @@ -347,10 +362,12 @@ esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel) { - if(!ledc_is_valid_mode(speed_mode)) + if(!ledc_is_valid_mode(speed_mode)) { return 0; - if(!ledc_is_valid_channel(channel)) - return ESP_ERR_INVALID_ARG; + } + if(!ledc_is_valid_channel(channel)) { + return 0; + } portENTER_CRITICAL(&ledc_spinlock); uint32_t freq = 0; uint32_t timer_select = LEDC.high_speed_channel[channel].conf0.timer_sel; @@ -359,9 +376,9 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel) uint32_t div_num = LEDC.high_speed_timer[timer_select].conf.div_num; uint32_t precision = (0x1 << duty_depth); if(timer_source_clk == LEDC_APB_CLK) { - freq = ((uint64_t) LEDC_APB_CLK_HZ) * 256 / precision / div_num; + freq = ((uint64_t) LEDC_APB_CLK_HZ << 8) / precision / div_num; } else { - freq = ((uint64_t) LEDC_REF_CLK_HZ) * 256 / precision / div_num; + freq = ((uint64_t) LEDC_REF_CLK_HZ << 8) / precision / div_num; } portEXIT_CRITICAL(&ledc_spinlock); return freq; diff --git a/components/esp32/include/soc/io_mux_reg.h b/components/esp32/include/soc/io_mux_reg.h index f6ec4e5200..208a60703a 100644 --- a/components/esp32/include/soc/io_mux_reg.h +++ b/components/esp32/include/soc/io_mux_reg.h @@ -40,6 +40,8 @@ #define PIN_PULLDWN_EN(PIN_NAME) REG_SET_BIT(PIN_NAME, FUN_PD) #define PIN_FUNC_SELECT(PIN_NAME, FUNC) REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC) +#define PIN_FUNC_GPIO 2 + #define PIN_CTRL (DR_REG_IO_MUX_BASE +0x00) #define CLK_OUT3 0xf #define CLK_OUT3_S 8 @@ -48,84 +50,17 @@ #define CLK_OUT1 0xf #define CLK_OUT1_S 0 -#define PERIPHS_IO_MUX_GPIO36_U (DR_REG_IO_MUX_BASE +0x04) -#define FUNC_GPIO36_GPIO36 2 -#define FUNC_GPIO36_GPIO36_0 0 +#define PERIPHS_IO_MUX_GPIO0_U (DR_REG_IO_MUX_BASE +0x44) +#define FUNC_GPIO0_EMAC_TX_CLK 5 +#define FUNC_GPIO0_GPIO0 2 +#define FUNC_GPIO0_CLK_OUT1 1 +#define FUNC_GPIO0_GPIO0_0 0 -#define PERIPHS_IO_MUX_GPIO37_U (DR_REG_IO_MUX_BASE +0x08) -#define FUNC_GPIO37_GPIO37 2 -#define FUNC_GPIO37_GPIO37_0 0 - -#define PERIPHS_IO_MUX_GPIO38_U (DR_REG_IO_MUX_BASE +0x0c) -#define FUNC_GPIO38_GPIO38 2 -#define FUNC_GPIO38_GPIO38_0 0 - -#define PERIPHS_IO_MUX_GPIO39_U (DR_REG_IO_MUX_BASE +0x10) -#define FUNC_GPIO39_GPIO39 2 -#define FUNC_GPIO39_GPIO39_0 0 - -#define PERIPHS_IO_MUX_GPIO34_U (DR_REG_IO_MUX_BASE +0x14) -#define FUNC_GPIO34_GPIO34 2 -#define FUNC_GPIO34_GPIO34_0 0 - -#define PERIPHS_IO_MUX_GPIO35_U (DR_REG_IO_MUX_BASE +0x18) -#define FUNC_GPIO35_GPIO35 2 -#define FUNC_GPIO35_GPIO35_0 0 - -#define PERIPHS_IO_MUX_GPIO32_U (DR_REG_IO_MUX_BASE +0x1c) -#define FUNC_GPIO32_GPIO32 2 -#define FUNC_GPIO32_GPIO32_0 0 - -#define PERIPHS_IO_MUX_GPIO33_U (DR_REG_IO_MUX_BASE +0x20) -#define FUNC_GPIO33_GPIO33 2 -#define FUNC_GPIO33_GPIO33_0 0 - -#define PERIPHS_IO_MUX_GPIO25_U (DR_REG_IO_MUX_BASE +0x24) -#define FUNC_GPIO25_EMAC_RXD0 5 -#define FUNC_GPIO25_GPIO25 2 -#define FUNC_GPIO25_GPIO25_0 0 - -#define PERIPHS_IO_MUX_GPIO26_U (DR_REG_IO_MUX_BASE +0x28) -#define FUNC_GPIO26_EMAC_RXD1 5 -#define FUNC_GPIO26_GPIO26 2 -#define FUNC_GPIO26_GPIO26_0 0 - -#define PERIPHS_IO_MUX_GPIO27_U (DR_REG_IO_MUX_BASE +0x2c) -#define FUNC_GPIO27_EMAC_RX_DV 5 -#define FUNC_GPIO27_GPIO27 2 -#define FUNC_GPIO27_GPIO27_0 0 - -#define PERIPHS_IO_MUX_MTMS_U (DR_REG_IO_MUX_BASE +0x30) -#define FUNC_MTMS_EMAC_TXD2 5 -#define FUNC_MTMS_SD_CLK 4 -#define FUNC_MTMS_HS2_CLk 3 -#define FUNC_MTMS_GPIO14 2 -#define FUNC_MTMS_HSPICLK 1 -#define FUNC_MTMS_MTMS 0 - -#define PERIPHS_IO_MUX_MTDI_U (DR_REG_IO_MUX_BASE +0x34) -#define FUNC_MTDI_EMAC_TXD3 5 -#define FUNC_MTDI_SD_DATA2 4 -#define FUNC_MTDI_HS2_DATA2 3 -#define FUNC_MTDI_GPIO12 2 -#define FUNC_MTDI_HSPIQ 1 -#define FUNC_MTDI_MTDI 0 - -#define PERIPHS_IO_MUX_MTCK_U (DR_REG_IO_MUX_BASE +0x38) -#define FUNC_MTCK_EMAC_RX_ER 5 -#define FUNC_MTCK_SD_DATA3 4 -#define FUNC_MTCK_HS2_DATA3 3 -#define FUNC_MTCK_GPIO13 2 -#define FUNC_MTCK_HSPID 1 -#define FUNC_MTCK_MTCK 0 - -#define PERIPHS_IO_MUX_MTDO_U (DR_REG_IO_MUX_BASE +0x3c) -#define FUNC_MTDO_EMAC_RXD3 5 -#define FUNC_MTDO_SD_CMD 4 -#define FUNC_MTDO_HS2_CMD 3 -#define FUNC_MTDO_GPIO15 2 -#define FUNC_MTDO_HSPICS0 1 -#define FUNC_MTDO_MTDO 0 +#define PERIPHS_IO_MUX_U0TXD_U (DR_REG_IO_MUX_BASE +0x88) +#define FUNC_U0TXD_EMAC_RXD2 3 +#define FUNC_U0TXD_GPIO1 2 +#define FUNC_U0TXD_CLK_OUT3 1 +#define FUNC_U0TXD_U0TXD 0 #define PERIPHS_IO_MUX_GPIO2_U (DR_REG_IO_MUX_BASE +0x40) #define FUNC_GPIO2_SD_DATA0 4 @@ -134,11 +69,10 @@ #define FUNC_GPIO2_HSPIWP 1 #define FUNC_GPIO2_GPIO2_0 0 -#define PERIPHS_IO_MUX_GPIO0_U (DR_REG_IO_MUX_BASE +0x44) -#define FUNC_GPIO0_EMAC_TX_CLK 5 -#define FUNC_GPIO0_GPIO0 2 -#define FUNC_GPIO0_CLK_OUT1 1 -#define FUNC_GPIO0_GPIO0_0 0 +#define PERIPHS_IO_MUX_U0RXD_U (DR_REG_IO_MUX_BASE +0x84) +#define FUNC_U0RXD_GPIO3 2 +#define FUNC_U0RXD_CLK_OUT2 1 +#define FUNC_U0RXD_U0RXD 0 #define PERIPHS_IO_MUX_GPIO4_U (DR_REG_IO_MUX_BASE +0x48) #define FUNC_GPIO4_EMAC_TX_ER 5 @@ -148,40 +82,12 @@ #define FUNC_GPIO4_HSPIHD 1 #define FUNC_GPIO4_GPIO4_0 0 -#define PERIPHS_IO_MUX_GPIO16_U (DR_REG_IO_MUX_BASE +0x4c) -#define FUNC_GPIO16_EMAC_CLK_OUT 5 -#define FUNC_GPIO16_U2RXD 4 -#define FUNC_GPIO16_HS1_DATA4 3 -#define FUNC_GPIO16_GPIO16 2 -#define FUNC_GPIO16_GPIO16_0 0 - -#define PERIPHS_IO_MUX_GPIO17_U (DR_REG_IO_MUX_BASE +0x50) -#define FUNC_GPIO17_EMAC_CLK_OUT_180 5 -#define FUNC_GPIO17_U2TXD 4 -#define FUNC_GPIO17_HS1_DATA5 3 -#define FUNC_GPIO17_GPIO17 2 -#define FUNC_GPIO17_GPIO17_0 0 - -#define PERIPHS_IO_MUX_SD_DATA2_U (DR_REG_IO_MUX_BASE +0x54) -#define FUNC_SD_DATA2_U1RXD 4 -#define FUNC_SD_DATA2_HS1_DATA2 3 -#define FUNC_SD_DATA2_GPIO9 2 -#define FUNC_SD_DATA2_SPIHD 1 -#define FUNC_SD_DATA2_SD_DATA2 0 - -#define PERIPHS_IO_MUX_SD_DATA3_U (DR_REG_IO_MUX_BASE +0x58) -#define FUNC_SD_DATA3_U1TXD 4 -#define FUNC_SD_DATA3_HS1_DATA3 3 -#define FUNC_SD_DATA3_GPIO10 2 -#define FUNC_SD_DATA3_SPIWP 1 -#define FUNC_SD_DATA3_SD_DATA3 0 - -#define PERIPHS_IO_MUX_SD_CMD_U (DR_REG_IO_MUX_BASE +0x5c) -#define FUNC_SD_CMD_U1RTS 4 -#define FUNC_SD_CMD_HS1_CMD 3 -#define FUNC_SD_CMD_GPIO11 2 -#define FUNC_SD_CMD_SPICS0 1 -#define FUNC_SD_CMD_SD_CMD 0 +#define PERIPHS_IO_MUX_GPIO5_U (DR_REG_IO_MUX_BASE +0x6c) +#define FUNC_GPIO5_EMAC_RX_CLK 5 +#define FUNC_GPIO5_HS1_DATA6 3 +#define FUNC_GPIO5_GPIO5 2 +#define FUNC_GPIO5_VSPICS0 1 +#define FUNC_GPIO5_GPIO5_0 0 #define PERIPHS_IO_MUX_SD_CLK_U (DR_REG_IO_MUX_BASE +0x60) #define FUNC_SD_CLK_U1CTS 4 @@ -204,12 +110,72 @@ #define FUNC_SD_DATA1_SPID 1 #define FUNC_SD_DATA1_SD_DATA1 0 -#define PERIPHS_IO_MUX_GPIO5_U (DR_REG_IO_MUX_BASE +0x6c) -#define FUNC_GPIO5_EMAC_RX_CLK 5 -#define FUNC_GPIO5_HS1_DATA6 3 -#define FUNC_GPIO5_GPIO5 2 -#define FUNC_GPIO5_VSPICS0 1 -#define FUNC_GPIO5_GPIO5_0 0 +#define PERIPHS_IO_MUX_SD_DATA2_U (DR_REG_IO_MUX_BASE +0x54) +#define FUNC_SD_DATA2_U1RXD 4 +#define FUNC_SD_DATA2_HS1_DATA2 3 +#define FUNC_SD_DATA2_GPIO9 2 +#define FUNC_SD_DATA2_SPIHD 1 +#define FUNC_SD_DATA2_SD_DATA2 0 + +#define PERIPHS_IO_MUX_SD_DATA3_U (DR_REG_IO_MUX_BASE +0x58) +#define FUNC_SD_DATA3_U1TXD 4 +#define FUNC_SD_DATA3_HS1_DATA3 3 +#define FUNC_SD_DATA3_GPIO10 2 +#define FUNC_SD_DATA3_SPIWP 1 +#define FUNC_SD_DATA3_SD_DATA3 0 + +#define PERIPHS_IO_MUX_SD_CMD_U (DR_REG_IO_MUX_BASE +0x5c) +#define FUNC_SD_CMD_U1RTS 4 +#define FUNC_SD_CMD_HS1_CMD 3 +#define FUNC_SD_CMD_GPIO11 2 +#define FUNC_SD_CMD_SPICS0 1 +#define FUNC_SD_CMD_SD_CMD 0 + +#define PERIPHS_IO_MUX_MTDI_U (DR_REG_IO_MUX_BASE +0x34) +#define FUNC_MTDI_EMAC_TXD3 5 +#define FUNC_MTDI_SD_DATA2 4 +#define FUNC_MTDI_HS2_DATA2 3 +#define FUNC_MTDI_GPIO12 2 +#define FUNC_MTDI_HSPIQ 1 +#define FUNC_MTDI_MTDI 0 + +#define PERIPHS_IO_MUX_MTCK_U (DR_REG_IO_MUX_BASE +0x38) +#define FUNC_MTCK_EMAC_RX_ER 5 +#define FUNC_MTCK_SD_DATA3 4 +#define FUNC_MTCK_HS2_DATA3 3 +#define FUNC_MTCK_GPIO13 2 +#define FUNC_MTCK_HSPID 1 +#define FUNC_MTCK_MTCK 0 + +#define PERIPHS_IO_MUX_MTMS_U (DR_REG_IO_MUX_BASE +0x30) +#define FUNC_MTMS_EMAC_TXD2 5 +#define FUNC_MTMS_SD_CLK 4 +#define FUNC_MTMS_HS2_CLk 3 +#define FUNC_MTMS_GPIO14 2 +#define FUNC_MTMS_HSPICLK 1 +#define FUNC_MTMS_MTMS 0 + +#define PERIPHS_IO_MUX_MTDO_U (DR_REG_IO_MUX_BASE +0x3c) +#define FUNC_MTDO_EMAC_RXD3 5 +#define FUNC_MTDO_SD_CMD 4 +#define FUNC_MTDO_HS2_CMD 3 +#define FUNC_MTDO_GPIO15 2 +#define FUNC_MTDO_HSPICS0 1 +#define FUNC_MTDO_MTDO 0 + +#define PERIPHS_IO_MUX_GPIO16_U (DR_REG_IO_MUX_BASE +0x4c) +#define FUNC_GPIO16_EMAC_CLK_OUT 5 +#define FUNC_GPIO16_U2RXD 4 +#define FUNC_GPIO16_HS1_DATA4 3 +#define FUNC_GPIO16_GPIO16 2 +#define FUNC_GPIO16_GPIO16_0 0 + +#define PERIPHS_IO_MUX_GPIO17_U (DR_REG_IO_MUX_BASE +0x50) +#define FUNC_GPIO17_EMAC_CLK_OUT_180 5 +#define FUNC_GPIO17_U2TXD 4 +#define FUNC_GPIO17_HS1_DATA5 3 +#define FUNC_GPIO17_GPIO17 2 +#define FUNC_GPIO17_GPIO17_0 0 #define PERIPHS_IO_MUX_GPIO18_U (DR_REG_IO_MUX_BASE +0x70) #define FUNC_GPIO18_HS1_DATA7 3 @@ -241,17 +207,6 @@ #define FUNC_GPIO22_VSPIWP 1 #define FUNC_GPIO22_GPIO22_0 0 -#define PERIPHS_IO_MUX_U0RXD_U (DR_REG_IO_MUX_BASE +0x84) -#define FUNC_U0RXD_GPIO3 2 -#define FUNC_U0RXD_CLK_OUT2 1 -#define FUNC_U0RXD_U0RXD 0 - -#define PERIPHS_IO_MUX_U0TXD_U (DR_REG_IO_MUX_BASE +0x88) -#define FUNC_U0TXD_EMAC_RXD2 3 -#define FUNC_U0TXD_GPIO1 2 -#define FUNC_U0TXD_CLK_OUT3 1 -#define FUNC_U0TXD_U0TXD 0 - #define PERIPHS_IO_MUX_GPIO23_U (DR_REG_IO_MUX_BASE +0x8c) #define FUNC_GPIO23_HS1_STROBE 3 #define FUNC_GPIO23_GPIO23 2 @@ -262,4 +217,51 @@ #define FUNC_GPIO24_GPIO24 2 #define FUNC_GPIO24_GPIO24_0 0 +#define PERIPHS_IO_MUX_GPIO25_U (DR_REG_IO_MUX_BASE +0x24) +#define FUNC_GPIO25_EMAC_RXD0 5 +#define FUNC_GPIO25_GPIO25 2 +#define FUNC_GPIO25_GPIO25_0 0 + +#define PERIPHS_IO_MUX_GPIO26_U (DR_REG_IO_MUX_BASE +0x28) +#define FUNC_GPIO26_EMAC_RXD1 5 +#define FUNC_GPIO26_GPIO26 2 +#define FUNC_GPIO26_GPIO26_0 0 + +#define PERIPHS_IO_MUX_GPIO27_U (DR_REG_IO_MUX_BASE +0x2c) +#define FUNC_GPIO27_EMAC_RX_DV 5 +#define FUNC_GPIO27_GPIO27 2 +#define FUNC_GPIO27_GPIO27_0 0 + +#define PERIPHS_IO_MUX_GPIO32_U (DR_REG_IO_MUX_BASE +0x1c) +#define FUNC_GPIO32_GPIO32 2 +#define FUNC_GPIO32_GPIO32_0 0 + +#define PERIPHS_IO_MUX_GPIO33_U (DR_REG_IO_MUX_BASE +0x20) +#define FUNC_GPIO33_GPIO33 2 +#define FUNC_GPIO33_GPIO33_0 0 + +#define PERIPHS_IO_MUX_GPIO34_U (DR_REG_IO_MUX_BASE +0x14) +#define FUNC_GPIO34_GPIO34 2 +#define FUNC_GPIO34_GPIO34_0 0 + +#define PERIPHS_IO_MUX_GPIO35_U (DR_REG_IO_MUX_BASE +0x18) +#define FUNC_GPIO35_GPIO35 2 +#define FUNC_GPIO35_GPIO35_0 0 + +#define PERIPHS_IO_MUX_GPIO36_U (DR_REG_IO_MUX_BASE +0x04) +#define FUNC_GPIO36_GPIO36 2 +#define FUNC_GPIO36_GPIO36_0 0 + +#define PERIPHS_IO_MUX_GPIO37_U (DR_REG_IO_MUX_BASE +0x08) +#define FUNC_GPIO37_GPIO37 2 +#define FUNC_GPIO37_GPIO37_0 0 + +#define PERIPHS_IO_MUX_GPIO38_U (DR_REG_IO_MUX_BASE +0x0c) +#define FUNC_GPIO38_GPIO38 2 +#define FUNC_GPIO38_GPIO38_0 0 + +#define PERIPHS_IO_MUX_GPIO39_U (DR_REG_IO_MUX_BASE +0x10) +#define FUNC_GPIO39_GPIO39 2 +#define FUNC_GPIO39_GPIO39_0 0 + #endif /* _SOC_IO_MUX_REG_H_ */ From 6bb5a93221c4a4a74d0e4fea719ce35493630749 Mon Sep 17 00:00:00 2001 From: snake Date: Fri, 23 Sep 2016 14:54:30 +0800 Subject: [PATCH 064/179] add 'extern C' in header files --- components/bt/include/bt.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index f8b7a8a0fd..8511aabdf8 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -18,6 +18,11 @@ #include "freertos/FreeRTOS.h" #include "esp_err.h" +#ifdef __cplusplus +extern "C" { +#endif + + typedef void (* bt_app_startup_cb_t)(void *param); esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx); @@ -54,4 +59,8 @@ void API_vhci_host_send_packet(uint8_t *data, uint16_t len); */ void API_vhci_host_register_callback(const vhci_host_callback_t *callback); +#ifdef __cplusplus +} +#endif + #endif /* __BT_H__ */ From 6718e321f244abf63b1be079152ec01ff73533ce Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 23 Sep 2016 15:02:17 +0800 Subject: [PATCH 065/179] components/esp32: clean up unused function warnings in single core mode --- components/esp32/cpu_start.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 85f4ace512..b31b1e5e8e 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -44,8 +44,11 @@ #include "esp_log.h" static void IRAM_ATTR user_start_cpu0(void); +#if !CONFIG_FREERTOS_UNICORE static void IRAM_ATTR call_user_start_cpu1(); static void IRAM_ATTR user_start_cpu1(void); +static bool app_cpu_started = false; +#endif extern void ets_setup_syscalls(void); extern esp_err_t app_main(void *ctx); @@ -57,7 +60,6 @@ extern void (*__init_array_end)(void); extern volatile int port_xSchedulerRunning[2]; static const char* TAG = "cpu_start"; -static bool app_cpu_started = false; /* * We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, @@ -107,7 +109,7 @@ void IRAM_ATTR call_user_start_cpu0() user_start_cpu0(); } - +#if !CONFIG_FREERTOS_UNICORE void IRAM_ATTR call_user_start_cpu1() { asm volatile (\ @@ -130,6 +132,7 @@ void IRAM_ATTR user_start_cpu1(void) ESP_LOGI(TAG, "Starting scheduler on APP CPU."); xPortStartScheduler(); } +#endif static void do_global_ctors(void) { From d63dac0320316fe803ab0110edeb1dcf748ad21d Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Fri, 23 Sep 2016 17:43:52 +0800 Subject: [PATCH 066/179] Remove all references to prvLockQueue / prvUnlockQueue --- components/esp32/lib | 2 +- components/freertos/queue.c | 389 ++++++++---------------------------- 2 files changed, 87 insertions(+), 304 deletions(-) diff --git a/components/esp32/lib b/components/esp32/lib index f6d558367a..1303c92c10 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit f6d558367a08b6c9b18c2de515bd0a6740d2c45c +Subproject commit 1303c92c1056b7f59b95360b58e70a21cb4a93e1 diff --git a/components/freertos/queue.c b/components/freertos/queue.c index 248ae7c00a..1fb0552d49 100644 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@ -100,11 +100,6 @@ header files above, but not in this file, in order to generate the correct privileged Vs unprivileged linkage and placement. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */ - -/* Constants used with the xRxLock and xTxLock structure members. */ -#define queueUNLOCKED ( ( BaseType_t ) -1 ) -#define queueLOCKED_UNMODIFIED ( ( BaseType_t ) 0 ) - /* When the Queue_t structure is used to represent a base queue its pcHead and pcTail members are used as pointers into the queue storage area. When the Queue_t structure is used to represent a mutex pcHead and pcTail pointers are @@ -163,9 +158,6 @@ typedef struct QueueDefinition UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */ - volatile BaseType_t xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - volatile BaseType_t xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - #if ( configUSE_TRACE_FACILITY == 1 ) UBaseType_t uxQueueNumber; uint8_t ucQueueType; @@ -212,15 +204,6 @@ typedef xQUEUE Queue_t; #endif /* configQUEUE_REGISTRY_SIZE */ -/* - * Unlocks a queue locked by a call to prvLockQueue. Locking a queue does not - * prevent an ISR from adding or removing items to the queue, but does prevent - * an ISR from removing tasks from the queue event lists. If an ISR finds a - * queue is locked it will instead increment the appropriate queue lock count - * to indicate that a task may require unblocking. When the queue in unlocked - * these lock counts are inspected, and the appropriate action taken. - */ -static void prvUnlockQueue( Queue_t * const pxQueue ) PRIVILEGED_FUNCTION; /* * Uses a critical section to determine if there is any data in a queue. @@ -255,27 +238,6 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; #endif -/*-----------------------------------------------------------*/ - -/* - * Macro to mark a queue as locked. Locking a queue prevents an ISR from - * accessing the queue event lists. - */ -#define prvLockQueue( pxQueue ) \ - taskENTER_CRITICAL(&pxQueue->mux); \ - { \ - if( ( pxQueue )->xRxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED; \ - } \ - if( ( pxQueue )->xTxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED; \ - } \ - } \ - taskEXIT_CRITICAL(&pxQueue->mux) -/*-----------------------------------------------------------*/ - BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) { Queue_t * const pxQueue = ( Queue_t * ) xQueue; @@ -292,8 +254,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U; pxQueue->pcWriteTo = pxQueue->pcHead; pxQueue->u.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - ( UBaseType_t ) 1U ) * pxQueue->uxItemSize ); - pxQueue->xRxLock = queueUNLOCKED; - pxQueue->xTxLock = queueUNLOCKED; if( xNewQueue == pdFALSE ) { @@ -441,8 +401,6 @@ int8_t *pcAllocatedBuffer; pxNewQueue->uxMessagesWaiting = ( UBaseType_t ) 0U; pxNewQueue->uxLength = ( UBaseType_t ) 1U; pxNewQueue->uxItemSize = ( UBaseType_t ) 0U; - pxNewQueue->xRxLock = queueUNLOCKED; - pxNewQueue->xTxLock = queueUNLOCKED; #if ( configUSE_TRACE_FACILITY == 1 ) { @@ -787,7 +745,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; now the critical section has been exited. */ taskENTER_CRITICAL(&pxQueue->mux); -// prvLockQueue( pxQueue ); /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) @@ -797,13 +754,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; traceBLOCKING_ON_QUEUE_SEND( pxQueue ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); - /* Unlocking the queue means queue events can effect the - event list. It is possible that interrupts occurring now - remove this task from the event list again - but as the - scheduler is suspended the task will go onto the pending - ready last instead of the actual ready list. */ -// prvUnlockQueue( pxQueue ); - /* Resuming the scheduler will move tasks from the pending ready list into the ready list - so it is feasible that this @@ -816,14 +766,12 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; else { /* Try again. */ -// prvUnlockQueue( pxQueue ); taskEXIT_CRITICAL(&pxQueue->mux); } } else { /* The timeout has expired. */ -// prvUnlockQueue( pxQueue ); taskEXIT_CRITICAL(&pxQueue->mux); /* Return to the original privilege level before exiting the @@ -1129,27 +1077,18 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; disinheritance here or to clear the mutex holder TCB member. */ ( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - /* The event list is not altered if the queue is locked. This will - be done when the queue is unlocked later. */ - if( pxQueue->xTxLock == queueUNLOCKED ) + #if ( configUSE_QUEUE_SETS == 1 ) { - #if ( configUSE_QUEUE_SETS == 1 ) + if( pxQueue->pxQueueSetContainer != NULL ) { - if( pxQueue->pxQueueSetContainer != NULL ) + if( prvNotifyQueueSetContainer( pxQueue, xCopyPosition ) == pdTRUE ) { - if( prvNotifyQueueSetContainer( pxQueue, xCopyPosition ) == pdTRUE ) + /* The queue is a member of a queue set, and posting + to the queue set caused a higher priority task to + unblock. A context switch is required. */ + if( pxHigherPriorityTaskWoken != NULL ) { - /* The queue is a member of a queue set, and posting - to the queue set caused a higher priority task to - unblock. A context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + *pxHigherPriorityTaskWoken = pdTRUE; } else { @@ -1158,40 +1097,17 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; } else { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so - record that a context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + mtCOVERAGE_TEST_MARKER(); } } - #else /* configUSE_QUEUE_SETS */ + else { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) { if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) { - /* The task waiting has a higher priority so record that a - context switch is required. */ + /* The task waiting has a higher priority so + record that a context switch is required. */ if( pxHigherPriorityTaskWoken != NULL ) { *pxHigherPriorityTaskWoken = pdTRUE; @@ -1211,16 +1127,35 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; mtCOVERAGE_TEST_MARKER(); } } - #endif /* configUSE_QUEUE_SETS */ } - else + #else /* configUSE_QUEUE_SETS */ { - /* Increment the lock count so the task that unlocks the queue - knows that data was posted while it was locked. */ - ++( pxQueue->xTxLock ); + if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) + { + if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) + { + /* The task waiting has a higher priority so record that a + context switch is required. */ + if( pxHigherPriorityTaskWoken != NULL ) + { + *pxHigherPriorityTaskWoken = pdTRUE; + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + } + else + { + mtCOVERAGE_TEST_MARKER(); + } } - - xReturn = pdPASS; + #endif /* configUSE_QUEUE_SETS */ } else { @@ -1285,27 +1220,18 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; ++( pxQueue->uxMessagesWaiting ); - /* The event list is not altered if the queue is locked. This will - be done when the queue is unlocked later. */ - if( pxQueue->xTxLock == queueUNLOCKED ) + #if ( configUSE_QUEUE_SETS == 1 ) { - #if ( configUSE_QUEUE_SETS == 1 ) + if( pxQueue->pxQueueSetContainer != NULL ) { - if( pxQueue->pxQueueSetContainer != NULL ) + if( prvNotifyQueueSetContainer( pxQueue, queueSEND_TO_BACK ) == pdTRUE ) { - if( prvNotifyQueueSetContainer( pxQueue, queueSEND_TO_BACK ) == pdTRUE ) + /* The semaphore is a member of a queue set, and + posting to the queue set caused a higher priority + task to unblock. A context switch is required. */ + if( pxHigherPriorityTaskWoken != NULL ) { - /* The semaphore is a member of a queue set, and - posting to the queue set caused a higher priority - task to unblock. A context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + *pxHigherPriorityTaskWoken = pdTRUE; } else { @@ -1314,40 +1240,17 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; } else { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so - record that a context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + mtCOVERAGE_TEST_MARKER(); } } - #else /* configUSE_QUEUE_SETS */ + else { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) { if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) { - /* The task waiting has a higher priority so record that a - context switch is required. */ + /* The task waiting has a higher priority so + record that a context switch is required. */ if( pxHigherPriorityTaskWoken != NULL ) { *pxHigherPriorityTaskWoken = pdTRUE; @@ -1367,14 +1270,35 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; mtCOVERAGE_TEST_MARKER(); } } - #endif /* configUSE_QUEUE_SETS */ } - else + #else /* configUSE_QUEUE_SETS */ { - /* Increment the lock count so the task that unlocks the queue - knows that data was posted while it was locked. */ - ++( pxQueue->xTxLock ); + if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) + { + if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) + { + /* The task waiting has a higher priority so record that a + context switch is required. */ + if( pxHigherPriorityTaskWoken != NULL ) + { + *pxHigherPriorityTaskWoken = pdTRUE; + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + } + else + { + mtCOVERAGE_TEST_MARKER(); + } } + #endif /* configUSE_QUEUE_SETS */ xReturn = pdPASS; } @@ -1525,7 +1449,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; now the critical section has been exited. */ taskENTER_CRITICAL(&pxQueue->mux); -// prvLockQueue( pxQueue ); /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) @@ -1548,20 +1471,17 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; #endif vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); -// prvUnlockQueue( pxQueue ); taskEXIT_CRITICAL(&pxQueue->mux); portYIELD_WITHIN_API(); } else { /* Try again. */ -// prvUnlockQueue( pxQueue ); taskEXIT_CRITICAL(&pxQueue->mux); } } else { -// prvUnlockQueue( pxQueue ); taskEXIT_CRITICAL(&pxQueue->mux); traceQUEUE_RECEIVE_FAILED( pxQueue ); return errQUEUE_EMPTY; @@ -1606,26 +1526,15 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; prvCopyDataFromQueue( pxQueue, pvBuffer ); --( pxQueue->uxMessagesWaiting ); - /* If the queue is locked the event list will not be modified. - Instead update the lock count so the task that unlocks the queue - will know that an ISR has removed data while the queue was - locked. */ - if( pxQueue->xRxLock == queueUNLOCKED ) + if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) + if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) + /* The task waiting has a higher priority than us so + force a context switch. */ + if( pxHigherPriorityTaskWoken != NULL ) { - /* The task waiting has a higher priority than us so - force a context switch. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + *pxHigherPriorityTaskWoken = pdTRUE; } else { @@ -1639,9 +1548,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; } else { - /* Increment the lock count so the task that unlocks the queue - knows that data was removed while it was locked. */ - ++( pxQueue->xRxLock ); + mtCOVERAGE_TEST_MARKER(); } xReturn = pdPASS; @@ -1902,129 +1809,7 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports. Also previous logic ensures a null pointer can only be passed to memcpy() when the count is 0. */ } } -/*-----------------------------------------------------------*/ -static void prvUnlockQueue( Queue_t * const pxQueue ) -{ - /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ - - /* The lock counts contains the number of extra data items placed or - removed from the queue while the queue was locked. When a queue is - locked items can be added or removed, but the event lists cannot be - updated. */ - taskENTER_CRITICAL(&pxQueue->mux); - { - /* See if data was added to the queue while it was locked. */ - while( pxQueue->xTxLock > queueLOCKED_UNMODIFIED ) - { - /* Data was posted while the queue was locked. Are any tasks - blocked waiting for data to become available? */ - #if ( configUSE_QUEUE_SETS == 1 ) - { - if( pxQueue->pxQueueSetContainer != NULL ) - { - if( prvNotifyQueueSetContainer( pxQueue, queueSEND_TO_BACK ) == pdTRUE ) - { - /* The queue is a member of a queue set, and posting to - the queue set caused a higher priority task to unblock. - A context switch is required. */ - taskEXIT_CRITICAL(&pxQueue->mux); //ToDo: Is aquire/release needed around any of the bTaskMissedYield calls? - vTaskMissedYield(); - taskENTER_CRITICAL(&pxQueue->mux); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* Tasks that are removed from the event list will get added to - the pending ready list as the scheduler is still suspended. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that a - context switch is required. */ - taskEXIT_CRITICAL(&pxQueue->mux); - vTaskMissedYield(); - taskENTER_CRITICAL(&pxQueue->mux); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - break; - } - } - } - #else /* configUSE_QUEUE_SETS */ - { - /* Tasks that are removed from the event list will get added to - the pending ready list as the scheduler is still suspended. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that a - context switch is required. */ - taskEXIT_CRITICAL(&pxQueue->mux); - vTaskMissedYield(); - taskENTER_CRITICAL(&pxQueue->mux); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - break; - } - } - #endif /* configUSE_QUEUE_SETS */ - - --( pxQueue->xTxLock ); - } - - pxQueue->xTxLock = queueUNLOCKED; - } - taskEXIT_CRITICAL(&pxQueue->mux); - - /* Do the same for the Rx lock. */ - taskENTER_CRITICAL(&pxQueue->mux); - { - while( pxQueue->xRxLock > queueLOCKED_UNMODIFIED ) - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - taskEXIT_CRITICAL(&pxQueue->mux); - vTaskMissedYield(); - taskENTER_CRITICAL(&pxQueue->mux); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - --( pxQueue->xRxLock ); - } - else - { - break; - } - } - - pxQueue->xRxLock = queueUNLOCKED; - } - taskEXIT_CRITICAL(&pxQueue->mux); -} /*-----------------------------------------------------------*/ static BaseType_t prvIsQueueEmpty( Queue_t *pxQueue ) @@ -2458,10 +2243,8 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* Only do anything if there are no messages in the queue. This function will not actually cause the task to block, just place it on a blocked list. It will not block until the scheduler is unlocked - at which - time a yield will be performed. If an item is added to the queue while - the queue is locked, and the calling task blocks on the queue, then the - calling task will be immediately unblocked when the queue is unlocked. */ -// prvLockQueue( pxQueue ); + time a yield will be performed. */ + taskENTER_CRITICAL(&pxQueue->mux); if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U ) { /* There is nothing in the queue, block for the specified period. */ @@ -2471,7 +2254,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; { mtCOVERAGE_TEST_MARKER(); } -// prvUnlockQueue( pxQueue ); + taskEXIT_CRITICAL(&pxQueue->mux); } #endif /* configUSE_TIMERS */ From b8bfa9fa35fb6f855b3c687f06f64df8ec36e670 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Fri, 23 Sep 2016 17:46:16 +0800 Subject: [PATCH 067/179] Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime --- components/freertos/tasks.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index ff3a0530d6..b9035bda0f 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -275,9 +275,7 @@ when the scheduler is unsuspended. The pending ready list itself can only be accessed from a critical section. */ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended[ portNUM_PROCESSORS ] = { ( UBaseType_t ) pdFALSE }; -/* Muxes used in the task code */ -PRIVILEGED_DATA static portBASE_TYPE xMutexesInitialised = pdFALSE; -/* For now, we use just one mux for all the critical sections. ToDo: give evrything a bit more granularity; +/* For now, we use just one mux for all the critical sections. ToDo: give everything a bit more granularity; that could improve performance by not needlessly spinning in spinlocks for unrelated resources. */ PRIVILEGED_DATA static portMUX_TYPE xTaskQueueMutex = portMUX_INITIALIZER_UNLOCKED; PRIVILEGED_DATA static portMUX_TYPE xTickCountMutex = portMUX_INITIALIZER_UNLOCKED; @@ -577,15 +575,6 @@ static void prvResetNextTaskUnblockTime( void ); #endif -/*-----------------------------------------------------------*/ - - -static void vTaskInitializeLocalMuxes( void ) -{ - vPortCPUInitializeMutex(&xTaskQueueMutex); - vPortCPUInitializeMutex(&xTickCountMutex); - xMutexesInitialised = pdTRUE; -} /*-----------------------------------------------------------*/ @@ -596,9 +585,6 @@ TCB_t * pxNewTCB; StackType_t *pxTopOfStack; BaseType_t i; - /* Initialize mutexes, if they're not already initialized. */ - if (xMutexesInitialised == pdFALSE) vTaskInitializeLocalMuxes(); - configASSERT( pxTaskCode ); configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) ); configASSERT( (xCoreID>=0 && xCoreID Date: Fri, 23 Sep 2016 18:08:39 +0800 Subject: [PATCH 068/179] Roll back submodule version --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 1303c92c10..f6d558367a 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 1303c92c1056b7f59b95360b58e70a21cb4a93e1 +Subproject commit f6d558367a08b6c9b18c2de515bd0a6740d2c45c From b936441b9b8188acff07989094f2c867312a2b98 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 00:50:57 +0800 Subject: [PATCH 069/179] Startup flow refactoring This change removes implicit WiFi/BT initialization from startup code. "main" task is started once essential part of startup code is complete. This task calls application-provided "int main(void)" function, which can call WiFi/BT init functions if necessary. --- components/bt/bt.c | 23 +----- components/bt/include/bt.h | 11 ++- components/esp32/Kconfig | 29 +++---- components/esp32/cpu_start.c | 37 +++------ components/esp32/include/esp_task.h | 7 +- components/esp32/include/esp_wifi.h | 21 ----- components/esp32/ld/esp32.rom.ld | 2 +- components/esp32/wifi.c | 115 ---------------------------- examples/04_ble_adv/main/app_bt.c | 3 +- 9 files changed, 38 insertions(+), 210 deletions(-) delete mode 100644 components/esp32/wifi.c diff --git a/components/bt/bt.c b/components/bt/bt.c index efb6d34ee3..d9bc5ae089 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -96,26 +96,11 @@ static void bt_controller_task(void *pvParam) btdm_controller_init(); } - -static void bt_init_task(void *pvParameters) +void bt_controller_init() { - xTaskCreatePinnedToCore(bt_controller_task, "btControllerTask", ESP_TASK_BT_CONTROLLER_STACK, NULL, ESP_TASK_BT_CONTROLLER_PRIO, NULL, 0); - - if (app_startup_cb) { - app_startup_cb(app_startup_ctx); - } - - vTaskDelete(NULL); + xTaskCreatePinnedToCore(bt_controller_task, "btController", + ESP_TASK_BT_CONTROLLER_STACK, NULL, + ESP_TASK_BT_CONTROLLER_PRIO, NULL, 0); } - -esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx) -{ - app_startup_cb = cb; - app_startup_ctx = ctx; - - xTaskCreatePinnedToCore(bt_init_task, "btInitTask", ESP_TASK_BT_INIT_STACK, NULL, ESP_TASK_BT_INIT_PRIO, NULL, 0); - - return ESP_OK; -} #endif diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index 8511aabdf8..0dc0424939 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -15,7 +15,7 @@ #ifndef __BT_H__ #define __BT_H__ -#include "freertos/FreeRTOS.h" +#include #include "esp_err.h" #ifdef __cplusplus @@ -23,9 +23,12 @@ extern "C" { #endif -typedef void (* bt_app_startup_cb_t)(void *param); - -esp_err_t esp_bt_startup(bt_app_startup_cb_t cb, void *ctx); +/** + * @brief Initialize BT controller + * + * This function should be called only once, before any other BT functions are called. + */ +void bt_controller_init(); /* @breif: vhci_host_callback * used for vhci call host function to notify what host need to do diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index c649a0e317..a43d16d2c6 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -80,33 +80,22 @@ config WIFI_ENABLED Temporarily, this option is not compatible with BT stack. -config WIFI_AUTO_STARTUP - bool "Start WiFi with system startup" - default "y" - depends on WIFI_ENABLED - help - By default, WiFi is started with system startup, you can turn off this - feature and start by yourself. - -config WIFI_AUTO_CONNECT - bool "Enable auto connect" - default "y" - depends on WIFI_ENABLED - help - If station is enabled, and station config is set, this will enable WiFi - station auto connect when WiFi startup. - config SYSTEM_EVENT_QUEUE_SIZE - int "system event queue size" + int "System event queue size" default 32 - depends on WIFI_ENABLED help Config system event queue size in different application. config SYSTEM_EVENT_TASK_STACK_SIZE - int "system event task stack size" + int "Event loop task stack size" default 2048 - depends on WIFI_ENABLED + help + Config system event task stack size in different application. + + +config MAIN_TASK_STACK_SIZE + int "Main task stack size" + default 4096 help Config system event task stack size in different application. diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 45a4bcec3c..f2cec84267 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -47,10 +47,7 @@ static void IRAM_ATTR user_start_cpu0(void); static void IRAM_ATTR call_user_start_cpu1(); static void IRAM_ATTR user_start_cpu1(void); extern void ets_setup_syscalls(void); -extern esp_err_t app_main(void *ctx); -#if CONFIG_BT_ENABLED -extern void bt_app_main(void *param); -#endif +extern int main(void); extern int _bss_start; extern int _bss_end; @@ -137,11 +134,17 @@ void IRAM_ATTR user_start_cpu1(void) static void do_global_ctors(void) { void (**p)(void); - for (p = &__init_array_start; p != &__init_array_end; ++p) { + for (p = &__init_array_end; p >= &__init_array_start; --p) { (*p)(); } } +static void mainTask(void* args) +{ + main(); + vTaskDelete(NULL); +} + void user_start_cpu0(void) { esp_set_cpu_freq(); // set CPU frequency configured in menuconfig @@ -150,28 +153,12 @@ void user_start_cpu0(void) do_global_ctors(); esp_ipc_init(); spi_flash_init(); - -#if CONFIG_WIFI_ENABLED - esp_err_t ret = nvs_flash_init(5, 3); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "nvs_flash_init failed, ret=%d", ret); - } - +#ifdef CONFIG_WIFI_ENABLED system_init(); - esp_event_init(NULL, NULL); - tcpip_adapter_init(); #endif - -#if CONFIG_WIFI_ENABLED && CONFIG_WIFI_AUTO_STARTUP -#include "esp_wifi.h" - esp_wifi_startup(app_main, NULL); -#elif CONFIG_BT_ENABLED -#include "bt.h" - esp_bt_startup(bt_app_main, NULL); -#else - app_main(NULL); -#endif - + xTaskCreatePinnedToCore(&mainTask, "mainTask", + ESP_TASK_MAIN_STACK, NULL, + ESP_TASK_MAIN_PRIO, NULL, 0); ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); vTaskStartScheduler(); } diff --git a/components/esp32/include/esp_task.h b/components/esp32/include/esp_task.h index 58458106fa..0a68e5d919 100644 --- a/components/esp32/include/esp_task.h +++ b/components/esp32/include/esp_task.h @@ -51,10 +51,9 @@ /* idf task */ #define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5) #define ESP_TASKD_EVENT_STACK CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE -#define ESP_TASK_WIFI_STARTUP_PRIO (ESP_TASK_PRIO_MAX - 7) -#define ESP_TASK_WIFI_STARTUP_STACK 4096 #define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7) #define ESP_TASK_TCPIP_STACK 2048 -#define ESP_TASK_BT_INIT_PRIO (ESP_TASK_PRIO_MAX - 7) -#define ESP_TASK_BT_INIT_STACK 2048 +#define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1) +#define ESP_TASK_MAIN_STACK CONFIG_MAIN_TASK_STACK_SIZE + #endif diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index a5b9d089ae..38b7bdac1c 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -136,27 +136,6 @@ typedef enum { WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ } wifi_second_chan_t; -/** - * @brief startup WiFi driver and register application specific callback function - * - * @attention 1. This API should be called in application startup code to init WiFi driver - * @attention 2. The callback function is used to provide application specific WiFi configuration, - * such as, set the WiFi mode, register the event callback, set AP SSID etc before - * WiFi is startup - * @attention 3. Avoid to create application task in the callback, otherwise you may get wrong behavior - * @attention 4. If the callback return is not ESP_OK, the startup will fail! - * @attention 5. Before this API can be called, system_init()/esp_event_init()/tcpip_adapter_init() should - * be called firstly - * - * @param wifi_startup_cb_t cb : application specific callback function - * @param void *ctx : reserved for user - * - * @return ESP_OK : succeed - * @return others : fail - */ -typedef esp_err_t (* wifi_startup_cb_t)(void *ctx); - -esp_err_t esp_wifi_startup(wifi_startup_cb_t cb, void *ctx); typedef struct { void *event_q; /**< WiFi event q handler, it's a freeRTOS queue */ diff --git a/components/esp32/ld/esp32.rom.ld b/components/esp32/ld/esp32.rom.ld index 6f9064a398..ac1142f82d 100644 --- a/components/esp32/ld/esp32.rom.ld +++ b/components/esp32/ld/esp32.rom.ld @@ -445,7 +445,6 @@ PROVIDE ( _lseek_r = 0x4000bd8c ); PROVIDE ( __lshrdi3 = 0x4000c84c ); PROVIDE ( __ltdf2 = 0x40063790 ); PROVIDE ( __ltsf2 = 0x4006342c ); -PROVIDE ( main = 0x400076c4 ); PROVIDE ( malloc = 0x4000bea0 ); PROVIDE ( _malloc_r = 0x4000bbb4 ); PROVIDE ( maxSecretKey_256 = 0x3ff97448 ); @@ -1378,6 +1377,7 @@ PROVIDE ( rom_iq_est_disable = 0x40005590 ); PROVIDE ( rom_iq_est_enable = 0x40005514 ); PROVIDE ( rom_linear_to_db = 0x40005f64 ); PROVIDE ( rom_loopback_mode_en = 0x400030f8 ); +PROVIDE ( rom_main = 0x400076c4 ); PROVIDE ( rom_meas_tone_pwr_db = 0x40006004 ); PROVIDE ( rom_mhz2ieee = 0x4000404c ); PROVIDE ( rom_noise_floor_auto_set = 0x40003bdc ); diff --git a/components/esp32/wifi.c b/components/esp32/wifi.c deleted file mode 100644 index fd44d30d00..0000000000 --- a/components/esp32/wifi.c +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed 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. - -#include -#include -#include - -#include "esp_err.h" -#include "esp_wifi.h" -#include "esp_event.h" -#include "esp_task.h" - -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/queue.h" -#include "freertos/semphr.h" - -#if CONFIG_WIFI_ENABLED - -static bool wifi_startup_flag = false; - -static wifi_startup_cb_t startup_cb; -static void *startup_ctx; - -#define WIFI_DEBUG(...) -#define WIFI_API_CALL_CHECK(info, api_call, ret) \ -do{\ - esp_err_t __err = (api_call);\ - if ((ret) != __err) {\ - WIFI_DEBUG("%s %d %s ret=%d\n", __FUNCTION__, __LINE__, (info), __err);\ - return __err;\ - }\ -} while(0) - - - -static void esp_wifi_task(void *pvParameters) -{ - esp_err_t err; - wifi_init_config_t cfg; - cfg.event_q = (xQueueHandle)esp_event_get_handler(); - - do { - err = esp_wifi_init(&cfg); - if (err != ESP_OK) { - WIFI_DEBUG("esp_wifi_init fail, ret=%d\n", err); - break; - } - - if (startup_cb) { - err = (*startup_cb)(startup_ctx); - if (err != ESP_OK) { - WIFI_DEBUG("startup_cb fail, ret=%d\n", err); - break; - } - } - - err = esp_wifi_start(); - if (err != ESP_OK) { - WIFI_DEBUG("esp_wifi_start fail, ret=%d\n", err); - break; - } - -#if CONFIG_WIFI_AUTO_CONNECT - wifi_mode_t mode; - bool auto_connect; - err = esp_wifi_get_mode(&mode); - if (err != ESP_OK) { - WIFI_DEBUG("esp_wifi_get_mode fail, ret=%d\n", err); - } - - err = esp_wifi_get_auto_connect(&auto_connect); - if ((mode == WIFI_MODE_STA || mode == WIFI_MODE_APSTA) && auto_connect) { - err = esp_wifi_connect(); - if (err != ESP_OK) { - WIFI_DEBUG("esp_wifi_connect fail, ret=%d\n", err); - break; - } - } -#endif - } while (0); - - if (err != ESP_OK) { - WIFI_DEBUG("wifi startup fail, deinit\n"); - esp_wifi_deinit(); - } - - vTaskDelete(NULL); -} - -esp_err_t esp_wifi_startup(wifi_startup_cb_t cb, void *ctx) -{ - if (wifi_startup_flag) { - return ESP_FAIL; - } - - startup_cb = cb; - startup_ctx = ctx; - - xTaskCreatePinnedToCore(esp_wifi_task, "wifiTask", ESP_TASK_WIFI_STARTUP_STACK, NULL, ESP_TASK_WIFI_STARTUP_PRIO, NULL, 0); - - return ESP_OK; -} -#endif diff --git a/examples/04_ble_adv/main/app_bt.c b/examples/04_ble_adv/main/app_bt.c index 011cf0c715..b2ffc77498 100755 --- a/examples/04_ble_adv/main/app_bt.c +++ b/examples/04_ble_adv/main/app_bt.c @@ -197,8 +197,9 @@ void bleAdvtTask(void *pvParameters) } } -void bt_app_main() +int main() { + bt_controller_init(); xTaskCreatePinnedToCore(&bleAdvtTask, "bleAdvtTask", 2048, NULL, 5, NULL, 0); } From e1c782a206b37830560f8f43185400e996d24099 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 00:51:56 +0800 Subject: [PATCH 070/179] components/esp32,bt: fix typos in comments --- components/bt/include/bt.h | 8 ++++---- components/esp32/include/esp_event.h | 2 +- components/esp32/include/esp_task.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index 0dc0424939..1e89f96aa1 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -30,7 +30,7 @@ extern "C" { */ void bt_controller_init(); -/* @breif: vhci_host_callback +/** @brief: vhci_host_callback * used for vhci call host function to notify what host need to do * * notify_host_send_available: notify host can send packet to controller @@ -42,20 +42,20 @@ typedef struct vhci_host_callback { int (*notify_host_recv)(uint8_t *data, uint16_t len); } vhci_host_callback_t; -/* @breif: API_vhci_host_check_send_available +/** @brief: API_vhci_host_check_send_available * used for check actively if the host can send packet to controller or not. * return true for ready to send, false means cannot send packet */ bool API_vhci_host_check_send_available(void); -/* @breif: API_vhci_host_send_packet +/** @brief: API_vhci_host_send_packet * host send packet to controller * param data is the packet point, the param len is the packet length * return void */ void API_vhci_host_send_packet(uint8_t *data, uint16_t len); -/* @breif: API_vhci_host_register_callback +/** @brief: API_vhci_host_register_callback * register the vhci referece callback, the call back * struct defined by vhci_host_callback structure. * param is the vhci_host_callback type variable diff --git a/components/esp32/include/esp_event.h b/components/esp32/include/esp_event.h index 0b61b70219..34358a2675 100644 --- a/components/esp32/include/esp_event.h +++ b/components/esp32/include/esp_event.h @@ -101,7 +101,7 @@ typedef union { } system_event_info_t; typedef struct { - system_event_id_t event_id; /**< even ID */ + system_event_id_t event_id; /**< event ID */ system_event_info_t event_info; /**< event information */ } system_event_t; diff --git a/components/esp32/include/esp_task.h b/components/esp32/include/esp_task.h index 0a68e5d919..bb028bf485 100644 --- a/components/esp32/include/esp_task.h +++ b/components/esp32/include/esp_task.h @@ -15,10 +15,10 @@ /* Notes: * 1. Put all task priority and stack size definition in this file * 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style, - * otherwise use ESP_TASK_PRIO_MIN - X style - * 3. If this is a daemon task, the macro prifix is ESP_TASKD_, otherwise + * otherwise use ESP_TASK_PRIO_MAX - X style + * 3. If this is a daemon task, the macro prefix is ESP_TASKD_, otherwise * it's ESP_TASK_ - * 4. If the configMAX_PRIORITIES is modified, please make all prority are + * 4. If the configMAX_PRIORITIES is modified, please make all priority are * greater than 0 * 5. Make sure esp_task.h is consistent between wifi lib and idf */ From cc8dd46da27defdc04fd9ae419b4393b01845362 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 23 Sep 2016 14:46:39 +0800 Subject: [PATCH 071/179] clean up warnings For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign). In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions. Only remaining warning is in FreeRTOS queue.c, and it may be a useful one. --- components/esp32/event.c | 84 ++++++++++++++++------------------- components/expat/component.mk | 2 +- components/lwip/component.mk | 2 +- 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/components/esp32/event.c b/components/esp32/event.c index c1d9d4e73b..b26a4ea304 100644 --- a/components/esp32/event.c +++ b/components/esp32/event.c @@ -27,22 +27,22 @@ #include "freertos/semphr.h" #include "tcpip_adapter.h" +#include "esp_log.h" #define ESP32_WORKAROUND 1 #if CONFIG_WIFI_ENABLED +static const char* TAG = "event"; static bool event_init_flag = false; static xQueueHandle g_event_handler = NULL; - static system_event_cb_t g_event_handler_cb; static void *g_event_ctx; -#define WIFI_DEBUG(...) #define WIFI_API_CALL_CHECK(info, api_call, ret) \ do{\ esp_err_t __err = (api_call);\ if ((ret) != __err) {\ - WIFI_DEBUG("%s %d %s ret=%d\n", __FUNCTION__, __LINE__, (info), __err);\ + ESP_LOGE(TAG, "%s %d %s ret=%d", __FUNCTION__, __LINE__, (info), __err);\ return __err;\ }\ } while(0) @@ -71,7 +71,7 @@ static system_event_handle_t g_system_event_handle_table[] = { {SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default}, {SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default}, {SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL}, - {SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default}, + {SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default}, {SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default}, {SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default}, {SYSTEM_EVENT_AP_STACONNECTED, NULL}, @@ -85,7 +85,7 @@ static esp_err_t system_event_sta_got_ip_default(system_event_t *event) extern esp_err_t esp_wifi_set_sta_ip(void); WIFI_API_CALL_CHECK("esp_wifi_set_sta_ip", esp_wifi_set_sta_ip(), ESP_OK); - printf("ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR "\n", + ESP_LOGI(TAG, "ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip), IP2STR(&event->event_info.got_ip.ip_info.netmask), IP2STR(&event->event_info.got_ip.ip_info.gw)); @@ -161,7 +161,7 @@ esp_err_t system_event_sta_connected_handle_default(system_event_t *event) esp_event_send(&evt); } else { - WIFI_DEBUG("invalid static ip\n"); + ESP_LOGE(TAG, "invalid static ip"); } } @@ -187,92 +187,86 @@ static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) static esp_err_t esp_system_event_debug(system_event_t *event) { if (event == NULL) { - printf("Error: event is null!\n"); + ESP_LOGE(TAG, "event is null!"); return ESP_FAIL; } - WIFI_DEBUG("received event: "); switch (event->event_id) { case SYSTEM_EVENT_WIFI_READY: { - WIFI_DEBUG("SYSTEM_EVENT_WIFI_READY\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_WIFI_READY"); break; } case SYSTEM_EVENT_SCAN_DONE: { - system_event_sta_scan_done_t *scan_done; - scan_done = &event->event_info.scan_done; - WIFI_DEBUG("SYSTEM_EVENT_SCAN_DONE\nstatus:%d, number:%d\n", scan_done->status, scan_done->number); + system_event_sta_scan_done_t *scan_done = &event->event_info.scan_done; + ESP_LOGD(TAG, "SYSTEM_EVENT_SCAN_DONE, status:%d, number:%d", scan_done->status, scan_done->number); break; } case SYSTEM_EVENT_STA_START: { - WIFI_DEBUG("SYSTEM_EVENT_STA_START\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_START"); break; } case SYSTEM_EVENT_STA_STOP: { - WIFI_DEBUG("SYSTEM_EVENT_STA_STOP\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_STOP"); break; } case SYSTEM_EVENT_STA_CONNECTED: { - system_event_sta_connected_t *connected; - connected = &event->event_info.connected; - WIFI_DEBUG("SYSTEM_EVENT_STA_CONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d\n", \ + system_event_sta_connected_t *connected = &event->event_info.connected; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_CONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d", \ connected->ssid, connected->ssid_len, connected->bssid[0], connected->bssid[0], connected->bssid[1], \ connected->bssid[3], connected->bssid[4], connected->bssid[5], connected->channel, connected->authmode); break; } case SYSTEM_EVENT_STA_DISCONNECTED: { - system_event_sta_disconnected_t *disconnected; - disconnected = &event->event_info.disconnected; - WIFI_DEBUG("SYSTEM_EVENT_STA_DISCONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d\n", \ + system_event_sta_disconnected_t *disconnected = &event->event_info.disconnected; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_DISCONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d", \ disconnected->ssid, disconnected->ssid_len, disconnected->bssid[0], disconnected->bssid[0], disconnected->bssid[1], \ disconnected->bssid[3], disconnected->bssid[4], disconnected->bssid[5], disconnected->reason); break; } case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: { - system_event_sta_authmode_change_t *auth_change; - auth_change = &event->event_info.auth_change; - WIFI_DEBUG("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode); + system_event_sta_authmode_change_t *auth_change = &event->event_info.auth_change; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_AUTHMODE_CHNAGE, old_mode:%d, new_mode:%d", auth_change->old_mode, auth_change->new_mode); break; } case SYSTEM_EVENT_STA_GOT_IP: { - system_event_sta_got_ip_t *got_ip; - got_ip = &event->event_info.got_ip; - WIFI_DEBUG("SYSTEM_EVENT_STA_GOTIP\n"); + system_event_sta_got_ip_t *got_ip = &event->event_info.got_ip; + ESP_LOGD(TAG, "SYSTEM_EVENT_STA_GOTIP, ip:" IPSTR ", mask:" IPSTR ", gw:" IPSTR, + IP2STR(&got_ip->ip_info.ip), + IP2STR(&got_ip->ip_info.netmask), + IP2STR(&got_ip->ip_info.gw)); break; } case SYSTEM_EVENT_AP_START: { - WIFI_DEBUG("SYSTEM_EVENT_AP_START\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_START"); break; } case SYSTEM_EVENT_AP_STOP: { - WIFI_DEBUG("SYSTEM_EVENT_AP_STOP\n"); + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STOP"); break; } case SYSTEM_EVENT_AP_STACONNECTED: { - system_event_ap_staconnected_t *staconnected; - staconnected = &event->event_info.sta_connected; - WIFI_DEBUG("SYSTEM_EVENT_AP_STACONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \ + system_event_ap_staconnected_t *staconnected = &event->event_info.sta_connected; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STACONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \ staconnected->mac[0], staconnected->mac[0], staconnected->mac[1], \ staconnected->mac[3], staconnected->mac[4], staconnected->mac[5], staconnected->aid); break; } case SYSTEM_EVENT_AP_STADISCONNECTED: { - system_event_ap_stadisconnected_t *stadisconnected; - stadisconnected = &event->event_info.sta_disconnected; - WIFI_DEBUG("SYSTEM_EVENT_AP_STADISCONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \ + system_event_ap_stadisconnected_t *stadisconnected = &event->event_info.sta_disconnected; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STADISCONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \ stadisconnected->mac[0], stadisconnected->mac[0], stadisconnected->mac[1], \ stadisconnected->mac[3], stadisconnected->mac[4], stadisconnected->mac[5], stadisconnected->aid); break; } case SYSTEM_EVENT_AP_PROBEREQRECVED: { - system_event_ap_probe_req_rx_t *ap_probereqrecved; - ap_probereqrecved = &event->event_info.ap_probereqrecved; - WIFI_DEBUG("SYSTEM_EVENT_AP_PROBEREQRECVED\nrssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x\n", \ + system_event_ap_probe_req_rx_t *ap_probereqrecved = &event->event_info.ap_probereqrecved; + ESP_LOGD(TAG, "SYSTEM_EVENT_AP_PROBEREQRECVED, rssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x", \ ap_probereqrecved->rssi, ap_probereqrecved->mac[0], ap_probereqrecved->mac[0], ap_probereqrecved->mac[1], \ ap_probereqrecved->mac[3], ap_probereqrecved->mac[4], ap_probereqrecved->mac[5]); break; } default: { - printf("Error: no such kind of event!\n"); + ESP_LOGW(TAG, "no such kind of event!"); break; } } @@ -283,19 +277,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event) static esp_err_t esp_system_event_handler(system_event_t *event) { if (event == NULL) { - printf("Error: event is null!\n"); + ESP_LOGE(TAG, "Error: event is null!"); return ESP_FAIL; } esp_system_event_debug(event); if ((event->event_id < SYSTEM_EVENT_MAX) && (event->event_id == g_system_event_handle_table[event->event_id].event_id)) { if (g_system_event_handle_table[event->event_id].event_handle) { - WIFI_DEBUG("enter default callback\n"); + ESP_LOGV(TAG, "enter default callback"); g_system_event_handle_table[event->event_id].event_handle(event); - WIFI_DEBUG("exit default callback\n"); + ESP_LOGV(TAG, "exit default callback"); } } else { - printf("mismatch or invalid event, id=%d\n", event->event_id); + ESP_LOGE(TAG, "mismatch or invalid event, id=%d", event->event_id); } return esp_wifi_post_event_to_user(event); @@ -310,7 +304,7 @@ static void esp_system_event_task(void *pvParameters) if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) { ret = esp_system_event_handler(&evt); if (ret == ESP_FAIL) { - printf("esp wifi post event to user fail!\n"); + ESP_LOGE(TAG, "post event to user fail!"); } } } @@ -334,9 +328,9 @@ esp_err_t esp_event_send(system_event_t *event) if (pdPASS != ret) { if (event) { - printf("e=%d f\n", event->event_id); + ESP_LOGE(TAG, "e=%d f", event->event_id); } else { - printf("e null\n"); + ESP_LOGE(TAG, "e null"); } return ESP_FAIL; } diff --git a/components/expat/component.mk b/components/expat/component.mk index 69595d7b27..907b358a87 100644 --- a/components/expat/component.mk +++ b/components/expat/component.mk @@ -10,6 +10,6 @@ COMPONENT_ADD_INCLUDEDIRS := port/include include/expat COMPONENT_SRCDIRS := library port -CFLAGS += -Wno-error=address -Waddress -DHAVE_EXPAT_CONFIG_H +CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H include $(IDF_PATH)/make/component_common.mk diff --git a/components/lwip/component.mk b/components/lwip/component.mk index 3e6b26c0f5..5d15020047 100644 --- a/components/lwip/component.mk +++ b/components/lwip/component.mk @@ -6,6 +6,6 @@ COMPONENT_ADD_INCLUDEDIRS := include/lwip include/lwip/port include/lwip/posix COMPONENT_SRCDIRS := api apps/sntp apps core/ipv4 core/ipv6 core netif port/freertos port/netif port -CFLAGS += -Wno-error=address -Waddress +CFLAGS += -Wno-address -Wno-unused-variable -Wno-unused-but-set-variable include $(IDF_PATH)/make/component_common.mk From 53de9f115fa78a3c06c858ff9daf1ced53611efb Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 01:17:32 +0800 Subject: [PATCH 072/179] Event handling refactoring This change separates definitions in esp_event.h and functions in event.c into several parts: - event structure definitions (esp_event.h) - default implementations of event handlers (event_default_handlers.c) - default implementation of event loop (event_loop.c, esp_event_loop.h) Purpose of this change is to allow applications choose their own poison: - full control of event loop at the expense of more bootstrap code - pre-defined event task firing event callbacks, but less code in app_main.c --- .../{event.c => event_default_handlers.c} | 86 +------------ components/esp32/event_loop.c | 118 ++++++++++++++++++ components/esp32/include/esp_event.h | 50 ++------ components/esp32/include/esp_event_loop.h | 81 ++++++++++++ 4 files changed, 211 insertions(+), 124 deletions(-) rename components/esp32/{event.c => event_default_handlers.c} (84%) create mode 100644 components/esp32/event_loop.c create mode 100644 components/esp32/include/esp_event_loop.h diff --git a/components/esp32/event.c b/components/esp32/event_default_handlers.c similarity index 84% rename from components/esp32/event.c rename to components/esp32/event_default_handlers.c index b26a4ea304..37ba634041 100644 --- a/components/esp32/event.c +++ b/components/esp32/event_default_handlers.c @@ -19,6 +19,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_event.h" +#include "esp_event_loop.h" #include "esp_task.h" #include "freertos/FreeRTOS.h" @@ -29,14 +30,7 @@ #include "tcpip_adapter.h" #include "esp_log.h" -#define ESP32_WORKAROUND 1 - -#if CONFIG_WIFI_ENABLED -static const char* TAG = "event"; -static bool event_init_flag = false; -static xQueueHandle g_event_handler = NULL; -static system_event_cb_t g_event_handler_cb; -static void *g_event_ctx; +const char* TAG = "event"; #define WIFI_API_CALL_CHECK(info, api_call, ret) \ do{\ @@ -175,15 +169,6 @@ esp_err_t system_event_sta_disconnected_handle_default(system_event_t *event) return ESP_OK; } -static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) -{ - if (g_event_handler_cb) { - return (*g_event_handler_cb)(g_event_ctx, event); - } - - return ESP_OK; -} - static esp_err_t esp_system_event_debug(system_event_t *event) { if (event == NULL) { @@ -274,7 +259,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event) return ESP_OK; } -static esp_err_t esp_system_event_handler(system_event_t *event) +esp_err_t esp_event_process_default(system_event_t *event) { if (event == NULL) { ESP_LOGE(TAG, "Error: event is null!"); @@ -290,72 +275,7 @@ static esp_err_t esp_system_event_handler(system_event_t *event) } } else { ESP_LOGE(TAG, "mismatch or invalid event, id=%d", event->event_id); - } - - return esp_wifi_post_event_to_user(event); -} - -static void esp_system_event_task(void *pvParameters) -{ - system_event_t evt; - esp_err_t ret; - - while (1) { - if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) { - ret = esp_system_event_handler(&evt); - if (ret == ESP_FAIL) { - ESP_LOGE(TAG, "post event to user fail!"); - } - } - } -} - -system_event_cb_t esp_event_set_cb(system_event_cb_t cb, void *ctx) -{ - system_event_cb_t old_cb = g_event_handler_cb; - - g_event_handler_cb = cb; - g_event_ctx = ctx; - - return old_cb; -} - -esp_err_t esp_event_send(system_event_t *event) -{ - portBASE_TYPE ret; - - ret = xQueueSendToBack((xQueueHandle)g_event_handler, event, 0); - - if (pdPASS != ret) { - if (event) { - ESP_LOGE(TAG, "e=%d f", event->event_id); - } else { - ESP_LOGE(TAG, "e null"); - } return ESP_FAIL; } - return ESP_OK; } - -void *esp_event_get_handler(void) -{ - return (void *)g_event_handler; -} - -esp_err_t esp_event_init(system_event_cb_t cb, void *ctx) -{ - if (event_init_flag) { - return ESP_FAIL; - } - - g_event_handler_cb = cb; - g_event_ctx = ctx; - - g_event_handler = xQueueCreate(CONFIG_SYSTEM_EVENT_QUEUE_SIZE, sizeof(system_event_t)); - - xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", ESP_TASKD_EVENT_STACK, NULL, ESP_TASKD_EVENT_PRIO, NULL, 0); - return ESP_OK; -} - -#endif diff --git a/components/esp32/event_loop.c b/components/esp32/event_loop.c new file mode 100644 index 0000000000..be00e34be4 --- /dev/null +++ b/components/esp32/event_loop.c @@ -0,0 +1,118 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include +#include +#include + +#include "esp_err.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "esp_event_loop.h" +#include "esp_task.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" + +#include "tcpip_adapter.h" +#include "esp_log.h" +#include "sdkconfig.h" + + +static const char* TAG = "event"; +static bool s_event_init_flag = false; +static QueueHandle_t s_event_queue = NULL; +static system_event_cb_t s_event_handler_cb = NULL; +static void *s_event_ctx = NULL; + +static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) +{ + if (s_event_handler_cb) { + return (*s_event_handler_cb)(s_event_ctx, event); + } + return ESP_OK; +} + +static void esp_system_event_task(void *pvParameters) +{ + system_event_t evt; + esp_err_t ret; + + while (1) { + if (xQueueReceive(s_event_queue, &evt, portMAX_DELAY) == pdPASS) { + ret = esp_event_process_default(&evt); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "default event handler failed!"); + } + ret = esp_wifi_post_event_to_user(&evt); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "post event to user fail!"); + } + } + } +} + +system_event_cb_t esp_event_set_cb(system_event_cb_t cb, void *ctx) +{ + system_event_cb_t old_cb = s_event_handler_cb; + + s_event_handler_cb = cb; + s_event_ctx = ctx; + + return old_cb; +} + +esp_err_t esp_event_send(system_event_t *event) +{ + portBASE_TYPE ret; + + ret = xQueueSendToBack(s_event_queue, event, 0); + + if (pdPASS != ret) { + if (event) { + ESP_LOGE(TAG, "e=%d f", event->event_id); + } else { + ESP_LOGE(TAG, "e null"); + } + return ESP_FAIL; + } + + return ESP_OK; +} + +QueueHandle_t esp_event_loop_get_queue(void) +{ + return s_event_queue; +} + +esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx) +{ + if (s_event_init_flag) { + return ESP_FAIL; + } + + s_event_handler_cb = cb; + s_event_ctx = ctx; + + s_event_queue = xQueueCreate(CONFIG_SYSTEM_EVENT_QUEUE_SIZE, sizeof(system_event_t)); + + xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", + ESP_TASKD_EVENT_STACK, NULL, ESP_TASKD_EVENT_PRIO, NULL, 0); + + s_event_init_flag = true; + return ESP_OK; +} + diff --git a/components/esp32/include/esp_event.h b/components/esp32/include/esp_event.h index 34358a2675..86afab2c40 100644 --- a/components/esp32/include/esp_event.h +++ b/components/esp32/include/esp_event.h @@ -105,30 +105,6 @@ typedef struct { system_event_info_t event_info; /**< event information */ } system_event_t; -/** - * @brief Application specified event callback function - * - * @param void *ctx : reserved for user - * @param system_event_t *event : event type defined in this file - * - * @return ESP_OK : succeed - * @return others : fail - */ -typedef esp_err_t (*system_event_cb_t)(void *ctx, system_event_t *event); - -/** - * @brief Set application specified event callback function - * - * @attention 1. If cb is NULL, means application don't need to handle - * If cb is not NULL, it will be call when an event is received, after the default event callback is completed - * - * @param system_event_cb_t cb : callback - * @param void *ctx : reserved for user - * - * @return system_event_cb_t : old callback - */ -system_event_cb_t esp_event_set_cb(system_event_cb_t cb, void *ctx); - /** * @brief Send a event to event task * @@ -142,28 +118,20 @@ system_event_cb_t esp_event_set_cb(system_event_cb_t cb, void *ctx); esp_err_t esp_event_send(system_event_t *event); /** - * @brief Get the event handler + * @brief Default event handler for system events * - * @attention : currently this API returns event queue handler, by this event queue, - * users can notice when WiFi has done something like scanning done, connected to AP or disconnected from AP. + * This function performs default handling of system events. + * When using esp_event_loop APIs, it is called automatically before invoking the user-provided + * callback function. * - * @param null + * Applications which implement a custom event loop must call this function + * as part of event processing. * - * @return void * : event queue pointer + * @param event pointer to event to be handled + * @return ESP_OK if an event was handled successfully */ -void *esp_event_get_handler(void); +esp_err_t esp_event_process_default(system_event_t *event); -/** - * @brief Init the event module - * Create the event handler and task - * - * @param system_event_cb_t cb : application specified event callback, it can be modified by call esp_event_set_cb - * @param void *ctx : reserved for user - * - * @return ESP_OK : succeed - * @return others : fail - */ -esp_err_t esp_event_init(system_event_cb_t cb, void *ctx); #ifdef __cplusplus } diff --git a/components/esp32/include/esp_event_loop.h b/components/esp32/include/esp_event_loop.h new file mode 100644 index 0000000000..97672aedf2 --- /dev/null +++ b/components/esp32/include/esp_event_loop.h @@ -0,0 +1,81 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __ESP_EVENT_LOOP_H__ +#define __ESP_EVENT_LOOP_H__ + +#include +#include + +#include "esp_err.h" +#include "esp_event.h" +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Application specified event callback function + * + * @param void *ctx : reserved for user + * @param system_event_t *event : event type defined in this file + * + * @return ESP_OK : succeed + * @return others : fail + */ +typedef esp_err_t (*system_event_cb_t)(void *ctx, system_event_t *event); + +/** + * @brief Initialize event loop + * Create the event handler and task + * + * @param system_event_cb_t cb : application specified event callback, it can be modified by call esp_event_set_cb + * @param void *ctx : reserved for user + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx); + +/** + * @brief Set application specified event callback function + * + * @attention 1. If cb is NULL, means application don't need to handle + * If cb is not NULL, it will be call when an event is received, after the default event callback is completed + * + * @param system_event_cb_t cb : callback + * @param void *ctx : reserved for user + * + * @return system_event_cb_t : old callback + */ +system_event_cb_t esp_event_loop_set_cb(system_event_cb_t cb, void *ctx); + +/** + * @brief Get the queue used by event loop + * + * @attention : currently this API is used to initialize "q" parameter + * of wifi_init structure. + * + * @return QueueHandle_t : event queue handle + */ +QueueHandle_t esp_event_loop_get_queue(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_EVENT_LOOP_H__ */ From e9b54b6b456c103f7d95b6a033d7c8c65e8aae85 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 01:34:05 +0800 Subject: [PATCH 073/179] components/esp32: add ESP_ERROR_CHECK Convenience macro to do error check and assert in cases when error recovery is not expected --- components/esp32/include/esp_err.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/esp32/include/esp_err.h b/components/esp32/include/esp_err.h index 6ea176991c..4f013f91ab 100644 --- a/components/esp32/include/esp_err.h +++ b/components/esp32/include/esp_err.h @@ -15,6 +15,7 @@ #define __ESP_ERR_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -31,6 +32,12 @@ typedef int32_t esp_err_t; #define ESP_ERR_INVALID_ARG 0x102 #define ESP_ERR_INVALID_STATE 0x103 +/** + * Macro which can be used to check the error code, + * and terminate the program in case the code is not ESP_OK. + * Prints the failed statement to serial output. + */ +#define ESP_ERROR_CHECK(x) do { esp_err_t rc = (x); if (rc != ESP_OK) { assert(0 && #x);} } while(0); #ifdef __cplusplus } From 5a762d9eeebff7ea191c9bd00bcd9446673f3506 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 01:35:31 +0800 Subject: [PATCH 074/179] components/esp32: clarify type of queue in wifi_init_config_t, add default init macro --- components/esp32/include/esp_wifi.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 38b7bdac1c..32d5cd0f67 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -59,7 +59,8 @@ #include #include - +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" #include "esp_err.h" #include "rom/queue.h" @@ -138,13 +139,22 @@ typedef enum { typedef struct { - void *event_q; /**< WiFi event q handler, it's a freeRTOS queue */ + QueueHandle_t event_queue; /**< WiFi event queue handle */ uint8_t rx_ba_win; /**< TBC */ uint8_t tx_ba_win; /**< TBC */ uint8_t rx_buf_cnt; /**< TBC */ uint8_t tx_buf_cnt; /**< TBC */ } wifi_init_config_t; + +#define WIFI_INIT_CONFIG_DEFAULT(event_queue_) { \ + .event_queue = event_queue_, \ + .rx_ba_win = 0, \ + .tx_ba_win = 0, \ + .rx_buf_cnt = 0, \ + .tx_buf_cnt = 0 \ +}; + /** * @brief Init WiFi * Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, From 10c69514b75151037560dea3ef26a67ce687042b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 01:45:12 +0800 Subject: [PATCH 075/179] components/bt: fix compilation, remove ./ from makefile --- components/bt/bt.c | 3 --- components/bt/component.mk | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/components/bt/bt.c b/components/bt/bt.c index d9bc5ae089..addea46dc4 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -36,9 +36,6 @@ extern void btdm_osi_funcs_register(void *osi_funcs); extern void btdm_controller_init(void); -static bt_app_startup_cb_t app_startup_cb; -static void *app_startup_ctx; - #define BT_DEBUG(...) #define BT_API_CALL_CHECK(info, api_call, ret) \ do{\ diff --git a/components/bt/component.mk b/components/bt/component.mk index 110d022672..8290f9f4a4 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -6,7 +6,7 @@ CURRENT_DIR=$(IDF_PATH)/components/bt -COMPONENT_ADD_INCLUDEDIRS := ./include +COMPONENT_ADD_INCLUDEDIRS := include CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses @@ -20,6 +20,4 @@ COMPONENT_ADD_LDFLAGS := -lbt -L$(abspath lib) \ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) -COMPONENT_SRCDIRS := ./ - include $(IDF_PATH)/make/component_common.mk From b190dc3e9ff85453235a638931a9314352d72fe2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 03:05:25 +0800 Subject: [PATCH 076/179] components/lwip,esp32: fixes for C++ - put contents of a few headers into c++ guard blocks - fix off-by-one error in do_global_ctors - remove system_init from startup code (should be called from main) --- components/esp32/cpu_start.c | 5 +---- components/lwip/include/lwip/port/arch/sys_arch.h | 12 +++++++++++- components/lwip/include/lwip/port/netif/wlanif.h | 8 ++++++++ components/tcpip_adapter/include/tcpip_adapter.h | 10 ++++++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index f2cec84267..5566d978a0 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -134,7 +134,7 @@ void IRAM_ATTR user_start_cpu1(void) static void do_global_ctors(void) { void (**p)(void); - for (p = &__init_array_end; p >= &__init_array_start; --p) { + for (p = &__init_array_end - 1; p >= &__init_array_start; --p) { (*p)(); } } @@ -153,9 +153,6 @@ void user_start_cpu0(void) do_global_ctors(); esp_ipc_init(); spi_flash_init(); -#ifdef CONFIG_WIFI_ENABLED - system_init(); -#endif xTaskCreatePinnedToCore(&mainTask, "mainTask", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL, 0); diff --git a/components/lwip/include/lwip/port/arch/sys_arch.h b/components/lwip/include/lwip/port/arch/sys_arch.h index be8ff72260..a863348256 100644 --- a/components/lwip/include/lwip/port/arch/sys_arch.h +++ b/components/lwip/include/lwip/port/arch/sys_arch.h @@ -38,6 +38,11 @@ #include "freertos/queue.h" #include "freertos/semphr.h" +#ifdef __cplusplus +extern "C" { +#endif + + typedef xSemaphoreHandle sys_sem_t; typedef xSemaphoreHandle sys_mutex_t; typedef xTaskHandle sys_thread_t; @@ -67,6 +72,11 @@ uint32_t system_get_time(void); void sys_delay_ms(uint32_t ms); sys_sem_t* sys_thread_sem_init(void); void sys_thread_sem_deinit(void); -sys_sem_t* sys_thread_sem_get(void); +sys_sem_t* sys_thread_sem_get(void); + +#ifdef __cplusplus +} +#endif + #endif /* __SYS_ARCH_H__ */ diff --git a/components/lwip/include/lwip/port/netif/wlanif.h b/components/lwip/include/lwip/port/netif/wlanif.h index f9e322ebda..7eb303eab4 100755 --- a/components/lwip/include/lwip/port/netif/wlanif.h +++ b/components/lwip/include/lwip/port/netif/wlanif.h @@ -10,6 +10,10 @@ #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + err_t wlanif_init(struct netif *netif); void wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb); @@ -20,4 +24,8 @@ wifi_interface_t wifi_get_interface(void *dev); void netif_reg_addr_change_cb(void* cb); +#ifdef __cplusplus +} +#endif + #endif /* _WLAN_LWIP_IF_H_ */ diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 9cae530eff..51fb233d81 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -16,9 +16,7 @@ #define _TCPIP_ADAPTER_H_ #include - #include "rom/queue.h" - #include "esp_wifi.h" #define CONFIG_TCPIP_LWIP 1 @@ -28,6 +26,10 @@ #include "lwip/ip_addr.h" #include "apps/dhcpserver.h" +#ifdef __cplusplus +extern "C" { +#endif + #define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \ ip4_addr2_16(ipaddr), \ ip4_addr3_16(ipaddr), \ @@ -129,5 +131,9 @@ wifi_interface_t tcpip_adapter_get_wifi_if(void *dev); esp_err_t tcpip_adapter_get_sta_list(struct station_info *sta_info, struct station_list **sta_list); esp_err_t tcpip_adapter_free_sta_list(struct station_list *sta_list); +#ifdef __cplusplus +} +#endif + #endif /* _TCPIP_ADAPTER_H_ */ From ec45e1a5937216bb40bd42f8ca4a789f23a9585a Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Mon, 26 Sep 2016 09:56:03 +0800 Subject: [PATCH 077/179] components/driver: modify LEDC driver 1. modify ledc struct header: combine high speed and low speed channel 2. modify ledc init function 3. add timer control api 4. modify typo in ledc.h --- components/driver/include/driver/ledc.h | 195 ++++++++++++++------- components/driver/ledc.c | 179 +++++++++++-------- components/esp32/include/soc/ledc_struct.h | 195 +++++++-------------- 3 files changed, 311 insertions(+), 258 deletions(-) diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index e8c03fd81c..2dffce8c9c 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -43,15 +43,15 @@ typedef enum { LEDC_DUTY_DIR_INCREASE = 1, /*LEDC duty increase direction */ } ledc_duty_direction_t; typedef enum { - LEDC_REF_TICK = 0, // 1MhZ - LEDC_APB_CLK, //80Mhz -}ledc_timer_src_t; + LEDC_REF_TICK = 0, /*LEDC timer clock divided from reference tick(1Mhz) */ + LEDC_APB_CLK, /*LEDC timer clock divided from APB clock(80Mhz)*/ +} ledc_clk_src_t; typedef enum { - LEDC_TIMER0 = 0, /*LEDC source time TIME0 */ - LEDC_TIMER1, /*LEDC source time TIME1 */ - LEDC_TIMER2, /*LEDC source time TIME2 */ - LEDC_TIMER3, /*LEDC source time TIME3 */ -} ledc_timer_source_t; + LEDC_TIMER0 = 0, /*LEDC source timer TIMER0 */ + LEDC_TIMER1, /*LEDC source timer TIMER1 */ + LEDC_TIMER2, /*LEDC source timer TIMER2 */ + LEDC_TIMER3, /*LEDC source timer TIMER3 */ +} ledc_timer_t; typedef enum { LEDC_CHANNEL_0 = 0, /*LEDC channel 0 */ LEDC_CHANNEL_1, /*LEDC channel 1 */ @@ -63,56 +63,56 @@ typedef enum { LEDC_CHANNEL_7, /*LEDC channel 7 */ } ledc_channel_t; typedef enum { - LEDC_DUTY_DEPTH_10_BIT = 10, /*LEDC PWM depth 10Bit */ - LEDC_DUTY_DEPTH_11_BIT = 11, /*LEDC PWM depth 11Bit */ - LEDC_DUTY_DEPTH_12_BIT = 12, /*LEDC PWM depth 12Bit */ - LEDC_DUTY_DEPTH_13_BIT = 13, /*LEDC PWM depth 13Bit */ - LEDC_DUTY_DEPTH_14_BIT = 14, /*LEDC PWM depth 14Bit */ - LEDC_DUTY_DEPTH_15_BIT = 15, /*LEDC PWM depth 15Bit */ -} ledc_duty_depth_t; + LEDC_TIMER_10_BIT = 10, /*LEDC PWM depth 10Bit */ + LEDC_TIMER_11_BIT = 11, /*LEDC PWM depth 11Bit */ + LEDC_TIMER_12_BIT = 12, /*LEDC PWM depth 12Bit */ + LEDC_TIMER_13_BIT = 13, /*LEDC PWM depth 13Bit */ + LEDC_TIMER_14_BIT = 14, /*LEDC PWM depth 14Bit */ + LEDC_TIMER_15_BIT = 15, /*LEDC PWM depth 15Bit */ +} ledc_timer_bit_t; typedef struct ledc_channel_t_config { - int gpio_num; /*the LEDC output gpio_num, if you want to use gpio16, ledc_config_t.gpio_num = 16*/ - ledc_mode_t speed_mode; /*LEDC speed speed_mode*/ + int gpio_num; /*the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16*/ + ledc_mode_t speed_mode; /*LEDC speed speed_mode, high-speed mode or low-speed mode*/ ledc_channel_t channel; /*LEDC channel(0 - 7)*/ - ledc_intr_type_t intr_type; /*configure interrupt , Fade interrupt enable or Fade interrupt disable*/ - ledc_timer_source_t timer_src; /*Select the timer source of channel (0 - 3)*/ + ledc_intr_type_t intr_type; /*configure interrupt, Fade interrupt enable or Fade interrupt disable*/ + ledc_timer_t timer_sel; /*Select the timer source of channel (0 - 3)*/ uint32_t freq_hz; /*LEDC channel frequency(Hz)*/ - uint32_t duty; /*LEDC channel duty,the duty range is [0,(2**duty_depth) - 1],*/ - ledc_duty_depth_t duty_depth; /*LEDC channel duty depth*/ + uint32_t duty; /*LEDC channel duty, the duty range is [0, (2**bit_num) - 1], */ + ledc_timer_bit_t bit_num; /*LEDC channel duty depth*/ } ledc_config_t; /** * @brief LEDC common configuration * - * User this Function,configure LEDC with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth + * User this Function, configure LEDC with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth * * @param[in] ledc_config_t * ledc_config_t.speed_mode : LEDC speed speed_mode * ledc_config_t.gpio_num : LEDC output gpio_num, if you want to use gpio16, ledc_config_t.gpio_num = 16 * ledc_config_t.channel : LEDC channel(0 - 7) - * ledc_config_t.intr_type : configure interrupt , Fade interrupt enable or Fade interrupt disable - * ledc_config_t.timer_src : Select the timer source of channel (0 - 3) - * When different channel ,select same timer ,their freq_hz and duty_depth must be the same + * ledc_config_t.intr_type : configure interrupt, Fade interrupt enable or Fade interrupt disable + * ledc_config_t.timer_sel : Select the timer source of channel (0 - 3) + * When different channel, select same timer, their freq_hz and bit_num must be the same * ledc_config_t.freq_hz : LEDC channel frequency(Hz), - * When different channel ,select same time ,their freq_hz and duty_depth must be same - * ledc_config_t.duty : LEDC channel duty,the duty range is [0,(2**duty_depth) - 1], - * ledc_config_t.duty_depth : LEDC channel duty depth - * When different channel ,select same time ,their freq_hz and duty_depth must be same + * When different channel, select same time, their freq_hz and bit_num must be same + * ledc_config_t.duty : LEDC channel duty, the duty range is [0, (2**bit_num) - 1], + * ledc_config_t.bit_num : LEDC channel duty depth + * When different channel, select same time, their freq_hz and bit_num must be same * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: Can not find a proper pre-devider number base on the given frequency and the current duty_depth. + * ESP_FAIL: Can not find a proper pre-divider number base on the given frequency and the current bit_num. * */ esp_err_t ledc_config(ledc_config_t* ledc_conf); /** - * @brief LEDC start + * @brief LEDC update channel parameters * * Call this function to activate the LEDC updated parameters. - * After ledc_set_duty,ledc_set_fade, we need to call this function to update the settings. + * After ledc_set_duty, ledc_set_fade, we need to call this function to update the settings. * - * @param[in] speed_mode : select the LEDC speed_mode, high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * * @param[in] channel : LEDC channel(0-7) * @@ -125,9 +125,9 @@ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); /** * @brief LEDC stop * - * Disable LEDC output,and set idle level + * Disable LEDC output, and set idle level * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * * @param[in] channel : LEDC channel(0-7) * @@ -141,41 +141,41 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl * * Set LEDC frequency(Hz) * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : current channel(0-7) + * @param[in] timer_num : LEDC timer index(0-3) * * @param[in] freq_hz : set the LEDC frequency * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error - * ESP_FAIL: Can not find a proper pre-devider number base on the given frequency and the current duty_depth. + * ESP_FAIL: Can not find a proper pre-divider number base on the given frequency and the current bit_num. */ -esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz); +esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num, uint32_t freq_hz); /** * @brief LEDC get channel frequency(Hz) * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] timer_num : LEDC timer index(0-3) * * @return 0 : error * others : current LEDC frequency * */ -uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel); +uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num); /** * @brief LEDC set duty * - * Set LEDC duty ,After the function calls the ledc_update function, the function can take effect. + * Set LEDC duty, After the function calls the ledc_update function, the function can take effect. * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7) * - * @param[in] duty : set the LEDC duty ,the duty range is [0,(2**duty_depth) - 1] + * @param[in] duty : set the LEDC duty, the duty range is [0, (2**bit_num) - 1] * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error @@ -185,7 +185,7 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t /** * @brief LEDC get duty * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * * @param[in] channel : LEDC channel(0-7) * @@ -199,13 +199,13 @@ int ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); /** * @brief LEDC set gradient * - * Set LEDC gradient , After the function calls the ledc_update function , the function can take effect. + * Set LEDC gradient, After the function calls the ledc_update function, the function can take effect. * - * @param[in] speed_mode : select the LEDC speed_mode,high-speed speed_mode and low-speed speed_mode,now we only support high-speed speed_mode ,next will add low-speed speed_mode + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * * @param[in] channel : LEDC channel(0-7) * - * @param[in] duty : set the start of the gradient duty , the duty range is [0,(2**duty_depth) - 1] + * @param[in] duty : set the start of the gradient duty, the duty range is [0, (2**bit_num) - 1] * * @param[in] gradule_direction : set the direction of the gradient * @@ -227,19 +227,92 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, * Users should know that which CPU is running and then pick a INUM that is not used by system. * We can find the information of INUM and interrupt level in soc.h. * TODO: to move INUM options to menu_config - * @parameter uint32_t ledc_intr_num : LEDC interrupt number,check the info in soc.h, and please see the core-isa.h for more details + * @parameter uint32_t ledc_intr_num : LEDC interrupt number, check the info in soc.h, and please see the core-isa.h for more details * @parameter void (* fn)(void* ) : interrupt handler function. * Note that the handler function MUST be defined with attribution of "IRAM_ATTR". * @parameter void * arg : parameter for handler function * * @return ESP_OK : success ; - * ESP_ERR_INVALID_ARG : fucntion ptr error. + * ESP_ERR_INVALID_ARG : function ptr error. */ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * arg); +/** + * @brief configure LEDC settings + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version + * + * @param[in] timer_sel : timer index(0-3), there are 4 timers in LEDC module + * + * @param[in] div_num : timer clock divide number, the timer clock is divided from the selected clock source + * + * @param[in] bit_num : the count number of one period, counter range is 0 ~ ((2 ** bit_num) - 1) + * + * @param[in] clk_src : select LEDC source clock. + * + * @return -1: parameter error + * other value: current LEDC duty + * + */ +esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src); +/** + * @brief reset LEDC timer + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version + * + * @param[in] timer_sel : LEDC timer index(0-3) + * + * + * @return ESP_ERR_INVALID_ARG: parameter error + * ESP_OK: success + * + */ +esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel); +/** + * @brief pause LEDC timer counter + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version + * + * @param[in] timer_sel : LEDC timer index(0-3) + * + * + * @return ESP_ERR_INVALID_ARG: parameter error + * ESP_OK: success + * + */ +esp_err_t ledc_timer_pause(ledc_mode_t speed_mode, uint32_t timer_sel); +/** + * @brief pause LEDC timer resume + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version + * + * @param[in] timer_sel : LEDC timer index(0-3) + * + * + * @return ESP_ERR_INVALID_ARG: parameter error + * ESP_OK: success + * + */ +esp_err_t ledc_timer_resume(ledc_mode_t speed_mode, uint32_t timer_sel); + +/** + * @brief bind LEDC channel with the selected timer + * + * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version + * + * @param[in] channel : LEDC channel index(0-7) + * + * @param[in] timer_idx : LEDC timer index(0-3) + * + * + * @return ESP_ERR_INVALID_ARG: parameter error + * ESP_OK: success + * + */ +esp_err_t ledc_bind_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint32_t timer_idx); /***************************EXAMPLE********************************** * @@ -247,20 +320,20 @@ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * ar * ----------------EXAMPLE OF LEDC SETTING --------------------- * ledc_config_t ledc_conf = { * .channel = LEDC_CHANNEL_0; //set LEDC channel 0 - * .duty = 1000; //set the duty for initialization.(duty range is 0 ~ ((2**duty_depth)-1) - * .freq_hz = 1000; //set frequency , e.g.,1KHz + * .duty = 1000; //set the duty for initialization.(duty range is 0 ~ ((2**bit_num)-1) + * .freq_hz = 1000; //set frequency, e.g., 1KHz * .gpio_num = 16; //GPIO number - * .intr_type = LEDC_INTR_FADE_END; //GPIO INTR TYPE, as an example,we enable fade_end interrupt here. - * .duty_depth = LEDC_DUTY_DEPTH_12_BIT; //set duty_depth , (duty range is 0 ~ ((2**duty_depth)-1) + * .intr_type = LEDC_INTR_FADE_END; //GPIO INTR TYPE, as an example, we enable fade_end interrupt here. + * .bit_num = LEDC_TIMER_12_BIT; //set bit_num, (duty range is 0 ~ ((2**bit_num)-1) * .speed_mode = LEDC_HIGH_SPEED_MODE; //set LEDC mode, from ledc_mode_t - * .timer_src = LEDC_TIMER0; //set LEDC timer source, if different channel use one timer, the frequency and duty_depth of these channels should be the same + * .timer_sel = LEDC_TIMER0; //set LEDC timer source, if different channel use one timer, the frequency and bit_num of these channels should be the same * } * ledc_config(&ledc_conf); //setup the configuration * ----------------EXAMPLE OF SETTING DUTY --- ----------------- * uint32_t ledc_channel = LEDC_CHANNEL_0; //LEDC channel(0-73) - * uint32_t duty = 2000; //duty range is 0 ~ ((2**duty_depth)-1) - * LEDC_set_duty(LEDC_HIGH_SPEED_MODE,ledc_channel,duty); //set speed mode, channel, and duty. - * ledc_update(LEDC_HIGH_SPEED_MODE,ledc_channel); //after set duty, we need to call ledc_update to update the settings. + * uint32_t duty = 2000; //duty range is 0 ~ ((2**bit_num)-1) + * LEDC_set_duty(LEDC_HIGH_SPEED_MODE, ledc_channel, duty); //set speed mode, channel, and duty. + * ledc_update(LEDC_HIGH_SPEED_MODE, ledc_channel); //after set duty, we need to call ledc_update to update the settings. * * * ----------------EXAMPLE OF LEDC INTERRUPT ------------------ @@ -277,7 +350,7 @@ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * ar * uint32_t intr_st = LEDC.int_st.val; //read LEDC interrupt status. * * //you will find which channels have triggered fade_end interrupt here, - * //then , you can post some event to RTOS queue to process the event. + * //then, you can post some event to RTOS queue to process the event. * //later we will add a queue in the driver code. * * LEDC.int_clr.val = intr_st; //clear LEDC interrupt status. diff --git a/components/driver/ledc.c b/components/driver/ledc.c index 68e87c9884..a5bf92f6f9 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -82,15 +82,30 @@ static int ledc_is_valid_mode(uint32_t mode) return 1; } -static esp_err_t ledc_timer_config(ledc_mode_t speed_mode, uint32_t timer_sel, uint32_t div_num, uint32_t timer_lim,ledc_timer_source_t clk) +static int ledc_is_valid_timer(int timer) +{ + if(timer > LEDC_TIMER3) { + LEDC_ERROR("LEDC TIMER ERR: %d\n", timer); + return 0; + } + return 1; +} + +esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; } + if(!ledc_is_valid_timer(timer_sel)) { + return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_timer[timer_sel].conf.div_num = div_num; - LEDC.high_speed_timer[timer_sel].conf.tick_sel = clk; - LEDC.high_speed_timer[timer_sel].conf.timer_lim = timer_lim; + LEDC.timer_group[speed_mode].timer[timer_sel].conf.div_num = div_num; + LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = clk_src; + LEDC.timer_group[speed_mode].timer[timer_sel].conf.bit_num = bit_num; + if(speed_mode == LEDC_HIGH_SPEED_MODE) { + LEDC.timer_group[speed_mode].timer[timer_sel].conf.low_speed_update = 1; + } portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } @@ -98,42 +113,74 @@ static esp_err_t ledc_timer_config(ledc_mode_t speed_mode, uint32_t timer_sel, u static esp_err_t ledc_duty_config(ledc_mode_t speed_mode, uint32_t channel_num, uint32_t hpoint_val, uint32_t duty_val, uint32_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale) { - if(!ledc_is_valid_mode(speed_mode)) { - return ESP_ERR_INVALID_ARG; - } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_channel[channel_num].hpoint.hpoint = hpoint_val; - LEDC.high_speed_channel[channel_num].duty.duty = duty_val; - LEDC.high_speed_channel[channel_num].conf1.duty_inc = duty_direction; - LEDC.high_speed_channel[channel_num].conf1.duty_num = duty_num; - LEDC.high_speed_channel[channel_num].conf1.duty_cycle = duty_cycle; - LEDC.high_speed_channel[channel_num].conf1.duty_scale = duty_scale; + LEDC.channel_group[speed_mode].channel[channel_num].hpoint.hpoint = hpoint_val; + LEDC.channel_group[speed_mode].channel[channel_num].duty.duty = duty_val; + LEDC.channel_group[speed_mode].channel[channel_num].conf1.val = ((duty_direction & LEDC_DUTY_INC_HSCH0_V) << LEDC_DUTY_INC_HSCH0_S) | + ((duty_num & LEDC_DUTY_NUM_HSCH0_V) << LEDC_DUTY_NUM_HSCH0_S) | + ((duty_cycle & LEDC_DUTY_CYCLE_HSCH0_V) << LEDC_DUTY_CYCLE_HSCH0_S) | + ((duty_scale & LEDC_DUTY_SCALE_HSCH0_V) << LEDC_DUTY_SCALE_HSCH0_S); portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } -static esp_err_t ledc_set_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint32_t timer_idx) +esp_err_t ledc_bind_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint32_t timer_idx) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; } + if(!ledc_is_valid_timer(timer_idx)) { + return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_channel[channel].conf0.timer_sel = timer_idx; + LEDC.channel_group[speed_mode].channel[channel].conf0.timer_sel = timer_idx; portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } -static esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel) +esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; } + if(!ledc_is_valid_timer(timer_sel)) { + return ESP_ERR_INVALID_ARG; + } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_timer[timer_sel].conf.rst = 1; - LEDC.high_speed_timer[timer_sel].conf.rst = 0; + LEDC.timer_group[speed_mode].timer[timer_sel].conf.rst = 1; + LEDC.timer_group[speed_mode].timer[timer_sel].conf.rst = 0; portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } + +esp_err_t ledc_timer_pause(ledc_mode_t speed_mode, uint32_t timer_sel) +{ + if(!ledc_is_valid_mode(speed_mode)) { + return ESP_ERR_INVALID_ARG; + } + if(!ledc_is_valid_timer(timer_sel)) { + return ESP_ERR_INVALID_ARG; + } + portENTER_CRITICAL(&ledc_spinlock); + LEDC.timer_group[speed_mode].timer[timer_sel].conf.pause = 1; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + +esp_err_t ledc_timer_resume(ledc_mode_t speed_mode, uint32_t timer_sel) +{ + if(!ledc_is_valid_mode(speed_mode)) { + return ESP_ERR_INVALID_ARG; + } + if(!ledc_is_valid_timer(timer_sel)) { + return ESP_ERR_INVALID_ARG; + } + portENTER_CRITICAL(&ledc_spinlock); + LEDC.timer_group[speed_mode].timer[timer_sel].conf.pause = 0; + portEXIT_CRITICAL(&ledc_spinlock); + return ESP_OK; +} + static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, ledc_intr_type_t type) { if(!ledc_is_valid_mode(speed_mode)) { @@ -143,10 +190,10 @@ static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, uint32_t intr_type = type; portENTER_CRITICAL(&ledc_spinlock); value = LEDC.int_ena.val; - if(intr_type & LEDC_INTR_FADE_END) { - LEDC.int_ena.val = value | BIT(8 + channel); + if(intr_type == LEDC_INTR_FADE_END) { + LEDC.int_ena.val = value | BIT(LEDC_DUTY_CHNG_END_HSCH0_INT_ENA_S + channel); } else { - LEDC.int_ena.val = (value & (~(BIT(8 + channel)))); + LEDC.int_ena.val = (value & (~(BIT(LEDC_DUTY_CHNG_END_HSCH0_INT_ENA_S + channel)))); } portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; @@ -175,13 +222,14 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) uint32_t gpio_num = ledc_conf->gpio_num; uint32_t ledc_channel = ledc_conf->channel; uint32_t freq_hz = ledc_conf->freq_hz; - uint32_t timer_select = ledc_conf->timer_src; - uint32_t duty_depth = ledc_conf->duty_depth; + uint32_t timer_select = ledc_conf->timer_sel; + uint32_t bit_num = ledc_conf->bit_num; uint32_t intr_type = ledc_conf->intr_type; uint32_t duty = ledc_conf->duty; uint32_t div_param = 0; uint32_t precision = 0; int timer_clk_src = 0; + if(!ledc_is_valid_channel(ledc_channel)) { return ESP_ERR_INVALID_ARG; } @@ -192,8 +240,8 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); return ESP_ERR_INVALID_ARG; } - if(freq_hz == 0 || duty_depth == 0 || duty_depth > LEDC_DUTY_DEPTH_15_BIT) { - LEDC_ERROR("freq_hz=%u duty_depth=%u\n", div_param, duty_depth); + if(freq_hz == 0 || bit_num == 0 || bit_num > LEDC_TIMER_15_BIT) { + LEDC_ERROR("freq_hz=%u bit_num=%u\n", div_param, bit_num); return ESP_ERR_INVALID_ARG; } if(timer_select > LEDC_TIMER3) { @@ -202,15 +250,9 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) } portENTER_CRITICAL(&ledc_spinlock); esp_err_t ret = ESP_OK; - /*gpio matrix ledc pwm signal*/ - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); - gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); - gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); - /*configure ledc param*/ - /*calculate the div_param and select which base clock and first we will select the apb_clk */ - precision = (0x1 << duty_depth); //2**depth + precision = (0x1 << bit_num); //2**depth div_param = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; //8bit fragment - /*Fail ,because the div num overflow or too small*/ + /*Fail ,because the div_num overflow or too small*/ if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0_V) { //REF TICK /*Selet the reference tick*/ div_param = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; @@ -219,20 +261,31 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) ret = ESP_FAIL; } timer_clk_src = LEDC_REF_TICK; - ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, timer_clk_src); - ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); } else { //APB TICK timer_clk_src = LEDC_APB_CLK; - ledc_timer_config(speed_mode, timer_select, div_param, duty_depth, timer_clk_src); - ledc_set_channel_timer(speed_mode, ledc_channel, timer_select); } + //1. set timer parameters + // timer settings decide the clk of counter and the period of PWM + ledc_timer_config(speed_mode, timer_select, div_param, bit_num, timer_clk_src); + // reset timer. ledc_timer_rst(speed_mode, timer_select); + //2. set channel parameters + // channel parameters decide how the waveform looks like in one period + // set channel duty, duty range is (0 ~ ((2 ** bit_num) - 1)) ledc_set_duty(speed_mode, ledc_channel, duty); + //update duty settings + ledc_update(speed_mode, ledc_channel); + //3. bind the channel with the timer + ledc_bind_channel_timer(speed_mode, ledc_channel, timer_select); + //4. set interrupt type ledc_enable_intr_type(speed_mode, ledc_channel, intr_type); LEDC_INFO("LEDC_PWM CHANNEL %1u|GPIO %02u|FreHz %05u|Duty %04u|Depth %04u|Time %01u|SourceClk %01u|Divparam %u\n", - ledc_channel, gpio_num, freq_hz, duty, duty_depth, timer_select, timer_clk_src, div_param + ledc_channel, gpio_num, freq_hz, duty, bit_num, timer_select, timer_clk_src, div_param ); - ledc_update(speed_mode, ledc_channel); + /*5. set LEDC signal in gpio matrix*/ + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); + gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); + gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); portEXIT_CRITICAL(&ledc_spinlock); return ret; } @@ -246,8 +299,8 @@ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel) return ESP_ERR_INVALID_ARG; } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_channel[channel].conf0.sig_out_en = 1; - LEDC.high_speed_channel[channel].conf1.duty_start = 1; + LEDC.channel_group[speed_mode].channel[channel].conf0.sig_out_en = 1; + LEDC.channel_group[speed_mode].channel[channel].conf1.duty_start = 1; portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } @@ -261,9 +314,9 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl return ESP_ERR_INVALID_ARG; } portENTER_CRITICAL(&ledc_spinlock); - LEDC.high_speed_channel[channel].conf0.idle_lv = idle_level; - LEDC.high_speed_channel[channel].conf0.sig_out_en = 0; - LEDC.high_speed_channel[channel].conf1.duty_start = 0; + LEDC.channel_group[speed_mode].channel[channel].conf0.idle_lv = idle_level & 0x1; + LEDC.channel_group[speed_mode].channel[channel].conf0.sig_out_en = 0; + LEDC.channel_group[speed_mode].channel[channel].conf1.duty_start = 0; portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } @@ -284,7 +337,6 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, LEDC_ERROR("step_num=%u duty_cyle_num=%u duty_scale=%u\n", step_num, duty_cyle_num, duty_scale); return ESP_ERR_INVALID_ARG; } - portENTER_CRITICAL(&ledc_spinlock); ledc_duty_config(speed_mode, channel, //uint32_t chan_num, 0, //uint32_t hpoint_val, @@ -294,7 +346,6 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, duty_cyle_num, //uint32_t duty_cycle, duty_scale //uint32_t duty_scale ); - portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } @@ -306,7 +357,6 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t if(!ledc_is_valid_channel(channel)) { return ESP_ERR_INVALID_ARG; } - portENTER_CRITICAL(&ledc_spinlock); ledc_duty_config(speed_mode, channel, //uint32_t chan_num, 0, //uint32_t hpoint_val, @@ -316,7 +366,6 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t 1, //uint32_t duty_cycle, 0 //uint32_t duty_scale ); - portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } @@ -325,56 +374,46 @@ int ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel) if(!ledc_is_valid_mode(speed_mode)) { return -1; } - uint32_t duty = (LEDC.high_speed_channel[channel].duty_rd.duty_read >> 4); + uint32_t duty = (LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> 4); return duty; } -esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t freq_hz) +esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num, uint32_t freq_hz) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; } - if(!ledc_is_valid_channel(channel)) { - return ESP_ERR_INVALID_ARG; - } portENTER_CRITICAL(&ledc_spinlock); esp_err_t ret = ESP_OK; uint32_t div_num = 0; - /*Select timer*/ - uint32_t timer_select = LEDC.high_speed_channel[channel].conf0.timer_sel; - /*Get timer limit*/ - uint32_t duty_depth = LEDC.high_speed_timer[timer_select].conf.timer_lim; - uint32_t timer_source_clk = LEDC.high_speed_timer[timer_select].conf.tick_sel; - uint32_t precision = (0x1 << duty_depth); + uint32_t bit_num = LEDC.timer_group[speed_mode].timer[timer_num].conf.bit_num; + uint32_t timer_source_clk = LEDC.timer_group[speed_mode].timer[timer_num].conf.tick_sel; + uint32_t precision = (0x1 << bit_num); if(timer_source_clk == LEDC_APB_CLK) { div_num = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; } else { div_num = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; } if(div_num <= 256 || div_num > LEDC_DIV_NUM_HSTIMER0) { - LEDC_ERROR("channel %u,div param err,div_param=%u\n", channel, div_num); + LEDC_ERROR("div param err,div_param=%u\n", div_num); ret = ESP_FAIL; } - LEDC.high_speed_timer[timer_select].conf.div_num = div_num; + LEDC.timer_group[speed_mode].timer[timer_num].conf.div_num = div_num; portEXIT_CRITICAL(&ledc_spinlock); return ret; } -uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_channel_t channel) +uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num) { if(!ledc_is_valid_mode(speed_mode)) { return 0; } - if(!ledc_is_valid_channel(channel)) { - return 0; - } portENTER_CRITICAL(&ledc_spinlock); uint32_t freq = 0; - uint32_t timer_select = LEDC.high_speed_channel[channel].conf0.timer_sel; - uint32_t timer_source_clk = LEDC.high_speed_timer[timer_select].conf.tick_sel; - uint32_t duty_depth = LEDC.high_speed_timer[timer_select].conf.timer_lim; - uint32_t div_num = LEDC.high_speed_timer[timer_select].conf.div_num; - uint32_t precision = (0x1 << duty_depth); + uint32_t timer_source_clk = LEDC.timer_group[speed_mode].timer[timer_num].conf.tick_sel; + uint32_t bit_num = LEDC.timer_group[speed_mode].timer[timer_num].conf.bit_num; + uint32_t div_num = LEDC.timer_group[speed_mode].timer[timer_num].conf.div_num; + uint32_t precision = (0x1 << bit_num); if(timer_source_clk == LEDC_APB_CLK) { freq = ((uint64_t) LEDC_APB_CLK_HZ << 8) / precision / div_num; } else { diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index d44720a149..d119289acd 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -14,133 +14,74 @@ #ifndef _SOC_LEDC_STRUCT_H_ #define _SOC_LEDC_STRUCT_H_ typedef volatile struct { - struct{ - union { - struct { - uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ - uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ - uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ - uint32_t reserved4: 27; - uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ - }; - uint32_t val; - } conf0; - union { - struct { - uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ - uint32_t reserved20: 12; - }; - uint32_t val; - } hpoint; - union { - struct { - uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ - uint32_t reserved25: 7; - }; - uint32_t val; - } duty; - union { - struct { - uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ - uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ - uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ - uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ - uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ - }; - uint32_t val; - } conf1; - union { - struct { - uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ - uint32_t reserved25: 7; - }; - uint32_t val; - } duty_rd; - } high_speed_channel[8]; - struct{ - union { - struct { - uint32_t timer_sel: 2; /*There are four low speed timers the two bits are used to select one of them for low speed channel. 2'b00: seletc lstimer0. 2'b01: select lstimer1. 2'b10: select lstimer2. 2'b11: select lstimer3.*/ - uint32_t sig_out_en: 1; /*This is the output enable control bit for low speed channel.*/ - uint32_t idle_lv: 1; /*This bit is used to control the output value when low speed channel is off.*/ - uint32_t para_up: 1; /*This bit is used to update register LEDC_LSCH0_HPOINT and LEDC_LSCH0_DUTY for low speed channel.*/ - uint32_t reserved5: 27; - }; - uint32_t val; - } conf0; - union { - struct { - uint32_t hpoint: 20; /*The output value changes to high when lstimerx(x=[0 3]) selected by low speed channel has reached reg_hpoint_lsch0[19:0]*/ - uint32_t reserved20: 12; - }; - uint32_t val; - } hpoint; - union { - struct { - uint32_t duty: 25; /*The register is used to control output duty. When lstimerx(x=[0 3]) choosed by low speed channel has reached reg_lpoint_lsch0 the output signal changes to low. reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4]) (1) reg_lpoint_lsch0=(reg_hpoint_lsch0[19:0]+reg_duty_lsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ - uint32_t reserved25: 7; - }; - uint32_t val; - } duty; - union { - struct { - uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for low speed channel.*/ - uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_lsch0 cycles for low speed channel.*/ - uint32_t duty_num: 10; /*This register is used to control the num of increased or decreased times for low speed channel6.*/ - uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for low speed channel6.*/ - uint32_t duty_start: 1; /*When reg_duty_num_hsch1 reg_duty_cycle_hsch1 and reg_duty_scale_hsch1 has been configured. these register won't take effect until set reg_duty_start_hsch1. this bit is automatically cleared by hardware.*/ - }; - uint32_t val; - } conf1; - union { - struct { - uint32_t duty_read: 25; /*This register represents the current duty of the output signal for low speed channel.*/ - uint32_t reserved25: 7; - }; - uint32_t val; - } duty_r; - } low_speed_channel[8]; - struct{ - union { - struct { - uint32_t timer_lim: 5; /*This register controls the range of the counter in high speed timer. the counter range is [0 2**reg_hstimer0_lim] the max bit width for counter is 20.*/ - uint32_t div_num: 18; /*This register is used to configure parameter for divider in high speed timer the least significant eight bits represent the decimal part.*/ - uint32_t pause: 1; /*This bit is used to pause the counter in high speed timer*/ - uint32_t rst: 1; /*This bit is used to reset high speed timer the counter will be 0 after reset.*/ - uint32_t tick_sel: 1; /*This bit is used to choose apb_clk or ref_tick for high speed timer. 1'b1:apb_clk 0:ref_tick*/ - uint32_t reserved26: 6; - }; - uint32_t val; - } conf; - union { - struct { - uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ - uint32_t reserved20: 12; - }; - uint32_t val; - } value; - } high_speed_timer[4]; - struct{ - union { - struct { - uint32_t timer_lim: 5; /*This register controls the range of the counter in low speed timer. the counter range is [0 2**reg_lstimer0_lim] the max bit width for counter is 20.*/ - uint32_t div_num: 18; /*This register is used to configure parameter for divider in low speed timer the least significant eight bits represent the decimal part.*/ - uint32_t pause: 1; /*This bit is used to pause the counter in low speed timer.*/ - uint32_t rst: 1; /*This bit is used to reset low speed timer the counter will be 0 after reset.*/ - uint32_t tick_sel: 1; /*This bit is used to choose slow_clk or ref_tick for low speed timer. 1'b1:slow_clk 0:ref_tick*/ - uint32_t param_update: 1; /*Set this bit to update reg_div_num_lstime0 and reg_lstimer0_lim.*/ - uint32_t reserved27: 5; - }; - uint32_t val; - } conf; - union { - struct { - uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in low speed timer.*/ - uint32_t reserved20: 12; - }; - uint32_t val; - } value; - } low_speed_timer[4]; + struct { + struct { + union { + struct { + uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ + uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ + uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ + uint32_t reserved4: 27; + uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t hpoint: 20; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } hpoint; + union { + struct { + uint32_t duty: 25; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + uint32_t reserved25: 7; + }; + uint32_t val; + } duty; + union { + struct { + uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ + uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ + uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ + uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ + uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t duty_read: 25; /*This register represents the current duty of the output signal for high speed channel.*/ + uint32_t reserved25: 7; + }; + uint32_t val; + } duty_rd; + } channel[8]; + } channel_group[2]; /*two channel groups : 0: high-speed channels; 1: low-speed channels*/ + struct { + struct { + union { + struct { + uint32_t bit_num: 5; /*This register controls the range of the counter in high speed timer. the counter range is [0 2**reg_hstimer0_lim] the max bit width for counter is 20.*/ + uint32_t div_num: 18; /*This register is used to configure parameter for divider in high speed timer the least significant eight bits represent the decimal part.*/ + uint32_t pause: 1; /*This bit is used to pause the counter in high speed timer*/ + uint32_t rst: 1; /*This bit is used to reset high speed timer the counter will be 0 after reset.*/ + uint32_t tick_sel: 1; /*This bit is used to choose apb_clk or ref_tick for high speed timer. 1'b1:apb_clk 0:ref_tick*/ + uint32_t low_speed_update: 1; /*This bit is only useful for low speed timer channels, reserved for high speed timers*/ + uint32_t reserved26: 5; + }; + uint32_t val; + } conf; + union { + struct { + uint32_t timer_cnt: 20; /*software can read this register to get the current counter value in high speed timer*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } value; + } timer[4]; + } timer_group[2]; /*two channel groups : 0: high-speed channels; 1: low-speed channels*/ union { struct { uint32_t hstimer0_ovf: 1; /*The interrupt raw bit for high speed channel0 counter overflow.*/ From 14de3a38152dffadda34373fb91ed20dd4b4cdcd Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Mon, 26 Sep 2016 11:18:43 +0800 Subject: [PATCH 078/179] Fix a spelling mistake in panic message, add carriage return to stack canary message --- components/freertos/panic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/freertos/panic.c b/components/freertos/panic.c index 06ff86c37f..b575022369 100644 --- a/components/freertos/panic.c +++ b/components/freertos/panic.c @@ -81,7 +81,7 @@ int xPortGetCoreID(); void __attribute__((weak)) vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) { panicPutStr("***ERROR*** A stack overflow in task"); panicPutStr((char*)pcTaskName); - panicPutStr("has been detected.\n"); + panicPutStr("has been detected.\r\n"); } static const char *edesc[]={ @@ -160,7 +160,7 @@ void xt_unhandled_exception(XtExcFrame *frame) { panicPutStr("Guru Meditation Error of type "); x=regs[20]; if (x<40) panicPutStr(edesc[x]); else panicPutStr("Unknown"); - panicPutStr(" occured on core "); + panicPutStr(" occurred on core "); panicPutDec(xPortGetCoreID()); if (inOCDMode()) { panicPutStr(" at pc="); From 62aaec630c2d60ce108f3503c0e3841b9c720998 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 12:29:00 +0800 Subject: [PATCH 079/179] components/esp32: remove "_user" part from entry points, weaken start_cpu0/1 With this change applications can override very early part of startup procedure by implementing "start_cpu0" and "start_cpu1" functions. --- components/esp32/cpu_start.c | 57 +++++++++++++++-------------- components/esp32/ld/esp32.common.ld | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 5566d978a0..76a5e6a1c5 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -43,9 +43,13 @@ #include "esp_ipc.h" #include "esp_log.h" -static void IRAM_ATTR user_start_cpu0(void); -static void IRAM_ATTR call_user_start_cpu1(); -static void IRAM_ATTR user_start_cpu1(void); +void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))); +void start_cpu1(void) __attribute__((weak, alias("start_cpu0_default"))); +void start_cpu0_default(void) IRAM_ATTR; +void start_cpu1_default(void) IRAM_ATTR; +static void IRAM_ATTR call_start_cpu1(); +static void do_global_ctors(void); +static void main_task(void* args); extern void ets_setup_syscalls(void); extern int main(void); @@ -64,7 +68,7 @@ static bool app_cpu_started = false; * and the app CPU is in reset. We do have a stack, so we can do the initialization in C. */ -void IRAM_ATTR call_user_start_cpu0() +void IRAM_ATTR call_start_cpu0() { //Kill wdt REG_CLR_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); @@ -88,13 +92,13 @@ void IRAM_ATTR call_user_start_cpu0() ESP_EARLY_LOGI(TAG, "Pro cpu up."); #ifndef CONFIG_FREERTOS_UNICORE - ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_user_start_cpu1); + ESP_EARLY_LOGI(TAG, "Starting app cpu, entry point is %p", call_start_cpu1); SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_C_REG, DPORT_APPCPU_RUNSTALL); SET_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_A_REG, DPORT_APPCPU_RESETTING); - ets_set_appcpu_boot_addr((uint32_t)call_user_start_cpu1); + ets_set_appcpu_boot_addr((uint32_t)call_start_cpu1); while (!app_cpu_started) { ets_delay_us(100); @@ -104,11 +108,10 @@ void IRAM_ATTR call_user_start_cpu0() CLEAR_PERI_REG_MASK(DPORT_APPCPU_CTRL_B_REG, DPORT_APPCPU_CLKGATE_EN); #endif ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); - user_start_cpu0(); + start_cpu0(); } - -void IRAM_ATTR call_user_start_cpu1() +void IRAM_ATTR call_start_cpu1() { asm volatile (\ "wsr %0, vecbase\n" \ @@ -118,10 +121,25 @@ void IRAM_ATTR call_user_start_cpu1() ESP_EARLY_LOGI(TAG, "App cpu up."); app_cpu_started = 1; - user_start_cpu1(); + start_cpu1(); } -void IRAM_ATTR user_start_cpu1(void) +void start_cpu0_default(void) +{ + esp_set_cpu_freq(); // set CPU frequency configured in menuconfig + uart_div_modify(0, (APB_CLK_FREQ << 4) / 115200); + ets_setup_syscalls(); + do_global_ctors(); + esp_ipc_init(); + spi_flash_init(); + xTaskCreatePinnedToCore(&main_task, "main", + ESP_TASK_MAIN_STACK, NULL, + ESP_TASK_MAIN_PRIO, NULL, 0); + ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); + vTaskStartScheduler(); +} + +void start_cpu1_default(void) { // Wait for FreeRTOS initialization to finish on PRO CPU while (port_xSchedulerRunning[0] == 0) { @@ -139,24 +157,9 @@ static void do_global_ctors(void) } } -static void mainTask(void* args) +static void main_task(void* args) { main(); vTaskDelete(NULL); } -void user_start_cpu0(void) -{ - esp_set_cpu_freq(); // set CPU frequency configured in menuconfig - uart_div_modify(0, (APB_CLK_FREQ << 4) / 115200); - ets_setup_syscalls(); - do_global_ctors(); - esp_ipc_init(); - spi_flash_init(); - xTaskCreatePinnedToCore(&mainTask, "mainTask", - ESP_TASK_MAIN_STACK, NULL, - ESP_TASK_MAIN_PRIO, NULL, 0); - ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); - vTaskStartScheduler(); -} - diff --git a/components/esp32/ld/esp32.common.ld b/components/esp32/ld/esp32.common.ld index 45bcc24f47..3fb4ca761c 100644 --- a/components/esp32/ld/esp32.common.ld +++ b/components/esp32/ld/esp32.common.ld @@ -1,5 +1,5 @@ /* Default entry point: */ -ENTRY(call_user_start_cpu0); +ENTRY(call_start_cpu0); SECTIONS { From 890fadc394a4e79d7dce1a50b15c891e94798082 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 12:35:09 +0800 Subject: [PATCH 080/179] components/esp32: fix renaming of esp_event_set_cb, minor clean up --- components/esp32/event_loop.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/components/esp32/event_loop.c b/components/esp32/event_loop.c index be00e34be4..4b6e21fe09 100644 --- a/components/esp32/event_loop.c +++ b/components/esp32/event_loop.c @@ -27,7 +27,6 @@ #include "freertos/queue.h" #include "freertos/semphr.h" -#include "tcpip_adapter.h" #include "esp_log.h" #include "sdkconfig.h" @@ -38,7 +37,7 @@ static QueueHandle_t s_event_queue = NULL; static system_event_cb_t s_event_handler_cb = NULL; static void *s_event_ctx = NULL; -static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) +static esp_err_t esp_event_post_to_user(system_event_t *event) { if (s_event_handler_cb) { return (*s_event_handler_cb)(s_event_ctx, event); @@ -46,18 +45,16 @@ static esp_err_t esp_wifi_post_event_to_user(system_event_t *event) return ESP_OK; } -static void esp_system_event_task(void *pvParameters) +static void esp_event_loop_task(void *pvParameters) { - system_event_t evt; - esp_err_t ret; - while (1) { + system_event_t evt; if (xQueueReceive(s_event_queue, &evt, portMAX_DELAY) == pdPASS) { - ret = esp_event_process_default(&evt); + esp_err_t ret = esp_event_process_default(&evt); if (ret != ESP_OK) { ESP_LOGE(TAG, "default event handler failed!"); } - ret = esp_wifi_post_event_to_user(&evt); + ret = esp_event_post_to_user(&evt); if (ret != ESP_OK) { ESP_LOGE(TAG, "post event to user fail!"); } @@ -65,23 +62,18 @@ static void esp_system_event_task(void *pvParameters) } } -system_event_cb_t esp_event_set_cb(system_event_cb_t cb, void *ctx) +system_event_cb_t esp_event_loop_set_cb(system_event_cb_t cb, void *ctx) { system_event_cb_t old_cb = s_event_handler_cb; - s_event_handler_cb = cb; s_event_ctx = ctx; - return old_cb; } esp_err_t esp_event_send(system_event_t *event) { - portBASE_TYPE ret; - - ret = xQueueSendToBack(s_event_queue, event, 0); - - if (pdPASS != ret) { + portBASE_TYPE ret = xQueueSendToBack(s_event_queue, event, 0); + if (ret != pdPASS) { if (event) { ESP_LOGE(TAG, "e=%d f", event->event_id); } else { @@ -89,7 +81,6 @@ esp_err_t esp_event_send(system_event_t *event) } return ESP_FAIL; } - return ESP_OK; } @@ -103,13 +94,11 @@ esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx) if (s_event_init_flag) { return ESP_FAIL; } - s_event_handler_cb = cb; s_event_ctx = ctx; - s_event_queue = xQueueCreate(CONFIG_SYSTEM_EVENT_QUEUE_SIZE, sizeof(system_event_t)); - xTaskCreatePinnedToCore(esp_system_event_task, "eventTask", + xTaskCreatePinnedToCore(esp_event_loop_task, "eventTask", ESP_TASKD_EVENT_STACK, NULL, ESP_TASKD_EVENT_PRIO, NULL, 0); s_event_init_flag = true; From 6f2ed934d278394eb23980debacd76024bb79860 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 12:41:04 +0800 Subject: [PATCH 081/179] components/nvs: fix broken sentences in comment blocks --- components/nvs_flash/include/nvs.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/nvs_flash/include/nvs.h b/components/nvs_flash/include/nvs.h index bfcebc2e59..912ea22103 100644 --- a/components/nvs_flash/include/nvs.h +++ b/components/nvs_flash/include/nvs.h @@ -78,9 +78,8 @@ esp_err_t nvs_open(const char* name, nvs_open_mode open_mode, nvs_handle *out_ha * This family of functions set value for the key, given its name. Note that * actual storage will not be updated until nvs_commit function is called. * - * @param[in] handle Handle obtained from nvs_open function. If the handle was - * opened with read_only set to true, nvs_set_X functions will - * fail with ESP_ERR_NVS_READONLY. + * @param[in] handle Handle obtained from nvs_open function. + * Handles that were opened read only cannot be used. * @param[in] key Key name. Maximal length is determined by the underlying * implementation, but is guaranteed to be at least * 16 characters. Shouldn't be empty. @@ -185,8 +184,8 @@ esp_err_t nvs_get_blob(nvs_handle handle, const char* key, void* out_value, size * * Note that actual storage may not be updated until nvs_commit function is called. * - * @param[in] handle Storage handle obtained with nvs_open. If handle has to be - * opened as not read only for this call to succeed. + * @param[in] handle Storage handle obtained with nvs_open. + * Handles that were opened read only cannot be used. * * @param[in] key Key name. Maximal length is determined by the underlying * implementation, but is guaranteed to be at least @@ -205,8 +204,8 @@ esp_err_t nvs_erase_key(nvs_handle handle, const char* key); * * Note that actual storage may not be updated until nvs_commit function is called. * - * @param[in] handle Storage handle obtained with nvs_open. If handle has to be - * opened as not read only for this call to succeed. + * @param[in] handle Storage handle obtained with nvs_open. + * Handles that were opened read only cannot be used. * * @return - ESP_OK if erase operation was successful * - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL @@ -222,8 +221,8 @@ esp_err_t nvs_erase_all(nvs_handle handle); * to non-volatile storage. Individual implementations may write to storage at other times, * but this is not guaranteed. * - * @param[in] handle Storage handle obtained with nvs_open. If handle has to be - * opened as not read only for this call to succeed. + * @param[in] handle Storage handle obtained with nvs_open. + * Handles that were opened read only cannot be used. * * @return - ESP_OK if the changes have been written successfully * - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL From bdfd4ec3db96ef23778a72b6374c366f4737285b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 12:47:17 +0800 Subject: [PATCH 082/179] components/spi_flash: remove stray level of indentation --- components/spi_flash/esp_spi_flash.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/spi_flash/esp_spi_flash.c b/components/spi_flash/esp_spi_flash.c index a9da316abf..d702f3b815 100644 --- a/components/spi_flash/esp_spi_flash.c +++ b/components/spi_flash/esp_spi_flash.c @@ -246,11 +246,8 @@ esp_err_t IRAM_ATTR spi_flash_read(uint32_t src_addr, uint32_t *dest, uint32_t s { COUNTER_START(); spi_flash_disable_interrupts_caches_and_other_cpu(); - SpiFlashOpResult rc; - { - rc = SPIRead(src_addr, dest, (int32_t) size); - COUNTER_ADD_BYTES(read, size); - } + SpiFlashOpResult rc = SPIRead(src_addr, dest, (int32_t) size); + COUNTER_ADD_BYTES(read, size); spi_flash_enable_interrupts_caches_and_other_cpu(); COUNTER_STOP(read); return spi_flash_translate_rc(rc); From 123788c1ab8263510f20bd5dc8e81eed26f6d74d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 14:17:31 +0800 Subject: [PATCH 083/179] gitlab-ci: build SSC with matching branch name, if available --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7233d9ac4d..42f24cd033 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,7 @@ build_ssc: script: - git clone ssh://git@gitlab.espressif.cn:27227/yinling/SSC.git - cd SSC + - git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..." - make defconfig - chmod +x gen_misc_ng.sh - ./gen_misc_ng.sh From 7cef0308dc4eb18a09bcd3e4f8bcb7223599de64 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 14:48:41 +0800 Subject: [PATCH 084/179] Change application entry point name back to app_main --- components/esp32/cpu_start.c | 4 ++-- examples/04_ble_adv/main/app_bt.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 664b21ff64..3abebde947 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -55,7 +55,7 @@ static bool app_cpu_started = false; static void do_global_ctors(void); static void main_task(void* args); extern void ets_setup_syscalls(void); -extern int main(void); +extern int app_main(void); extern int _bss_start; extern int _bss_end; @@ -166,7 +166,7 @@ static void do_global_ctors(void) static void main_task(void* args) { - main(); + app_main(); vTaskDelete(NULL); } diff --git a/examples/04_ble_adv/main/app_bt.c b/examples/04_ble_adv/main/app_bt.c index b2ffc77498..7f5dda5ec5 100755 --- a/examples/04_ble_adv/main/app_bt.c +++ b/examples/04_ble_adv/main/app_bt.c @@ -197,9 +197,10 @@ void bleAdvtTask(void *pvParameters) } } -int main() +int app_main() { bt_controller_init(); xTaskCreatePinnedToCore(&bleAdvtTask, "bleAdvtTask", 2048, NULL, 5, NULL, 0); + return 0; } From 46e88e9f24693e1fcbc0a4ba9f5c049ba0bbbe6d Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 17:59:16 +1000 Subject: [PATCH 085/179] esptool: Bump upstream revision Fixes github #14 (unexpected errors writing to DIO flash) Also speed boost when writing compressed data (can now go via stub) --- components/esptool_py/Makefile.projbuild | 2 +- components/esptool_py/esptool | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index ef82e42e72..49f0548369 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -16,7 +16,7 @@ ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32 ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD) # the no-stub argument is temporary until esptool.py fully supports compressed uploads -ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) $(if $(CONFIG_ESPTOOLPY_COMPRESSED),--no-stub) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) +ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN) diff --git a/components/esptool_py/esptool b/components/esptool_py/esptool index 7c84dd4335..197ba605fe 160000 --- a/components/esptool_py/esptool +++ b/components/esptool_py/esptool @@ -1 +1 @@ -Subproject commit 7c84dd433512bac80e4c01c569e42b4fe76646a7 +Subproject commit 197ba605fe0c05e16bf4c5ec07b726adc8d86abc From adfb9fafaafbee4184bdeb2c2097ff10a4789b82 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 15:57:54 +0800 Subject: [PATCH 086/179] components/freertos: fix a bug with an uninitialised return value introduced in d63dac0 --- components/freertos/queue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/freertos/queue.c b/components/freertos/queue.c index 1fb0552d49..bdd413ea5e 100644 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@ -1156,6 +1156,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; } } #endif /* configUSE_QUEUE_SETS */ + xReturn = pdPASS; } else { From 991fde1f9d06aa0f08c412961bb61f5c94c084d3 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 26 Sep 2016 15:58:58 +0800 Subject: [PATCH 087/179] compoenents/esp32: don't alias start_cpu1 to start_cpu0_default --- components/esp32/cpu_start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 3abebde947..fd46eec282 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -47,7 +47,7 @@ void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))); void start_cpu0_default(void) IRAM_ATTR; #if !CONFIG_FREERTOS_UNICORE static void IRAM_ATTR call_start_cpu1(); -void start_cpu1(void) __attribute__((weak, alias("start_cpu0_default"))); +void start_cpu1(void) __attribute__((weak, alias("start_cpu1_default"))); void start_cpu1_default(void) IRAM_ATTR; static bool app_cpu_started = false; #endif //!CONFIG_FREERTOS_UNICORE From b9167f70cdacc1f18eb84f5c40ab5fcc8f86bb34 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Mon, 26 Sep 2016 18:52:15 +0800 Subject: [PATCH 088/179] component/bt: add VHCI mutex protetion 1. add mutex to VHCI APIs 2. remove bss/data log print during initialization; 3. add bss/data symbols in esp32.rom.ld 4. add & modify BTDM OSI functions --- components/bt/bt.c | 43 +++++++++++++++++++++++++++----- components/esp32/ld/esp32.rom.ld | 4 +++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/components/bt/bt.c b/components/bt/bt.c index efb6d34ee3..de11c4fb2f 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -56,8 +56,11 @@ struct osi_funcs_t { void (*_interrupt_restore)(void); void (*_task_yield)(void); void *(*_semphr_create)(uint32_t max, uint32_t init); - void *(*_semphr_give_from_isr)(void *semphr, void *hptw); - void *(*_semphr_take)(void *semphr, uint32_t block_time); + int32_t (*_semphr_give_from_isr)(void *semphr, void *hptw); + int32_t (*_semphr_take)(void *semphr, uint32_t block_time_ms); + void *(*_mutex_create)(void); + int32_t (*_mutex_lock)(void *mutex); + int32_t (*_mutex_unlock)(void *mutex); esp_err_t (* _read_efuse_mac)(uint8_t mac[6]); }; @@ -73,9 +76,34 @@ static void IRAM_ATTR interrupt_restore(void) portEXIT_CRITICAL(&global_int_mux); } -static void * IRAM_ATTR semphr_take_wrapper(void *semphr, uint32_t block_time) +static void * IRAM_ATTR semphr_create_wrapper(uint32_t max, uint32_t init) { - return (void *)xSemaphoreTake(semphr, block_time); + return (void *)xSemaphoreCreateCounting(max, init); +} + +static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); +} + +static int32_t IRAM_ATTR semphr_take_wrapper(void *semphr, uint32_t block_time_ms) +{ + return (int32_t)xSemaphoreTake(semphr, block_time_ms / portTICK_RATE_MS); +} + +static void * IRAM_ATTR mutex_create_wrapper(void) +{ + return (void *)xSemaphoreCreateMutex(); +} + +static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreTake(mutex, portMAX_DELAY); +} + +static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreGive(mutex); } static struct osi_funcs_t osi_funcs = { @@ -84,9 +112,12 @@ static struct osi_funcs_t osi_funcs = { ._interrupt_disable = interrupt_disable, ._interrupt_restore = interrupt_restore, ._task_yield = vPortYield, - ._semphr_create = xQueueCreateCountingSemaphore, - ._semphr_give_from_isr = (void *)xQueueGiveFromISR, + ._semphr_create = semphr_create_wrapper, + ._semphr_give_from_isr = semphr_give_from_isr_wrapper, ._semphr_take = semphr_take_wrapper, + ._mutex_create = mutex_create_wrapper, + ._mutex_lock = mutex_lock_wrapper, + ._mutex_unlock = mutex_unlock_wrapper, ._read_efuse_mac = system_efuse_read_mac, }; diff --git a/components/esp32/ld/esp32.rom.ld b/components/esp32/ld/esp32.rom.ld index 6f9064a398..f6bc02a37b 100644 --- a/components/esp32/ld/esp32.rom.ld +++ b/components/esp32/ld/esp32.rom.ld @@ -99,6 +99,10 @@ PROVIDE ( _data_end = 0x4000d5c8 ); PROVIDE ( _data_end_btdm_rom = 0x4000d4f8 ); PROVIDE ( _data_start = 0x4000d4f8 ); PROVIDE ( _data_start_btdm_rom = 0x4000d4f4 ); +PROVIDE ( _data_start_btdm = 0x3ffae6e0); +PROVIDE ( _data_end_btdm = 0x3ffaff10); +PROVIDE ( _bss_start_btdm = 0x3ffb8000); +PROVIDE ( _bss_end_btdm = 0x3ffbff70); PROVIDE ( _daylight = 0x3ffae0a4 ); PROVIDE ( dbg_default_handler = 0x3ff97218 ); PROVIDE ( dbg_state = 0x3ffb8d5d ); From 3c33350af9505a6ba3444c7a208208ed53c6ba25 Mon Sep 17 00:00:00 2001 From: liuhan Date: Tue, 6 Sep 2016 17:24:10 +0800 Subject: [PATCH 089/179] components/nghttp: add HTTP2.0 protocol feature Develop and Issue HTTP2.0 protocol parse function, see nghttp file. --- components/nghttp/COPYING | 23 + components/nghttp/LICENSE | 1 + components/nghttp/Makefile | 17 + components/nghttp/README | 1 + components/nghttp/include/nghttp2/nghttp2.h | 5030 +++++++++++ .../nghttp/include/nghttp2/nghttp2ver.h | 42 + components/nghttp/include/nghttp2_buf.h | 388 + components/nghttp/include/nghttp2_callbacks.h | 117 + components/nghttp/include/nghttp2_frame.h | 581 ++ components/nghttp/include/nghttp2_hd.h | 430 + .../nghttp/include/nghttp2_hd_huffman.h | 77 + components/nghttp/include/nghttp2_helper.h | 122 + components/nghttp/include/nghttp2_http.h | 97 + components/nghttp/include/nghttp2_int.h | 58 + components/nghttp/include/nghttp2_map.h | 144 + components/nghttp/include/nghttp2_mem.h | 45 + components/nghttp/include/nghttp2_net.h | 91 + components/nghttp/include/nghttp2_npn.h | 34 + components/nghttp/include/nghttp2_option.h | 116 + .../nghttp/include/nghttp2_outbound_item.h | 166 + components/nghttp/include/nghttp2_pq.h | 128 + .../nghttp/include/nghttp2_priority_spec.h | 42 + components/nghttp/include/nghttp2_queue.h | 49 + components/nghttp/include/nghttp2_rcbuf.h | 80 + components/nghttp/include/nghttp2_session.h | 878 ++ components/nghttp/include/nghttp2_stream.h | 436 + components/nghttp/include/nghttp2_submit.h | 34 + components/nghttp/library/nghttp2_buf.c | 494 ++ components/nghttp/library/nghttp2_callbacks.c | 158 + components/nghttp/library/nghttp2_frame.c | 1001 +++ components/nghttp/library/nghttp2_hd.c | 2330 +++++ .../nghttp/library/nghttp2_hd_huffman.c | 202 + .../nghttp/library/nghttp2_hd_huffman_data.c | 5152 +++++++++++ components/nghttp/library/nghttp2_helper.c | 520 ++ components/nghttp/library/nghttp2_http.c | 563 ++ components/nghttp/library/nghttp2_map.c | 189 + components/nghttp/library/nghttp2_mem.c | 65 + components/nghttp/library/nghttp2_npn.c | 57 + components/nghttp/library/nghttp2_option.c | 103 + .../nghttp/library/nghttp2_outbound_item.c | 124 + components/nghttp/library/nghttp2_pq.c | 184 + .../nghttp/library/nghttp2_priority_spec.c | 52 + components/nghttp/library/nghttp2_queue.c | 85 + components/nghttp/library/nghttp2_rcbuf.c | 99 + components/nghttp/library/nghttp2_session.c | 7513 +++++++++++++++++ components/nghttp/library/nghttp2_stream.c | 1007 +++ components/nghttp/library/nghttp2_submit.c | 723 ++ components/nghttp/library/nghttp2_version.c | 38 + components/nghttp/port/http_parser.c | 2469 ++++++ components/nghttp/port/include/config.h | 36 + components/nghttp/port/include/http_parser.h | 362 + 51 files changed, 32753 insertions(+) create mode 100644 components/nghttp/COPYING create mode 100644 components/nghttp/LICENSE create mode 100644 components/nghttp/Makefile create mode 100644 components/nghttp/README create mode 100644 components/nghttp/include/nghttp2/nghttp2.h create mode 100644 components/nghttp/include/nghttp2/nghttp2ver.h create mode 100644 components/nghttp/include/nghttp2_buf.h create mode 100644 components/nghttp/include/nghttp2_callbacks.h create mode 100644 components/nghttp/include/nghttp2_frame.h create mode 100644 components/nghttp/include/nghttp2_hd.h create mode 100644 components/nghttp/include/nghttp2_hd_huffman.h create mode 100644 components/nghttp/include/nghttp2_helper.h create mode 100644 components/nghttp/include/nghttp2_http.h create mode 100644 components/nghttp/include/nghttp2_int.h create mode 100644 components/nghttp/include/nghttp2_map.h create mode 100644 components/nghttp/include/nghttp2_mem.h create mode 100644 components/nghttp/include/nghttp2_net.h create mode 100644 components/nghttp/include/nghttp2_npn.h create mode 100644 components/nghttp/include/nghttp2_option.h create mode 100644 components/nghttp/include/nghttp2_outbound_item.h create mode 100644 components/nghttp/include/nghttp2_pq.h create mode 100644 components/nghttp/include/nghttp2_priority_spec.h create mode 100644 components/nghttp/include/nghttp2_queue.h create mode 100644 components/nghttp/include/nghttp2_rcbuf.h create mode 100644 components/nghttp/include/nghttp2_session.h create mode 100644 components/nghttp/include/nghttp2_stream.h create mode 100644 components/nghttp/include/nghttp2_submit.h create mode 100644 components/nghttp/library/nghttp2_buf.c create mode 100644 components/nghttp/library/nghttp2_callbacks.c create mode 100644 components/nghttp/library/nghttp2_frame.c create mode 100644 components/nghttp/library/nghttp2_hd.c create mode 100644 components/nghttp/library/nghttp2_hd_huffman.c create mode 100644 components/nghttp/library/nghttp2_hd_huffman_data.c create mode 100644 components/nghttp/library/nghttp2_helper.c create mode 100644 components/nghttp/library/nghttp2_http.c create mode 100644 components/nghttp/library/nghttp2_map.c create mode 100644 components/nghttp/library/nghttp2_mem.c create mode 100644 components/nghttp/library/nghttp2_npn.c create mode 100644 components/nghttp/library/nghttp2_option.c create mode 100644 components/nghttp/library/nghttp2_outbound_item.c create mode 100644 components/nghttp/library/nghttp2_pq.c create mode 100644 components/nghttp/library/nghttp2_priority_spec.c create mode 100644 components/nghttp/library/nghttp2_queue.c create mode 100644 components/nghttp/library/nghttp2_rcbuf.c create mode 100644 components/nghttp/library/nghttp2_session.c create mode 100644 components/nghttp/library/nghttp2_stream.c create mode 100644 components/nghttp/library/nghttp2_submit.c create mode 100644 components/nghttp/library/nghttp2_version.c create mode 100644 components/nghttp/port/http_parser.c create mode 100644 components/nghttp/port/include/config.h create mode 100644 components/nghttp/port/include/http_parser.h diff --git a/components/nghttp/COPYING b/components/nghttp/COPYING new file mode 100644 index 0000000000..80201792ec --- /dev/null +++ b/components/nghttp/COPYING @@ -0,0 +1,23 @@ +The MIT License + +Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa +Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/components/nghttp/LICENSE b/components/nghttp/LICENSE new file mode 100644 index 0000000000..45d9408ffa --- /dev/null +++ b/components/nghttp/LICENSE @@ -0,0 +1 @@ +See COPYING diff --git a/components/nghttp/Makefile b/components/nghttp/Makefile new file mode 100644 index 0000000000..ec2514477b --- /dev/null +++ b/components/nghttp/Makefile @@ -0,0 +1,17 @@ +# +# Component Makefile +# +# This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default, +# this will take the sources in this directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the SDK documents if you need to do this. +# +COMPONENT_ADD_INCLUDEDIRS := port/include include + +COMPONENT_SRCDIRS := library port + +#EXTRA_CFLAGS += -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' + +EXTRA_CFLAGS := -Wno-error=address -Waddress -DHAVE_CONFIG_H + +include $(IDF_PATH)/make/component.mk \ No newline at end of file diff --git a/components/nghttp/README b/components/nghttp/README new file mode 100644 index 0000000000..5ccc0ea36b --- /dev/null +++ b/components/nghttp/README @@ -0,0 +1 @@ +See README.rst diff --git a/components/nghttp/include/nghttp2/nghttp2.h b/components/nghttp/include/nghttp2/nghttp2.h new file mode 100644 index 0000000000..0ed36051e5 --- /dev/null +++ b/components/nghttp/include/nghttp2/nghttp2.h @@ -0,0 +1,5030 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013, 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_H +#define NGHTTP2_H + +/* Define WIN32 when build target is Win32 API (borrowed from + libcurl) */ +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +#define WIN32 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#if defined(_MSC_VER) && (_MSC_VER < 1800) +/* MSVC < 2013 does not have inttypes.h because it is not C99 + compliant. See compiler macros and version number in + https://sourceforge.net/p/predef/wiki/Compilers/ */ +#include +#else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */ +#include +#endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */ +#include + +#include + +#ifdef NGHTTP2_STATICLIB +#define NGHTTP2_EXTERN +#elif defined(WIN32) +#ifdef BUILDING_NGHTTP2 +#define NGHTTP2_EXTERN __declspec(dllexport) +#else /* !BUILDING_NGHTTP2 */ +#define NGHTTP2_EXTERN __declspec(dllimport) +#endif /* !BUILDING_NGHTTP2 */ +#else /* !defined(WIN32) */ +#ifdef BUILDING_NGHTTP2 +#define NGHTTP2_EXTERN __attribute__((visibility("default"))) +#else /* !BUILDING_NGHTTP2 */ +#define NGHTTP2_EXTERN +#endif /* !BUILDING_NGHTTP2 */ +#endif /* !defined(WIN32) */ + +/** + * @macro + * + * The protocol version identification string of this library + * supports. This identifier is used if HTTP/2 is used over TLS. + */ +#define NGHTTP2_PROTO_VERSION_ID "h2" +/** + * @macro + * + * The length of :macro:`NGHTTP2_PROTO_VERSION_ID`. + */ +#define NGHTTP2_PROTO_VERSION_ID_LEN 2 + +/** + * @macro + * + * The serialized form of ALPN protocol identifier this library + * supports. Notice that first byte is the length of following + * protocol identifier. This is the same wire format of `TLS ALPN + * extension `_. This is useful + * to process incoming ALPN tokens in wire format. + */ +#define NGHTTP2_PROTO_ALPN "\x2h2" + +/** + * @macro + * + * The length of :macro:`NGHTTP2_PROTO_ALPN`. + */ +#define NGHTTP2_PROTO_ALPN_LEN (sizeof(NGHTTP2_PROTO_ALPN) - 1) + +/** + * @macro + * + * The protocol version identification string of this library + * supports. This identifier is used if HTTP/2 is used over cleartext + * TCP. + */ +#define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "h2c" + +/** + * @macro + * + * The length of :macro:`NGHTTP2_CLEARTEXT_PROTO_VERSION_ID`. + */ +#define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN 3 + +struct nghttp2_session; +/** + * @struct + * + * The primary structure to hold the resources needed for a HTTP/2 + * session. The details of this structure are intentionally hidden + * from the public API. + */ +typedef struct nghttp2_session nghttp2_session; + +/** + * @macro + * + * The age of :type:`nghttp2_info` + */ +#define NGHTTP2_VERSION_AGE 1 + +/** + * @struct + * + * This struct is what `nghttp2_version()` returns. It holds + * information about the particular nghttp2 version. + */ +typedef struct { + /** + * Age of this struct. This instance of nghttp2 sets it to + * :macro:`NGHTTP2_VERSION_AGE` but a future version may bump it and + * add more struct fields at the bottom + */ + int age; + /** + * the :macro:`NGHTTP2_VERSION_NUM` number (since age ==1) + */ + int version_num; + /** + * points to the :macro:`NGHTTP2_VERSION` string (since age ==1) + */ + const char *version_str; + /** + * points to the :macro:`NGHTTP2_PROTO_VERSION_ID` string this + * instance implements (since age ==1) + */ + const char *proto_str; + /* -------- the above fields all exist when age == 1 */ +} nghttp2_info; + +/** + * @macro + * + * The default weight of stream dependency. + */ +#define NGHTTP2_DEFAULT_WEIGHT 16 + +/** + * @macro + * + * The maximum weight of stream dependency. + */ +#define NGHTTP2_MAX_WEIGHT 256 + +/** + * @macro + * + * The minimum weight of stream dependency. + */ +#define NGHTTP2_MIN_WEIGHT 1 + +/** + * @macro + * + * The maximum window size + */ +#define NGHTTP2_MAX_WINDOW_SIZE ((int32_t)((1U << 31) - 1)) + +/** + * @macro + * + * The initial window size for stream level flow control. + */ +#define NGHTTP2_INITIAL_WINDOW_SIZE ((1 << 16) - 1) +/** + * @macro + * + * The initial window size for connection level flow control. + */ +#define NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE ((1 << 16) - 1) + +/** + * @macro + * + * The default header table size. + */ +#define NGHTTP2_DEFAULT_HEADER_TABLE_SIZE (1 << 12) + +/** + * @macro + * + * The client magic string, which is the first 24 bytes byte string of + * client connection preface. + */ +#define NGHTTP2_CLIENT_MAGIC "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" + +/** + * @macro + * + * The length of :macro:`NGHTTP2_CLIENT_MAGIC`. + */ +#define NGHTTP2_CLIENT_MAGIC_LEN 24 + +/** + * @enum + * + * Error codes used in this library. The code range is [-999, -500], + * inclusive. The following values are defined: + */ +typedef enum { + /** + * Invalid argument passed. + */ + NGHTTP2_ERR_INVALID_ARGUMENT = -501, + /** + * Out of buffer space. + */ + NGHTTP2_ERR_BUFFER_ERROR = -502, + /** + * The specified protocol version is not supported. + */ + NGHTTP2_ERR_UNSUPPORTED_VERSION = -503, + /** + * Used as a return value from :type:`nghttp2_send_callback`, + * :type:`nghttp2_recv_callback` and + * :type:`nghttp2_send_data_callback` to indicate that the operation + * would block. + */ + NGHTTP2_ERR_WOULDBLOCK = -504, + /** + * General protocol error + */ + NGHTTP2_ERR_PROTO = -505, + /** + * The frame is invalid. + */ + NGHTTP2_ERR_INVALID_FRAME = -506, + /** + * The peer performed a shutdown on the connection. + */ + NGHTTP2_ERR_EOF = -507, + /** + * Used as a return value from + * :func:`nghttp2_data_source_read_callback` to indicate that data + * transfer is postponed. See + * :func:`nghttp2_data_source_read_callback` for details. + */ + NGHTTP2_ERR_DEFERRED = -508, + /** + * Stream ID has reached the maximum value. Therefore no stream ID + * is available. + */ + NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE = -509, + /** + * The stream is already closed; or the stream ID is invalid. + */ + NGHTTP2_ERR_STREAM_CLOSED = -510, + /** + * RST_STREAM has been added to the outbound queue. The stream is + * in closing state. + */ + NGHTTP2_ERR_STREAM_CLOSING = -511, + /** + * The transmission is not allowed for this stream (e.g., a frame + * with END_STREAM flag set has already sent). + */ + NGHTTP2_ERR_STREAM_SHUT_WR = -512, + /** + * The stream ID is invalid. + */ + NGHTTP2_ERR_INVALID_STREAM_ID = -513, + /** + * The state of the stream is not valid (e.g., DATA cannot be sent + * to the stream if response HEADERS has not been sent). + */ + NGHTTP2_ERR_INVALID_STREAM_STATE = -514, + /** + * Another DATA frame has already been deferred. + */ + NGHTTP2_ERR_DEFERRED_DATA_EXIST = -515, + /** + * Starting new stream is not allowed (e.g., GOAWAY has been sent + * and/or received). + */ + NGHTTP2_ERR_START_STREAM_NOT_ALLOWED = -516, + /** + * GOAWAY has already been sent. + */ + NGHTTP2_ERR_GOAWAY_ALREADY_SENT = -517, + /** + * The received frame contains the invalid header block (e.g., There + * are duplicate header names; or the header names are not encoded + * in US-ASCII character set and not lower cased; or the header name + * is zero-length string; or the header value contains multiple + * in-sequence NUL bytes). + */ + NGHTTP2_ERR_INVALID_HEADER_BLOCK = -518, + /** + * Indicates that the context is not suitable to perform the + * requested operation. + */ + NGHTTP2_ERR_INVALID_STATE = -519, + /** + * The user callback function failed due to the temporal error. + */ + NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE = -521, + /** + * The length of the frame is invalid, either too large or too small. + */ + NGHTTP2_ERR_FRAME_SIZE_ERROR = -522, + /** + * Header block inflate/deflate error. + */ + NGHTTP2_ERR_HEADER_COMP = -523, + /** + * Flow control error + */ + NGHTTP2_ERR_FLOW_CONTROL = -524, + /** + * Insufficient buffer size given to function. + */ + NGHTTP2_ERR_INSUFF_BUFSIZE = -525, + /** + * Callback was paused by the application + */ + NGHTTP2_ERR_PAUSE = -526, + /** + * There are too many in-flight SETTING frame and no more + * transmission of SETTINGS is allowed. + */ + NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS = -527, + /** + * The server push is disabled. + */ + NGHTTP2_ERR_PUSH_DISABLED = -528, + /** + * DATA or HEADERS frame for a given stream has been already + * submitted and has not been fully processed yet. Application + * should wait for the transmission of the previously submitted + * frame before submitting another. + */ + NGHTTP2_ERR_DATA_EXIST = -529, + /** + * The current session is closing due to a connection error or + * `nghttp2_session_terminate_session()` is called. + */ + NGHTTP2_ERR_SESSION_CLOSING = -530, + /** + * Invalid HTTP header field was received and stream is going to be + * closed. + */ + NGHTTP2_ERR_HTTP_HEADER = -531, + /** + * Violation in HTTP messaging rule. + */ + NGHTTP2_ERR_HTTP_MESSAGING = -532, + /** + * Stream was refused. + */ + NGHTTP2_ERR_REFUSED_STREAM = -533, + /** + * Unexpected internal error, but recovered. + */ + NGHTTP2_ERR_INTERNAL = -534, + /** + * Indicates that a processing was canceled. + */ + NGHTTP2_ERR_CANCEL = -535, + /** + * The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is + * under unexpected condition and processing was terminated (e.g., + * out of memory). If application receives this error code, it must + * stop using that :type:`nghttp2_session` object and only allowed + * operation for that object is deallocate it using + * `nghttp2_session_del()`. + */ + NGHTTP2_ERR_FATAL = -900, + /** + * Out of memory. This is a fatal error. + */ + NGHTTP2_ERR_NOMEM = -901, + /** + * The user callback function failed. This is a fatal error. + */ + NGHTTP2_ERR_CALLBACK_FAILURE = -902, + /** + * Invalid client magic (see :macro:`NGHTTP2_CLIENT_MAGIC`) was + * received and further processing is not possible. + */ + NGHTTP2_ERR_BAD_CLIENT_MAGIC = -903, + /** + * Possible flooding by peer was detected in this HTTP/2 session. + * Flooding is measured by how many PING and SETTINGS frames with + * ACK flag set are queued for transmission. These frames are + * response for the peer initiated frames, and peer can cause memory + * exhaustion on server side to send these frames forever and does + * not read network. + */ + NGHTTP2_ERR_FLOODED = -904 +} nghttp2_error; + +/** + * @struct + * + * The object representing single contiguous buffer. + */ +typedef struct { + /** + * The pointer to the buffer. + */ + uint8_t *base; + /** + * The length of the buffer. + */ + size_t len; +} nghttp2_vec; + +struct nghttp2_rcbuf; + +/** + * @struct + * + * The object representing reference counted buffer. The details of + * this structure are intentionally hidden from the public API. + */ +typedef struct nghttp2_rcbuf nghttp2_rcbuf; + +/** + * @function + * + * Increments the reference count of |rcbuf| by 1. + */ +NGHTTP2_EXTERN void nghttp2_rcbuf_incref(nghttp2_rcbuf *rcbuf); + +/** + * @function + * + * Decrements the reference count of |rcbuf| by 1. If the reference + * count becomes zero, the object pointed by |rcbuf| will be freed. + * In this case, application must not use |rcbuf| again. + */ +NGHTTP2_EXTERN void nghttp2_rcbuf_decref(nghttp2_rcbuf *rcbuf); + +/** + * @function + * + * Returns the underlying buffer managed by |rcbuf|. + */ +NGHTTP2_EXTERN nghttp2_vec nghttp2_rcbuf_get_buf(nghttp2_rcbuf *rcbuf); + +/** + * @enum + * + * The flags for header field name/value pair. + */ +typedef enum { + /** + * No flag set. + */ + NGHTTP2_NV_FLAG_NONE = 0, + /** + * Indicates that this name/value pair must not be indexed ("Literal + * Header Field never Indexed" representation must be used in HPACK + * encoding). Other implementation calls this bit as "sensitive". + */ + NGHTTP2_NV_FLAG_NO_INDEX = 0x01, + /** + * This flag is set solely by application. If this flag is set, the + * library does not make a copy of header field name. This could + * improve performance. + */ + NGHTTP2_NV_FLAG_NO_COPY_NAME = 0x02, + /** + * This flag is set solely by application. If this flag is set, the + * library does not make a copy of header field value. This could + * improve performance. + */ + NGHTTP2_NV_FLAG_NO_COPY_VALUE = 0x04 +} nghttp2_nv_flag; + +/** + * @struct + * + * The name/value pair, which mainly used to represent header fields. + */ +typedef struct { + /** + * The |name| byte string. If this struct is presented from library + * (e.g., :type:`nghttp2_on_frame_recv_callback`), |name| is + * guaranteed to be NULL-terminated. For some callbacks + * (:type:`nghttp2_before_frame_send_callback`, + * :type:`nghttp2_on_frame_send_callback`, and + * :type:`nghttp2_on_frame_not_send_callback`), it may not be + * NULL-terminated if header field is passed from application with + * the flag :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`). When application + * is constructing this struct, |name| is not required to be + * NULL-terminated. + */ + uint8_t *name; + /** + * The |value| byte string. If this struct is presented from + * library (e.g., :type:`nghttp2_on_frame_recv_callback`), |value| + * is guaranteed to be NULL-terminated. For some callbacks + * (:type:`nghttp2_before_frame_send_callback`, + * :type:`nghttp2_on_frame_send_callback`, and + * :type:`nghttp2_on_frame_not_send_callback`), it may not be + * NULL-terminated if header field is passed from application with + * the flag :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE`). When + * application is constructing this struct, |value| is not required + * to be NULL-terminated. + */ + uint8_t *value; + /** + * The length of the |name|, excluding terminating NULL. + */ + size_t namelen; + /** + * The length of the |value|, excluding terminating NULL. + */ + size_t valuelen; + /** + * Bitwise OR of one or more of :type:`nghttp2_nv_flag`. + */ + uint8_t flags; +} nghttp2_nv; + +/** + * @enum + * + * The frame types in HTTP/2 specification. + */ +typedef enum { + /** + * The DATA frame. + */ + NGHTTP2_DATA = 0, + /** + * The HEADERS frame. + */ + NGHTTP2_HEADERS = 0x01, + /** + * The PRIORITY frame. + */ + NGHTTP2_PRIORITY = 0x02, + /** + * The RST_STREAM frame. + */ + NGHTTP2_RST_STREAM = 0x03, + /** + * The SETTINGS frame. + */ + NGHTTP2_SETTINGS = 0x04, + /** + * The PUSH_PROMISE frame. + */ + NGHTTP2_PUSH_PROMISE = 0x05, + /** + * The PING frame. + */ + NGHTTP2_PING = 0x06, + /** + * The GOAWAY frame. + */ + NGHTTP2_GOAWAY = 0x07, + /** + * The WINDOW_UPDATE frame. + */ + NGHTTP2_WINDOW_UPDATE = 0x08, + /** + * The CONTINUATION frame. This frame type won't be passed to any + * callbacks because the library processes this frame type and its + * preceding HEADERS/PUSH_PROMISE as a single frame. + */ + NGHTTP2_CONTINUATION = 0x09, + /** + * The ALTSVC frame, which is defined in `RFC 7383 + * `_. + */ + NGHTTP2_ALTSVC = 0x0a +} nghttp2_frame_type; + +/** + * @enum + * + * The flags for HTTP/2 frames. This enum defines all flags for all + * frames. + */ +typedef enum { + /** + * No flag set. + */ + NGHTTP2_FLAG_NONE = 0, + /** + * The END_STREAM flag. + */ + NGHTTP2_FLAG_END_STREAM = 0x01, + /** + * The END_HEADERS flag. + */ + NGHTTP2_FLAG_END_HEADERS = 0x04, + /** + * The ACK flag. + */ + NGHTTP2_FLAG_ACK = 0x01, + /** + * The PADDED flag. + */ + NGHTTP2_FLAG_PADDED = 0x08, + /** + * The PRIORITY flag. + */ + NGHTTP2_FLAG_PRIORITY = 0x20 +} nghttp2_flag; + +/** + * @enum + * The SETTINGS ID. + */ +typedef enum { + /** + * SETTINGS_HEADER_TABLE_SIZE + */ + NGHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0x01, + /** + * SETTINGS_ENABLE_PUSH + */ + NGHTTP2_SETTINGS_ENABLE_PUSH = 0x02, + /** + * SETTINGS_MAX_CONCURRENT_STREAMS + */ + NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 0x03, + /** + * SETTINGS_INITIAL_WINDOW_SIZE + */ + NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 0x04, + /** + * SETTINGS_MAX_FRAME_SIZE + */ + NGHTTP2_SETTINGS_MAX_FRAME_SIZE = 0x05, + /** + * SETTINGS_MAX_HEADER_LIST_SIZE + */ + NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 0x06 +} nghttp2_settings_id; +/* Note: If we add SETTINGS, update the capacity of + NGHTTP2_INBOUND_NUM_IV as well */ + +/** + * @macro + * + * .. warning:: + * + * Deprecated. The initial max concurrent streams is 0xffffffffu. + * + * Default maximum number of incoming concurrent streams. Use + * `nghttp2_submit_settings()` with + * :enum:`NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS` to change the + * maximum number of incoming concurrent streams. + * + * .. note:: + * + * The maximum number of outgoing concurrent streams is 100 by + * default. + */ +#define NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1) + +/** + * @enum + * The status codes for the RST_STREAM and GOAWAY frames. + */ +typedef enum { + /** + * No errors. + */ + NGHTTP2_NO_ERROR = 0x00, + /** + * PROTOCOL_ERROR + */ + NGHTTP2_PROTOCOL_ERROR = 0x01, + /** + * INTERNAL_ERROR + */ + NGHTTP2_INTERNAL_ERROR = 0x02, + /** + * FLOW_CONTROL_ERROR + */ + NGHTTP2_FLOW_CONTROL_ERROR = 0x03, + /** + * SETTINGS_TIMEOUT + */ + NGHTTP2_SETTINGS_TIMEOUT = 0x04, + /** + * STREAM_CLOSED + */ + NGHTTP2_STREAM_CLOSED = 0x05, + /** + * FRAME_SIZE_ERROR + */ + NGHTTP2_FRAME_SIZE_ERROR = 0x06, + /** + * REFUSED_STREAM + */ + NGHTTP2_REFUSED_STREAM = 0x07, + /** + * CANCEL + */ + NGHTTP2_CANCEL = 0x08, + /** + * COMPRESSION_ERROR + */ + NGHTTP2_COMPRESSION_ERROR = 0x09, + /** + * CONNECT_ERROR + */ + NGHTTP2_CONNECT_ERROR = 0x0a, + /** + * ENHANCE_YOUR_CALM + */ + NGHTTP2_ENHANCE_YOUR_CALM = 0x0b, + /** + * INADEQUATE_SECURITY + */ + NGHTTP2_INADEQUATE_SECURITY = 0x0c, + /** + * HTTP_1_1_REQUIRED + */ + NGHTTP2_HTTP_1_1_REQUIRED = 0x0d +} nghttp2_error_code; + +/** + * @struct + * The frame header. + */ +typedef struct { + /** + * The length field of this frame, excluding frame header. + */ + size_t length; + /** + * The stream identifier (aka, stream ID) + */ + int32_t stream_id; + /** + * The type of this frame. See `nghttp2_frame_type`. + */ + uint8_t type; + /** + * The flags. + */ + uint8_t flags; + /** + * Reserved bit in frame header. Currently, this is always set to 0 + * and application should not expect something useful in here. + */ + uint8_t reserved; +} nghttp2_frame_hd; + +/** + * @union + * + * This union represents the some kind of data source passed to + * :type:`nghttp2_data_source_read_callback`. + */ +typedef union { + /** + * The integer field, suitable for a file descriptor. + */ + int fd; + /** + * The pointer to an arbitrary object. + */ + void *ptr; +} nghttp2_data_source; + +/** + * @enum + * + * The flags used to set in |data_flags| output parameter in + * :type:`nghttp2_data_source_read_callback`. + */ +typedef enum { + /** + * No flag set. + */ + NGHTTP2_DATA_FLAG_NONE = 0, + /** + * Indicates EOF was sensed. + */ + NGHTTP2_DATA_FLAG_EOF = 0x01, + /** + * Indicates that END_STREAM flag must not be set even if + * NGHTTP2_DATA_FLAG_EOF is set. Usually this flag is used to send + * trailer fields with `nghttp2_submit_request()` or + * `nghttp2_submit_response()`. + */ + NGHTTP2_DATA_FLAG_NO_END_STREAM = 0x02, + /** + * Indicates that application will send complete DATA frame in + * :type:`nghttp2_send_data_callback`. + */ + NGHTTP2_DATA_FLAG_NO_COPY = 0x04 +} nghttp2_data_flag; + +/** + * @functypedef + * + * Callback function invoked when the library wants to read data from + * the |source|. The read data is sent in the stream |stream_id|. + * The implementation of this function must read at most |length| + * bytes of data from |source| (or possibly other places) and store + * them in |buf| and return number of data stored in |buf|. If EOF is + * reached, set :enum:`NGHTTP2_DATA_FLAG_EOF` flag in |*data_flags|. + * + * Sometime it is desirable to avoid copying data into |buf| and let + * application to send data directly. To achieve this, set + * :enum:`NGHTTP2_DATA_FLAG_NO_COPY` to |*data_flags| (and possibly + * other flags, just like when we do copy), and return the number of + * bytes to send without copying data into |buf|. The library, seeing + * :enum:`NGHTTP2_DATA_FLAG_NO_COPY`, will invoke + * :type:`nghttp2_send_data_callback`. The application must send + * complete DATA frame in that callback. + * + * If this callback is set by `nghttp2_submit_request()`, + * `nghttp2_submit_response()` or `nghttp2_submit_headers()` and + * `nghttp2_submit_data()` with flag parameter + * :enum:`NGHTTP2_FLAG_END_STREAM` set, and + * :enum:`NGHTTP2_DATA_FLAG_EOF` flag is set to |*data_flags|, DATA + * frame will have END_STREAM flag set. Usually, this is expected + * behaviour and all are fine. One exception is send trailer fields. + * You cannot send trailer fields after sending frame with END_STREAM + * set. To avoid this problem, one can set + * :enum:`NGHTTP2_DATA_FLAG_NO_END_STREAM` along with + * :enum:`NGHTTP2_DATA_FLAG_EOF` to signal the library not to set + * END_STREAM in DATA frame. Then application can use + * `nghttp2_submit_trailer()` to send trailer fields. + * `nghttp2_submit_trailer()` can be called inside this callback. + * + * If the application wants to postpone DATA frames (e.g., + * asynchronous I/O, or reading data blocks for long time), it is + * achieved by returning :enum:`NGHTTP2_ERR_DEFERRED` without reading + * any data in this invocation. The library removes DATA frame from + * the outgoing queue temporarily. To move back deferred DATA frame + * to outgoing queue, call `nghttp2_session_resume_data()`. In case + * of error, there are 2 choices. Returning + * :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will close the stream + * by issuing RST_STREAM with :enum:`NGHTTP2_INTERNAL_ERROR`. If a + * different error code is desirable, use + * `nghttp2_submit_rst_stream()` with a desired error code and then + * return :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. Returning + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will signal the entire session + * failure. + */ +typedef ssize_t (*nghttp2_data_source_read_callback)( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data); + +/** + * @struct + * + * This struct represents the data source and the way to read a chunk + * of data from it. + */ +typedef struct { + /** + * The data source. + */ + nghttp2_data_source source; + /** + * The callback function to read a chunk of data from the |source|. + */ + nghttp2_data_source_read_callback read_callback; +} nghttp2_data_provider; + +/** + * @struct + * + * The DATA frame. The received data is delivered via + * :type:`nghttp2_on_data_chunk_recv_callback`. + */ +typedef struct { + nghttp2_frame_hd hd; + /** + * The length of the padding in this frame. This includes PAD_HIGH + * and PAD_LOW. + */ + size_t padlen; +} nghttp2_data; + +/** + * @enum + * + * The category of HEADERS, which indicates the role of the frame. In + * HTTP/2 spec, request, response, push response and other arbitrary + * headers (e.g., trailer fields) are all called just HEADERS. To + * give the application the role of incoming HEADERS frame, we define + * several categories. + */ +typedef enum { + /** + * The HEADERS frame is opening new stream, which is analogous to + * SYN_STREAM in SPDY. + */ + NGHTTP2_HCAT_REQUEST = 0, + /** + * The HEADERS frame is the first response headers, which is + * analogous to SYN_REPLY in SPDY. + */ + NGHTTP2_HCAT_RESPONSE = 1, + /** + * The HEADERS frame is the first headers sent against reserved + * stream. + */ + NGHTTP2_HCAT_PUSH_RESPONSE = 2, + /** + * The HEADERS frame which does not apply for the above categories, + * which is analogous to HEADERS in SPDY. If non-final response + * (e.g., status 1xx) is used, final response HEADERS frame will be + * categorized here. + */ + NGHTTP2_HCAT_HEADERS = 3 +} nghttp2_headers_category; + +/** + * @struct + * + * The structure to specify stream dependency. + */ +typedef struct { + /** + * The stream ID of the stream to depend on. Specifying 0 makes + * stream not depend any other stream. + */ + int32_t stream_id; + /** + * The weight of this dependency. + */ + int32_t weight; + /** + * nonzero means exclusive dependency + */ + uint8_t exclusive; +} nghttp2_priority_spec; + +/** + * @struct + * + * The HEADERS frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The length of the padding in this frame. This includes PAD_HIGH + * and PAD_LOW. + */ + size_t padlen; + /** + * The priority specification + */ + nghttp2_priority_spec pri_spec; + /** + * The name/value pairs. + */ + nghttp2_nv *nva; + /** + * The number of name/value pairs in |nva|. + */ + size_t nvlen; + /** + * The category of this HEADERS frame. + */ + nghttp2_headers_category cat; +} nghttp2_headers; + +/** + * @struct + * + * The PRIORITY frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The priority specification. + */ + nghttp2_priority_spec pri_spec; +} nghttp2_priority; + +/** + * @struct + * + * The RST_STREAM frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The error code. See :type:`nghttp2_error_code`. + */ + uint32_t error_code; +} nghttp2_rst_stream; + +/** + * @struct + * + * The SETTINGS ID/Value pair. It has the following members: + */ +typedef struct { + /** + * The SETTINGS ID. See :type:`nghttp2_settings_id`. + */ + int32_t settings_id; + /** + * The value of this entry. + */ + uint32_t value; +} nghttp2_settings_entry; + +/** + * @struct + * + * The SETTINGS frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The number of SETTINGS ID/Value pairs in |iv|. + */ + size_t niv; + /** + * The pointer to the array of SETTINGS ID/Value pair. + */ + nghttp2_settings_entry *iv; +} nghttp2_settings; + +/** + * @struct + * + * The PUSH_PROMISE frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The length of the padding in this frame. This includes PAD_HIGH + * and PAD_LOW. + */ + size_t padlen; + /** + * The name/value pairs. + */ + nghttp2_nv *nva; + /** + * The number of name/value pairs in |nva|. + */ + size_t nvlen; + /** + * The promised stream ID + */ + int32_t promised_stream_id; + /** + * Reserved bit. Currently this is always set to 0 and application + * should not expect something useful in here. + */ + uint8_t reserved; +} nghttp2_push_promise; + +/** + * @struct + * + * The PING frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The opaque data + */ + uint8_t opaque_data[8]; +} nghttp2_ping; + +/** + * @struct + * + * The GOAWAY frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The last stream stream ID. + */ + int32_t last_stream_id; + /** + * The error code. See :type:`nghttp2_error_code`. + */ + uint32_t error_code; + /** + * The additional debug data + */ + uint8_t *opaque_data; + /** + * The length of |opaque_data| member. + */ + size_t opaque_data_len; + /** + * Reserved bit. Currently this is always set to 0 and application + * should not expect something useful in here. + */ + uint8_t reserved; +} nghttp2_goaway; + +/** + * @struct + * + * The WINDOW_UPDATE frame. It has the following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The window size increment. + */ + int32_t window_size_increment; + /** + * Reserved bit. Currently this is always set to 0 and application + * should not expect something useful in here. + */ + uint8_t reserved; +} nghttp2_window_update; + +/** + * @struct + * + * The extension frame. It has following members: + */ +typedef struct { + /** + * The frame header. + */ + nghttp2_frame_hd hd; + /** + * The pointer to extension payload. The exact pointer type is + * determined by hd.type. + * + * Currently, no extension is supported. This is a place holder for + * the future extensions. + */ + void *payload; +} nghttp2_extension; + +/** + * @union + * + * This union includes all frames to pass them to various function + * calls as nghttp2_frame type. The CONTINUATION frame is omitted + * from here because the library deals with it internally. + */ +typedef union { + /** + * The frame header, which is convenient to inspect frame header. + */ + nghttp2_frame_hd hd; + /** + * The DATA frame. + */ + nghttp2_data data; + /** + * The HEADERS frame. + */ + nghttp2_headers headers; + /** + * The PRIORITY frame. + */ + nghttp2_priority priority; + /** + * The RST_STREAM frame. + */ + nghttp2_rst_stream rst_stream; + /** + * The SETTINGS frame. + */ + nghttp2_settings settings; + /** + * The PUSH_PROMISE frame. + */ + nghttp2_push_promise push_promise; + /** + * The PING frame. + */ + nghttp2_ping ping; + /** + * The GOAWAY frame. + */ + nghttp2_goaway goaway; + /** + * The WINDOW_UPDATE frame. + */ + nghttp2_window_update window_update; + /** + * The extension frame. + */ + nghttp2_extension ext; +} nghttp2_frame; + +/** + * @functypedef + * + * Callback function invoked when |session| wants to send data to the + * remote peer. The implementation of this function must send at most + * |length| bytes of data stored in |data|. The |flags| is currently + * not used and always 0. It must return the number of bytes sent if + * it succeeds. If it cannot send any single byte without blocking, + * it must return :enum:`NGHTTP2_ERR_WOULDBLOCK`. For other errors, + * it must return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. The + * |user_data| pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * This callback is required if the application uses + * `nghttp2_session_send()` to send data to the remote endpoint. If + * the application uses solely `nghttp2_session_mem_send()` instead, + * this callback function is unnecessary. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_send_callback()`. + * + * .. note:: + * + * The |length| may be very small. If that is the case, and + * application disables Nagle algorithm (``TCP_NODELAY``), then just + * writing |data| to the network stack leads to very small packet, + * and it is very inefficient. An application should be responsible + * to buffer up small chunks of data as necessary to avoid this + * situation. + */ +typedef ssize_t (*nghttp2_send_callback)(nghttp2_session *session, + const uint8_t *data, size_t length, + int flags, void *user_data); + +/** + * @functypedef + * + * Callback function invoked when :enum:`NGHTTP2_DATA_FLAG_NO_COPY` is + * used in :type:`nghttp2_data_source_read_callback` to send complete + * DATA frame. + * + * The |frame| is a DATA frame to send. The |framehd| is the + * serialized frame header (9 bytes). The |length| is the length of + * application data to send (this does not include padding). The + * |source| is the same pointer passed to + * :type:`nghttp2_data_source_read_callback`. + * + * The application first must send frame header |framehd| of length 9 + * bytes. If ``frame->data.padlen > 0``, send 1 byte of value + * ``frame->data.padlen - 1``. Then send exactly |length| bytes of + * application data. Finally, if ``frame->data.padlen > 1``, send + * ``frame->data.padlen - 1`` bytes of zero as padding. + * + * The application has to send complete DATA frame in this callback. + * If all data were written successfully, return 0. + * + * If it cannot send any data at all, just return + * :enum:`NGHTTP2_ERR_WOULDBLOCK`; the library will call this callback + * with the same parameters later (It is recommended to send complete + * DATA frame at once in this function to deal with error; if partial + * frame data has already sent, it is impossible to send another data + * in that state, and all we can do is tear down connection). When + * data is fully processed, but application wants to make + * `nghttp2_session_mem_send()` or `nghttp2_session_send()` return + * immediately without processing next frames, return + * :enum:`NGHTTP2_ERR_PAUSE`. If application decided to reset this + * stream, return :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`, then + * the library will send RST_STREAM with INTERNAL_ERROR as error code. + * The application can also return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`, which will result in + * connection closure. Returning any other value is treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned. + */ +typedef int (*nghttp2_send_data_callback)(nghttp2_session *session, + nghttp2_frame *frame, + const uint8_t *framehd, size_t length, + nghttp2_data_source *source, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when |session| wants to receive data from + * the remote peer. The implementation of this function must read at + * most |length| bytes of data and store it in |buf|. The |flags| is + * currently not used and always 0. It must return the number of + * bytes written in |buf| if it succeeds. If it cannot read any + * single byte without blocking, it must return + * :enum:`NGHTTP2_ERR_WOULDBLOCK`. If it gets EOF before it reads any + * single byte, it must return :enum:`NGHTTP2_ERR_EOF`. For other + * errors, it must return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * Returning 0 is treated as :enum:`NGHTTP2_ERR_WOULDBLOCK`. The + * |user_data| pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * This callback is required if the application uses + * `nghttp2_session_recv()` to receive data from the remote endpoint. + * If the application uses solely `nghttp2_session_mem_recv()` + * instead, this callback function is unnecessary. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_recv_callback()`. + */ +typedef ssize_t (*nghttp2_recv_callback)(nghttp2_session *session, uint8_t *buf, + size_t length, int flags, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked by `nghttp2_session_recv()` and + * `nghttp2_session_mem_recv()` when a frame is received. The + * |user_data| pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen`` + * member of their data structure are always ``NULL`` and 0 + * respectively. The header name/value pairs are emitted via + * :type:`nghttp2_on_header_callback`. + * + * For HEADERS, PUSH_PROMISE and DATA frames, this callback may be + * called after stream is closed (see + * :type:`nghttp2_on_stream_close_callback`). The application should + * check that stream is still alive using its own stream management or + * :func:`nghttp2_session_get_stream_user_data()`. + * + * Only HEADERS and DATA frame can signal the end of incoming data. + * If ``frame->hd.flags & NGHTTP2_FLAG_END_STREAM`` is nonzero, the + * |frame| is the last frame from the remote peer in this stream. + * + * This callback won't be called for CONTINUATION frames. + * HEADERS/PUSH_PROMISE + CONTINUATIONs are treated as single frame. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero value is returned, it is treated as fatal error and + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_frame_recv_callback()`. + */ +typedef int (*nghttp2_on_frame_recv_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked by `nghttp2_session_recv()` and + * `nghttp2_session_mem_recv()` when an invalid non-DATA frame is + * received. The error is indicated by the |lib_error_code|, which is + * one of the values defined in :type:`nghttp2_error`. When this + * callback function is invoked, the library automatically submits + * either RST_STREAM or GOAWAY frame. The |user_data| pointer is the + * third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen`` + * member of their data structure are always ``NULL`` and 0 + * respectively. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero is returned, it is treated as fatal error and + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()`. + */ +typedef int (*nghttp2_on_invalid_frame_recv_callback)( + nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when a chunk of data in DATA frame is + * received. The |stream_id| is the stream ID this DATA frame belongs + * to. The |flags| is the flags of DATA frame which this data chunk + * is contained. ``(flags & NGHTTP2_FLAG_END_STREAM) != 0`` does not + * necessarily mean this chunk of data is the last one in the stream. + * You should use :type:`nghttp2_on_frame_recv_callback` to know all + * data frames are received. The |user_data| pointer is the third + * argument passed in to the call to `nghttp2_session_client_new()` or + * `nghttp2_session_server_new()`. + * + * If the application uses `nghttp2_session_mem_recv()`, it can return + * :enum:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()` + * return without processing further input bytes. The memory by + * pointed by the |data| is retained until + * `nghttp2_session_mem_recv()` or `nghttp2_session_recv()` is called. + * The application must retain the input bytes which was used to + * produce the |data| parameter, because it may refer to the memory + * region included in the input bytes. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero is returned, it is treated as fatal error, and + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_data_chunk_recv_callback()`. + */ +typedef int (*nghttp2_on_data_chunk_recv_callback)(nghttp2_session *session, + uint8_t flags, + int32_t stream_id, + const uint8_t *data, + size_t len, void *user_data); + +/** + * @functypedef + * + * Callback function invoked just before the non-DATA frame |frame| is + * sent. The |user_data| pointer is the third argument passed in to + * the call to `nghttp2_session_client_new()` or + * `nghttp2_session_server_new()`. + * + * The implementation of this function must return 0 if it succeeds. + * It can also return :enum:`NGHTTP2_ERR_CANCEL` to cancel the + * transmission of the given frame. + * + * If there is a fatal error while executing this callback, the + * implementation should return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`, + * which makes `nghttp2_session_send()` and + * `nghttp2_session_mem_send()` functions immediately return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * If the other value is returned, it is treated as if + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned. But the + * implementation should not rely on this since the library may define + * new return value to extend its capability. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_before_frame_send_callback()`. + */ +typedef int (*nghttp2_before_frame_send_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked after the frame |frame| is sent. The + * |user_data| pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero is returned, it is treated as fatal error and + * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_frame_send_callback()`. + */ +typedef int (*nghttp2_on_frame_send_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked after the non-DATA frame |frame| is not + * sent because of the error. The error is indicated by the + * |lib_error_code|, which is one of the values defined in + * :type:`nghttp2_error`. The |user_data| pointer is the third + * argument passed in to the call to `nghttp2_session_client_new()` or + * `nghttp2_session_server_new()`. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero is returned, it is treated as fatal error and + * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * `nghttp2_session_get_stream_user_data()` can be used to get + * associated data. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_frame_not_send_callback()`. + */ +typedef int (*nghttp2_on_frame_not_send_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + int lib_error_code, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when the stream |stream_id| is closed. + * The reason of closure is indicated by the |error_code|. The + * |error_code| is usually one of :enum:`nghttp2_error_code`, but that + * is not guaranteed. The stream_user_data, which was specified in + * `nghttp2_submit_request()` or `nghttp2_submit_headers()`, is still + * available in this function. The |user_data| pointer is the third + * argument passed in to the call to `nghttp2_session_client_new()` or + * `nghttp2_session_server_new()`. + * + * This function is also called for a stream in reserved state. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero is returned, it is treated as fatal error and + * `nghttp2_session_recv()`, `nghttp2_session_mem_recv()`, + * `nghttp2_session_send()`, and `nghttp2_session_mem_send()` + * functions immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_stream_close_callback()`. + */ +typedef int (*nghttp2_on_stream_close_callback)(nghttp2_session *session, + int32_t stream_id, + uint32_t error_code, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when the reception of header block in + * HEADERS or PUSH_PROMISE is started. Each header name/value pair + * will be emitted by :type:`nghttp2_on_header_callback`. + * + * The ``frame->hd.flags`` may not have + * :enum:`NGHTTP2_FLAG_END_HEADERS` flag set, which indicates that one + * or more CONTINUATION frames are involved. But the application does + * not need to care about that because the header name/value pairs are + * emitted transparently regardless of CONTINUATION frames. + * + * The server applications probably create an object to store + * information about new stream if ``frame->hd.type == + * NGHTTP2_HEADERS`` and ``frame->headers.cat == + * NGHTTP2_HCAT_REQUEST``. If |session| is configured as server side, + * ``frame->headers.cat`` is either ``NGHTTP2_HCAT_REQUEST`` + * containing request headers or ``NGHTTP2_HCAT_HEADERS`` containing + * trailer fields and never get PUSH_PROMISE in this callback. + * + * For the client applications, ``frame->hd.type`` is either + * ``NGHTTP2_HEADERS`` or ``NGHTTP2_PUSH_PROMISE``. In case of + * ``NGHTTP2_HEADERS``, ``frame->headers.cat == + * NGHTTP2_HCAT_RESPONSE`` means that it is the first response + * headers, but it may be non-final response which is indicated by 1xx + * status code. In this case, there may be zero or more HEADERS frame + * with ``frame->headers.cat == NGHTTP2_HCAT_HEADERS`` which has + * non-final response code and finally client gets exactly one HEADERS + * frame with ``frame->headers.cat == NGHTTP2_HCAT_HEADERS`` + * containing final response headers (non-1xx status code). The + * trailer fields also has ``frame->headers.cat == + * NGHTTP2_HCAT_HEADERS`` which does not contain any status code. + * + * Returning :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will close + * the stream (promised stream if frame is PUSH_PROMISE) by issuing + * RST_STREAM with :enum:`NGHTTP2_INTERNAL_ERROR`. In this case, + * :type:`nghttp2_on_header_callback` and + * :type:`nghttp2_on_frame_recv_callback` will not be invoked. If a + * different error code is desirable, use + * `nghttp2_submit_rst_stream()` with a desired error code and then + * return :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. Again, use + * ``frame->push_promise.promised_stream_id`` as stream_id parameter + * in `nghttp2_submit_rst_stream()` if frame is PUSH_PROMISE. + * + * The implementation of this function must return 0 if it succeeds. + * It can return :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` to + * reset the stream (promised stream if frame is PUSH_PROMISE). For + * critical errors, it must return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If the other value is + * returned, it is treated as if :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` + * is returned. If :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned, + * `nghttp2_session_mem_recv()` function will immediately return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_begin_headers_callback()`. + */ +typedef int (*nghttp2_on_begin_headers_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when a header name/value pair is received + * for the |frame|. The |name| of length |namelen| is header name. + * The |value| of length |valuelen| is header value. The |flags| is + * bitwise OR of one or more of :type:`nghttp2_nv_flag`. + * + * If :enum:`NGHTTP2_NV_FLAG_NO_INDEX` is set in |flags|, the receiver + * must not index this name/value pair when forwarding it to the next + * hop. More specifically, "Literal Header Field never Indexed" + * representation must be used in HPACK encoding. + * + * When this callback is invoked, ``frame->hd.type`` is either + * :enum:`NGHTTP2_HEADERS` or :enum:`NGHTTP2_PUSH_PROMISE`. After all + * header name/value pairs are processed with this callback, and no + * error has been detected, :type:`nghttp2_on_frame_recv_callback` + * will be invoked. If there is an error in decompression, + * :type:`nghttp2_on_frame_recv_callback` for the |frame| will not be + * invoked. + * + * Both |name| and |value| are guaranteed to be NULL-terminated. The + * |namelen| and |valuelen| do not include terminal NULL. If + * `nghttp2_option_set_no_http_messaging()` is used with nonzero + * value, NULL character may be included in |name| or |value| before + * terminating NULL. + * + * Please note that unless `nghttp2_option_set_no_http_messaging()` is + * used, nghttp2 library does perform validation against the |name| + * and the |value| using `nghttp2_check_header_name()` and + * `nghttp2_check_header_value()`. In addition to this, nghttp2 + * performs validation based on HTTP Messaging rule, which is briefly + * explained in :ref:`http-messaging` section. + * + * If the application uses `nghttp2_session_mem_recv()`, it can return + * :enum:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()` + * return without processing further input bytes. The memory pointed + * by |frame|, |name| and |value| parameters are retained until + * `nghttp2_session_mem_recv()` or `nghttp2_session_recv()` is called. + * The application must retain the input bytes which was used to + * produce these parameters, because it may refer to the memory region + * included in the input bytes. + * + * Returning :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will close + * the stream (promised stream if frame is PUSH_PROMISE) by issuing + * RST_STREAM with :enum:`NGHTTP2_INTERNAL_ERROR`. In this case, + * :type:`nghttp2_on_header_callback` and + * :type:`nghttp2_on_frame_recv_callback` will not be invoked. If a + * different error code is desirable, use + * `nghttp2_submit_rst_stream()` with a desired error code and then + * return :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. Again, use + * ``frame->push_promise.promised_stream_id`` as stream_id parameter + * in `nghttp2_submit_rst_stream()` if frame is PUSH_PROMISE. + * + * The implementation of this function must return 0 if it succeeds. + * It may return :enum:`NGHTTP2_ERR_PAUSE` or + * :enum:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. For other critical + * failures, it must return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If + * the other nonzero value is returned, it is treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned, + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_header_callback()`. + * + * .. warning:: + * + * Application should properly limit the total buffer size to store + * incoming header fields. Without it, peer may send large number + * of header fields or large header fields to cause out of memory in + * local endpoint. Due to how HPACK works, peer can do this + * effectively without using much memory on their own. + */ +typedef int (*nghttp2_on_header_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + const uint8_t *name, size_t namelen, + const uint8_t *value, size_t valuelen, + uint8_t flags, void *user_data); + +/** + * @functypedef + * + * Callback function invoked when a header name/value pair is received + * for the |frame|. The |name| is header name. The |value| is header + * value. The |flags| is bitwise OR of one or more of + * :type:`nghttp2_nv_flag`. + * + * This callback behaves like :type:`nghttp2_on_header_callback`, + * except that |name| and |value| are stored in reference counted + * buffer. If application wishes to keep these references without + * copying them, use `nghttp2_rcbuf_incref()` to increment their + * reference count. It is the application's responsibility to call + * `nghttp2_rcbuf_decref()` if they called `nghttp2_rcbuf_incref()` so + * as not to leak memory. If the |session| is created by + * `nghttp2_session_server_new3()` or `nghttp2_session_client_new3()`, + * the function to free memory is the one belongs to the mem + * parameter. As long as this free function alives, |name| and + * |value| can live after |session| was destroyed. + */ +typedef int (*nghttp2_on_header_callback2)(nghttp2_session *session, + const nghttp2_frame *frame, + nghttp2_rcbuf *name, + nghttp2_rcbuf *value, uint8_t flags, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when the library asks application how + * many padding bytes are required for the transmission of the + * |frame|. The application must choose the total length of payload + * including padded bytes in range [frame->hd.length, max_payloadlen], + * inclusive. Choosing number not in this range will be treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. Returning + * ``frame->hd.length`` means no padding is added. Returning + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will make + * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_select_padding_callback()`. + */ +typedef ssize_t (*nghttp2_select_padding_callback)(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payloadlen, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when library wants to get max length of + * data to send data to the remote peer. The implementation of this + * function should return a value in the following range. [1, + * min(|session_remote_window_size|, |stream_remote_window_size|, + * |remote_max_frame_size|)]. If a value greater than this range is + * returned than the max allow value will be used. Returning a value + * smaller than this range is treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. The |frame_type| is provided + * for future extensibility and identifies the type of frame (see + * :type:`nghttp2_frame_type`) for which to get the length for. + * Currently supported frame types are: :enum:`NGHTTP2_DATA`. + * + * This callback can be used to control the length in bytes for which + * :type:`nghttp2_data_source_read_callback` is allowed to send to the + * remote endpoint. This callback is optional. Returning + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will signal the entire session + * failure. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_data_source_read_length_callback()`. + */ +typedef ssize_t (*nghttp2_data_source_read_length_callback)( + nghttp2_session *session, uint8_t frame_type, int32_t stream_id, + int32_t session_remote_window_size, int32_t stream_remote_window_size, + uint32_t remote_max_frame_size, void *user_data); + +/** + * @functypedef + * + * Callback function invoked when a frame header is received. The + * |hd| points to received frame header. + * + * Unlike :type:`nghttp2_on_frame_recv_callback`, this callback will + * also be called when frame header of CONTINUATION frame is received. + * + * If both :type:`nghttp2_on_begin_frame_callback` and + * :type:`nghttp2_on_begin_headers_callback` are set and HEADERS or + * PUSH_PROMISE is received, :type:`nghttp2_on_begin_frame_callback` + * will be called first. + * + * The implementation of this function must return 0 if it succeeds. + * If nonzero value is returned, it is treated as fatal error and + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_on_begin_frame_callback()`. + */ +typedef int (*nghttp2_on_begin_frame_callback)(nghttp2_session *session, + const nghttp2_frame_hd *hd, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when chunk of extension frame payload is + * received. The |hd| points to frame header. The received + * chunk is |data| of length |len|. + * + * The implementation of this function must return 0 if it succeeds. + * + * To abort processing this extension frame, return + * :enum:`NGHTTP2_ERR_CANCEL`. + * + * If fatal error occurred, application should return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If the + * other values are returned, currently they are treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + */ +typedef int (*nghttp2_on_extension_chunk_recv_callback)( + nghttp2_session *session, const nghttp2_frame_hd *hd, const uint8_t *data, + size_t len, void *user_data); + +/** + * @functypedef + * + * Callback function invoked when library asks the application to + * unpack extension payload from its wire format. The extension + * payload has been passed to the application using + * :type:`nghttp2_on_extension_chunk_recv_callback`. The frame header + * is already unpacked by the library and provided as |hd|. + * + * To receive extension frames, the application must tell desired + * extension frame type to the library using + * `nghttp2_option_set_user_recv_extension_type()`. + * + * The implementation of this function may store the pointer to the + * created object as a result of unpacking in |*payload|, and returns + * 0. The pointer stored in |*payload| is opaque to the library, and + * the library does not own its pointer. |*payload| is initialized as + * ``NULL``. The |*payload| is available as ``frame->ext.payload`` in + * :type:`nghttp2_on_frame_recv_callback`. Therefore if application + * can free that memory inside :type:`nghttp2_on_frame_recv_callback` + * callback. Of course, application has a liberty not ot use + * |*payload|, and do its own mechanism to process extension frames. + * + * To abort processing this extension frame, return + * :enum:`NGHTTP2_ERR_CANCEL`. + * + * If fatal error occurred, application should return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If the + * other values are returned, currently they are treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + */ +typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session, + void **payload, + const nghttp2_frame_hd *hd, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when library asks the application to pack + * extension payload in its wire format. The frame header will be + * packed by library. Application must pack payload only. + * ``frame->ext.payload`` is the object passed to + * `nghttp2_submit_extension()` as payload parameter. Application + * must pack extension payload to the |buf| of its capacity |len| + * bytes. The |len| is at least 16KiB. + * + * The implementation of this function should return the number of + * bytes written into |buf| when it succeeds. + * + * To abort processing this extension frame, return + * :enum:`NGHTTP2_ERR_CANCEL`, and + * :type:`nghttp2_on_frame_not_send_callback` will be invoked. + * + * If fatal error occurred, application should return + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If the + * other values are returned, currently they are treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. If the return value is + * strictly larger than |len|, it is treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. + */ +typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, + uint8_t *buf, size_t len, + const nghttp2_frame *frame, + void *user_data); + +/** + * @functypedef + * + * Callback function invoked when library provides the error message + * intended for human consumption. This callback is solely for + * debugging purpose. The |msg| is typically NULL-terminated string + * of length |len|. |len| does not include the sentinel NULL + * character. + * + * The format of error message may change between nghttp2 library + * versions. The application should not depend on the particular + * format. + * + * Normally, application should return 0 from this callback. If fatal + * error occurred while doing something in this callback, application + * should return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + * library will return immediately with return value + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. Currently, if nonzero value + * is returned from this callback, they are treated as + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`, but application should not + * rely on this details. + */ +typedef int (*nghttp2_error_callback)(nghttp2_session *session, const char *msg, + size_t len, void *user_data); + +struct nghttp2_session_callbacks; + +/** + * @struct + * + * Callback functions for :type:`nghttp2_session`. The details of + * this structure are intentionally hidden from the public API. + */ +typedef struct nghttp2_session_callbacks nghttp2_session_callbacks; + +/** + * @function + * + * Initializes |*callbacks_ptr| with NULL values. + * + * The initialized object can be used when initializing multiple + * :type:`nghttp2_session` objects. + * + * When the application finished using this object, it can use + * `nghttp2_session_callbacks_del()` to free its memory. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_callbacks_new(nghttp2_session_callbacks **callbacks_ptr); + +/** + * @function + * + * Frees any resources allocated for |callbacks|. If |callbacks| is + * ``NULL``, this function does nothing. + */ +NGHTTP2_EXTERN void +nghttp2_session_callbacks_del(nghttp2_session_callbacks *callbacks); + +/** + * @function + * + * Sets callback function invoked when a session wants to send data to + * the remote peer. This callback is not necessary if the application + * uses solely `nghttp2_session_mem_send()` to serialize data to + * transmit. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_send_callback( + nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback); + +/** + * @function + * + * Sets callback function invoked when the a session wants to receive + * data from the remote peer. This callback is not necessary if the + * application uses solely `nghttp2_session_mem_recv()` to process + * received data. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_recv_callback( + nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback); + +/** + * @function + * + * Sets callback function invoked by `nghttp2_session_recv()` and + * `nghttp2_session_mem_recv()` when a frame is received. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_recv_callback on_frame_recv_callback); + +/** + * @function + * + * Sets callback function invoked by `nghttp2_session_recv()` and + * `nghttp2_session_mem_recv()` when an invalid non-DATA frame is + * received. + */ +NGHTTP2_EXTERN void +nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback); + +/** + * @function + * + * Sets callback function invoked when a chunk of data in DATA frame + * is received. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback); + +/** + * @function + * + * Sets callback function invoked before a non-DATA frame is sent. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_before_frame_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_before_frame_send_callback before_frame_send_callback); + +/** + * @function + * + * Sets callback function invoked after a frame is sent. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_send_callback on_frame_send_callback); + +/** + * @function + * + * Sets callback function invoked when a non-DATA frame is not sent + * because of an error. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_not_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_not_send_callback on_frame_not_send_callback); + +/** + * @function + * + * Sets callback function invoked when the stream is closed. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_stream_close_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_stream_close_callback on_stream_close_callback); + +/** + * @function + * + * Sets callback function invoked when the reception of header block + * in HEADERS or PUSH_PROMISE is started. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_begin_headers_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_headers_callback on_begin_headers_callback); + +/** + * @function + * + * Sets callback function invoked when a header name/value pair is + * received. If both + * `nghttp2_session_callbacks_set_on_header_callback()` and + * `nghttp2_session_callbacks_set_on_header_callback2()` are used to + * set callbacks, the latter has the precedence. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback on_header_callback); + +/** + * @function + * + * Sets callback function invoked when a header name/value pair is + * received. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback2 on_header_callback2); + +/** + * @function + * + * Sets callback function invoked when the library asks application + * how many padding bytes are required for the transmission of the + * given frame. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_select_padding_callback( + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback select_padding_callback); + +/** + * @function + * + * Sets callback function determine the length allowed in + * :type:`nghttp2_data_source_read_callback`. + */ +NGHTTP2_EXTERN void +nghttp2_session_callbacks_set_data_source_read_length_callback( + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback data_source_read_length_callback); + +/** + * @function + * + * Sets callback function invoked when a frame header is received. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_begin_frame_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_frame_callback on_begin_frame_callback); + +/** + * @function + * + * Sets callback function invoked when + * :enum:`NGHTTP2_DATA_FLAG_NO_COPY` is used in + * :type:`nghttp2_data_source_read_callback` to avoid data copy. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_send_data_callback( + nghttp2_session_callbacks *cbs, + nghttp2_send_data_callback send_data_callback); + +/** + * @function + * + * Sets callback function invoked when the library asks the + * application to pack extension frame payload in wire format. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_pack_extension_callback( + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback pack_extension_callback); + +/** + * @function + * + * Sets callback function invoked when the library asks the + * application to unpack extension frame payload from wire format. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_unpack_extension_callback( + nghttp2_session_callbacks *cbs, + nghttp2_unpack_extension_callback unpack_extension_callback); + +/** + * @function + * + * Sets callback function invoked when chunk of extension frame + * payload is received. + */ +NGHTTP2_EXTERN void +nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback); + +/** + * @function + * + * Sets callback function invoked when library tells error message to + * the application. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback( + nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback); + +/** + * @functypedef + * + * Custom memory allocator to replace malloc(). The |mem_user_data| + * is the mem_user_data member of :type:`nghttp2_mem` structure. + */ +typedef void *(*nghttp2_malloc)(size_t size, void *mem_user_data); + +/** + * @functypedef + * + * Custom memory allocator to replace free(). The |mem_user_data| is + * the mem_user_data member of :type:`nghttp2_mem` structure. + */ +typedef void (*nghttp2_free)(void *ptr, void *mem_user_data); + +/** + * @functypedef + * + * Custom memory allocator to replace calloc(). The |mem_user_data| + * is the mem_user_data member of :type:`nghttp2_mem` structure. + */ +typedef void *(*nghttp2_calloc)(size_t nmemb, size_t size, void *mem_user_data); + +/** + * @functypedef + * + * Custom memory allocator to replace realloc(). The |mem_user_data| + * is the mem_user_data member of :type:`nghttp2_mem` structure. + */ +typedef void *(*nghttp2_realloc)(void *ptr, size_t size, void *mem_user_data); + +/** + * @struct + * + * Custom memory allocator functions and user defined pointer. The + * |mem_user_data| member is passed to each allocator function. This + * can be used, for example, to achieve per-session memory pool. + * + * In the following example code, ``my_malloc``, ``my_free``, + * ``my_calloc`` and ``my_realloc`` are the replacement of the + * standard allocators ``malloc``, ``free``, ``calloc`` and + * ``realloc`` respectively:: + * + * void *my_malloc_cb(size_t size, void *mem_user_data) { + * return my_malloc(size); + * } + * + * void my_free_cb(void *ptr, void *mem_user_data) { my_free(ptr); } + * + * void *my_calloc_cb(size_t nmemb, size_t size, void *mem_user_data) { + * return my_calloc(nmemb, size); + * } + * + * void *my_realloc_cb(void *ptr, size_t size, void *mem_user_data) { + * return my_realloc(ptr, size); + * } + * + * void session_new() { + * nghttp2_session *session; + * nghttp2_session_callbacks *callbacks; + * nghttp2_mem mem = {NULL, my_malloc_cb, my_free_cb, my_calloc_cb, + * my_realloc_cb}; + * + * ... + * + * nghttp2_session_client_new3(&session, callbacks, NULL, NULL, &mem); + * + * ... + * } + */ +typedef struct { + /** + * An arbitrary user supplied data. This is passed to each + * allocator function. + */ + void *mem_user_data; + /** + * Custom allocator function to replace malloc(). + */ + nghttp2_malloc malloc; + /** + * Custom allocator function to replace free(). + */ + nghttp2_free free; + /** + * Custom allocator function to replace calloc(). + */ + nghttp2_calloc calloc; + /** + * Custom allocator function to replace realloc(). + */ + nghttp2_realloc realloc; +} nghttp2_mem; + +struct nghttp2_option; + +/** + * @struct + * + * Configuration options for :type:`nghttp2_session`. The details of + * this structure are intentionally hidden from the public API. + */ +typedef struct nghttp2_option nghttp2_option; + +/** + * @function + * + * Initializes |*option_ptr| with default values. + * + * When the application finished using this object, it can use + * `nghttp2_option_del()` to free its memory. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_option_new(nghttp2_option **option_ptr); + +/** + * @function + * + * Frees any resources allocated for |option|. If |option| is + * ``NULL``, this function does nothing. + */ +NGHTTP2_EXTERN void nghttp2_option_del(nghttp2_option *option); + +/** + * @function + * + * This option prevents the library from sending WINDOW_UPDATE for a + * connection automatically. If this option is set to nonzero, the + * library won't send WINDOW_UPDATE for DATA until application calls + * `nghttp2_session_consume()` to indicate the consumed amount of + * data. Don't use `nghttp2_submit_window_update()` for this purpose. + * By default, this option is set to zero. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_no_auto_window_update(nghttp2_option *option, int val); + +/** + * @function + * + * This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of + * remote endpoint as if it is received in SETTINGS frame. Without + * specifying this option, before the local endpoint receives + * SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame from remote + * endpoint, SETTINGS_MAX_CONCURRENT_STREAMS is unlimited. This may + * cause problem if local endpoint submits lots of requests initially + * and sending them at once to the remote peer may lead to the + * rejection of some requests. Specifying this option to the sensible + * value, say 100, may avoid this kind of issue. This value will be + * overwritten if the local endpoint receives + * SETTINGS_MAX_CONCURRENT_STREAMS from the remote endpoint. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_peer_max_concurrent_streams(nghttp2_option *option, + uint32_t val); + +/** + * @function + * + * By default, nghttp2 library, if configured as server, requires + * first 24 bytes of client magic byte string (MAGIC). In most cases, + * this will simplify the implementation of server. But sometimes + * server may want to detect the application protocol based on first + * few bytes on clear text communication. + * + * If this option is used with nonzero |val|, nghttp2 library does not + * handle MAGIC. It still checks following SETTINGS frame. This + * means that applications should deal with MAGIC by themselves. + * + * If this option is not used or used with zero value, if MAGIC does + * not match :macro:`NGHTTP2_CLIENT_MAGIC`, `nghttp2_session_recv()` + * and `nghttp2_session_mem_recv()` will return error + * :enum:`NGHTTP2_ERR_BAD_CLIENT_MAGIC`, which is fatal error. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_no_recv_client_magic(nghttp2_option *option, int val); + +/** + * @function + * + * By default, nghttp2 library enforces subset of HTTP Messaging rules + * described in `HTTP/2 specification, section 8 + * `_. See + * :ref:`http-messaging` section for details. For those applications + * who use nghttp2 library as non-HTTP use, give nonzero to |val| to + * disable this enforcement. + */ +NGHTTP2_EXTERN void nghttp2_option_set_no_http_messaging(nghttp2_option *option, + int val); + +/** + * @function + * + * RFC 7540 does not enforce any limit on the number of incoming + * reserved streams (in RFC 7540 terms, streams in reserved (remote) + * state). This only affects client side, since only server can push + * streams. Malicious server can push arbitrary number of streams, + * and make client's memory exhausted. This option can set the + * maximum number of such incoming streams to avoid possible memory + * exhaustion. If this option is set, and pushed streams are + * automatically closed on reception, without calling user provided + * callback, if they exceed the given limit. The default value is + * 200. If session is configured as server side, this option has no + * effect. Server can control the number of streams to push. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_max_reserved_remote_streams(nghttp2_option *option, + uint32_t val); + +/** + * @function + * + * Sets extension frame type the application is willing to handle with + * user defined callbacks (see + * :type:`nghttp2_on_extension_chunk_recv_callback` and + * :type:`nghttp2_unpack_extension_callback`). The |type| is + * extension frame type, and must be strictly greater than 0x9. + * Otherwise, this function does nothing. The application can call + * this function multiple times to set more than one frame type to + * receive. The application does not have to call this function if it + * just sends extension frames. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_user_recv_extension_type(nghttp2_option *option, + uint8_t type); + +/** + * @function + * + * Sets extension frame type the application is willing to receive + * using builtin handler. The |type| is the extension frame type to + * receive, and must be strictly greater than 0x9. Otherwise, this + * function does nothing. The application can call this function + * multiple times to set more than one frame type to receive. The + * application does not have to call this function if it just sends + * extension frames. + * + * If same frame type is passed to both + * `nghttp2_option_set_builtin_recv_extension_type()` and + * `nghttp2_option_set_user_recv_extension_type()`, the latter takes + * precedence. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_builtin_recv_extension_type(nghttp2_option *option, + uint8_t type); + +/** + * @function + * + * This option prevents the library from sending PING frame with ACK + * flag set automatically when PING frame without ACK flag set is + * received. If this option is set to nonzero, the library won't send + * PING frame with ACK flag set in the response for incoming PING + * frame. The application can send PING frame with ACK flag set using + * `nghttp2_submit_ping()` with :enum:`NGHTTP2_FLAG_ACK` as flags + * parameter. + */ +NGHTTP2_EXTERN void nghttp2_option_set_no_auto_ping_ack(nghttp2_option *option, + int val); + +/** + * @function + * + * This option sets the maximum length of header block (a set of + * header fields per one HEADERS frame) to send. The length of a + * given set of header fields is calculated using + * `nghttp2_hd_deflate_bound()`. The default value is 64KiB. If + * application attempts to send header fields larger than this limit, + * the transmission of the frame fails with error code + * :enum:`NGHTTP2_ERR_FRAME_SIZE_ERROR`. + */ +NGHTTP2_EXTERN void +nghttp2_option_set_max_send_header_block_length(nghttp2_option *option, + size_t val); + +/** + * @function + * + * Initializes |*session_ptr| for client use. The all members of + * |callbacks| are copied to |*session_ptr|. Therefore |*session_ptr| + * does not store |callbacks|. The |user_data| is an arbitrary user + * supplied data, which will be passed to the callback functions. + * + * The :type:`nghttp2_send_callback` must be specified. If the + * application code uses `nghttp2_session_recv()`, the + * :type:`nghttp2_recv_callback` must be specified. The other members + * of |callbacks| can be ``NULL``. + * + * If this function fails, |*session_ptr| is left untouched. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_client_new(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data); + +/** + * @function + * + * Initializes |*session_ptr| for server use. The all members of + * |callbacks| are copied to |*session_ptr|. Therefore |*session_ptr| + * does not store |callbacks|. The |user_data| is an arbitrary user + * supplied data, which will be passed to the callback functions. + * + * The :type:`nghttp2_send_callback` must be specified. If the + * application code uses `nghttp2_session_recv()`, the + * :type:`nghttp2_recv_callback` must be specified. The other members + * of |callbacks| can be ``NULL``. + * + * If this function fails, |*session_ptr| is left untouched. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_server_new(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data); + +/** + * @function + * + * Like `nghttp2_session_client_new()`, but with additional options + * specified in the |option|. + * + * The |option| can be ``NULL`` and the call is equivalent to + * `nghttp2_session_client_new()`. + * + * This function does not take ownership |option|. The application is + * responsible for freeing |option| if it finishes using the object. + * + * The library code does not refer to |option| after this function + * returns. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_client_new2(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option); + +/** + * @function + * + * Like `nghttp2_session_server_new()`, but with additional options + * specified in the |option|. + * + * The |option| can be ``NULL`` and the call is equivalent to + * `nghttp2_session_server_new()`. + * + * This function does not take ownership |option|. The application is + * responsible for freeing |option| if it finishes using the object. + * + * The library code does not refer to |option| after this function + * returns. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_server_new2(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option); + +/** + * @function + * + * Like `nghttp2_session_client_new2()`, but with additional custom + * memory allocator specified in the |mem|. + * + * The |mem| can be ``NULL`` and the call is equivalent to + * `nghttp2_session_client_new2()`. + * + * This function does not take ownership |mem|. The application is + * responsible for freeing |mem|. + * + * The library code does not refer to |mem| pointer after this + * function returns, so the application can safely free it. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_session_client_new3( + nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, nghttp2_mem *mem); + +/** + * @function + * + * Like `nghttp2_session_server_new2()`, but with additional custom + * memory allocator specified in the |mem|. + * + * The |mem| can be ``NULL`` and the call is equivalent to + * `nghttp2_session_server_new2()`. + * + * This function does not take ownership |mem|. The application is + * responsible for freeing |mem|. + * + * The library code does not refer to |mem| pointer after this + * function returns, so the application can safely free it. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_session_server_new3( + nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, nghttp2_mem *mem); + +/** + * @function + * + * Frees any resources allocated for |session|. If |session| is + * ``NULL``, this function does nothing. + */ +NGHTTP2_EXTERN void nghttp2_session_del(nghttp2_session *session); + +/** + * @function + * + * Sends pending frames to the remote peer. + * + * This function retrieves the highest prioritized frame from the + * outbound queue and sends it to the remote peer. It does this as + * many as possible until the user callback + * :type:`nghttp2_send_callback` returns + * :enum:`NGHTTP2_ERR_WOULDBLOCK` or the outbound queue becomes empty. + * This function calls several callback functions which are passed + * when initializing the |session|. Here is the simple time chart + * which tells when each callback is invoked: + * + * 1. Get the next frame to send from outbound queue. + * + * 2. Prepare transmission of the frame. + * + * 3. If the control frame cannot be sent because some preconditions + * are not met (e.g., request HEADERS cannot be sent after GOAWAY), + * :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort + * the following steps. + * + * 4. If the frame is HEADERS, PUSH_PROMISE or DATA, + * :type:`nghttp2_select_padding_callback` is invoked. + * + * 5. If the frame is request HEADERS, the stream is opened here. + * + * 6. :type:`nghttp2_before_frame_send_callback` is invoked. + * + * 7. If :enum:`NGHTTP2_ERR_CANCEL` is returned from + * :type:`nghttp2_before_frame_send_callback`, the current frame + * transmission is canceled, and + * :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort + * the following steps. + * + * 8. :type:`nghttp2_send_callback` is invoked one or more times to + * send the frame. + * + * 9. :type:`nghttp2_on_frame_send_callback` is invoked. + * + * 10. If the transmission of the frame triggers closure of the + * stream, the stream is closed and + * :type:`nghttp2_on_stream_close_callback` is invoked. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` + * The callback function failed. + */ +NGHTTP2_EXTERN int nghttp2_session_send(nghttp2_session *session); + +/** + * @function + * + * Returns the serialized data to send. + * + * This function behaves like `nghttp2_session_send()` except that it + * does not use :type:`nghttp2_send_callback` to transmit data. + * Instead, it assigns the pointer to the serialized data to the + * |*data_ptr| and returns its length. The other callbacks are called + * in the same way as they are in `nghttp2_session_send()`. + * + * If no data is available to send, this function returns 0. + * + * This function may not return all serialized data in one invocation. + * To get all data, call this function repeatedly until it returns 0 + * or one of negative error codes. + * + * The assigned |*data_ptr| is valid until the next call of + * `nghttp2_session_mem_send()` or `nghttp2_session_send()`. + * + * The caller must send all data before sending the next chunk of + * data. + * + * This function returns the length of the data pointed by the + * |*data_ptr| if it succeeds, or one of the following negative error + * codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * + * .. note:: + * + * This function may produce very small byte string. If that is the + * case, and application disables Nagle algorithm (``TCP_NODELAY``), + * then writing this small chunk leads to very small packet, and it + * is very inefficient. An application should be responsible to + * buffer up small chunks of data as necessary to avoid this + * situation. + */ +NGHTTP2_EXTERN ssize_t +nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr); + +/** + * @function + * + * Receives frames from the remote peer. + * + * This function receives as many frames as possible until the user + * callback :type:`nghttp2_recv_callback` returns + * :enum:`NGHTTP2_ERR_WOULDBLOCK`. This function calls several + * callback functions which are passed when initializing the + * |session|. Here is the simple time chart which tells when each + * callback is invoked: + * + * 1. :type:`nghttp2_recv_callback` is invoked one or more times to + * receive frame header. + * + * 2. When frame header is received, + * :type:`nghttp2_on_begin_frame_callback` is invoked. + * + * 3. If the frame is DATA frame: + * + * 1. :type:`nghttp2_recv_callback` is invoked to receive DATA + * payload. For each chunk of data, + * :type:`nghttp2_on_data_chunk_recv_callback` is invoked. + * + * 2. If one DATA frame is completely received, + * :type:`nghttp2_on_frame_recv_callback` is invoked. If the + * reception of the frame triggers the closure of the stream, + * :type:`nghttp2_on_stream_close_callback` is invoked. + * + * 4. If the frame is the control frame: + * + * 1. :type:`nghttp2_recv_callback` is invoked one or more times to + * receive whole frame. + * + * 2. If the received frame is valid, then following actions are + * taken. If the frame is either HEADERS or PUSH_PROMISE, + * :type:`nghttp2_on_begin_headers_callback` is invoked. Then + * :type:`nghttp2_on_header_callback` is invoked for each header + * name/value pair. After all name/value pairs are emitted + * successfully, :type:`nghttp2_on_frame_recv_callback` is + * invoked. For other frames, + * :type:`nghttp2_on_frame_recv_callback` is invoked. If the + * reception of the frame triggers the closure of the stream, + * :type:`nghttp2_on_stream_close_callback` is invoked. + * + * 3. If the received frame is unpacked but is interpreted as + * invalid, :type:`nghttp2_on_invalid_frame_recv_callback` is + * invoked. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_EOF` + * The remote peer did shutdown on the connection. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` + * The callback function failed. + * :enum:`NGHTTP2_ERR_BAD_CLIENT_MAGIC` + * Invalid client magic was detected. This error only returns + * when |session| was configured as server and + * `nghttp2_option_set_no_recv_client_magic()` is not used with + * nonzero value. + * :enum:`NGHTTP2_ERR_FLOODED` + * Flooding was detected in this HTTP/2 session, and it must be + * closed. This is most likely caused by misbehaviour of peer. + */ +NGHTTP2_EXTERN int nghttp2_session_recv(nghttp2_session *session); + +/** + * @function + * + * Processes data |in| as an input from the remote endpoint. The + * |inlen| indicates the number of bytes in the |in|. + * + * This function behaves like `nghttp2_session_recv()` except that it + * does not use :type:`nghttp2_recv_callback` to receive data; the + * |in| is the only data for the invocation of this function. If all + * bytes are processed, this function returns. The other callbacks + * are called in the same way as they are in `nghttp2_session_recv()`. + * + * In the current implementation, this function always tries to + * processes all input data unless either an error occurs or + * :enum:`NGHTTP2_ERR_PAUSE` is returned from + * :type:`nghttp2_on_header_callback` or + * :type:`nghttp2_on_data_chunk_recv_callback`. If + * :enum:`NGHTTP2_ERR_PAUSE` is used, the return value includes the + * number of bytes which was used to produce the data or frame for the + * callback. + * + * This function returns the number of processed bytes, or one of the + * following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` + * The callback function failed. + * :enum:`NGHTTP2_ERR_BAD_CLIENT_MAGIC` + * Invalid client magic was detected. This error only returns + * when |session| was configured as server and + * `nghttp2_option_set_no_recv_client_magic()` is not used with + * nonzero value. + * :enum:`NGHTTP2_ERR_FLOODED` + * Flooding was detected in this HTTP/2 session, and it must be + * closed. This is most likely caused by misbehaviour of peer. + */ +NGHTTP2_EXTERN ssize_t nghttp2_session_mem_recv(nghttp2_session *session, + const uint8_t *in, + size_t inlen); + +/** + * @function + * + * Puts back previously deferred DATA frame in the stream |stream_id| + * to the outbound queue. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The stream does not exist; or no deferred data exist. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_session_resume_data(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Returns nonzero value if |session| wants to receive data from the + * remote peer. + * + * If both `nghttp2_session_want_read()` and + * `nghttp2_session_want_write()` return 0, the application should + * drop the connection. + */ +NGHTTP2_EXTERN int nghttp2_session_want_read(nghttp2_session *session); + +/** + * @function + * + * Returns nonzero value if |session| wants to send data to the remote + * peer. + * + * If both `nghttp2_session_want_read()` and + * `nghttp2_session_want_write()` return 0, the application should + * drop the connection. + */ +NGHTTP2_EXTERN int nghttp2_session_want_write(nghttp2_session *session); + +/** + * @function + * + * Returns stream_user_data for the stream |stream_id|. The + * stream_user_data is provided by `nghttp2_submit_request()`, + * `nghttp2_submit_headers()` or + * `nghttp2_session_set_stream_user_data()`. Unless it is set using + * `nghttp2_session_set_stream_user_data()`, if the stream is + * initiated by the remote endpoint, stream_user_data is always + * ``NULL``. If the stream does not exist, this function returns + * ``NULL``. + */ +NGHTTP2_EXTERN void * +nghttp2_session_get_stream_user_data(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Sets the |stream_user_data| to the stream denoted by the + * |stream_id|. If a stream user data is already set to the stream, + * it is replaced with the |stream_user_data|. It is valid to specify + * ``NULL`` in the |stream_user_data|, which nullifies the associated + * data pointer. + * + * It is valid to set the |stream_user_data| to the stream reserved by + * PUSH_PROMISE frame. + * + * This function returns 0 if it succeeds, or one of following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The stream does not exist + */ +NGHTTP2_EXTERN int +nghttp2_session_set_stream_user_data(nghttp2_session *session, + int32_t stream_id, void *stream_user_data); + +/** + * @function + * + * Returns the number of frames in the outbound queue. This does not + * include the deferred DATA frames. + */ +NGHTTP2_EXTERN size_t +nghttp2_session_get_outbound_queue_size(nghttp2_session *session); + +/** + * @function + * + * Returns the number of DATA payload in bytes received without + * WINDOW_UPDATE transmission for the stream |stream_id|. The local + * (receive) window size can be adjusted by + * `nghttp2_submit_window_update()`. This function takes into account + * that and returns effective data length. In particular, if the + * local window size is reduced by submitting negative + * window_size_increment with `nghttp2_submit_window_update()`, this + * function returns the number of bytes less than actually received. + * + * This function returns -1 if it fails. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_stream_effective_recv_data_length(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Returns the local (receive) window size for the stream |stream_id|. + * The local window size can be adjusted by + * `nghttp2_submit_window_update()`. This function takes into account + * that and returns effective window size. + * + * This function returns -1 if it fails. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_stream_effective_local_window_size(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Returns the number of DATA payload in bytes received without + * WINDOW_UPDATE transmission for a connection. The local (receive) + * window size can be adjusted by `nghttp2_submit_window_update()`. + * This function takes into account that and returns effective data + * length. In particular, if the local window size is reduced by + * submitting negative window_size_increment with + * `nghttp2_submit_window_update()`, this function returns the number + * of bytes less than actually received. + * + * This function returns -1 if it fails. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_effective_recv_data_length(nghttp2_session *session); + +/** + * @function + * + * Returns the local (receive) window size for a connection. The + * local window size can be adjusted by + * `nghttp2_submit_window_update()`. This function takes into account + * that and returns effective window size. + * + * This function returns -1 if it fails. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_effective_local_window_size(nghttp2_session *session); + +/** + * @function + * + * Returns the remote window size for a given stream |stream_id|. + * + * This is the amount of flow-controlled payload (e.g., DATA) that the + * local endpoint can send without stream level WINDOW_UPDATE. There + * is also connection level flow control, so the effective size of + * payload that the local endpoint can actually send is + * min(`nghttp2_session_get_stream_remote_window_size()`, + * `nghttp2_session_get_remote_window_size()`). + * + * This function returns -1 if it fails. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_stream_remote_window_size(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Returns the remote window size for a connection. + * + * This function always succeeds. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_remote_window_size(nghttp2_session *session); + +/** + * @function + * + * Returns 1 if local peer half closed the given stream |stream_id|. + * Returns 0 if it did not. Returns -1 if no such stream exists. + */ +NGHTTP2_EXTERN int +nghttp2_session_get_stream_local_close(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Returns 1 if remote peer half closed the given stream |stream_id|. + * Returns 0 if it did not. Returns -1 if no such stream exists. + */ +NGHTTP2_EXTERN int +nghttp2_session_get_stream_remote_close(nghttp2_session *session, + int32_t stream_id); + +/** + * @function + * + * Signals the session so that the connection should be terminated. + * + * The last stream ID is the minimum value between the stream ID of a + * stream for which :type:`nghttp2_on_frame_recv_callback` was called + * most recently and the last stream ID we have sent to the peer + * previously. + * + * The |error_code| is the error code of this GOAWAY frame. The + * pre-defined error code is one of :enum:`nghttp2_error_code`. + * + * After the transmission, both `nghttp2_session_want_read()` and + * `nghttp2_session_want_write()` return 0. + * + * This function should be called when the connection should be + * terminated after sending GOAWAY. If the remaining streams should + * be processed after GOAWAY, use `nghttp2_submit_goaway()` instead. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_session_terminate_session(nghttp2_session *session, + uint32_t error_code); + +/** + * @function + * + * Signals the session so that the connection should be terminated. + * + * This function behaves like `nghttp2_session_terminate_session()`, + * but the last stream ID can be specified by the application for fine + * grained control of stream. The HTTP/2 specification does not allow + * last_stream_id to be increased. So the actual value sent as + * last_stream_id is the minimum value between the given + * |last_stream_id| and the last_stream_id we have previously sent to + * the peer. + * + * The |last_stream_id| is peer's stream ID or 0. So if |session| is + * initialized as client, |last_stream_id| must be even or 0. If + * |session| is initialized as server, |last_stream_id| must be odd or + * 0. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |last_stream_id| is invalid. + */ +NGHTTP2_EXTERN int nghttp2_session_terminate_session2(nghttp2_session *session, + int32_t last_stream_id, + uint32_t error_code); + +/** + * @function + * + * Signals to the client that the server started graceful shutdown + * procedure. + * + * This function is only usable for server. If this function is + * called with client side session, this function returns + * :enum:`NGHTTP2_ERR_INVALID_STATE`. + * + * To gracefully shutdown HTTP/2 session, server should call this + * function to send GOAWAY with last_stream_id (1u << 31) - 1. And + * after some delay (e.g., 1 RTT), send another GOAWAY with the stream + * ID that the server has some processing using + * `nghttp2_submit_goaway()`. See also + * `nghttp2_session_get_last_proc_stream_id()`. + * + * Unlike `nghttp2_submit_goaway()`, this function just sends GOAWAY + * and does nothing more. This is a mere indication to the client + * that session shutdown is imminent. The application should call + * `nghttp2_submit_goaway()` with appropriate last_stream_id after + * this call. + * + * If one or more GOAWAY frame have been already sent by either + * `nghttp2_submit_goaway()` or `nghttp2_session_terminate_session()`, + * this function has no effect. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * The |session| is initialized as client. + */ +NGHTTP2_EXTERN int nghttp2_submit_shutdown_notice(nghttp2_session *session); + +/** + * @function + * + * Returns the value of SETTINGS |id| notified by a remote endpoint. + * The |id| must be one of values defined in + * :enum:`nghttp2_settings_id`. + */ +NGHTTP2_EXTERN uint32_t +nghttp2_session_get_remote_settings(nghttp2_session *session, + nghttp2_settings_id id); + +/** + * @function + * + * Tells the |session| that next stream ID is |next_stream_id|. The + * |next_stream_id| must be equal or greater than the value returned + * by `nghttp2_session_get_next_stream_id()`. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |next_stream_id| is strictly less than the value + * `nghttp2_session_get_next_stream_id()` returns; or + * |next_stream_id| is invalid (e.g., even integer for client, or + * odd integer for server). + */ +NGHTTP2_EXTERN int nghttp2_session_set_next_stream_id(nghttp2_session *session, + int32_t next_stream_id); + +/** + * @function + * + * Returns the next outgoing stream ID. Notice that return type is + * uint32_t. If we run out of stream ID for this session, this + * function returns 1 << 31. + */ +NGHTTP2_EXTERN uint32_t +nghttp2_session_get_next_stream_id(nghttp2_session *session); + +/** + * @function + * + * Tells the |session| that |size| bytes for a stream denoted by + * |stream_id| were consumed by application and are ready to + * WINDOW_UPDATE. The consumed bytes are counted towards both + * connection and stream level WINDOW_UPDATE (see + * `nghttp2_session_consume_connection()` and + * `nghttp2_session_consume_stream()` to update consumption + * independently). This function is intended to be used without + * automatic window update (see + * `nghttp2_option_set_no_auto_window_update()`). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * Automatic WINDOW_UPDATE is not disabled. + */ +NGHTTP2_EXTERN int nghttp2_session_consume(nghttp2_session *session, + int32_t stream_id, size_t size); + +/** + * @function + * + * Like `nghttp2_session_consume()`, but this only tells library that + * |size| bytes were consumed only for connection level. Note that + * HTTP/2 maintains connection and stream level flow control windows + * independently. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * Automatic WINDOW_UPDATE is not disabled. + */ +NGHTTP2_EXTERN int nghttp2_session_consume_connection(nghttp2_session *session, + size_t size); + +/** + * @function + * + * Like `nghttp2_session_consume()`, but this only tells library that + * |size| bytes were consumed only for stream denoted by |stream_id|. + * Note that HTTP/2 maintains connection and stream level flow control + * windows independently. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * Automatic WINDOW_UPDATE is not disabled. + */ +NGHTTP2_EXTERN int nghttp2_session_consume_stream(nghttp2_session *session, + int32_t stream_id, + size_t size); + +/** + * @function + * + * Changes priority of existing stream denoted by |stream_id|. The + * new priority specification is |pri_spec|. + * + * The priority is changed silently and instantly, and no PRIORITY + * frame will be sent to notify the peer of this change. This + * function may be useful for server to change the priority of pushed + * stream. + * + * If |session| is initialized as server, and ``pri_spec->stream_id`` + * points to the idle stream, the idle stream is created if it does + * not exist. The created idle stream will depend on root stream + * (stream 0) with weight 16. + * + * Otherwise, if stream denoted by ``pri_spec->stream_id`` is not + * found, we use default priority instead of given |pri_spec|. That + * is make stream depend on root stream with weight 16. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * Attempted to depend on itself; or no stream exist for the given + * |stream_id|; or |stream_id| is 0 + */ +NGHTTP2_EXTERN int +nghttp2_session_change_stream_priority(nghttp2_session *session, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec); + +/** + * @function + * + * Creates idle stream with the given |stream_id|, and priority + * |pri_spec|. + * + * The stream creation is done without sending PRIORITY frame, which + * means that peer does not know about the existence of this idle + * stream in the local endpoint. + * + * RFC 7540 does not disallow the use of creation of idle stream with + * odd or even stream ID regardless of client or server. So this + * function can create odd or even stream ID regardless of client or + * server. But probably it is a bit safer to use the stream ID the + * local endpoint can initiate (in other words, use odd stream ID for + * client, and even stream ID for server), to avoid potential + * collision from peer's instruction. Also we can use + * `nghttp2_session_set_next_stream_id()` to avoid to open created + * idle streams accidentally if we follow this recommendation. + * + * If |session| is initialized as server, and ``pri_spec->stream_id`` + * points to the idle stream, the idle stream is created if it does + * not exist. The created idle stream will depend on root stream + * (stream 0) with weight 16. + * + * Otherwise, if stream denoted by ``pri_spec->stream_id`` is not + * found, we use default priority instead of given |pri_spec|. That + * is make stream depend on root stream with weight 16. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * Attempted to depend on itself; or stream denoted by |stream_id| + * already exists; or |stream_id| cannot be used to create idle + * stream (in other words, local endpoint has already opened + * stream ID greater than or equal to the given stream ID; or + * |stream_id| is 0 + */ +NGHTTP2_EXTERN int +nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, + const nghttp2_priority_spec *pri_spec); + +/** + * @function + * + * Performs post-process of HTTP Upgrade request. This function can + * be called from both client and server, but the behavior is very + * different in each other. + * + * .. warning:: + * + * This function is deprecated in favor of + * `nghttp2_session_upgrade2()`, because this function lacks the + * parameter to tell the library the request method used in the + * original HTTP request. This information is required for client + * to validate actual response body length against content-length + * header field (see `nghttp2_option_set_no_http_messaging()`). If + * HEAD is used in request, the length of response body must be 0 + * regardless of value included in content-length header field. + * + * If called from client side, the |settings_payload| must be the + * value sent in ``HTTP2-Settings`` header field and must be decoded + * by base64url decoder. The |settings_payloadlen| is the length of + * |settings_payload|. The |settings_payload| is unpacked and its + * setting values will be submitted using `nghttp2_submit_settings()`. + * This means that the client application code does not need to submit + * SETTINGS by itself. The stream with stream ID=1 is opened and the + * |stream_user_data| is used for its stream_user_data. The opened + * stream becomes half-closed (local) state. + * + * If called from server side, the |settings_payload| must be the + * value received in ``HTTP2-Settings`` header field and must be + * decoded by base64url decoder. The |settings_payloadlen| is the + * length of |settings_payload|. It is treated as if the SETTINGS + * frame with that payload is received. Thus, callback functions for + * the reception of SETTINGS frame will be invoked. The stream with + * stream ID=1 is opened. The |stream_user_data| is ignored. The + * opened stream becomes half-closed (remote). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |settings_payload| is badly formed. + * :enum:`NGHTTP2_ERR_PROTO` + * The stream ID 1 is already used or closed; or is not available. + */ +NGHTTP2_EXTERN int nghttp2_session_upgrade(nghttp2_session *session, + const uint8_t *settings_payload, + size_t settings_payloadlen, + void *stream_user_data); + +/** + * @function + * + * Performs post-process of HTTP Upgrade request. This function can + * be called from both client and server, but the behavior is very + * different in each other. + * + * If called from client side, the |settings_payload| must be the + * value sent in ``HTTP2-Settings`` header field and must be decoded + * by base64url decoder. The |settings_payloadlen| is the length of + * |settings_payload|. The |settings_payload| is unpacked and its + * setting values will be submitted using `nghttp2_submit_settings()`. + * This means that the client application code does not need to submit + * SETTINGS by itself. The stream with stream ID=1 is opened and the + * |stream_user_data| is used for its stream_user_data. The opened + * stream becomes half-closed (local) state. + * + * If called from server side, the |settings_payload| must be the + * value received in ``HTTP2-Settings`` header field and must be + * decoded by base64url decoder. The |settings_payloadlen| is the + * length of |settings_payload|. It is treated as if the SETTINGS + * frame with that payload is received. Thus, callback functions for + * the reception of SETTINGS frame will be invoked. The stream with + * stream ID=1 is opened. The |stream_user_data| is ignored. The + * opened stream becomes half-closed (remote). + * + * If the request method is HEAD, pass nonzero value to + * |head_request|. Otherwise, pass 0. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |settings_payload| is badly formed. + * :enum:`NGHTTP2_ERR_PROTO` + * The stream ID 1 is already used or closed; or is not available. + */ +NGHTTP2_EXTERN int nghttp2_session_upgrade2(nghttp2_session *session, + const uint8_t *settings_payload, + size_t settings_payloadlen, + int head_request, + void *stream_user_data); + +/** + * @function + * + * Serializes the SETTINGS values |iv| in the |buf|. The size of the + * |buf| is specified by |buflen|. The number of entries in the |iv| + * array is given by |niv|. The required space in |buf| for the |niv| + * entries is ``8*niv`` bytes and if the given buffer is too small, an + * error is returned. This function is used mainly for creating a + * SETTINGS payload to be sent with the ``HTTP2-Settings`` header + * field in an HTTP Upgrade request. The data written in |buf| is NOT + * base64url encoded and the application is responsible for encoding. + * + * This function returns the number of bytes written in |buf|, or one + * of the following negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |iv| contains duplicate settings ID or invalid value. + * + * :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE` + * The provided |buflen| size is too small to hold the output. + */ +NGHTTP2_EXTERN ssize_t +nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen, + const nghttp2_settings_entry *iv, size_t niv); + +/** + * @function + * + * Returns string describing the |lib_error_code|. The + * |lib_error_code| must be one of the :enum:`nghttp2_error`. + */ +NGHTTP2_EXTERN const char *nghttp2_strerror(int lib_error_code); + +/** + * @function + * + * Returns string representation of HTTP/2 error code |error_code| + * (e.g., ``PROTOCOL_ERROR`` is returned if ``error_code == + * NGHTTP2_PROTOCOL_ERROR``). If string representation is unknown for + * given |error_code|, this function returns string ``unknown``. + */ +NGHTTP2_EXTERN const char *nghttp2_http2_strerror(uint32_t error_code); + +/** + * @function + * + * Initializes |pri_spec| with the |stream_id| of the stream to depend + * on with |weight| and its exclusive flag. If |exclusive| is + * nonzero, exclusive flag is set. + * + * The |weight| must be in [:enum:`NGHTTP2_MIN_WEIGHT`, + * :enum:`NGHTTP2_MAX_WEIGHT`], inclusive. + */ +NGHTTP2_EXTERN void nghttp2_priority_spec_init(nghttp2_priority_spec *pri_spec, + int32_t stream_id, + int32_t weight, int exclusive); + +/** + * @function + * + * Initializes |pri_spec| with the default values. The default values + * are: stream_id = 0, weight = :macro:`NGHTTP2_DEFAULT_WEIGHT` and + * exclusive = 0. + */ +NGHTTP2_EXTERN void +nghttp2_priority_spec_default_init(nghttp2_priority_spec *pri_spec); + +/** + * @function + * + * Returns nonzero if the |pri_spec| is filled with default values. + */ +NGHTTP2_EXTERN int +nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec); + +/** + * @function + * + * Submits HEADERS frame and optionally one or more DATA frames. + * + * The |pri_spec| is priority specification of this request. ``NULL`` + * means the default priority (see + * `nghttp2_priority_spec_default_init()`). To specify the priority, + * use `nghttp2_priority_spec_init()`. If |pri_spec| is not ``NULL``, + * this function will copy its data members. + * + * The ``pri_spec->weight`` must be in [:enum:`NGHTTP2_MIN_WEIGHT`, + * :enum:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` is + * strictly less than :enum:`NGHTTP2_MIN_WEIGHT`, it becomes + * :enum:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than + * :enum:`NGHTTP2_MAX_WEIGHT`, it becomes :enum:`NGHTTP2_MAX_WEIGHT`. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name + * and value are not copied respectively. With + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to + * pass header field name in lowercase. The application should + * maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * HTTP/2 specification has requirement about header fields in the + * request HEADERS. See the specification for more details. + * + * If |data_prd| is not ``NULL``, it provides data which will be sent + * in subsequent DATA frames. In this case, a method that allows + * request message bodies + * (https://tools.ietf.org/html/rfc7231#section-4) must be specified + * with ``:method`` key in |nva| (e.g. ``POST``). This function does + * not take ownership of the |data_prd|. The function copies the + * members of the |data_prd|. If |data_prd| is ``NULL``, HEADERS have + * END_STREAM set. The |stream_user_data| is data associated to the + * stream opened by this request and can be an arbitrary pointer, + * which can be retrieved later by + * `nghttp2_session_get_stream_user_data()`. + * + * This function returns assigned stream ID if it succeeds, or one of + * the following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + * No stream ID is available because maximum stream ID was + * reached. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * Trying to depend on itself (new stream ID equals + * ``pri_spec->stream_id``). + * :enum:`NGHTTP2_ERR_PROTO` + * The |session| is server session. + * + * .. warning:: + * + * This function returns assigned stream ID if it succeeds. But + * that stream is not opened yet. The application must not submit + * frame to that stream ID before + * :type:`nghttp2_before_frame_send_callback` is called for this + * frame. + * + */ +NGHTTP2_EXTERN int32_t +nghttp2_submit_request(nghttp2_session *session, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd, + void *stream_user_data); + +/** + * @function + * + * Submits response HEADERS frame and optionally one or more DATA + * frames against the stream |stream_id|. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name + * and value are not copied respectively. With + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to + * pass header field name in lowercase. The application should + * maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * HTTP/2 specification has requirement about header fields in the + * response HEADERS. See the specification for more details. + * + * If |data_prd| is not ``NULL``, it provides data which will be sent + * in subsequent DATA frames. This function does not take ownership + * of the |data_prd|. The function copies the members of the + * |data_prd|. If |data_prd| is ``NULL``, HEADERS will have + * END_STREAM flag set. + * + * This method can be used as normal HTTP response and push response. + * When pushing a resource using this function, the |session| must be + * configured using `nghttp2_session_server_new()` or its variants and + * the target stream denoted by the |stream_id| must be reserved using + * `nghttp2_submit_push_promise()`. + * + * To send non-final response headers (e.g., HTTP status 101), don't + * use this function because this function half-closes the outbound + * stream. Instead, use `nghttp2_submit_headers()` for this purpose. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + * :enum:`NGHTTP2_ERR_DATA_EXIST` + * DATA or HEADERS has been already submitted and not fully + * processed yet. Normally, this does not happen, but when + * application wrongly calls `nghttp2_submit_response()` twice, + * this may happen. + * :enum:`NGHTTP2_ERR_PROTO` + * The |session| is client session. + * + * .. warning:: + * + * Calling this function twice for the same stream ID may lead to + * program crash. It is generally considered to a programming error + * to commit response twice. + */ +NGHTTP2_EXTERN int +nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd); + +/** + * @function + * + * Submits trailer fields HEADERS against the stream |stream_id|. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible not to include + * pseudo-header fields (header field whose name starts with ":") in + * |nva|. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name + * and value are not copied respectively. With + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to + * pass header field name in lowercase. The application should + * maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * For server, trailer fields must follow response HEADERS or response + * DATA without END_STREAM flat set. The library does not enforce + * this requirement, and applications should do this for themselves. + * If `nghttp2_submit_trailer()` is called before any response HEADERS + * submission (usually by `nghttp2_submit_response()`), the content of + * |nva| will be sent as response headers, which will result in error. + * + * This function has the same effect with `nghttp2_submit_headers()`, + * with flags = :enum:`NGHTTP2_FLAG_END_STREAM` and both pri_spec and + * stream_user_data to NULL. + * + * To submit trailer fields after `nghttp2_submit_response()` is + * called, the application has to specify + * :type:`nghttp2_data_provider` to `nghttp2_submit_response()`. + * Inside of :type:`nghttp2_data_source_read_callback`, when setting + * :enum:`NGHTTP2_DATA_FLAG_EOF`, also set + * :enum:`NGHTTP2_DATA_FLAG_NO_END_STREAM`. After that, the + * application can send trailer fields using + * `nghttp2_submit_trailer()`. `nghttp2_submit_trailer()` can be used + * inside :type:`nghttp2_data_source_read_callback`. + * + * This function returns 0 if it succeeds and |stream_id| is -1. + * Otherwise, this function returns 0 if it succeeds, or one of the + * following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + */ +NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, + int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen); + +/** + * @function + * + * Submits HEADERS frame. The |flags| is bitwise OR of the + * following values: + * + * * :enum:`NGHTTP2_FLAG_END_STREAM` + * + * If |flags| includes :enum:`NGHTTP2_FLAG_END_STREAM`, this frame has + * END_STREAM flag set. + * + * The library handles the CONTINUATION frame internally and it + * correctly sets END_HEADERS to the last sequence of the PUSH_PROMISE + * or CONTINUATION frame. + * + * If the |stream_id| is -1, this frame is assumed as request (i.e., + * request HEADERS frame which opens new stream). In this case, the + * assigned stream ID will be returned. Otherwise, specify stream ID + * in |stream_id|. + * + * The |pri_spec| is priority specification of this request. ``NULL`` + * means the default priority (see + * `nghttp2_priority_spec_default_init()`). To specify the priority, + * use `nghttp2_priority_spec_init()`. If |pri_spec| is not ``NULL``, + * this function will copy its data members. + * + * The ``pri_spec->weight`` must be in [:enum:`NGHTTP2_MIN_WEIGHT`, + * :enum:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` is + * strictly less than :enum:`NGHTTP2_MIN_WEIGHT`, it becomes + * :enum:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than + * :enum:`NGHTTP2_MAX_WEIGHT`, it becomes :enum:`NGHTTP2_MAX_WEIGHT`. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name + * and value are not copied respectively. With + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to + * pass header field name in lowercase. The application should + * maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * The |stream_user_data| is a pointer to an arbitrary data which is + * associated to the stream this frame will open. Therefore it is + * only used if this frame opens streams, in other words, it changes + * stream state from idle or reserved to open. + * + * This function is low-level in a sense that the application code can + * specify flags directly. For usual HTTP request, + * `nghttp2_submit_request()` is useful. Likewise, for HTTP response, + * prefer `nghttp2_submit_response()`. + * + * This function returns newly assigned stream ID if it succeeds and + * |stream_id| is -1. Otherwise, this function returns 0 if it + * succeeds, or one of the following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + * No stream ID is available because maximum stream ID was + * reached. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0; or trying to depend on itself (stream ID + * equals ``pri_spec->stream_id``). + * :enum:`NGHTTP2_ERR_DATA_EXIST` + * DATA or HEADERS has been already submitted and not fully + * processed yet. This happens if stream denoted by |stream_id| + * is in reserved state. + * :enum:`NGHTTP2_ERR_PROTO` + * The |stream_id| is -1, and |session| is server session. + * + * .. warning:: + * + * This function returns assigned stream ID if it succeeds and + * |stream_id| is -1. But that stream is not opened yet. The + * application must not submit frame to that stream ID before + * :type:`nghttp2_before_frame_send_callback` is called for this + * frame. + * + */ +NGHTTP2_EXTERN int32_t +nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, + int32_t stream_id, const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + void *stream_user_data); + +/** + * @function + * + * Submits one or more DATA frames to the stream |stream_id|. The + * data to be sent are provided by |data_prd|. If |flags| contains + * :enum:`NGHTTP2_FLAG_END_STREAM`, the last DATA frame has END_STREAM + * flag set. + * + * This function does not take ownership of the |data_prd|. The + * function copies the members of the |data_prd|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_DATA_EXIST` + * DATA or HEADERS has been already submitted and not fully + * processed yet. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + * :enum:`NGHTTP2_ERR_STREAM_CLOSED` + * The stream was already closed; or the |stream_id| is invalid. + * + * .. note:: + * + * Currently, only one DATA or HEADERS is allowed for a stream at a + * time. Submitting these frames more than once before first DATA + * or HEADERS is finished results in :enum:`NGHTTP2_ERR_DATA_EXIST` + * error code. The earliest callback which tells that previous + * frame is done is :type:`nghttp2_on_frame_send_callback`. In side + * that callback, new data can be submitted using + * `nghttp2_submit_data()`. Of course, all data except for last one + * must not have :enum:`NGHTTP2_FLAG_END_STREAM` flag set in + * |flags|. This sounds a bit complicated, and we recommend to use + * `nghttp2_submit_request()` and `nghttp2_submit_response()` to + * avoid this cascading issue. The experience shows that for HTTP + * use, these two functions are enough to implement both client and + * server. + */ +NGHTTP2_EXTERN int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider *data_prd); + +/** + * @function + * + * Submits PRIORITY frame to change the priority of stream |stream_id| + * to the priority specification |pri_spec|. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * The |pri_spec| is priority specification of this request. ``NULL`` + * is not allowed for this function. To specify the priority, use + * `nghttp2_priority_spec_init()`. This function will copy its data + * members. + * + * The ``pri_spec->weight`` must be in [:enum:`NGHTTP2_MIN_WEIGHT`, + * :enum:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` is + * strictly less than :enum:`NGHTTP2_MIN_WEIGHT`, it becomes + * :enum:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than + * :enum:`NGHTTP2_MAX_WEIGHT`, it becomes :enum:`NGHTTP2_MAX_WEIGHT`. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0; or the |pri_spec| is NULL; or trying to + * depend on itself. + */ +NGHTTP2_EXTERN int +nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec); + +/** + * @function + * + * Submits RST_STREAM frame to cancel/reject the stream |stream_id| + * with the error code |error_code|. + * + * The pre-defined error code is one of :enum:`nghttp2_error_code`. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + */ +NGHTTP2_EXTERN int nghttp2_submit_rst_stream(nghttp2_session *session, + uint8_t flags, int32_t stream_id, + uint32_t error_code); + +/** + * @function + * + * Stores local settings and submits SETTINGS frame. The |iv| is the + * pointer to the array of :type:`nghttp2_settings_entry`. The |niv| + * indicates the number of :type:`nghttp2_settings_entry`. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * This function does not take ownership of the |iv|. This function + * copies all the elements in the |iv|. + * + * While updating individual stream's local window size, if the window + * size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE, + * RST_STREAM is issued against such a stream. + * + * SETTINGS with :enum:`NGHTTP2_FLAG_ACK` is automatically submitted + * by the library and application could not send it at its will. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |iv| contains invalid value (e.g., initial window size + * strictly greater than (1 << 31) - 1. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_submit_settings(nghttp2_session *session, + uint8_t flags, + const nghttp2_settings_entry *iv, + size_t niv); + +/** + * @function + * + * Submits PUSH_PROMISE frame. + * + * The |flags| is currently ignored. The library handles the + * CONTINUATION frame internally and it correctly sets END_HEADERS to + * the last sequence of the PUSH_PROMISE or CONTINUATION frame. + * + * The |stream_id| must be client initiated stream ID. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name + * and value are not copied respectively. With + * :enum:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to + * pass header field name in lowercase. The application should + * maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * The |promised_stream_user_data| is a pointer to an arbitrary data + * which is associated to the promised stream this frame will open and + * make it in reserved state. It is available using + * `nghttp2_session_get_stream_user_data()`. The application can + * access it in :type:`nghttp2_before_frame_send_callback` and + * :type:`nghttp2_on_frame_send_callback` of this frame. + * + * The client side is not allowed to use this function. + * + * To submit response headers and data, use + * `nghttp2_submit_response()`. + * + * This function returns assigned promised stream ID if it succeeds, + * or one of the following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_PROTO` + * This function was invoked when |session| is initialized as + * client. + * :enum:`NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + * No stream ID is available because maximum stream ID was + * reached. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0; The |stream_id| does not designate stream + * that peer initiated. + * :enum:`NGHTTP2_ERR_STREAM_CLOSED` + * The stream was already closed; or the |stream_id| is invalid. + * + * .. warning:: + * + * This function returns assigned promised stream ID if it succeeds. + * As of 1.16.0, stream object for pushed resource is created when + * this function succeeds. In that case, the application can submit + * push response for the promised frame. + * + * In 1.15.0 or prior versions, pushed stream is not opened yet when + * this function succeeds. The application must not submit frame to + * that stream ID before :type:`nghttp2_before_frame_send_callback` + * is called for this frame. + * + */ +NGHTTP2_EXTERN int32_t +nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags, + int32_t stream_id, const nghttp2_nv *nva, + size_t nvlen, void *promised_stream_user_data); + +/** + * @function + * + * Submits PING frame. You don't have to send PING back when you + * received PING frame. The library automatically submits PING frame + * in this case. + * + * The |flags| is bitwise OR of 0 or more of the following value. + * + * * :enum:`NGHTTP2_FLAG_ACK` + * + * Unless `nghttp2_option_set_no_auto_ping_ack()` is used, the |flags| + * should be :enum:`NGHTTP2_FLAG_NONE`. + * + * If the |opaque_data| is non ``NULL``, then it should point to the 8 + * bytes array of memory to specify opaque data to send with PING + * frame. If the |opaque_data| is ``NULL``, zero-cleared 8 bytes will + * be sent as opaque data. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, + const uint8_t *opaque_data); + +/** + * @function + * + * Submits GOAWAY frame with the last stream ID |last_stream_id| and + * the error code |error_code|. + * + * The pre-defined error code is one of :enum:`nghttp2_error_code`. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * The |last_stream_id| is peer's stream ID or 0. So if |session| is + * initialized as client, |last_stream_id| must be even or 0. If + * |session| is initialized as server, |last_stream_id| must be odd or + * 0. + * + * The HTTP/2 specification says last_stream_id must not be increased + * from the value previously sent. So the actual value sent as + * last_stream_id is the minimum value between the given + * |last_stream_id| and the last_stream_id previously sent to the + * peer. + * + * If the |opaque_data| is not ``NULL`` and |opaque_data_len| is not + * zero, those data will be sent as additional debug data. The + * library makes a copy of the memory region pointed by |opaque_data| + * with the length |opaque_data_len|, so the caller does not need to + * keep this memory after the return of this function. If the + * |opaque_data_len| is 0, the |opaque_data| could be ``NULL``. + * + * After successful transmission of GOAWAY, following things happen. + * All incoming streams having strictly more than |last_stream_id| are + * closed. All incoming HEADERS which starts new stream are simply + * ignored. After all active streams are handled, both + * `nghttp2_session_want_read()` and `nghttp2_session_want_write()` + * return 0 and the application can close session. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |opaque_data_len| is too large; the |last_stream_id| is + * invalid. + */ +NGHTTP2_EXTERN int nghttp2_submit_goaway(nghttp2_session *session, + uint8_t flags, int32_t last_stream_id, + uint32_t error_code, + const uint8_t *opaque_data, + size_t opaque_data_len); + +/** + * @function + * + * Returns the last stream ID of a stream for which + * :type:`nghttp2_on_frame_recv_callback` was invoked most recently. + * The returned value can be used as last_stream_id parameter for + * `nghttp2_submit_goaway()` and + * `nghttp2_session_terminate_session2()`. + * + * This function always succeeds. + */ +NGHTTP2_EXTERN int32_t +nghttp2_session_get_last_proc_stream_id(nghttp2_session *session); + +/** + * @function + * + * Returns nonzero if new request can be sent from local endpoint. + * + * This function return 0 if request is not allowed for this session. + * There are several reasons why request is not allowed. Some of the + * reasons are: session is server; stream ID has been spent; GOAWAY + * has been sent or received. + * + * The application can call `nghttp2_submit_request()` without + * consulting this function. In that case, `nghttp2_submit_request()` + * may return error. Or, request is failed to sent, and + * :type:`nghttp2_on_stream_close_callback` is called. + */ +NGHTTP2_EXTERN int +nghttp2_session_check_request_allowed(nghttp2_session *session); + +/** + * @function + * + * Returns nonzero if |session| is initialized as server side session. + */ +NGHTTP2_EXTERN int +nghttp2_session_check_server_session(nghttp2_session *session); + +/** + * @function + * + * Submits WINDOW_UPDATE frame. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * The |stream_id| is the stream ID to send this WINDOW_UPDATE. To + * send connection level WINDOW_UPDATE, specify 0 to |stream_id|. + * + * If the |window_size_increment| is positive, the WINDOW_UPDATE with + * that value as window_size_increment is queued. If the + * |window_size_increment| is larger than the received bytes from the + * remote endpoint, the local window size is increased by that + * difference. If the sole purpose is to increase the local window + * size, consider to use `nghttp2_session_set_local_window_size()`. + * + * If the |window_size_increment| is negative, the local window size + * is decreased by -|window_size_increment|. If automatic + * WINDOW_UPDATE is enabled + * (`nghttp2_option_set_no_auto_window_update()`), and the library + * decided that the WINDOW_UPDATE should be submitted, then + * WINDOW_UPDATE is queued with the current received bytes count. If + * the sole purpose is to decrease the local window size, consider to + * use `nghttp2_session_set_local_window_size()`. + * + * If the |window_size_increment| is 0, the function does nothing and + * returns 0. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_FLOW_CONTROL` + * The local window size overflow or gets negative. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_submit_window_update(nghttp2_session *session, + uint8_t flags, + int32_t stream_id, + int32_t window_size_increment); + +/** + * @function + * + * Set local window size (local endpoints's window size) to the given + * |window_size| for the given stream denoted by |stream_id|. To + * change connection level window size, specify 0 to |stream_id|. To + * increase window size, this function may submit WINDOW_UPDATE frame + * to transmission queue. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * This sounds similar to `nghttp2_submit_window_update()`, but there + * are 2 differences. The first difference is that this function + * takes the absolute value of window size to set, rather than the + * delta. To change the window size, this may be easier to use since + * the application just declares the intended window size, rather than + * calculating delta. The second difference is that + * `nghttp2_submit_window_update()` affects the received bytes count + * which has not acked yet. By the specification of + * `nghttp2_submit_window_update()`, to strictly increase the local + * window size, we have to submit delta including all received bytes + * count, which might not be desirable in some cases. On the other + * hand, this function does not affect the received bytes count. It + * just sets the local window size to the given value. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is negative. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_session_set_local_window_size(nghttp2_session *session, uint8_t flags, + int32_t stream_id, int32_t window_size); + +/** + * @function + * + * Submits extension frame. + * + * Application can pass arbitrary frame flags and stream ID in |flags| + * and |stream_id| respectively. The |payload| is opaque pointer, and + * it can be accessible though ``frame->ext.payload`` in + * :type:`nghttp2_pack_extension_callback`. The library will not own + * passed |payload| pointer. + * + * The application must set :type:`nghttp2_pack_extension_callback` + * using `nghttp2_session_callbacks_set_pack_extension_callback()`. + * + * The application should retain the memory pointed by |payload| until + * the transmission of extension frame is done (which is indicated by + * :type:`nghttp2_on_frame_send_callback`), or transmission fails + * (which is indicated by :type:`nghttp2_on_frame_not_send_callback`). + * If application does not touch this memory region after packing it + * into a wire format, application can free it inside + * :type:`nghttp2_pack_extension_callback`. + * + * The standard HTTP/2 frame cannot be sent with this function, so + * |type| must be strictly grater than 0x9. Otherwise, this function + * will fail with error code :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * If :type:`nghttp2_pack_extension_callback` is not set. + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * If |type| specifies standard HTTP/2 frame type. The frame + * types in the rage [0x0, 0x9], both inclusive, are standard + * HTTP/2 frame type, and cannot be sent using this function. + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory + */ +NGHTTP2_EXTERN int nghttp2_submit_extension(nghttp2_session *session, + uint8_t type, uint8_t flags, + int32_t stream_id, void *payload); + +/** + * @struct + * + * The payload of ALTSVC frame. ALTSVC frame is a non-critical + * extension to HTTP/2. If this frame is received, and + * `nghttp2_option_set_user_recv_extension_type()` is not set, and + * `nghttp2_option_set_builtin_recv_extension_type()` is set for + * :enum:`NGHTTP2_ALTSVC`, ``nghttp2_extension.payload`` will point to + * this struct. + * + * It has the following members: + */ +typedef struct { + /** + * The pointer to origin which this alternative service is + * associated with. This is not necessarily NULL-terminated. + */ + uint8_t *origin; + /** + * The length of the |origin|. + */ + size_t origin_len; + /** + * The pointer to Alt-Svc field value contained in ALTSVC frame. + * This is not necessarily NULL-terminated. + */ + uint8_t *field_value; + /** + * The length of the |field_value|. + */ + size_t field_value_len; +} nghttp2_ext_altsvc; + +/** + * @function + * + * Submits ALTSVC frame. + * + * ALTSVC frame is a non-critical extension to HTTP/2, and defined in + * is defined in `RFC 7383 + * `_. + * + * The |flags| is currently ignored and should be + * :enum:`NGHTTP2_FLAG_NONE`. + * + * The |origin| points to the origin this alternative service is + * associated with. The |origin_len| is the length of the origin. If + * |stream_id| is 0, the origin must be specified. If |stream_id| is + * not zero, the origin must be empty (in other words, |origin_len| + * must be 0). + * + * The ALTSVC frame is only usable from server side. If this function + * is invoked with client side session, this function returns + * :enum:`NGHTTP2_ERR_INVALID_STATE`. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * The function is called from client side session + * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` + * The sum of |origin_len| and |field_value_len| is larger than + * 16382; or |origin_len| is 0 while |stream_id| is 0; or + * |origin_len| is not 0 while |stream_id| is not 0. + */ +NGHTTP2_EXTERN int nghttp2_submit_altsvc(nghttp2_session *session, + uint8_t flags, int32_t stream_id, + const uint8_t *origin, + size_t origin_len, + const uint8_t *field_value, + size_t field_value_len); + +/** + * @function + * + * Compares ``lhs->name`` of length ``lhs->namelen`` bytes and + * ``rhs->name`` of length ``rhs->namelen`` bytes. Returns negative + * integer if ``lhs->name`` is found to be less than ``rhs->name``; or + * returns positive integer if ``lhs->name`` is found to be greater + * than ``rhs->name``; or returns 0 otherwise. + */ +NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, + const nghttp2_nv *rhs); + +/** + * @function + * + * A helper function for dealing with NPN in client side or ALPN in + * server side. The |in| contains peer's protocol list in preferable + * order. The format of |in| is length-prefixed and not + * null-terminated. For example, ``h2`` and + * ``http/1.1`` stored in |in| like this:: + * + * in[0] = 2 + * in[1..2] = "h2" + * in[3] = 8 + * in[4..11] = "http/1.1" + * inlen = 12 + * + * The selection algorithm is as follows: + * + * 1. If peer's list contains HTTP/2 protocol the library supports, + * it is selected and returns 1. The following step is not taken. + * + * 2. If peer's list contains ``http/1.1``, this function selects + * ``http/1.1`` and returns 0. The following step is not taken. + * + * 3. This function selects nothing and returns -1 (So called + * non-overlap case). In this case, |out| and |outlen| are left + * untouched. + * + * Selecting ``h2`` means that ``h2`` is written into |*out| and its + * length (which is 2) is assigned to |*outlen|. + * + * For ALPN, refer to https://tools.ietf.org/html/rfc7301 + * + * See http://technotes.googlecode.com/git/nextprotoneg.html for more + * details about NPN. + * + * For NPN, to use this method you should do something like:: + * + * static int select_next_proto_cb(SSL* ssl, + * unsigned char **out, + * unsigned char *outlen, + * const unsigned char *in, + * unsigned int inlen, + * void *arg) + * { + * int rv; + * rv = nghttp2_select_next_protocol(out, outlen, in, inlen); + * if (rv == -1) { + * return SSL_TLSEXT_ERR_NOACK; + * } + * if (rv == 1) { + * ((MyType*)arg)->http2_selected = 1; + * } + * return SSL_TLSEXT_ERR_OK; + * } + * ... + * SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, my_obj); + * + */ +NGHTTP2_EXTERN int nghttp2_select_next_protocol(unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen); + +/** + * @function + * + * Returns a pointer to a nghttp2_info struct with version information + * about the run-time library in use. The |least_version| argument + * can be set to a 24 bit numerical value for the least accepted + * version number and if the condition is not met, this function will + * return a ``NULL``. Pass in 0 to skip the version checking. + */ +NGHTTP2_EXTERN nghttp2_info *nghttp2_version(int least_version); + +/** + * @function + * + * Returns nonzero if the :type:`nghttp2_error` library error code + * |lib_error| is fatal. + */ +NGHTTP2_EXTERN int nghttp2_is_fatal(int lib_error_code); + +/** + * @function + * + * Returns nonzero if HTTP header field name |name| of length |len| is + * valid according to http://tools.ietf.org/html/rfc7230#section-3.2 + * + * Because this is a header field name in HTTP2, the upper cased alphabet + * is treated as error. + */ +NGHTTP2_EXTERN int nghttp2_check_header_name(const uint8_t *name, size_t len); + +/** + * @function + * + * Returns nonzero if HTTP header field value |value| of length |len| + * is valid according to + * http://tools.ietf.org/html/rfc7230#section-3.2 + */ +NGHTTP2_EXTERN int nghttp2_check_header_value(const uint8_t *value, size_t len); + +/* HPACK API */ + +struct nghttp2_hd_deflater; + +/** + * @struct + * + * HPACK deflater object. + */ +typedef struct nghttp2_hd_deflater nghttp2_hd_deflater; + +/** + * @function + * + * Initializes |*deflater_ptr| for deflating name/values pairs. + * + * The |deflate_hd_table_bufsize_max| is the upper bound of header + * table size the deflater will use. + * + * If this function fails, |*deflater_ptr| is left untouched. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, + size_t deflate_hd_table_bufsize_max); + +/** + * @function + * + * Like `nghttp2_hd_deflate_new()`, but with additional custom memory + * allocator specified in the |mem|. + * + * The |mem| can be ``NULL`` and the call is equivalent to + * `nghttp2_hd_deflate_new()`. + * + * This function does not take ownership |mem|. The application is + * responsible for freeing |mem|. + * + * The library code does not refer to |mem| pointer after this + * function returns, so the application can safely free it. + */ +NGHTTP2_EXTERN int nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr, + size_t deflate_hd_table_bufsize_max, + nghttp2_mem *mem); + +/** + * @function + * + * Deallocates any resources allocated for |deflater|. + */ +NGHTTP2_EXTERN void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater); + +/** + * @function + * + * Changes header table size of the |deflater| to + * |settings_hd_table_bufsize_max| bytes. This may trigger eviction + * in the dynamic table. + * + * The |settings_hd_table_bufsize_max| should be the value received in + * SETTINGS_HEADER_TABLE_SIZE. + * + * The deflater never uses more memory than + * ``deflate_hd_table_bufsize_max`` bytes specified in + * `nghttp2_hd_deflate_new()`. Therefore, if + * |settings_hd_table_bufsize_max| > ``deflate_hd_table_bufsize_max``, + * resulting maximum table size becomes + * ``deflate_hd_table_bufsize_max``. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int +nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, + size_t settings_hd_table_bufsize_max); + +/** + * @function + * + * Deflates the |nva|, which has the |nvlen| name/value pairs, into + * the |buf| of length |buflen|. + * + * If |buf| is not large enough to store the deflated header block, + * this function fails with :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE`. The + * caller should use `nghttp2_hd_deflate_bound()` to know the upper + * bound of buffer size required to deflate given header name/value + * pairs. + * + * Once this function fails, subsequent call of this function always + * returns :enum:`NGHTTP2_ERR_HEADER_COMP`. + * + * After this function returns, it is safe to delete the |nva|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_HEADER_COMP` + * Deflation process has failed. + * :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE` + * The provided |buflen| size is too small to hold the output. + */ +NGHTTP2_EXTERN ssize_t +nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, + size_t buflen, const nghttp2_nv *nva, size_t nvlen); + +/** + * @function + * + * Returns an upper bound on the compressed size after deflation of + * |nva| of length |nvlen|. + */ +NGHTTP2_EXTERN size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater, + const nghttp2_nv *nva, + size_t nvlen); + +/** + * @function + * + * Returns the number of entries that header table of |deflater| + * contains. This is the sum of the number of static table and + * dynamic table, so the return value is at least 61. + */ +NGHTTP2_EXTERN +size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater); + +/** + * @function + * + * Returns the table entry denoted by |idx| from header table of + * |deflater|. The |idx| is 1-based, and idx=1 returns first entry of + * static table. idx=62 returns first entry of dynamic table if it + * exists. Specifying idx=0 is error, and this function returns NULL. + * If |idx| is strictly greater than the number of entries the tables + * contain, this function returns NULL. + */ +NGHTTP2_EXTERN +const nghttp2_nv * +nghttp2_hd_deflate_get_table_entry(nghttp2_hd_deflater *deflater, size_t idx); + +/** + * @function + * + * Returns the used dynamic table size, including the overhead 32 + * bytes per entry described in RFC 7541. + */ +NGHTTP2_EXTERN +size_t nghttp2_hd_deflate_get_dynamic_table_size(nghttp2_hd_deflater *deflater); + +/** + * @function + * + * Returns the maximum dynamic table size. + */ +NGHTTP2_EXTERN +size_t +nghttp2_hd_deflate_get_max_dynamic_table_size(nghttp2_hd_deflater *deflater); + +struct nghttp2_hd_inflater; + +/** + * @struct + * + * HPACK inflater object. + */ +typedef struct nghttp2_hd_inflater nghttp2_hd_inflater; + +/** + * @function + * + * Initializes |*inflater_ptr| for inflating name/values pairs. + * + * If this function fails, |*inflater_ptr| is left untouched. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +NGHTTP2_EXTERN int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr); + +/** + * @function + * + * Like `nghttp2_hd_inflate_new()`, but with additional custom memory + * allocator specified in the |mem|. + * + * The |mem| can be ``NULL`` and the call is equivalent to + * `nghttp2_hd_inflate_new()`. + * + * This function does not take ownership |mem|. The application is + * responsible for freeing |mem|. + * + * The library code does not refer to |mem| pointer after this + * function returns, so the application can safely free it. + */ +NGHTTP2_EXTERN int nghttp2_hd_inflate_new2(nghttp2_hd_inflater **inflater_ptr, + nghttp2_mem *mem); + +/** + * @function + * + * Deallocates any resources allocated for |inflater|. + */ +NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater); + +/** + * @function + * + * Changes header table size in the |inflater|. This may trigger + * eviction in the dynamic table. + * + * The |settings_hd_table_bufsize_max| should be the value transmitted + * in SETTINGS_HEADER_TABLE_SIZE. + * + * This function must not be called while header block is being + * inflated. In other words, this function must be called after + * initialization of |inflater|, but before calling + * `nghttp2_hd_inflate_hd2()`, or after + * `nghttp2_hd_inflate_end_headers()`. Otherwise, + * `NGHTTP2_ERR_INVALID_STATE` was returned. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_INVALID_STATE` + * The function is called while header block is being inflated. + * Probably, application missed to call + * `nghttp2_hd_inflate_end_headers()`. + */ +NGHTTP2_EXTERN int +nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, + size_t settings_hd_table_bufsize_max); + +/** + * @enum + * + * The flags for header inflation. + */ +typedef enum { + /** + * No flag set. + */ + NGHTTP2_HD_INFLATE_NONE = 0, + /** + * Indicates all headers were inflated. + */ + NGHTTP2_HD_INFLATE_FINAL = 0x01, + /** + * Indicates a header was emitted. + */ + NGHTTP2_HD_INFLATE_EMIT = 0x02 +} nghttp2_hd_inflate_flag; + +/** + * @function + * + * .. warning:: + * + * Deprecated. Use `nghttp2_hd_inflate_hd2()` instead. + * + * Inflates name/value block stored in |in| with length |inlen|. This + * function performs decompression. For each successful emission of + * header name/value pair, :enum:`NGHTTP2_HD_INFLATE_EMIT` is set in + * |*inflate_flags| and name/value pair is assigned to the |nv_out| + * and the function returns. The caller must not free the members of + * |nv_out|. + * + * The |nv_out| may include pointers to the memory region in the |in|. + * The caller must retain the |in| while the |nv_out| is used. + * + * The application should call this function repeatedly until the + * ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + * return value is non-negative. This means the all input values are + * processed successfully. Then the application must call + * `nghttp2_hd_inflate_end_headers()` to prepare for the next header + * block input. + * + * The caller can feed complete compressed header block. It also can + * feed it in several chunks. The caller must set |in_final| to + * nonzero if the given input is the last block of the compressed + * header. + * + * This function returns the number of bytes processed if it succeeds, + * or one of the following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_HEADER_COMP` + * Inflation process has failed. + * :enum:`NGHTTP2_ERR_BUFFER_ERROR` + * The header field name or value is too large. + * + * Example follows:: + * + * int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + * uint8_t *in, size_t inlen, int final) + * { + * ssize_t rv; + * + * for(;;) { + * nghttp2_nv nv; + * int inflate_flags = 0; + * + * rv = nghttp2_hd_inflate_hd(hd_inflater, &nv, &inflate_flags, + * in, inlen, final); + * + * if(rv < 0) { + * fprintf(stderr, "inflate failed with error code %zd", rv); + * return -1; + * } + * + * in += rv; + * inlen -= rv; + * + * if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + * fwrite(nv.name, nv.namelen, 1, stderr); + * fprintf(stderr, ": "); + * fwrite(nv.value, nv.valuelen, 1, stderr); + * fprintf(stderr, "\n"); + * } + * if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + * nghttp2_hd_inflate_end_headers(hd_inflater); + * break; + * } + * if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + * inlen == 0) { + * break; + * } + * } + * + * return 0; + * } + * + */ +NGHTTP2_EXTERN ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, + nghttp2_nv *nv_out, + int *inflate_flags, uint8_t *in, + size_t inlen, int in_final); + +/** + * @function + * + * Inflates name/value block stored in |in| with length |inlen|. This + * function performs decompression. For each successful emission of + * header name/value pair, :enum:`NGHTTP2_HD_INFLATE_EMIT` is set in + * |*inflate_flags| and name/value pair is assigned to the |nv_out| + * and the function returns. The caller must not free the members of + * |nv_out|. + * + * The |nv_out| may include pointers to the memory region in the |in|. + * The caller must retain the |in| while the |nv_out| is used. + * + * The application should call this function repeatedly until the + * ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + * return value is non-negative. This means the all input values are + * processed successfully. Then the application must call + * `nghttp2_hd_inflate_end_headers()` to prepare for the next header + * block input. + * + * The caller can feed complete compressed header block. It also can + * feed it in several chunks. The caller must set |in_final| to + * nonzero if the given input is the last block of the compressed + * header. + * + * This function returns the number of bytes processed if it succeeds, + * or one of the following negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`NGHTTP2_ERR_HEADER_COMP` + * Inflation process has failed. + * :enum:`NGHTTP2_ERR_BUFFER_ERROR` + * The header field name or value is too large. + * + * Example follows:: + * + * int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + * uint8_t *in, size_t inlen, int final) + * { + * ssize_t rv; + * + * for(;;) { + * nghttp2_nv nv; + * int inflate_flags = 0; + * + * rv = nghttp2_hd_inflate_hd2(hd_inflater, &nv, &inflate_flags, + * in, inlen, final); + * + * if(rv < 0) { + * fprintf(stderr, "inflate failed with error code %zd", rv); + * return -1; + * } + * + * in += rv; + * inlen -= rv; + * + * if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + * fwrite(nv.name, nv.namelen, 1, stderr); + * fprintf(stderr, ": "); + * fwrite(nv.value, nv.valuelen, 1, stderr); + * fprintf(stderr, "\n"); + * } + * if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + * nghttp2_hd_inflate_end_headers(hd_inflater); + * break; + * } + * if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + * inlen == 0) { + * break; + * } + * } + * + * return 0; + * } + * + */ +NGHTTP2_EXTERN ssize_t +nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, + int *inflate_flags, const uint8_t *in, size_t inlen, + int in_final); + +/** + * @function + * + * Signals the end of decompression for one header block. + * + * This function returns 0 if it succeeds. Currently this function + * always succeeds. + */ +NGHTTP2_EXTERN int +nghttp2_hd_inflate_end_headers(nghttp2_hd_inflater *inflater); + +/** + * @function + * + * Returns the number of entries that header table of |inflater| + * contains. This is the sum of the number of static table and + * dynamic table, so the return value is at least 61. + */ +NGHTTP2_EXTERN +size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater); + +/** + * @function + * + * Returns the table entry denoted by |idx| from header table of + * |inflater|. The |idx| is 1-based, and idx=1 returns first entry of + * static table. idx=62 returns first entry of dynamic table if it + * exists. Specifying idx=0 is error, and this function returns NULL. + * If |idx| is strictly greater than the number of entries the tables + * contain, this function returns NULL. + */ +NGHTTP2_EXTERN +const nghttp2_nv * +nghttp2_hd_inflate_get_table_entry(nghttp2_hd_inflater *inflater, size_t idx); + +/** + * @function + * + * Returns the used dynamic table size, including the overhead 32 + * bytes per entry described in RFC 7541. + */ +NGHTTP2_EXTERN +size_t nghttp2_hd_inflate_get_dynamic_table_size(nghttp2_hd_inflater *inflater); + +/** + * @function + * + * Returns the maximum dynamic table size. + */ +NGHTTP2_EXTERN +size_t +nghttp2_hd_inflate_get_max_dynamic_table_size(nghttp2_hd_inflater *inflater); + +struct nghttp2_stream; + +/** + * @struct + * + * The structure to represent HTTP/2 stream. The details of this + * structure are intentionally hidden from the public API. + */ +typedef struct nghttp2_stream nghttp2_stream; + +/** + * @function + * + * Returns pointer to :type:`nghttp2_stream` object denoted by + * |stream_id|. If stream was not found, returns NULL. + * + * Returns imaginary root stream (see + * `nghttp2_session_get_root_stream()`) if 0 is given in |stream_id|. + * + * Unless |stream_id| == 0, the returned pointer is valid until next + * call of `nghttp2_session_send()`, `nghttp2_session_mem_send()`, + * `nghttp2_session_recv()`, and `nghttp2_session_mem_recv()`. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_session_find_stream(nghttp2_session *session, int32_t stream_id); + +/** + * @enum + * + * State of stream as described in RFC 7540. + */ +typedef enum { + /** + * idle state. + */ + NGHTTP2_STREAM_STATE_IDLE = 1, + /** + * open state. + */ + NGHTTP2_STREAM_STATE_OPEN, + /** + * reserved (local) state. + */ + NGHTTP2_STREAM_STATE_RESERVED_LOCAL, + /** + * reserved (remote) state. + */ + NGHTTP2_STREAM_STATE_RESERVED_REMOTE, + /** + * half closed (local) state. + */ + NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL, + /** + * half closed (remote) state. + */ + NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE, + /** + * closed state. + */ + NGHTTP2_STREAM_STATE_CLOSED +} nghttp2_stream_proto_state; + +/** + * @function + * + * Returns state of |stream|. The root stream retrieved by + * `nghttp2_session_get_root_stream()` will have stream state + * :enum:`NGHTTP2_STREAM_STATE_IDLE`. + */ +NGHTTP2_EXTERN nghttp2_stream_proto_state +nghttp2_stream_get_state(nghttp2_stream *stream); + +/** + * @function + * + * Returns root of dependency tree, which is imaginary stream with + * stream ID 0. The returned pointer is valid until |session| is + * freed by `nghttp2_session_del()`. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_session_get_root_stream(nghttp2_session *session); + +/** + * @function + * + * Returns the parent stream of |stream| in dependency tree. Returns + * NULL if there is no such stream. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_stream_get_parent(nghttp2_stream *stream); + +NGHTTP2_EXTERN int32_t nghttp2_stream_get_stream_id(nghttp2_stream *stream); + +/** + * @function + * + * Returns the next sibling stream of |stream| in dependency tree. + * Returns NULL if there is no such stream. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_stream_get_next_sibling(nghttp2_stream *stream); + +/** + * @function + * + * Returns the previous sibling stream of |stream| in dependency tree. + * Returns NULL if there is no such stream. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_stream_get_previous_sibling(nghttp2_stream *stream); + +/** + * @function + * + * Returns the first child stream of |stream| in dependency tree. + * Returns NULL if there is no such stream. + */ +NGHTTP2_EXTERN nghttp2_stream * +nghttp2_stream_get_first_child(nghttp2_stream *stream); + +/** + * @function + * + * Returns dependency weight to the parent stream of |stream|. + */ +NGHTTP2_EXTERN int32_t nghttp2_stream_get_weight(nghttp2_stream *stream); + +/** + * @function + * + * Returns the sum of the weight for |stream|'s children. + */ +NGHTTP2_EXTERN int32_t +nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream); + +#ifdef __cplusplus +} +#endif + +#endif /* NGHTTP2_H */ diff --git a/components/nghttp/include/nghttp2/nghttp2ver.h b/components/nghttp/include/nghttp2/nghttp2ver.h new file mode 100644 index 0000000000..a12cb7083d --- /dev/null +++ b/components/nghttp/include/nghttp2/nghttp2ver.h @@ -0,0 +1,42 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2VER_H +#define NGHTTP2VER_H + +/** + * @macro + * Version number of the nghttp2 library release + */ +#define NGHTTP2_VERSION "@PACKAGE_VERSION@" + +/** + * @macro + * Numerical representation of the version number of the nghttp2 library + * release. This is a 24 bit number with 8 bits for major number, 8 bits + * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. + */ +#define NGHTTP2_VERSION_NUM 0x010203 + +#endif /* NGHTTP2VER_H */ diff --git a/components/nghttp/include/nghttp2_buf.h b/components/nghttp/include/nghttp2_buf.h new file mode 100644 index 0000000000..6770d6f368 --- /dev/null +++ b/components/nghttp/include/nghttp2_buf.h @@ -0,0 +1,388 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_BUF_H +#define NGHTTP2_BUF_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +#include "nghttp2_int.h" +#include "nghttp2_mem.h" + +typedef struct { + /* This points to the beginning of the buffer. The effective range + of buffer is [begin, end). */ + uint8_t *begin; + /* This points to the memory one byte beyond the end of the + buffer. */ + uint8_t *end; + /* The position indicator for effective start of the buffer. pos <= + last must be hold. */ + uint8_t *pos; + /* The position indicator for effective one beyond of the end of the + buffer. last <= end must be hold. */ + uint8_t *last; + /* Mark arbitrary position in buffer [begin, end) */ + uint8_t *mark; +} nghttp2_buf; + +#define nghttp2_buf_len(BUF) ((size_t)((BUF)->last - (BUF)->pos)) +#define nghttp2_buf_avail(BUF) ((size_t)((BUF)->end - (BUF)->last)) +#define nghttp2_buf_mark_avail(BUF) ((size_t)((BUF)->mark - (BUF)->last)) +#define nghttp2_buf_cap(BUF) ((size_t)((BUF)->end - (BUF)->begin)) + +#define nghttp2_buf_pos_offset(BUF) ((size_t)((BUF)->pos - (BUF)->begin)) +#define nghttp2_buf_last_offset(BUF) ((size_t)((BUF)->last - (BUF)->begin)) + +#define nghttp2_buf_shift_right(BUF, AMT) \ + do { \ + (BUF)->pos += AMT; \ + (BUF)->last += AMT; \ + } while (0) + +#define nghttp2_buf_shift_left(BUF, AMT) \ + do { \ + (BUF)->pos -= AMT; \ + (BUF)->last -= AMT; \ + } while (0) + +/* + * Initializes the |buf|. No memory is allocated in this function. Use + * nghttp2_buf_reserve() to allocate memory. + */ +void nghttp2_buf_init(nghttp2_buf *buf); + +/* + * Initializes the |buf| and allocates at least |initial| bytes of + * memory. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_buf_init2(nghttp2_buf *buf, size_t initial, nghttp2_mem *mem); + +/* + * Frees buffer in |buf|. + */ +void nghttp2_buf_free(nghttp2_buf *buf, nghttp2_mem *mem); + +/* + * Extends buffer so that nghttp2_buf_cap() returns at least + * |new_cap|. If extensions took place, buffer pointers in |buf| will + * change. + * + * This function returns 0 if it succeeds, or one of the followings + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap, nghttp2_mem *mem); + +/* + * Resets pos, last, mark member of |buf| to buf->begin. + */ +void nghttp2_buf_reset(nghttp2_buf *buf); + +/* + * Initializes |buf| using supplied buffer |begin| of length + * |len|. Semantically, the application should not call *_reserve() or + * nghttp2_free() functions for |buf|. + */ +void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len); + +struct nghttp2_buf_chain; + +typedef struct nghttp2_buf_chain nghttp2_buf_chain; + +/* Chains 2 buffers */ +struct nghttp2_buf_chain { + /* Points to the subsequent buffer. NULL if there is no such + buffer. */ + nghttp2_buf_chain *next; + nghttp2_buf buf; +}; + +typedef struct { + /* Points to the first buffer */ + nghttp2_buf_chain *head; + /* Buffer pointer where write occurs. */ + nghttp2_buf_chain *cur; + /* Memory allocator */ + nghttp2_mem *mem; + /* The buffer capacity of each buf */ + size_t chunk_length; + /* The maximum number of nghttp2_buf_chain */ + size_t max_chunk; + /* The number of nghttp2_buf_chain allocated */ + size_t chunk_used; + /* The number of nghttp2_buf_chain to keep on reset */ + size_t chunk_keep; + /* pos offset from begin in each buffers. On initialization and + reset, buf->pos and buf->last are positioned at buf->begin + + offset. */ + size_t offset; +} nghttp2_bufs; + +/* + * This is the same as calling nghttp2_bufs_init2 with the given + * arguments and offset = 0. + */ +int nghttp2_bufs_init(nghttp2_bufs *bufs, size_t chunk_length, size_t max_chunk, + nghttp2_mem *mem); + +/* + * This is the same as calling nghttp2_bufs_init3 with the given + * arguments and chunk_keep = max_chunk. + */ +int nghttp2_bufs_init2(nghttp2_bufs *bufs, size_t chunk_length, + size_t max_chunk, size_t offset, nghttp2_mem *mem); + +/* + * Initializes |bufs|. Each buffer size is given in the + * |chunk_length|. The maximum number of buffers is given in the + * |max_chunk|. On reset, first |chunk_keep| buffers are kept and + * remaining buffers are deleted. Each buffer will have bufs->pos and + * bufs->last shifted to left by |offset| bytes on creation and reset. + * + * This function allocates first buffer. bufs->head and bufs->cur + * will point to the first buffer after this call. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_INVALID_ARGUMENT + * chunk_keep is 0; or max_chunk < chunk_keep; or offset is too + * long. + */ +int nghttp2_bufs_init3(nghttp2_bufs *bufs, size_t chunk_length, + size_t max_chunk, size_t chunk_keep, size_t offset, + nghttp2_mem *mem); + +/* + * Frees any related resources to the |bufs|. + */ +void nghttp2_bufs_free(nghttp2_bufs *bufs); + +/* + * Initializes |bufs| using supplied buffer |begin| of length |len|. + * The first buffer bufs->head uses buffer |begin|. The buffer size + * is fixed and no allocate extra chunk buffer is allocated. In other + * words, max_chunk = chunk_keep = 1. To free the resource allocated + * for |bufs|, use nghttp2_bufs_wrap_free(). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_bufs_wrap_init(nghttp2_bufs *bufs, uint8_t *begin, size_t len, + nghttp2_mem *mem); + +/* + * Frees any related resource to the |bufs|. This function does not + * free supplied buffer provided in nghttp2_bufs_wrap_init(). + */ +void nghttp2_bufs_wrap_free(nghttp2_bufs *bufs); + +/* + * Reallocates internal buffer using |chunk_length|. The max_chunk, + * chunk_keep and offset do not change. After successful allocation + * of new buffer, previous buffers are deallocated without copying + * anything into new buffers. chunk_used is reset to 1. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_INVALID_ARGUMENT + * chunk_length < offset + */ +int nghttp2_bufs_realloc(nghttp2_bufs *bufs, size_t chunk_length); + +/* + * Appends the |data| of length |len| to the |bufs|. The write starts + * at bufs->cur->buf.last. A new buffers will be allocated to store + * all data. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len); + +/* + * Appends a single byte |b| to the |bufs|. The write starts at + * bufs->cur->buf.last. A new buffers will be allocated to store all + * data. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_bufs_addb(nghttp2_bufs *bufs, uint8_t b); + +/* + * Behaves like nghttp2_bufs_addb(), but this does not update + * buf->last pointer. + */ +int nghttp2_bufs_addb_hold(nghttp2_bufs *bufs, uint8_t b); + +#define nghttp2_bufs_fast_addb(BUFS, B) \ + do { \ + *(BUFS)->cur->buf.last++ = B; \ + } while (0) + +#define nghttp2_bufs_fast_addb_hold(BUFS, B) \ + do { \ + *(BUFS)->cur->buf.last = B; \ + } while (0) + +/* + * Performs bitwise-OR of |b| at bufs->cur->buf.last. A new buffers + * will be allocated if necessary. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_bufs_orb(nghttp2_bufs *bufs, uint8_t b); + +/* + * Behaves like nghttp2_bufs_orb(), but does not update buf->last + * pointer. + */ +int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b); + +#define nghttp2_bufs_fast_orb(BUFS, B) \ + do { \ + uint8_t **p = &(BUFS)->cur->buf.last; \ + **p = (uint8_t)(**p | (B)); \ + ++(*p); \ + } while (0) + +#define nghttp2_bufs_fast_orb_hold(BUFS, B) \ + do { \ + uint8_t *p = (BUFS)->cur->buf.last; \ + *p = (uint8_t)(*p | (B)); \ + } while (0) + +/* + * Copies all data stored in |bufs| to the contiguous buffer. This + * function allocates the contiguous memory to store all data in + * |bufs| and assigns it to |*out|. + * + * The contents of |bufs| is left unchanged. + * + * This function returns the length of copied data and assigns the + * pointer to copied data to |*out| if it succeeds, or one of the + * following negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out); + +/* + * Copies all data stored in |bufs| to |out|. This function assumes + * that the buffer space pointed by |out| has at least + * nghttp2_bufs(bufs) bytes. + * + * The contents of |bufs| is left unchanged. + * + * This function returns the length of copied data. + */ +size_t nghttp2_bufs_remove_copy(nghttp2_bufs *bufs, uint8_t *out); + +/* + * Resets |bufs| and makes the buffers empty. + */ +void nghttp2_bufs_reset(nghttp2_bufs *bufs); + +/* + * Moves bufs->cur to bufs->cur->next. If resulting bufs->cur is + * NULL, this function allocates new buffers and bufs->cur points to + * it. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_bufs_advance(nghttp2_bufs *bufs); + +/* Sets bufs->cur to bufs->head */ +#define nghttp2_bufs_rewind(BUFS) \ + do { \ + (BUFS)->cur = (BUFS)->head; \ + } while (0) + +/* + * Move bufs->cur, from the current position, using next member, to + * the last buf which has nghttp2_buf_len(buf) > 0 without seeing buf + * which satisfies nghttp2_buf_len(buf) == 0. If + * nghttp2_buf_len(&bufs->cur->buf) == 0 or bufs->cur->next is NULL, + * bufs->cur is unchanged. + */ +void nghttp2_bufs_seek_last_present(nghttp2_bufs *bufs); + +/* + * Returns nonzero if bufs->cur->next is not emtpy. + */ +int nghttp2_bufs_next_present(nghttp2_bufs *bufs); + +#define nghttp2_bufs_cur_avail(BUFS) nghttp2_buf_avail(&(BUFS)->cur->buf) + +/* + * Returns the buffer length of |bufs|. + */ +size_t nghttp2_bufs_len(nghttp2_bufs *bufs); + +#endif /* NGHTTP2_BUF_H */ diff --git a/components/nghttp/include/nghttp2_callbacks.h b/components/nghttp/include/nghttp2_callbacks.h new file mode 100644 index 0000000000..5f08474a43 --- /dev/null +++ b/components/nghttp/include/nghttp2_callbacks.h @@ -0,0 +1,117 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_CALLBACKS_H +#define NGHTTP2_CALLBACKS_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +/* + * Callback functions. + */ +struct nghttp2_session_callbacks { + /** + * Callback function invoked when the session wants to send data to + * the remote peer. This callback is not necessary if the + * application uses solely `nghttp2_session_mem_send()` to serialize + * data to transmit. + */ + nghttp2_send_callback send_callback; + /** + * Callback function invoked when the session wants to receive data + * from the remote peer. This callback is not necessary if the + * application uses solely `nghttp2_session_mem_recv()` to process + * received data. + */ + nghttp2_recv_callback recv_callback; + /** + * Callback function invoked by `nghttp2_session_recv()` when a + * frame is received. + */ + nghttp2_on_frame_recv_callback on_frame_recv_callback; + /** + * Callback function invoked by `nghttp2_session_recv()` when an + * invalid non-DATA frame is received. + */ + nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback; + /** + * Callback function invoked when a chunk of data in DATA frame is + * received. + */ + nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback; + /** + * Callback function invoked before a non-DATA frame is sent. + */ + nghttp2_before_frame_send_callback before_frame_send_callback; + /** + * Callback function invoked after a frame is sent. + */ + nghttp2_on_frame_send_callback on_frame_send_callback; + /** + * The callback function invoked when a non-DATA frame is not sent + * because of an error. + */ + nghttp2_on_frame_not_send_callback on_frame_not_send_callback; + /** + * Callback function invoked when the stream is closed. + */ + nghttp2_on_stream_close_callback on_stream_close_callback; + /** + * Callback function invoked when the reception of header block in + * HEADERS or PUSH_PROMISE is started. + */ + nghttp2_on_begin_headers_callback on_begin_headers_callback; + /** + * Callback function invoked when a header name/value pair is + * received. + */ + nghttp2_on_header_callback on_header_callback; + nghttp2_on_header_callback2 on_header_callback2; + /** + * Callback function invoked when the library asks application how + * many padding bytes are required for the transmission of the given + * frame. + */ + nghttp2_select_padding_callback select_padding_callback; + /** + * The callback function used to determine the length allowed in + * `nghttp2_data_source_read_callback()` + */ + nghttp2_data_source_read_length_callback read_length_callback; + /** + * Sets callback function invoked when a frame header is received. + */ + nghttp2_on_begin_frame_callback on_begin_frame_callback; + nghttp2_send_data_callback send_data_callback; + nghttp2_pack_extension_callback pack_extension_callback; + nghttp2_unpack_extension_callback unpack_extension_callback; + nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback; + nghttp2_error_callback error_callback; +}; + +#endif /* NGHTTP2_CALLBACKS_H */ diff --git a/components/nghttp/include/nghttp2_frame.h b/components/nghttp/include/nghttp2_frame.h new file mode 100644 index 0000000000..6493465a07 --- /dev/null +++ b/components/nghttp/include/nghttp2_frame.h @@ -0,0 +1,581 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_FRAME_H +#define NGHTTP2_FRAME_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_hd.h" +#include "nghttp2_buf.h" + +#define NGHTTP2_STREAM_ID_MASK ((1u << 31) - 1) +#define NGHTTP2_PRI_GROUP_ID_MASK ((1u << 31) - 1) +#define NGHTTP2_PRIORITY_MASK ((1u << 31) - 1) +#define NGHTTP2_WINDOW_SIZE_INCREMENT_MASK ((1u << 31) - 1) +#define NGHTTP2_SETTINGS_ID_MASK ((1 << 24) - 1) + +/* The number of bytes of frame header. */ +#define NGHTTP2_FRAME_HDLEN 9 + +#define NGHTTP2_MAX_FRAME_SIZE_MAX ((1 << 24) - 1) +#define NGHTTP2_MAX_FRAME_SIZE_MIN (1 << 14) + +#define NGHTTP2_MAX_PAYLOADLEN 8192//16384--LiuHan/0812 +/* The one frame buffer length for tranmission. We may use several of + them to support CONTINUATION. To account for Pad Length field, we + allocate extra 1 byte, which saves extra large memcopying. */ +#define NGHTTP2_FRAMEBUF_CHUNKLEN \ + (NGHTTP2_FRAME_HDLEN + 1 + NGHTTP2_MAX_PAYLOADLEN) + +/* The default length of DATA frame payload. */ +#define NGHTTP2_DATA_PAYLOADLEN NGHTTP2_MAX_FRAME_SIZE_MIN + +/* Maximum headers block size to send, calculated using + nghttp2_hd_deflate_bound(). This is the default value, and can be + overridden by nghttp2_option_set_max_send_header_block_size(). */ +#define NGHTTP2_MAX_HEADERSLEN 65536 + +/* The number of bytes for each SETTINGS entry */ +#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 6 + +/* Length of priority related fields in HEADERS/PRIORITY frames */ +#define NGHTTP2_PRIORITY_SPECLEN 5 + +/* Maximum length of padding in bytes. */ +#define NGHTTP2_MAX_PADLEN 256 + +/* Union of extension frame payload */ +typedef union { nghttp2_ext_altsvc altsvc; } nghttp2_ext_frame_payload; + +void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd); + +void nghttp2_frame_unpack_frame_hd(nghttp2_frame_hd *hd, const uint8_t *buf); + +/** + * Initializes frame header |hd| with given parameters. Reserved bit + * is set to 0. + */ +void nghttp2_frame_hd_init(nghttp2_frame_hd *hd, size_t length, uint8_t type, + uint8_t flags, int32_t stream_id); + +/** + * Returns the number of priority field depending on the |flags|. If + * |flags| has neither NGHTTP2_FLAG_PRIORITY_GROUP nor + * NGHTTP2_FLAG_PRIORITY_DEPENDENCY set, return 0. + */ +size_t nghttp2_frame_priority_len(uint8_t flags); + +/** + * Packs the |pri_spec| in |buf|. This function assumes |buf| has + * enough space for serialization. + */ +void nghttp2_frame_pack_priority_spec(uint8_t *buf, + const nghttp2_priority_spec *pri_spec); + +/** + * Unpacks the priority specification from payload |payload| of length + * |payloadlen| to |pri_spec|. The |flags| is used to determine what + * kind of priority specification is in |payload|. This function + * assumes the |payload| contains whole priority specification. + */ +void nghttp2_frame_unpack_priority_spec(nghttp2_priority_spec *pri_spec, + uint8_t flags, const uint8_t *payload, + size_t payloadlen); + +/* + * Returns the offset from the HEADERS frame payload where the + * compressed header block starts. The frame payload does not include + * frame header. + */ +size_t nghttp2_frame_headers_payload_nv_offset(nghttp2_headers *frame); + +/* + * Packs HEADERS frame |frame| in wire format and store it in |bufs|. + * This function expands |bufs| as necessary to store frame. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * frame->hd.length is assigned after length is determined during + * packing process. CONTINUATION frames are also serialized in this + * function. This function does not handle padding. + * + * This function returns 0 if it succeeds, or returns one of the + * following negative error codes: + * + * NGHTTP2_ERR_HEADER_COMP + * The deflate operation failed. + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_frame_pack_headers(nghttp2_bufs *bufs, nghttp2_headers *frame, + nghttp2_hd_deflater *deflater); + +/* + * Unpacks HEADERS frame byte sequence into |frame|. This function + * only unapcks bytes that come before name/value header block and + * after possible Pad Length field. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_unpack_headers_payload(nghttp2_headers *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs PRIORITY frame |frame| in wire format and store it in + * |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_pack_priority(nghttp2_bufs *bufs, nghttp2_priority *frame); + +/* + * Unpacks PRIORITY wire format into |frame|. + */ +void nghttp2_frame_unpack_priority_payload(nghttp2_priority *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs RST_STREAM frame |frame| in wire frame format and store it in + * |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_pack_rst_stream(nghttp2_bufs *bufs, + nghttp2_rst_stream *frame); + +/* + * Unpacks RST_STREAM frame byte sequence into |frame|. + */ +void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs SETTINGS frame |frame| in wire format and store it in + * |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function returns 0 if it succeeds, or returns one of the + * following negative error codes: + * + * NGHTTP2_ERR_FRAME_SIZE_ERROR + * The length of the frame is too large. + */ +int nghttp2_frame_pack_settings(nghttp2_bufs *bufs, nghttp2_settings *frame); + +/* + * Packs the |iv|, which includes |niv| entries, in the |buf|, + * assuming the |buf| has at least 8 * |niv| bytes. + * + * Returns the number of bytes written into the |buf|. + */ +size_t nghttp2_frame_pack_settings_payload(uint8_t *buf, + const nghttp2_settings_entry *iv, + size_t niv); + +void nghttp2_frame_unpack_settings_entry(nghttp2_settings_entry *iv, + const uint8_t *payload); + +/* + * Initializes payload of frame->settings. The |frame| takes + * ownership of |iv|. + */ +void nghttp2_frame_unpack_settings_payload(nghttp2_settings *frame, + nghttp2_settings_entry *iv, + size_t niv); + +/* + * Unpacks SETTINGS payload into |*iv_ptr|. The number of entries are + * assigned to the |*niv_ptr|. This function allocates enough memory + * to store the result in |*iv_ptr|. The caller is responsible to free + * |*iv_ptr| after its use. + * + * This function returns 0 if it succeeds or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr, + size_t *niv_ptr, + const uint8_t *payload, + size_t payloadlen, nghttp2_mem *mem); + +/* + * Packs PUSH_PROMISE frame |frame| in wire format and store it in + * |bufs|. This function expands |bufs| as necessary to store + * frame. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * frame->hd.length is assigned after length is determined during + * packing process. CONTINUATION frames are also serialized in this + * function. This function does not handle padding. + * + * This function returns 0 if it succeeds, or returns one of the + * following negative error codes: + * + * NGHTTP2_ERR_HEADER_COMP + * The deflate operation failed. + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs, + nghttp2_push_promise *frame, + nghttp2_hd_deflater *deflater); + +/* + * Unpacks PUSH_PROMISE frame byte sequence into |frame|. This + * function only unapcks bytes that come before name/value header + * block and after possible Pad Length field. + * + * This function returns 0 if it succeeds or one of the following + * negative error codes: + * + * NGHTTP2_ERR_PROTO + * TODO END_HEADERS flag is not set + */ +int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs PING frame |frame| in wire format and store it in + * |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_pack_ping(nghttp2_bufs *bufs, nghttp2_ping *frame); + +/* + * Unpacks PING wire format into |frame|. + */ +void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs GOAWAY frame |frame| in wire format and store it in |bufs|. + * This function expands |bufs| as necessary to store frame. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function returns 0 if it succeeds or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_FRAME_SIZE_ERROR + * The length of the frame is too large. + */ +int nghttp2_frame_pack_goaway(nghttp2_bufs *bufs, nghttp2_goaway *frame); + +/* + * Unpacks GOAWAY wire format into |frame|. The |payload| of length + * |payloadlen| contains first 8 bytes of payload. The + * |var_gift_payload| of length |var_gift_payloadlen| contains + * remaining payload and its buffer is gifted to the function and then + * |frame|. The |var_gift_payloadlen| must be freed by + * nghttp2_frame_goaway_free(). + */ +void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame, + const uint8_t *payload, + size_t payloadlen, + uint8_t *var_gift_payload, + size_t var_gift_payloadlen); + +/* + * Unpacks GOAWAY wire format into |frame|. This function only exists + * for unit test. After allocating buffer for debug data, this + * function internally calls nghttp2_frame_unpack_goaway_payload(). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_frame_unpack_goaway_payload2(nghttp2_goaway *frame, + const uint8_t *payload, + size_t payloadlen, nghttp2_mem *mem); + +/* + * Packs WINDOW_UPDATE frame |frame| in wire frame format and store it + * in |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_pack_window_update(nghttp2_bufs *bufs, + nghttp2_window_update *frame); + +/* + * Unpacks WINDOW_UPDATE frame byte sequence into |frame|. + */ +void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame, + const uint8_t *payload, + size_t payloadlen); + +/* + * Packs ALTSVC frame |frame| in wire frame format and store it in + * |bufs|. + * + * The caller must make sure that nghttp2_bufs_reset(bufs) is called + * before calling this function. + * + * This function always succeeds and returns 0. + */ +int nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *ext); + +/* + * Unpacks ALTSVC wire format into |frame|. The |payload| of + * |payloadlen| bytes contains frame payload. This function assumes + * that frame->payload points to the nghttp2_ext_altsvc object. + * + * This function always succeeds and returns 0. + */ +void nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, + size_t origin_len, uint8_t *payload, + size_t payloadlen); + +/* + * Unpacks ALTSVC wire format into |frame|. This function only exists + * for unit test. After allocating buffer for fields, this function + * internally calls nghttp2_frame_unpack_altsvc_payload(). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_FRAME_SIZE_ERROR + * The payload is too small. + */ +int nghttp2_frame_unpack_altsvc_payload2(nghttp2_extension *frame, + const uint8_t *payload, + size_t payloadlen, nghttp2_mem *mem); + +/* + * Initializes HEADERS frame |frame| with given values. |frame| takes + * ownership of |nva|, so caller must not free it. If |stream_id| is + * not assigned yet, it must be -1. + */ +void nghttp2_frame_headers_init(nghttp2_headers *frame, uint8_t flags, + int32_t stream_id, nghttp2_headers_category cat, + const nghttp2_priority_spec *pri_spec, + nghttp2_nv *nva, size_t nvlen); + +void nghttp2_frame_headers_free(nghttp2_headers *frame, nghttp2_mem *mem); + +void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id, + const nghttp2_priority_spec *pri_spec); + +void nghttp2_frame_priority_free(nghttp2_priority *frame); + +void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, int32_t stream_id, + uint32_t error_code); + +void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame); + +/* + * Initializes PUSH_PROMISE frame |frame| with given values. |frame| + * takes ownership of |nva|, so caller must not free it. + */ +void nghttp2_frame_push_promise_init(nghttp2_push_promise *frame, uint8_t flags, + int32_t stream_id, + int32_t promised_stream_id, + nghttp2_nv *nva, size_t nvlen); + +void nghttp2_frame_push_promise_free(nghttp2_push_promise *frame, + nghttp2_mem *mem); + +/* + * Initializes SETTINGS frame |frame| with given values. |frame| takes + * ownership of |iv|, so caller must not free it. The |flags| are + * bitwise-OR of one or more of nghttp2_settings_flag. + */ +void nghttp2_frame_settings_init(nghttp2_settings *frame, uint8_t flags, + nghttp2_settings_entry *iv, size_t niv); + +void nghttp2_frame_settings_free(nghttp2_settings *frame, nghttp2_mem *mem); + +/* + * Initializes PING frame |frame| with given values. If the + * |opqeue_data| is not NULL, it must point to 8 bytes memory region + * of data. The data pointed by |opaque_data| is copied. It can be + * NULL. In this case, 8 bytes NULL is used. + */ +void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags, + const uint8_t *opque_data); + +void nghttp2_frame_ping_free(nghttp2_ping *frame); + +/* + * Initializes GOAWAY frame |frame| with given values. On success, + * this function takes ownership of |opaque_data|, so caller must not + * free it. If the |opaque_data_len| is 0, opaque_data could be NULL. + */ +void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id, + uint32_t error_code, uint8_t *opaque_data, + size_t opaque_data_len); + +void nghttp2_frame_goaway_free(nghttp2_goaway *frame, nghttp2_mem *mem); + +void nghttp2_frame_window_update_init(nghttp2_window_update *frame, + uint8_t flags, int32_t stream_id, + int32_t window_size_increment); + +void nghttp2_frame_window_update_free(nghttp2_window_update *frame); + +void nghttp2_frame_extension_init(nghttp2_extension *frame, uint8_t type, + uint8_t flags, int32_t stream_id, + void *payload); + +void nghttp2_frame_extension_free(nghttp2_extension *frame); + +/* + * Initializes ALTSVC frame |frame| with given values. This function + * assumes that frame->payload points to nghttp2_ext_altsvc object. + * Also |origin| and |field_value| are allocated in single buffer, + * starting |origin|. On success, this function takes ownership of + * |origin|, so caller must not free it. + */ +void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id, + uint8_t *origin, size_t origin_len, + uint8_t *field_value, size_t field_value_len); + +/* + * Frees up resources under |frame|. This function does not free + * nghttp2_ext_altsvc object pointed by frame->payload. This function + * only frees origin pointed by nghttp2_ext_altsvc.origin. Therefore, + * other fields must be allocated in the same buffer with origin. + */ +void nghttp2_frame_altsvc_free(nghttp2_extension *frame, nghttp2_mem *mem); + +/* + * Returns the number of padding bytes after payload. The total + * padding length is given in the |padlen|. The returned value does + * not include the Pad Length field. If |padlen| is 0, this function + * returns 0, regardless of frame->hd.flags. + */ +size_t nghttp2_frame_trail_padlen(nghttp2_frame *frame, size_t padlen); + +void nghttp2_frame_data_init(nghttp2_data *frame, uint8_t flags, + int32_t stream_id); + +void nghttp2_frame_data_free(nghttp2_data *frame); + +/* + * Makes copy of |iv| and return the copy. The |niv| is the number of + * entries in |iv|. This function returns the pointer to the copy if + * it succeeds, or NULL. + */ +nghttp2_settings_entry *nghttp2_frame_iv_copy(const nghttp2_settings_entry *iv, + size_t niv, nghttp2_mem *mem); + +/* + * Sorts the |nva| in ascending order of name and value. If names are + * equivalent, sort them by value. + */ +void nghttp2_nv_array_sort(nghttp2_nv *nva, size_t nvlen); + +/* + * Copies name/value pairs from |nva|, which contains |nvlen| pairs, + * to |*nva_ptr|, which is dynamically allocated so that all items can + * be stored. The resultant name and value in nghttp2_nv are + * guaranteed to be NULL-terminated even if the input is not + * null-terminated. + * + * The |*nva_ptr| must be freed using nghttp2_nv_array_del(). + * + * This function returns 0 if it succeeds or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_nv_array_copy(nghttp2_nv **nva_ptr, const nghttp2_nv *nva, + size_t nvlen, nghttp2_mem *mem); + +/* + * Returns nonzero if the name/value pair |a| equals to |b|. The name + * is compared in case-sensitive, because we ensure that this function + * is called after the name is lower-cased. + */ +int nghttp2_nv_equal(const nghttp2_nv *a, const nghttp2_nv *b); + +/* + * Frees |nva|. + */ +void nghttp2_nv_array_del(nghttp2_nv *nva, nghttp2_mem *mem); + +/* + * Checks that the |iv|, which includes |niv| entries, does not have + * invalid values. + * + * This function returns nonzero if it succeeds, or 0. + */ +int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv); + +/* + * Sets Pad Length field and flags and adjusts frame header position + * of each buffers in |bufs|. The number of padding is given in the + * |padlen| including Pad Length field. The |hd| is the frame header + * for the serialized data. This function fills zeros padding region + * unless framehd_only is nonzero. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_FRAME_SIZE_ERROR + * The length of the resulting frame is too large. + */ +int nghttp2_frame_add_pad(nghttp2_bufs *bufs, nghttp2_frame_hd *hd, + size_t padlen, int framehd_only); + +#endif /* NGHTTP2_FRAME_H */ diff --git a/components/nghttp/include/nghttp2_hd.h b/components/nghttp/include/nghttp2_hd.h new file mode 100644 index 0000000000..1da9eb5863 --- /dev/null +++ b/components/nghttp/include/nghttp2_hd.h @@ -0,0 +1,430 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_HD_H +#define NGHTTP2_HD_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +#include "nghttp2_hd_huffman.h" +#include "nghttp2_buf.h" +#include "nghttp2_mem.h" +#include "nghttp2_rcbuf.h" + +#define NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE NGHTTP2_DEFAULT_HEADER_TABLE_SIZE +#define NGHTTP2_HD_ENTRY_OVERHEAD 32 + +/* The maximum length of one name/value pair. This is the sum of the + length of name and value. This is not specified by the spec. We + just chose the arbitrary size */ +#define NGHTTP2_HD_MAX_NV 65536 + +/* Default size of maximum table buffer size for encoder. Even if + remote decoder notifies larger buffer size for its decoding, + encoder only uses the memory up to this value. */ +#define NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE (1 << 12) + +/* Exported for unit test */ +#define NGHTTP2_STATIC_TABLE_LENGTH 61 + +/* Generated by genlibtokenlookup.py */ +typedef enum { + NGHTTP2_TOKEN__AUTHORITY = 0, + NGHTTP2_TOKEN__METHOD = 1, + NGHTTP2_TOKEN__PATH = 3, + NGHTTP2_TOKEN__SCHEME = 5, + NGHTTP2_TOKEN__STATUS = 7, + NGHTTP2_TOKEN_ACCEPT_CHARSET = 14, + NGHTTP2_TOKEN_ACCEPT_ENCODING = 15, + NGHTTP2_TOKEN_ACCEPT_LANGUAGE = 16, + NGHTTP2_TOKEN_ACCEPT_RANGES = 17, + NGHTTP2_TOKEN_ACCEPT = 18, + NGHTTP2_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN = 19, + NGHTTP2_TOKEN_AGE = 20, + NGHTTP2_TOKEN_ALLOW = 21, + NGHTTP2_TOKEN_AUTHORIZATION = 22, + NGHTTP2_TOKEN_CACHE_CONTROL = 23, + NGHTTP2_TOKEN_CONTENT_DISPOSITION = 24, + NGHTTP2_TOKEN_CONTENT_ENCODING = 25, + NGHTTP2_TOKEN_CONTENT_LANGUAGE = 26, + NGHTTP2_TOKEN_CONTENT_LENGTH = 27, + NGHTTP2_TOKEN_CONTENT_LOCATION = 28, + NGHTTP2_TOKEN_CONTENT_RANGE = 29, + NGHTTP2_TOKEN_CONTENT_TYPE = 30, + NGHTTP2_TOKEN_COOKIE = 31, + NGHTTP2_TOKEN_DATE = 32, + NGHTTP2_TOKEN_ETAG = 33, + NGHTTP2_TOKEN_EXPECT = 34, + NGHTTP2_TOKEN_EXPIRES = 35, + NGHTTP2_TOKEN_FROM = 36, + NGHTTP2_TOKEN_HOST = 37, + NGHTTP2_TOKEN_IF_MATCH = 38, + NGHTTP2_TOKEN_IF_MODIFIED_SINCE = 39, + NGHTTP2_TOKEN_IF_NONE_MATCH = 40, + NGHTTP2_TOKEN_IF_RANGE = 41, + NGHTTP2_TOKEN_IF_UNMODIFIED_SINCE = 42, + NGHTTP2_TOKEN_LAST_MODIFIED = 43, + NGHTTP2_TOKEN_LINK = 44, + NGHTTP2_TOKEN_LOCATION = 45, + NGHTTP2_TOKEN_MAX_FORWARDS = 46, + NGHTTP2_TOKEN_PROXY_AUTHENTICATE = 47, + NGHTTP2_TOKEN_PROXY_AUTHORIZATION = 48, + NGHTTP2_TOKEN_RANGE = 49, + NGHTTP2_TOKEN_REFERER = 50, + NGHTTP2_TOKEN_REFRESH = 51, + NGHTTP2_TOKEN_RETRY_AFTER = 52, + NGHTTP2_TOKEN_SERVER = 53, + NGHTTP2_TOKEN_SET_COOKIE = 54, + NGHTTP2_TOKEN_STRICT_TRANSPORT_SECURITY = 55, + NGHTTP2_TOKEN_TRANSFER_ENCODING = 56, + NGHTTP2_TOKEN_USER_AGENT = 57, + NGHTTP2_TOKEN_VARY = 58, + NGHTTP2_TOKEN_VIA = 59, + NGHTTP2_TOKEN_WWW_AUTHENTICATE = 60, + NGHTTP2_TOKEN_TE, + NGHTTP2_TOKEN_CONNECTION, + NGHTTP2_TOKEN_KEEP_ALIVE, + NGHTTP2_TOKEN_PROXY_CONNECTION, + NGHTTP2_TOKEN_UPGRADE, +} nghttp2_token; + +struct nghttp2_hd_entry; +typedef struct nghttp2_hd_entry nghttp2_hd_entry; + +typedef struct { + /* The buffer containing header field name. NULL-termination is + guaranteed. */ + nghttp2_rcbuf *name; + /* The buffer containing header field value. NULL-termination is + guaranteed. */ + nghttp2_rcbuf *value; + /* nghttp2_token value for name. It could be -1 if we have no token + for that header field name. */ + int32_t token; + /* Bitwise OR of one or more of nghttp2_nv_flag. */ + uint8_t flags; +} nghttp2_hd_nv; + +struct nghttp2_hd_entry { + /* The header field name/value pair */ + nghttp2_hd_nv nv; + /* This is solely for nghttp2_hd_{deflate,inflate}_get_table_entry + APIs to keep backward compatibility. */ + nghttp2_nv cnv; + /* The next entry which shares same bucket in hash table. */ + nghttp2_hd_entry *next; + /* The sequence number. We will increment it by one whenever we + store nghttp2_hd_entry to dynamic header table. */ + uint32_t seq; + /* The hash value for header name (nv.name). */ + uint32_t hash; +}; + +/* The entry used for static header table. */ +typedef struct { + nghttp2_rcbuf name; + nghttp2_rcbuf value; + nghttp2_nv cnv; + int32_t token; + uint32_t hash; +} nghttp2_hd_static_entry; + +typedef struct { + nghttp2_hd_entry **buffer; + size_t mask; + size_t first; + size_t len; +} nghttp2_hd_ringbuf; + +typedef enum { + NGHTTP2_HD_OPCODE_NONE, + NGHTTP2_HD_OPCODE_INDEXED, + NGHTTP2_HD_OPCODE_NEWNAME, + NGHTTP2_HD_OPCODE_INDNAME +} nghttp2_hd_opcode; + +typedef enum { + NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE, + NGHTTP2_HD_STATE_INFLATE_START, + NGHTTP2_HD_STATE_OPCODE, + NGHTTP2_HD_STATE_READ_TABLE_SIZE, + NGHTTP2_HD_STATE_READ_INDEX, + NGHTTP2_HD_STATE_NEWNAME_CHECK_NAMELEN, + NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN, + NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF, + NGHTTP2_HD_STATE_NEWNAME_READ_NAME, + NGHTTP2_HD_STATE_CHECK_VALUELEN, + NGHTTP2_HD_STATE_READ_VALUELEN, + NGHTTP2_HD_STATE_READ_VALUEHUFF, + NGHTTP2_HD_STATE_READ_VALUE +} nghttp2_hd_inflate_state; + +typedef enum { + NGHTTP2_HD_WITH_INDEXING, + NGHTTP2_HD_WITHOUT_INDEXING, + NGHTTP2_HD_NEVER_INDEXING +} nghttp2_hd_indexing_mode; + +typedef struct { + /* dynamic header table */ + nghttp2_hd_ringbuf hd_table; + /* Memory allocator */ + nghttp2_mem *mem; + /* Abstract buffer size of hd_table as described in the spec. This + is the sum of length of name/value in hd_table + + NGHTTP2_HD_ENTRY_OVERHEAD bytes overhead per each entry. */ + size_t hd_table_bufsize; + /* The effective header table size. */ + size_t hd_table_bufsize_max; + /* Next sequence number for nghttp2_hd_entry */ + uint32_t next_seq; + /* If inflate/deflate error occurred, this value is set to 1 and + further invocation of inflate/deflate will fail with + NGHTTP2_ERR_HEADER_COMP. */ + uint8_t bad; +} nghttp2_hd_context; + +#define HD_MAP_SIZE 128 + +typedef struct { nghttp2_hd_entry *table[HD_MAP_SIZE]; } nghttp2_hd_map; + +struct nghttp2_hd_deflater { + nghttp2_hd_context ctx; + nghttp2_hd_map map; + /* The upper limit of the header table size the deflater accepts. */ + size_t deflate_hd_table_bufsize_max; + /* Minimum header table size notified in the next context update */ + size_t min_hd_table_bufsize_max; + /* If nonzero, send header table size using encoding context update + in the next deflate process */ + uint8_t notify_table_size_change; +}; + +struct nghttp2_hd_inflater { + nghttp2_hd_context ctx; + /* Stores current state of huffman decoding */ + nghttp2_hd_huff_decode_context huff_decode_ctx; + /* header buffer */ + nghttp2_buf namebuf, valuebuf; + nghttp2_rcbuf *namercbuf, *valuercbuf; + /* Pointer to the name/value pair which are used in the current + header emission. */ + nghttp2_rcbuf *nv_name_keep, *nv_value_keep; + /* The number of bytes to read */ + size_t left; + /* The index in indexed repr or indexed name */ + size_t index; + /* The maximum header table size the inflater supports. This is the + same value transmitted in SETTINGS_HEADER_TABLE_SIZE */ + size_t settings_hd_table_bufsize_max; + /* Minimum header table size set by nghttp2_hd_inflate_change_table_size */ + size_t min_hd_table_bufsize_max; + /* The number of next shift to decode integer */ + size_t shift; + nghttp2_hd_opcode opcode; + nghttp2_hd_inflate_state state; + /* nonzero if string is huffman encoded */ + uint8_t huffman_encoded; + /* nonzero if deflater requires that current entry is indexed */ + uint8_t index_required; + /* nonzero if deflater requires that current entry must not be + indexed */ + uint8_t no_index; +}; + +/* + * Initializes the |ent| members. The reference counts of nv->name + * and nv->value are increased by one for each. + */ +void nghttp2_hd_entry_init(nghttp2_hd_entry *ent, nghttp2_hd_nv *nv); + +/* + * This function decreases the reference counts of nv->name and + * nv->value. + */ +void nghttp2_hd_entry_free(nghttp2_hd_entry *ent); + +/* + * Initializes |deflater| for deflating name/values pairs. + * + * The encoder only uses up to + * NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE bytes for header table + * even if the larger value is specified later in + * nghttp2_hd_change_table_size(). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem); + +/* + * Initializes |deflater| for deflating name/values pairs. + * + * The encoder only uses up to |deflate_hd_table_bufsize_max| bytes + * for header table even if the larger value is specified later in + * nghttp2_hd_change_table_size(). + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, + size_t deflate_hd_table_bufsize_max, + nghttp2_mem *mem); + +/* + * Deallocates any resources allocated for |deflater|. + */ +void nghttp2_hd_deflate_free(nghttp2_hd_deflater *deflater); + +/* + * Deflates the |nva|, which has the |nvlen| name/value pairs, into + * the |bufs|. + * + * This function expands |bufs| as necessary to store the result. If + * buffers is full and the process still requires more space, this + * funtion fails and returns NGHTTP2_ERR_HEADER_COMP. + * + * After this function returns, it is safe to delete the |nva|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_HEADER_COMP + * Deflation process has failed. + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_hd_deflate_hd_bufs(nghttp2_hd_deflater *deflater, + nghttp2_bufs *bufs, const nghttp2_nv *nva, + size_t nvlen); + +/* + * Initializes |inflater| for inflating name/values pairs. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`NGHTTP2_ERR_NOMEM` + * Out of memory. + */ +int nghttp2_hd_inflate_init(nghttp2_hd_inflater *inflater, nghttp2_mem *mem); + +/* + * Deallocates any resources allocated for |inflater|. + */ +void nghttp2_hd_inflate_free(nghttp2_hd_inflater *inflater); + +/* + * Similar to nghttp2_hd_inflate_hd(), but this takes nghttp2_hd_nv + * instead of nghttp2_nv as output parameter |nv_out|. Other than + * that return values and semantics are the same as + * nghttp2_hd_inflate_hd(). + */ +ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, int in_final); + +/* For unittesting purpose */ +int nghttp2_hd_emit_indname_block(nghttp2_bufs *bufs, size_t index, + nghttp2_nv *nv, int indexing_mode); + +/* For unittesting purpose */ +int nghttp2_hd_emit_newname_block(nghttp2_bufs *bufs, nghttp2_nv *nv, + int indexing_mode); + +/* For unittesting purpose */ +int nghttp2_hd_emit_table_size(nghttp2_bufs *bufs, size_t table_size); + +/* For unittesting purpose */ +nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t index); + +/* For unittesting purpose */ +ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *final, + uint32_t initial, size_t shift, uint8_t *in, + uint8_t *last, size_t prefix); + +/* Huffman encoding/decoding functions */ + +/* + * Counts the required bytes to encode |src| with length |len|. + * + * This function returns the number of required bytes to encode given + * data, including padding of prefix of terminal symbol code. This + * function always succeeds. + */ +size_t nghttp2_hd_huff_encode_count(const uint8_t *src, size_t len); + +/* + * Encodes the given data |src| with length |srclen| to the |bufs|. + * This function expands extra buffers in |bufs| if necessary. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_BUFFER_ERROR + * Out of buffer space. + */ +int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src, + size_t srclen); + +void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx); + +/* + * Decodes the given data |src| with length |srclen|. The |ctx| must + * be initialized by nghttp2_hd_huff_decode_context_init(). The result + * will be written to |buf|. This function assumes that |buf| has the + * enough room to store the decoded byte string. + * + * The caller must set the |final| to nonzero if the given input is + * the final block. + * + * This function returns the number of read bytes from the |in|. + * + * If this function fails, it returns one of the following negative + * return codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_HEADER_COMP + * Decoding process has failed. + */ +ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, + nghttp2_buf *buf, const uint8_t *src, + size_t srclen, int final); + +#endif /* NGHTTP2_HD_H */ diff --git a/components/nghttp/include/nghttp2_hd_huffman.h b/components/nghttp/include/nghttp2_hd_huffman.h new file mode 100644 index 0000000000..8332340031 --- /dev/null +++ b/components/nghttp/include/nghttp2_hd_huffman.h @@ -0,0 +1,77 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_HD_HUFFMAN_H +#define NGHTTP2_HD_HUFFMAN_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +typedef enum { + /* FSA accepts this state as the end of huffman encoding + sequence. */ + NGHTTP2_HUFF_ACCEPTED = 1, + /* This state emits symbol */ + NGHTTP2_HUFF_SYM = (1 << 1), + /* If state machine reaches this state, decoding fails. */ + NGHTTP2_HUFF_FAIL = (1 << 2) +} nghttp2_huff_decode_flag; + +typedef struct { + /* huffman decoding state, which is actually the node ID of internal + huffman tree. We have 257 leaf nodes, but they are identical to + root node other than emitting a symbol, so we have 256 internal + nodes [1..255], inclusive. */ + uint8_t state; + /* bitwise OR of zero or more of the nghttp2_huff_decode_flag */ + uint8_t flags; + /* symbol if NGHTTP2_HUFF_SYM flag set */ + uint8_t sym; +} nghttp2_huff_decode; + +typedef nghttp2_huff_decode huff_decode_table_type[16]; + +typedef struct { + /* Current huffman decoding state. We stripped leaf nodes, so the + value range is [0..255], inclusive. */ + uint8_t state; + /* nonzero if we can say that the decoding process succeeds at this + state */ + uint8_t accept; +} nghttp2_hd_huff_decode_context; + +typedef struct { + /* The number of bits in this code */ + uint32_t nbits; + /* Huffman code aligned to LSB */ + uint32_t code; +} nghttp2_huff_sym; + +extern const nghttp2_huff_sym huff_sym_table[]; +extern const nghttp2_huff_decode huff_decode_table[][16]; + +#endif /* NGHTTP2_HD_HUFFMAN_H */ diff --git a/components/nghttp/include/nghttp2_helper.h b/components/nghttp/include/nghttp2_helper.h new file mode 100644 index 0000000000..4a32564f39 --- /dev/null +++ b/components/nghttp/include/nghttp2_helper.h @@ -0,0 +1,122 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_HELPER_H +#define NGHTTP2_HELPER_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include + +#include +#include "nghttp2_mem.h" + +#define nghttp2_min(A, B) ((A) < (B) ? (A) : (B)) +#define nghttp2_max(A, B) ((A) > (B) ? (A) : (B)) + +#define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0) + +#define nghttp2_struct_of(ptr, type, member) \ + ((type *)(void *)((char *)(ptr)-offsetof(type, member))) + +/* + * Copies 2 byte unsigned integer |n| in host byte order to |buf| in + * network byte order. + */ +void nghttp2_put_uint16be(uint8_t *buf, uint16_t n); + +/* + * Copies 4 byte unsigned integer |n| in host byte order to |buf| in + * network byte order. + */ +void nghttp2_put_uint32be(uint8_t *buf, uint32_t n); + +/* + * Retrieves 2 byte unsigned integer stored in |data| in network byte + * order and returns it in host byte order. + */ +uint16_t nghttp2_get_uint16(const uint8_t *data); + +/* + * Retrieves 4 byte unsigned integer stored in |data| in network byte + * order and returns it in host byte order. + */ +uint32_t nghttp2_get_uint32(const uint8_t *data); + +void nghttp2_downcase(uint8_t *s, size_t len); + +/* + * Adjusts |*local_window_size_ptr|, |*recv_window_size_ptr|, + * |*recv_reduction_ptr| with |*delta_ptr| which is the + * WINDOW_UPDATE's window_size_increment sent from local side. If + * |delta| is strictly larger than |*recv_window_size_ptr|, + * |*local_window_size_ptr| is increased by delta - + * *recv_window_size_ptr. If |delta| is negative, + * |*local_window_size_ptr| is decreased by delta. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_FLOW_CONTROL + * local_window_size overflow or gets negative. + */ +int nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr); + +/* + * This function works like nghttp2_adjust_local_window_size(). The + * difference is that this function assumes *delta_ptr >= 0, and + * *recv_window_size_ptr is not decreased by *delta_ptr. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_FLOW_CONTROL + * local_window_size overflow or gets negative. + */ +int nghttp2_increase_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr); + +/* + * Returns non-zero if the function decided that WINDOW_UPDATE should + * be sent. + */ +int nghttp2_should_send_window_update(int32_t local_window_size, + int32_t recv_window_size); + +/* + * Copies the buffer |src| of length |len| to the destination pointed + * by the |dest|, assuming that the |dest| is at lest |len| bytes long + * . Returns dest + len. + */ +uint8_t *nghttp2_cpymem(uint8_t *dest, const void *src, size_t len); + +#endif /* NGHTTP2_HELPER_H */ diff --git a/components/nghttp/include/nghttp2_http.h b/components/nghttp/include/nghttp2_http.h new file mode 100644 index 0000000000..ac684c4d9e --- /dev/null +++ b/components/nghttp/include/nghttp2_http.h @@ -0,0 +1,97 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2015 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_HTTP_H +#define NGHTTP2_HTTP_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_session.h" +#include "nghttp2_stream.h" + +/* + * This function is called when HTTP header field |nv| in |frame| is + * received for |stream|. This function will validate |nv| against + * the current state of stream. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_HTTP_HEADER + * Invalid HTTP header field was received. + * NGHTTP2_ERR_IGN_HTTP_HEADER + * Invalid HTTP header field was received but it can be treated as + * if it was not received because of compatibility reasons. + */ +int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, + nghttp2_frame *frame, nghttp2_hd_nv *nv, + int trailer); + +/* + * This function is called when request header is received. This + * function performs validation and returns 0 if it succeeds, or -1. + */ +int nghttp2_http_on_request_headers(nghttp2_stream *stream, + nghttp2_frame *frame); + +/* + * This function is called when response header is received. This + * function performs validation and returns 0 if it succeeds, or -1. + */ +int nghttp2_http_on_response_headers(nghttp2_stream *stream); + +/* + * This function is called trailer header (for both request and + * response) is received. This function performs validation and + * returns 0 if it succeeds, or -1. + */ +int nghttp2_http_on_trailer_headers(nghttp2_stream *stream, + nghttp2_frame *frame); + +/* + * This function is called when END_STREAM flag is seen in incoming + * frame. This function performs validation and returns 0 if it + * succeeds, or -1. + */ +int nghttp2_http_on_remote_end_stream(nghttp2_stream *stream); + +/* + * This function is called when chunk of data is received. This + * function performs validation and returns 0 if it succeeds, or -1. + */ +int nghttp2_http_on_data_chunk(nghttp2_stream *stream, size_t n); + +/* + * This function inspects header field in |frame| and records its + * method in stream->http_flags. If frame->hd.type is neither + * NGHTTP2_HEADERS nor NGHTTP2_PUSH_PROMISE, this function does + * nothing. + */ +void nghttp2_http_record_request_method(nghttp2_stream *stream, + nghttp2_frame *frame); + +#endif /* NGHTTP2_HTTP_H */ diff --git a/components/nghttp/include/nghttp2_int.h b/components/nghttp/include/nghttp2_int.h new file mode 100644 index 0000000000..c26c8e99a1 --- /dev/null +++ b/components/nghttp/include/nghttp2_int.h @@ -0,0 +1,58 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_INT_H +#define NGHTTP2_INT_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +/* Macros, types and constants for internal use */ + +#ifdef DEBUGBUILD +#define DEBUGF(x) x +#else +#define DEBUGF(x) \ + do { \ + } while (0) +#endif + +/* "less" function, return nonzero if |lhs| is less than |rhs|. */ +typedef int (*nghttp2_less)(const void *lhs, const void *rhs); + +/* Internal error code. They must be in the range [-499, -100], + inclusive. */ +typedef enum { + NGHTTP2_ERR_CREDENTIAL_PENDING = -101, + NGHTTP2_ERR_IGN_HEADER_BLOCK = -103, + NGHTTP2_ERR_IGN_PAYLOAD = -104, + /* + * Invalid HTTP header field was received but it can be treated as + * if it was not received because of compatibility reasons. + */ + NGHTTP2_ERR_IGN_HTTP_HEADER = -105 +} nghttp2_internal_error; + +#endif /* NGHTTP2_INT_H */ diff --git a/components/nghttp/include/nghttp2_map.h b/components/nghttp/include/nghttp2_map.h new file mode 100644 index 0000000000..21262488d6 --- /dev/null +++ b/components/nghttp/include/nghttp2_map.h @@ -0,0 +1,144 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_MAP_H +#define NGHTTP2_MAP_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_int.h" +#include "nghttp2_mem.h" + +/* Implementation of unordered map */ + +typedef int32_t key_type; + +typedef struct nghttp2_map_entry { + struct nghttp2_map_entry *next; + key_type key; +#if SIZEOF_INT_P == 4 + /* we requires 8 bytes aligment */ + int64_t pad; +#endif +} nghttp2_map_entry; + +typedef struct { + nghttp2_map_entry **table; + nghttp2_mem *mem; + size_t size; + uint32_t tablelen; +} nghttp2_map; + +/* + * Initializes the map |map|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_map_init(nghttp2_map *map, nghttp2_mem *mem); + +/* + * Deallocates any resources allocated for |map|. The stored entries + * are not freed by this function. Use nghttp2_map_each_free() to free + * each entries. + */ +void nghttp2_map_free(nghttp2_map *map); + +/* + * Deallocates each entries using |func| function and any resources + * allocated for |map|. The |func| function is responsible for freeing + * given the |entry| object. The |ptr| will be passed to the |func| as + * send argument. The return value of the |func| will be ignored. + */ +void nghttp2_map_each_free(nghttp2_map *map, + int (*func)(nghttp2_map_entry *entry, void *ptr), + void *ptr); + +/* + * Initializes the |entry| with the |key|. All entries to be inserted + * to the map must be initialized with this function. + */ +void nghttp2_map_entry_init(nghttp2_map_entry *entry, key_type key); + +/* + * Inserts the new |entry| with the key |entry->key| to the map |map|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_INVALID_ARGUMENT + * The item associated by |key| already exists. + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_map_insert(nghttp2_map *map, nghttp2_map_entry *entry); + +/* + * Returns the entry associated by the key |key|. If there is no such + * entry, this function returns NULL. + */ +nghttp2_map_entry *nghttp2_map_find(nghttp2_map *map, key_type key); + +/* + * Removes the entry associated by the key |key| from the |map|. The + * removed entry is not freed by this function. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_INVALID_ARGUMENT + * The entry associated by |key| does not exist. + */ +int nghttp2_map_remove(nghttp2_map *map, key_type key); + +/* + * Returns the number of items stored in the map |map|. + */ +size_t nghttp2_map_size(nghttp2_map *map); + +/* + * Applies the function |func| to each entry in the |map| with the + * optional user supplied pointer |ptr|. + * + * If the |func| returns 0, this function calls the |func| with the + * next entry. If the |func| returns nonzero, it will not call the + * |func| for further entries and return the return value of the + * |func| immediately. Thus, this function returns 0 if all the + * invocations of the |func| return 0, or nonzero value which the last + * invocation of |func| returns. + * + * Don't use this function to free each entry. Use + * nghttp2_map_each_free() instead. + */ +int nghttp2_map_each(nghttp2_map *map, + int (*func)(nghttp2_map_entry *entry, void *ptr), + void *ptr); + +#endif /* NGHTTP2_MAP_H */ diff --git a/components/nghttp/include/nghttp2_mem.h b/components/nghttp/include/nghttp2_mem.h new file mode 100644 index 0000000000..2d1bd6a0f4 --- /dev/null +++ b/components/nghttp/include/nghttp2_mem.h @@ -0,0 +1,45 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_MEM_H +#define NGHTTP2_MEM_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +/* The default, system standard memory allocator */ +nghttp2_mem *nghttp2_mem_default(void); + +/* Convenient wrapper functions to call allocator function in + |mem|. */ +void *nghttp2_mem_malloc(nghttp2_mem *mem, size_t size); +void nghttp2_mem_free(nghttp2_mem *mem, void *ptr); +void nghttp2_mem_free2(nghttp2_free free_func, void *ptr, void *mem_user_data); +void *nghttp2_mem_calloc(nghttp2_mem *mem, size_t nmemb, size_t size); +void *nghttp2_mem_realloc(nghttp2_mem *mem, void *ptr, size_t size); + +#endif /* NGHTTP2_MEM_H */ diff --git a/components/nghttp/include/nghttp2_net.h b/components/nghttp/include/nghttp2_net.h new file mode 100644 index 0000000000..587f4189fd --- /dev/null +++ b/components/nghttp/include/nghttp2_net.h @@ -0,0 +1,91 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_NET_H +#define NGHTTP2_NET_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#ifdef HAVE_ARPA_INET_H +#include +#endif /* HAVE_ARPA_INET_H */ + +#ifdef HAVE_NETINET_IN_H +#include +#endif /* HAVE_NETINET_IN_H */ + +#include + +#if defined(WIN32) +/* Windows requires ws2_32 library for ntonl family functions. We + define inline functions for those function so that we don't have + dependeny on that lib. */ + +#ifdef _MSC_VER +#define STIN static __inline +#else +#define STIN static inline +#endif + +STIN uint32_t htonl(uint32_t hostlong) { + uint32_t res; + unsigned char *p = (unsigned char *)&res; + *p++ = hostlong >> 24; + *p++ = (hostlong >> 16) & 0xffu; + *p++ = (hostlong >> 8) & 0xffu; + *p = hostlong & 0xffu; + return res; +} + +STIN uint16_t htons(uint16_t hostshort) { + uint16_t res; + unsigned char *p = (unsigned char *)&res; + *p++ = hostshort >> 8; + *p = hostshort & 0xffu; + return res; +} + +STIN uint32_t ntohl(uint32_t netlong) { + uint32_t res; + unsigned char *p = (unsigned char *)&netlong; + res = *p++ << 24; + res += *p++ << 16; + res += *p++ << 8; + res += *p; + return res; +} + +STIN uint16_t ntohs(uint16_t netshort) { + uint16_t res; + unsigned char *p = (unsigned char *)&netshort; + res = *p++ << 8; + res += *p; + return res; +} + +#endif /* WIN32 */ + +#endif /* NGHTTP2_NET_H */ diff --git a/components/nghttp/include/nghttp2_npn.h b/components/nghttp/include/nghttp2_npn.h new file mode 100644 index 0000000000..a481bde350 --- /dev/null +++ b/components/nghttp/include/nghttp2_npn.h @@ -0,0 +1,34 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_NPN_H +#define NGHTTP2_NPN_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +#endif /* NGHTTP2_NPN_H */ diff --git a/components/nghttp/include/nghttp2_option.h b/components/nghttp/include/nghttp2_option.h new file mode 100644 index 0000000000..fb79b9202d --- /dev/null +++ b/components/nghttp/include/nghttp2_option.h @@ -0,0 +1,116 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_OPTION_H +#define NGHTTP2_OPTION_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +/** + * Configuration options + */ +typedef enum { + /** + * This option prevents the library from sending WINDOW_UPDATE for a + * connection automatically. If this option is set to nonzero, the + * library won't send WINDOW_UPDATE for DATA until application calls + * nghttp2_session_consume() to indicate the amount of consumed + * DATA. By default, this option is set to zero. + */ + NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE = 1, + /** + * This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of + * remote endpoint as if it is received in SETTINGS frame. Without + * specifying this option, before the local endpoint receives + * SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame from remote + * endpoint, SETTINGS_MAX_CONCURRENT_STREAMS is unlimited. This may + * cause problem if local endpoint submits lots of requests + * initially and sending them at once to the remote peer may lead to + * the rejection of some requests. Specifying this option to the + * sensible value, say 100, may avoid this kind of issue. This value + * will be overwritten if the local endpoint receives + * SETTINGS_MAX_CONCURRENT_STREAMS from the remote endpoint. + */ + NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS = 1 << 1, + NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC = 1 << 2, + NGHTTP2_OPT_NO_HTTP_MESSAGING = 1 << 3, + NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS = 1 << 4, + NGHTTP2_OPT_USER_RECV_EXT_TYPES = 1 << 5, + NGHTTP2_OPT_NO_AUTO_PING_ACK = 1 << 6, + NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES = 1 << 7, + NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH = 1 << 8, +} nghttp2_option_flag; + +/** + * Struct to store option values for nghttp2_session. + */ +struct nghttp2_option { + /** + * NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH + */ + size_t max_send_header_block_length; + /** + * Bitwise OR of nghttp2_option_flag to determine that which fields + * are specified. + */ + uint32_t opt_set_mask; + /** + * NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS + */ + uint32_t peer_max_concurrent_streams; + /** + * NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS + */ + uint32_t max_reserved_remote_streams; + /** + * NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES + */ + uint32_t builtin_recv_ext_types; + /** + * NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE + */ + int no_auto_window_update; + /** + * NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC + */ + int no_recv_client_magic; + /** + * NGHTTP2_OPT_NO_HTTP_MESSAGING + */ + int no_http_messaging; + /** + * NGHTTP2_OPT_NO_AUTO_PING_ACK + */ + int no_auto_ping_ack; + /** + * NGHTTP2_OPT_USER_RECV_EXT_TYPES + */ + uint8_t user_recv_ext_types[32]; +}; + +#endif /* NGHTTP2_OPTION_H */ diff --git a/components/nghttp/include/nghttp2_outbound_item.h b/components/nghttp/include/nghttp2_outbound_item.h new file mode 100644 index 0000000000..8bda776bfe --- /dev/null +++ b/components/nghttp/include/nghttp2_outbound_item.h @@ -0,0 +1,166 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_OUTBOUND_ITEM_H +#define NGHTTP2_OUTBOUND_ITEM_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_frame.h" +#include "nghttp2_mem.h" + +/* struct used for HEADERS and PUSH_PROMISE frame */ +typedef struct { + nghttp2_data_provider data_prd; + void *stream_user_data; + /* error code when request HEADERS is canceled by RST_STREAM while + it is in queue. */ + uint32_t error_code; + /* nonzero if request HEADERS is canceled. The error code is stored + in |error_code|. */ + uint8_t canceled; +} nghttp2_headers_aux_data; + +/* struct used for DATA frame */ +typedef struct { + /** + * The data to be sent for this DATA frame. + */ + nghttp2_data_provider data_prd; + /** + * The flags of DATA frame. We use separate flags here and + * nghttp2_data frame. The latter contains flags actually sent to + * peer. This |flags| may contain NGHTTP2_FLAG_END_STREAM and only + * when |eof| becomes nonzero, flags in nghttp2_data has + * NGHTTP2_FLAG_END_STREAM set. + */ + uint8_t flags; + /** + * The flag to indicate whether EOF was reached or not. Initially + * |eof| is 0. It becomes 1 after all data were read. + */ + uint8_t eof; + /** + * The flag to indicate that NGHTTP2_DATA_FLAG_NO_COPY is used. + */ + uint8_t no_copy; +} nghttp2_data_aux_data; + +typedef enum { + NGHTTP2_GOAWAY_AUX_NONE = 0x0, + /* indicates that session should be terminated after the + transmission of this frame. */ + NGHTTP2_GOAWAY_AUX_TERM_ON_SEND = 0x1, + /* indicates that this GOAWAY is just a notification for graceful + shutdown. No nghttp2_session.goaway_flags should be updated on + the reaction to this frame. */ + NGHTTP2_GOAWAY_AUX_SHUTDOWN_NOTICE = 0x2 +} nghttp2_goaway_aux_flag; + +/* struct used for GOAWAY frame */ +typedef struct { + /* bitwise-OR of one or more of nghttp2_goaway_aux_flag. */ + uint8_t flags; +} nghttp2_goaway_aux_data; + +/* struct used for extension frame */ +typedef struct { + /* nonzero if this extension frame is serialized by library + function, instead of user-defined callbacks. */ + uint8_t builtin; +} nghttp2_ext_aux_data; + +/* Additional data which cannot be stored in nghttp2_frame struct */ +typedef union { + nghttp2_data_aux_data data; + nghttp2_headers_aux_data headers; + nghttp2_goaway_aux_data goaway; + nghttp2_ext_aux_data ext; +} nghttp2_aux_data; + +struct nghttp2_outbound_item; +typedef struct nghttp2_outbound_item nghttp2_outbound_item; + +struct nghttp2_outbound_item { + nghttp2_frame frame; + /* Storage for extension frame payload. frame->ext.payload points + to this structure to avoid frequent memory allocation. */ + nghttp2_ext_frame_payload ext_frame_payload; + nghttp2_aux_data aux_data; + /* The priority used in priority comparion. Smaller is served + ealier. For PING, SETTINGS and non-DATA frames (excluding + response HEADERS frame) have dedicated cycle value defined above. + For DATA frame, cycle is computed by taking into account of + effective weight and frame payload length previously sent, so + that the amount of transmission is distributed across streams + proportional to effective weight (inside a tree). */ + uint64_t cycle; + nghttp2_outbound_item *qnext; + /* nonzero if this object is queued, except for DATA or HEADERS + which are attached to stream as item. */ + uint8_t queued; +}; + +/* + * Initializes |item|. No memory allocation is done in this function. + * Don't call nghttp2_outbound_item_free() until frame member is + * initialized. + */ +void nghttp2_outbound_item_init(nghttp2_outbound_item *item); + +/* + * Deallocates resource for |item|. If |item| is NULL, this function + * does nothing. + */ +void nghttp2_outbound_item_free(nghttp2_outbound_item *item, nghttp2_mem *mem); + +/* + * queue for nghttp2_outbound_item. + */ +typedef struct { + nghttp2_outbound_item *head, *tail; + /* number of items in this queue. */ + size_t n; +} nghttp2_outbound_queue; + +void nghttp2_outbound_queue_init(nghttp2_outbound_queue *q); + +/* Pushes |item| into |q| */ +void nghttp2_outbound_queue_push(nghttp2_outbound_queue *q, + nghttp2_outbound_item *item); + +/* Pops |item| at the top from |q|. If |q| is empty, nothing + happens. */ +void nghttp2_outbound_queue_pop(nghttp2_outbound_queue *q); + +/* Returns the top item. */ +#define nghttp2_outbound_queue_top(Q) ((Q)->head) + +/* Returns the size of the queue */ +#define nghttp2_outbound_queue_size(Q) ((Q)->n) + +#endif /* NGHTTP2_OUTBOUND_ITEM_H */ diff --git a/components/nghttp/include/nghttp2_pq.h b/components/nghttp/include/nghttp2_pq.h new file mode 100644 index 0000000000..6b0ecfb476 --- /dev/null +++ b/components/nghttp/include/nghttp2_pq.h @@ -0,0 +1,128 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_PQ_H +#define NGHTTP2_PQ_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_int.h" +#include "nghttp2_mem.h" + +/* Implementation of priority queue */ + +typedef struct { size_t index; } nghttp2_pq_entry; + +typedef struct { + /* The pointer to the pointer to the item stored */ + nghttp2_pq_entry **q; + /* Memory allocator */ + nghttp2_mem *mem; + /* The number of items sotred */ + size_t length; + /* The maximum number of items this pq can store. This is + automatically extended when length is reached to this value. */ + size_t capacity; + /* The less function between items */ + nghttp2_less less; +} nghttp2_pq; + +/* + * Initializes priority queue |pq| with compare function |cmp|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem); + +/* + * Deallocates any resources allocated for |pq|. The stored items are + * not freed by this function. + */ +void nghttp2_pq_free(nghttp2_pq *pq); + +/* + * Adds |item| to the priority queue |pq|. + * + * This function returns 0 if it succeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_pq_push(nghttp2_pq *pq, nghttp2_pq_entry *item); + +/* + * Returns item at the top of the queue |pq|. If the queue is empty, + * this function returns NULL. + */ +nghttp2_pq_entry *nghttp2_pq_top(nghttp2_pq *pq); + +/* + * Pops item at the top of the queue |pq|. The popped item is not + * freed by this function. + */ +void nghttp2_pq_pop(nghttp2_pq *pq); + +/* + * Returns nonzero if the queue |pq| is empty. + */ +int nghttp2_pq_empty(nghttp2_pq *pq); + +/* + * Returns the number of items in the queue |pq|. + */ +size_t nghttp2_pq_size(nghttp2_pq *pq); + +typedef int (*nghttp2_pq_item_cb)(nghttp2_pq_entry *item, void *arg); + +/* + * Updates each item in |pq| using function |fun| and re-construct + * priority queue. The |fun| must return non-zero if it modifies the + * item in a way that it affects ordering in the priority queue. The + * |arg| is passed to the 2nd parameter of |fun|. + */ +void nghttp2_pq_update(nghttp2_pq *pq, nghttp2_pq_item_cb fun, void *arg); + +/* + * Applys |fun| to each item in |pq|. The |arg| is passed as arg + * parameter to callback function. This function must not change the + * ordering key. If the return value from callback is nonzero, this + * function returns 1 immediately without iterating remaining items. + * Otherwise this function returns 0. + */ +int nghttp2_pq_each(nghttp2_pq *pq, nghttp2_pq_item_cb fun, void *arg); + +/* + * Removes |item| from priority queue. + */ +void nghttp2_pq_remove(nghttp2_pq *pq, nghttp2_pq_entry *item); + +#endif /* NGHTTP2_PQ_H */ diff --git a/components/nghttp/include/nghttp2_priority_spec.h b/components/nghttp/include/nghttp2_priority_spec.h new file mode 100644 index 0000000000..98fac21060 --- /dev/null +++ b/components/nghttp/include/nghttp2_priority_spec.h @@ -0,0 +1,42 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_PRIORITY_SPEC_H +#define NGHTTP2_PRIORITY_SPEC_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +/* + * This function normalizes pri_spec->weight if it is out of range. + * If pri_spec->weight is less than NGHTTP2_MIN_WEIGHT, it is set to + * NGHTTP2_MIN_WEIGHT. If pri_spec->weight is larger than + * NGHTTP2_MAX_WEIGHT, it is set to NGHTTP2_MAX_WEIGHT. + */ +void nghttp2_priority_spec_normalize_weight(nghttp2_priority_spec *pri_spec); + +#endif /* NGHTTP2_PRIORITY_SPEC_H */ diff --git a/components/nghttp/include/nghttp2_queue.h b/components/nghttp/include/nghttp2_queue.h new file mode 100644 index 0000000000..d872b07bde --- /dev/null +++ b/components/nghttp/include/nghttp2_queue.h @@ -0,0 +1,49 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_QUEUE_H +#define NGHTTP2_QUEUE_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include + +typedef struct nghttp2_queue_cell { + void *data; + struct nghttp2_queue_cell *next; +} nghttp2_queue_cell; + +typedef struct { nghttp2_queue_cell *front, *back; } nghttp2_queue; + +void nghttp2_queue_init(nghttp2_queue *queue); +void nghttp2_queue_free(nghttp2_queue *queue); +int nghttp2_queue_push(nghttp2_queue *queue, void *data); +void nghttp2_queue_pop(nghttp2_queue *queue); +void *nghttp2_queue_front(nghttp2_queue *queue); +void *nghttp2_queue_back(nghttp2_queue *queue); +int nghttp2_queue_empty(nghttp2_queue *queue); + +#endif /* NGHTTP2_QUEUE_H */ diff --git a/components/nghttp/include/nghttp2_rcbuf.h b/components/nghttp/include/nghttp2_rcbuf.h new file mode 100644 index 0000000000..29d1543e2c --- /dev/null +++ b/components/nghttp/include/nghttp2_rcbuf.h @@ -0,0 +1,80 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_RCBUF_H +#define NGHTTP2_RCBUF_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +struct nghttp2_rcbuf { + /* custom memory allocator belongs to the mem parameter when + creating this object. */ + void *mem_user_data; + nghttp2_free free; + /* The pointer to the underlying buffer */ + uint8_t *base; + /* Size of buffer pointed by |base|. */ + size_t len; + /* Reference count */ + int32_t ref; +}; + +/* + * Allocates nghttp2_rcbuf object with |size| as initial buffer size. + * When the function succeeds, the reference count becomes 1. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM: + * Out of memory. + */ +int nghttp2_rcbuf_new(nghttp2_rcbuf **rcbuf_ptr, size_t size, nghttp2_mem *mem); + +/* + * Like nghttp2_rcbuf_new(), but initializes the buffer with |src| of + * length |srclen|. This function allocates additional byte at the + * end and puts '\0' into it, so that the resulting buffer could be + * used as NULL-terminated string. Still (*rcbuf_ptr)->len equals to + * |srclen|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM: + * Out of memory. + */ +int nghttp2_rcbuf_new2(nghttp2_rcbuf **rcbuf_ptr, const uint8_t *src, + size_t srclen, nghttp2_mem *mem); + +/* + * Frees |rcbuf| itself, regardless of its reference cout. + */ +void nghttp2_rcbuf_del(nghttp2_rcbuf *rcbuf); + +#endif /* NGHTTP2_RCBUF_H */ diff --git a/components/nghttp/include/nghttp2_session.h b/components/nghttp/include/nghttp2_session.h new file mode 100644 index 0000000000..5347002827 --- /dev/null +++ b/components/nghttp/include/nghttp2_session.h @@ -0,0 +1,878 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_SESSION_H +#define NGHTTP2_SESSION_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_map.h" +#include "nghttp2_frame.h" +#include "nghttp2_hd.h" +#include "nghttp2_stream.h" +#include "nghttp2_outbound_item.h" +#include "nghttp2_int.h" +#include "nghttp2_buf.h" +#include "nghttp2_callbacks.h" +#include "nghttp2_mem.h" + +/* The global variable for tests where we want to disable strict + preface handling. */ +extern int nghttp2_enable_strict_preface; + +/* + * Option flags. + */ +typedef enum { + NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE = 1 << 0, + NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC = 1 << 1, + NGHTTP2_OPTMASK_NO_HTTP_MESSAGING = 1 << 2, + NGHTTP2_OPTMASK_NO_AUTO_PING_ACK = 1 << 3 +} nghttp2_optmask; + +/* + * bitmask for built-in type to enable the default handling for that + * type of the frame. + */ +typedef enum { + NGHTTP2_TYPEMASK_NONE = 0, + NGHTTP2_TYPEMASK_ALTSVC = 1 << 0 +} nghttp2_typemask; + +typedef enum { + NGHTTP2_OB_POP_ITEM, + NGHTTP2_OB_SEND_DATA, + NGHTTP2_OB_SEND_NO_COPY, + NGHTTP2_OB_SEND_CLIENT_MAGIC +} nghttp2_outbound_state; + +typedef struct { + nghttp2_outbound_item *item; + nghttp2_bufs framebufs; + nghttp2_outbound_state state; +} nghttp2_active_outbound_item; + +/* Buffer length for inbound raw byte stream used in + nghttp2_session_recv(). */ +#define NGHTTP2_INBOUND_BUFFER_LENGTH 3072//16384--LiuHan/08.12 + +/* The default maximum number of incoming reserved streams */ +#define NGHTTP2_MAX_INCOMING_RESERVED_STREAMS 200 + +/* Even if we have less SETTINGS_MAX_CONCURRENT_STREAMS than this + number, we keep NGHTTP2_MIN_IDLE_STREAMS streams in idle state */ +#define NGHTTP2_MIN_IDLE_STREAMS 16 + +/* The maximum number of items in outbound queue, which is considered + as flooding caused by peer. All frames are not considered here. + We only consider PING + ACK and SETTINGS + ACK. This is because + they both are response to the frame initiated by peer and peer can + send as many of them as they want. If peer does not read network, + response frames are stacked up, which leads to memory exhaustion. + The value selected here is arbitrary, but safe value and if we have + these frames in this number, it is considered suspicious. */ +#define NGHTTP2_MAX_OBQ_FLOOD_ITEM 10000 + +/* The default value of maximum number of concurrent streams. */ +#define NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS 0xffffffffu + +/* Internal state when receiving incoming frame */ +typedef enum { + /* Receiving frame header */ + NGHTTP2_IB_READ_CLIENT_MAGIC, + NGHTTP2_IB_READ_FIRST_SETTINGS, + NGHTTP2_IB_READ_HEAD, + NGHTTP2_IB_READ_NBYTE, + NGHTTP2_IB_READ_HEADER_BLOCK, + NGHTTP2_IB_IGN_HEADER_BLOCK, + NGHTTP2_IB_IGN_PAYLOAD, + NGHTTP2_IB_FRAME_SIZE_ERROR, + NGHTTP2_IB_READ_SETTINGS, + NGHTTP2_IB_READ_GOAWAY_DEBUG, + NGHTTP2_IB_EXPECT_CONTINUATION, + NGHTTP2_IB_IGN_CONTINUATION, + NGHTTP2_IB_READ_PAD_DATA, + NGHTTP2_IB_READ_DATA, + NGHTTP2_IB_IGN_DATA, + NGHTTP2_IB_IGN_ALL, + NGHTTP2_IB_READ_ALTSVC_PAYLOAD, + NGHTTP2_IB_READ_EXTENSION_PAYLOAD +} nghttp2_inbound_state; + +typedef struct { + nghttp2_frame frame; + /* Storage for extension frame payload. frame->ext.payload points + to this structure to avoid frequent memory allocation. */ + nghttp2_ext_frame_payload ext_frame_payload; + /* The received SETTINGS entry. For the standard settings entries, + we only keep the last seen value. For + SETTINGS_HEADER_TABLE_SIZE, we also keep minimum value in the + last index. */ + nghttp2_settings_entry *iv; + /* buffer pointers to small buffer, raw_sbuf */ + nghttp2_buf sbuf; + /* buffer pointers to large buffer, raw_lbuf */ + nghttp2_buf lbuf; + /* Large buffer, malloced on demand */ + uint8_t *raw_lbuf; + /* The number of entry filled in |iv| */ + size_t niv; + /* The number of entries |iv| can store. */ + size_t max_niv; + /* How many bytes we still need to receive for current frame */ + size_t payloadleft; + /* padding length for the current frame */ + size_t padlen; + nghttp2_inbound_state state; + /* Small buffer. Currently the largest contiguous chunk to buffer + is frame header. We buffer part of payload, but they are smaller + than frame header. */ + uint8_t raw_sbuf[NGHTTP2_FRAME_HDLEN]; +} nghttp2_inbound_frame; + +typedef struct { + uint32_t header_table_size; + uint32_t enable_push; + uint32_t max_concurrent_streams; + uint32_t initial_window_size; + uint32_t max_frame_size; + uint32_t max_header_list_size; +} nghttp2_settings_storage; + +typedef enum { + NGHTTP2_GOAWAY_NONE = 0, + /* Flag means that connection should be terminated after sending GOAWAY. */ + NGHTTP2_GOAWAY_TERM_ON_SEND = 0x1, + /* Flag means GOAWAY to terminate session has been sent */ + NGHTTP2_GOAWAY_TERM_SENT = 0x2, + /* Flag means GOAWAY was sent */ + NGHTTP2_GOAWAY_SENT = 0x4, + /* Flag means GOAWAY was received */ + NGHTTP2_GOAWAY_RECV = 0x8 +} nghttp2_goaway_flag; + +/* nghttp2_inflight_settings stores the SETTINGS entries which local + endpoint has sent to the remote endpoint, and has not received ACK + yet. */ +struct nghttp2_inflight_settings { + struct nghttp2_inflight_settings *next; + nghttp2_settings_entry *iv; + size_t niv; +}; + +typedef struct nghttp2_inflight_settings nghttp2_inflight_settings; + +struct nghttp2_session { + nghttp2_map /* */ streams; + /* root of dependency tree*/ + nghttp2_stream root; + /* Queue for outbound urgent frames (PING and SETTINGS) */ + nghttp2_outbound_queue ob_urgent; + /* Queue for non-DATA frames */ + nghttp2_outbound_queue ob_reg; + /* Queue for outbound stream-creating HEADERS (request or push + response) frame, which are subject to + SETTINGS_MAX_CONCURRENT_STREAMS limit. */ + nghttp2_outbound_queue ob_syn; + nghttp2_active_outbound_item aob; + nghttp2_inbound_frame iframe; + nghttp2_hd_deflater hd_deflater; + nghttp2_hd_inflater hd_inflater; + nghttp2_session_callbacks callbacks; + /* Memory allocator */ + nghttp2_mem mem; + /* Base value when we schedule next DATA frame write. This is + updated when one frame was written. */ + uint64_t last_cycle; + void *user_data; + /* Points to the latest incoming closed stream. NULL if there is no + closed stream. Only used when session is initialized as + server. */ + nghttp2_stream *closed_stream_head; + /* Points to the oldest incoming closed stream. NULL if there is no + closed stream. Only used when session is initialized as + server. */ + nghttp2_stream *closed_stream_tail; + /* Points to the latest idle stream. NULL if there is no idle + stream. Only used when session is initialized as server .*/ + nghttp2_stream *idle_stream_head; + /* Points to the oldest idle stream. NULL if there is no idle + stream. Only used when session is initialized as erver. */ + nghttp2_stream *idle_stream_tail; + /* Queue of In-flight SETTINGS values. SETTINGS bearing ACK is not + considered as in-flight. */ + nghttp2_inflight_settings *inflight_settings_head; + /* The number of outgoing streams. This will be capped by + remote_settings.max_concurrent_streams. */ + size_t num_outgoing_streams; + /* The number of incoming streams. This will be capped by + local_settings.max_concurrent_streams. */ + size_t num_incoming_streams; + /* The number of incoming reserved streams. This is the number of + streams in reserved (remote) state. RFC 7540 does not limit this + number. nghttp2 offers + nghttp2_option_set_max_reserved_remote_streams() to achieve this. + If it is used, num_incoming_streams is capped by + max_incoming_reserved_streams. Client application should + consider to set this because without that server can send + arbitrary number of PUSH_PROMISE, and exhaust client's memory. */ + size_t num_incoming_reserved_streams; + /* The maximum number of incoming reserved streams (reserved + (remote) state). RST_STREAM will be sent for the pushed stream + which exceeds this limit. */ + size_t max_incoming_reserved_streams; + /* The number of closed streams still kept in |streams| hash. The + closed streams can be accessed through single linked list + |closed_stream_head|. The current implementation only keeps + incoming streams and session is initialized as server. */ + size_t num_closed_streams; + /* The number of idle streams kept in |streams| hash. The idle + streams can be accessed through doubly linked list + |idle_stream_head|. The current implementation only keeps idle + streams if session is initialized as server. */ + size_t num_idle_streams; + /* The number of bytes allocated for nvbuf */ + size_t nvbuflen; + /* Counter for detecting flooding in outbound queue */ + size_t obq_flood_counter_; + /* The maximum length of header block to send. Calculated by the + same way as nghttp2_hd_deflate_bound() does. */ + size_t max_send_header_block_length; + /* Next Stream ID. Made unsigned int to detect >= (1 << 31). */ + uint32_t next_stream_id; + /* The last stream ID this session initiated. For client session, + this is the last stream ID it has sent. For server session, it + is the last promised stream ID sent in PUSH_PROMISE. */ + int32_t last_sent_stream_id; + /* The largest stream ID received so far */ + int32_t last_recv_stream_id; + /* The largest stream ID which has been processed in some way. This + value will be used as last-stream-id when sending GOAWAY + frame. */ + int32_t last_proc_stream_id; + /* Counter of unique ID of PING. Wraps when it exceeds + NGHTTP2_MAX_UNIQUE_ID */ + uint32_t next_unique_id; + /* This is the last-stream-ID we have sent in GOAWAY */ + int32_t local_last_stream_id; + /* This is the value in GOAWAY frame received from remote endpoint. */ + int32_t remote_last_stream_id; + /* Current sender window size. This value is computed against the + current initial window size of remote endpoint. */ + int32_t remote_window_size; + /* Keep track of the number of bytes received without + WINDOW_UPDATE. This could be negative after submitting negative + value to WINDOW_UPDATE. */ + int32_t recv_window_size; + /* The number of bytes consumed by the application and now is + subject to WINDOW_UPDATE. This is only used when auto + WINDOW_UPDATE is turned off. */ + int32_t consumed_size; + /* The amount of recv_window_size cut using submitting negative + value to WINDOW_UPDATE */ + int32_t recv_reduction; + /* window size for local flow control. It is initially set to + NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE and could be + increased/decreased by submitting WINDOW_UPDATE. See + nghttp2_submit_window_update(). */ + int32_t local_window_size; + /* Settings value received from the remote endpoint. We just use ID + as index. The index = 0 is unused. */ + nghttp2_settings_storage remote_settings; + /* Settings value of the local endpoint. */ + nghttp2_settings_storage local_settings; + /* Option flags. This is bitwise-OR of 0 or more of nghttp2_optmask. */ + uint32_t opt_flags; + /* Unacked local SETTINGS_MAX_CONCURRENT_STREAMS value. We use this + to refuse the incoming stream if it exceeds this value. */ + uint32_t pending_local_max_concurrent_stream; + /* The bitwose OR of zero or more of nghttp2_typemask to indicate + that the default handling of extension frame is enabled. */ + uint32_t builtin_recv_ext_types; + /* Unacked local ENABLE_PUSH value. We use this to refuse + PUSH_PROMISE before SETTINGS ACK is received. */ + uint8_t pending_enable_push; + /* Nonzero if the session is server side. */ + uint8_t server; + /* Flags indicating GOAWAY is sent and/or recieved. The flags are + composed by bitwise OR-ing nghttp2_goaway_flag. */ + uint8_t goaway_flags; + /* This flag is used to reduce excessive queuing of WINDOW_UPDATE to + this session. The nonzero does not necessarily mean + WINDOW_UPDATE is not queued. */ + uint8_t window_update_queued; + /* Bitfield of extension frame types that application is willing to + receive. To designate the bit of given frame type i, use + user_recv_ext_types[i / 8] & (1 << (i & 0x7)). First 10 frame + types are standard frame types and not used in this bitfield. If + bit is set, it indicates that incoming frame with that type is + passed to user defined callbacks, otherwise they are ignored. */ + uint8_t user_recv_ext_types[32]; +}; + +/* Struct used when updating initial window size of each active + stream. */ +typedef struct { + nghttp2_session *session; + int32_t new_window_size, old_window_size; +} nghttp2_update_window_size_arg; + +typedef struct { + nghttp2_session *session; + /* linked list of streams to close */ + nghttp2_stream *head; + int32_t last_stream_id; + /* nonzero if GOAWAY is sent to peer, which means we are going to + close incoming streams. zero if GOAWAY is received from peer and + we are going to close outgoing streams. */ + int incoming; +} nghttp2_close_stream_on_goaway_arg; + +/* TODO stream timeout etc */ + +/* + * Returns nonzero value if |stream_id| is initiated by local + * endpoint. + */ +int nghttp2_session_is_my_stream_id(nghttp2_session *session, + int32_t stream_id); + +/* + * Adds |item| to the outbound queue in |session|. When this function + * succeeds, it takes ownership of |item|. So caller must not free it + * on success. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_STREAM_CLOSED + * Stream already closed (DATA and PUSH_PROMISE frame only) + */ +int nghttp2_session_add_item(nghttp2_session *session, + nghttp2_outbound_item *item); + +/* + * Adds RST_STREAM frame for the stream |stream_id| with the error + * code |error_code|. This is a convenient function built on top of + * nghttp2_session_add_frame() to add RST_STREAM easily. + * + * This function simply returns 0 without adding RST_STREAM frame if + * given stream is in NGHTTP2_STREAM_CLOSING state, because multiple + * RST_STREAM for a stream is redundant. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id, + uint32_t error_code); + +/* + * Adds PING frame. This is a convenient functin built on top of + * nghttp2_session_add_frame() to add PING easily. + * + * If the |opaque_data| is not NULL, it must point to 8 bytes memory + * region of data. The data pointed by |opaque_data| is copied. It can + * be NULL. In this case, 8 bytes NULL is used. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_FLOODED + * There are too many items in outbound queue; this only happens + * if NGHTTP2_FLAG_ACK is set in |flags| + */ +int nghttp2_session_add_ping(nghttp2_session *session, uint8_t flags, + const uint8_t *opaque_data); + +/* + * Adds GOAWAY frame with the last-stream-ID |last_stream_id| and the + * error code |error_code|. This is a convenient function built on top + * of nghttp2_session_add_frame() to add GOAWAY easily. The + * |aux_flags| are bitwise-OR of one or more of + * nghttp2_goaway_aux_flag. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_INVALID_ARGUMENT + * The |opaque_data_len| is too large. + */ +int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id, + uint32_t error_code, const uint8_t *opaque_data, + size_t opaque_data_len, uint8_t aux_flags); + +/* + * Adds WINDOW_UPDATE frame with stream ID |stream_id| and + * window-size-increment |window_size_increment|. This is a convenient + * function built on top of nghttp2_session_add_frame() to add + * WINDOW_UPDATE easily. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +int nghttp2_session_add_window_update(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + int32_t window_size_increment); + +/* + * Adds SETTINGS frame. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_FLOODED + * There are too many items in outbound queue; this only happens + * if NGHTTP2_FLAG_ACK is set in |flags| + */ +int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags, + const nghttp2_settings_entry *iv, size_t niv); + +/* + * Creates new stream in |session| with stream ID |stream_id|, + * priority |pri_spec| and flags |flags|. The |flags| is bitwise OR + * of nghttp2_stream_flag. Since this function is called when initial + * HEADERS is sent or received, these flags are taken from it. The + * state of stream is set to |initial_state|. The |stream_user_data| + * is a pointer to the arbitrary user supplied data to be associated + * to this stream. + * + * If |initial_state| is NGHTTP2_STREAM_RESERVED, this function sets + * NGHTTP2_STREAM_FLAG_PUSH flag set. + * + * This function returns a pointer to created new stream object, or + * NULL. + * + * This function adjusts neither the number of closed streams or idle + * streams. The caller should manually call + * nghttp2_session_adjust_closed_stream() or + * nghttp2_session_adjust_idle_stream() respectively. + */ +nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, + int32_t stream_id, uint8_t flags, + nghttp2_priority_spec *pri_spec, + nghttp2_stream_state initial_state, + void *stream_user_data); + +/* + * Closes stream whose stream ID is |stream_id|. The reason of closure + * is indicated by the |error_code|. When closing the stream, + * on_stream_close_callback will be called. + * + * If the session is initialized as server and |stream| is incoming + * stream, stream is just marked closed and this function calls + * nghttp2_session_keep_closed_stream() with |stream|. Otherwise, + * |stream| will be deleted from memory. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_INVALID_ARGUMENT + * The specified stream does not exist. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, + uint32_t error_code); + +/* + * Deletes |stream| from memory. After this function returns, stream + * cannot be accessed. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_destroy_stream(nghttp2_session *session, + nghttp2_stream *stream); + +/* + * Tries to keep incoming closed stream |stream|. Due to the + * limitation of maximum number of streams in memory, |stream| is not + * closed and just deleted from memory (see + * nghttp2_session_destroy_stream). + */ +void nghttp2_session_keep_closed_stream(nghttp2_session *session, + nghttp2_stream *stream); + +/* + * Appends |stream| to linked list |session->idle_stream_head|. We + * apply fixed limit for list size. To fit into that limit, one or + * more oldest streams are removed from list as necessary. + */ +void nghttp2_session_keep_idle_stream(nghttp2_session *session, + nghttp2_stream *stream); + +/* + * Detaches |stream| from idle streams linked list. + */ +void nghttp2_session_detach_idle_stream(nghttp2_session *session, + nghttp2_stream *stream); + +/* + * Deletes closed stream to ensure that number of incoming streams + * including active and closed is in the maximum number of allowed + * stream. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_adjust_closed_stream(nghttp2_session *session); + +/* + * Deletes idle stream to ensure that number of idle streams is in + * certain limit. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_adjust_idle_stream(nghttp2_session *session); + +/* + * If further receptions and transmissions over the stream |stream_id| + * are disallowed, close the stream with error code NGHTTP2_NO_ERROR. + * + * This function returns 0 if it + * succeeds, or one of the following negative error codes: + * + * NGHTTP2_ERR_INVALID_ARGUMENT + * The specified stream does not exist. + */ +int nghttp2_session_close_stream_if_shut_rdwr(nghttp2_session *session, + nghttp2_stream *stream); + +int nghttp2_session_on_request_headers_received(nghttp2_session *session, + nghttp2_frame *frame); + +int nghttp2_session_on_response_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream); + +int nghttp2_session_on_push_response_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream); + +/* + * Called when HEADERS is received, assuming |frame| is properly + * initialized. This function does first validate received frame and + * then open stream and call callback functions. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_IGN_HEADER_BLOCK + * Frame was rejected and header block must be decoded but + * result must be ignored. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed + */ +int nghttp2_session_on_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream); + +/* + * Called when PRIORITY is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed + */ +int nghttp2_session_on_priority_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when RST_STREAM is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed + */ +int nghttp2_session_on_rst_stream_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when SETTINGS is received, assuming |frame| is properly + * initialized. If |noack| is non-zero, SETTINGS with ACK will not be + * submitted. If |frame| has NGHTTP2_FLAG_ACK flag set, no SETTINGS + * with ACK will not be submitted regardless of |noack|. + * + * This function returns 0 if it succeeds, or one the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed + * NGHTTP2_ERR_FLOODED + * There are too many items in outbound queue, and this is most + * likely caused by misbehaviour of peer. + */ +int nghttp2_session_on_settings_received(nghttp2_session *session, + nghttp2_frame *frame, int noack); + +/* + * Called when PUSH_PROMISE is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_IGN_HEADER_BLOCK + * Frame was rejected and header block must be decoded but + * result must be ignored. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed + */ +int nghttp2_session_on_push_promise_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when PING is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + * NGHTTP2_ERR_FLOODED + * There are too many items in outbound queue, and this is most + * likely caused by misbehaviour of peer. + */ +int nghttp2_session_on_ping_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when GOAWAY is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_on_goaway_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when WINDOW_UPDATE is recieved, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_on_window_update_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when ALTSVC is recieved, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_on_altsvc_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Called when DATA is received, assuming |frame| is properly + * initialized. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_on_data_received(nghttp2_session *session, + nghttp2_frame *frame); + +/* + * Returns nghttp2_stream* object whose stream ID is |stream_id|. It + * could be NULL if such stream does not exist. This function returns + * NULL if stream is marked as closed. + */ +nghttp2_stream *nghttp2_session_get_stream(nghttp2_session *session, + int32_t stream_id); + +/* + * This function behaves like nghttp2_session_get_stream(), but it + * returns stream object even if it is marked as closed or in + * NGHTTP2_STREAM_IDLE state. + */ +nghttp2_stream *nghttp2_session_get_stream_raw(nghttp2_session *session, + int32_t stream_id); + +/* + * Packs DATA frame |frame| in wire frame format and stores it in + * |bufs|. Payload will be read using |aux_data->data_prd|. The + * length of payload is at most |datamax| bytes. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_DEFERRED + * The DATA frame is postponed. + * NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE + * The read_callback failed (stream error). + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The read_callback failed (session error). + */ +int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, + size_t datamax, nghttp2_frame *frame, + nghttp2_data_aux_data *aux_data, + nghttp2_stream *stream); + +/* + * Pops and returns next item to send. If there is no such item, + * returns NULL. This function takes into account max concurrent + * streams. That means if session->ob_syn has item and max concurrent + * streams is reached, the even if other queues contain items, then + * this function returns NULL. + */ +nghttp2_outbound_item * +nghttp2_session_pop_next_ob_item(nghttp2_session *session); + +/* + * Returns next item to send. If there is no such item, this function + * returns NULL. This function takes into account max concurrent + * streams. That means if session->ob_syn has item and max concurrent + * streams is reached, the even if other queues contain items, then + * this function returns NULL. + */ +nghttp2_outbound_item * +nghttp2_session_get_next_ob_item(nghttp2_session *session); + +/* + * Updates local settings with the |iv|. The number of elements in the + * array pointed by the |iv| is given by the |niv|. This function + * assumes that the all settings_id member in |iv| are in range 1 to + * NGHTTP2_SETTINGS_MAX, inclusive. + * + * While updating individual stream's local window size, if the window + * size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE, + * RST_STREAM is issued against such a stream. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_update_local_settings(nghttp2_session *session, + nghttp2_settings_entry *iv, + size_t niv); + +/* + * Re-prioritize |stream|. The new priority specification is + * |pri_spec|. Caller must ensure that stream->hd.stream_id != + * pri_spec->stream_id. + * + * This function does not adjust the number of idle streams. The + * caller should call nghttp2_session_adjust_idle_stream() later. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_reprioritize_stream(nghttp2_session *session, + nghttp2_stream *stream, + const nghttp2_priority_spec *pri_spec); + +/* + * Terminates current |session| with the |error_code|. The |reason| + * is NULL-terminated debug string. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_INVALID_ARGUMENT + * The |reason| is too long. + */ +int nghttp2_session_terminate_session_with_reason(nghttp2_session *session, + uint32_t error_code, + const char *reason); + +#endif /* NGHTTP2_SESSION_H */ diff --git a/components/nghttp/include/nghttp2_stream.h b/components/nghttp/include/nghttp2_stream.h new file mode 100644 index 0000000000..da0e5d532c --- /dev/null +++ b/components/nghttp/include/nghttp2_stream.h @@ -0,0 +1,436 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_STREAM_H +#define NGHTTP2_STREAM_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include "nghttp2_outbound_item.h" +#include "nghttp2_map.h" +#include "nghttp2_pq.h" +#include "nghttp2_int.h" + +/* + * If local peer is stream initiator: + * NGHTTP2_STREAM_OPENING : upon sending request HEADERS + * NGHTTP2_STREAM_OPENED : upon receiving response HEADERS + * NGHTTP2_STREAM_CLOSING : upon queuing RST_STREAM + * + * If remote peer is stream initiator: + * NGHTTP2_STREAM_OPENING : upon receiving request HEADERS + * NGHTTP2_STREAM_OPENED : upon sending response HEADERS + * NGHTTP2_STREAM_CLOSING : upon queuing RST_STREAM + */ +typedef enum { + /* Initial state */ + NGHTTP2_STREAM_INITIAL, + /* For stream initiator: request HEADERS has been sent, but response + HEADERS has not been received yet. For receiver: request HEADERS + has been received, but it does not send response HEADERS yet. */ + NGHTTP2_STREAM_OPENING, + /* For stream initiator: response HEADERS is received. For receiver: + response HEADERS is sent. */ + NGHTTP2_STREAM_OPENED, + /* RST_STREAM is received, but somehow we need to keep stream in + memory. */ + NGHTTP2_STREAM_CLOSING, + /* PUSH_PROMISE is received or sent */ + NGHTTP2_STREAM_RESERVED, + /* Stream is created in this state if it is used as anchor in + dependency tree. */ + NGHTTP2_STREAM_IDLE +} nghttp2_stream_state; + +typedef enum { + NGHTTP2_SHUT_NONE = 0, + /* Indicates further receptions will be disallowed. */ + NGHTTP2_SHUT_RD = 0x01, + /* Indicates further transmissions will be disallowed. */ + NGHTTP2_SHUT_WR = 0x02, + /* Indicates both further receptions and transmissions will be + disallowed. */ + NGHTTP2_SHUT_RDWR = NGHTTP2_SHUT_RD | NGHTTP2_SHUT_WR +} nghttp2_shut_flag; + +typedef enum { + NGHTTP2_STREAM_FLAG_NONE = 0, + /* Indicates that this stream is pushed stream and not opened + yet. */ + NGHTTP2_STREAM_FLAG_PUSH = 0x01, + /* Indicates that this stream was closed */ + NGHTTP2_STREAM_FLAG_CLOSED = 0x02, + /* Indicates the item is deferred due to flow control. */ + NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL = 0x04, + /* Indicates the item is deferred by user callback */ + NGHTTP2_STREAM_FLAG_DEFERRED_USER = 0x08, + /* bitwise OR of NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL and + NGHTTP2_STREAM_FLAG_DEFERRED_USER. */ + NGHTTP2_STREAM_FLAG_DEFERRED_ALL = 0x0c + +} nghttp2_stream_flag; + +/* HTTP related flags to enforce HTTP semantics */ +typedef enum { + NGHTTP2_HTTP_FLAG_NONE = 0, + /* header field seen so far */ + NGHTTP2_HTTP_FLAG__AUTHORITY = 1, + NGHTTP2_HTTP_FLAG__PATH = 1 << 1, + NGHTTP2_HTTP_FLAG__METHOD = 1 << 2, + NGHTTP2_HTTP_FLAG__SCHEME = 1 << 3, + /* host is not pseudo header, but we require either host or + :authority */ + NGHTTP2_HTTP_FLAG_HOST = 1 << 4, + NGHTTP2_HTTP_FLAG__STATUS = 1 << 5, + /* required header fields for HTTP request except for CONNECT + method. */ + NGHTTP2_HTTP_FLAG_REQ_HEADERS = NGHTTP2_HTTP_FLAG__METHOD | + NGHTTP2_HTTP_FLAG__PATH | + NGHTTP2_HTTP_FLAG__SCHEME, + NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED = 1 << 6, + /* HTTP method flags */ + NGHTTP2_HTTP_FLAG_METH_CONNECT = 1 << 7, + NGHTTP2_HTTP_FLAG_METH_HEAD = 1 << 8, + NGHTTP2_HTTP_FLAG_METH_OPTIONS = 1 << 9, + NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND = 1 << 10, + NGHTTP2_HTTP_FLAG_METH_ALL = NGHTTP2_HTTP_FLAG_METH_CONNECT | + NGHTTP2_HTTP_FLAG_METH_HEAD | + NGHTTP2_HTTP_FLAG_METH_OPTIONS | + NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND, + /* :path category */ + /* path starts with "/" */ + NGHTTP2_HTTP_FLAG_PATH_REGULAR = 1 << 11, + /* path "*" */ + NGHTTP2_HTTP_FLAG_PATH_ASTERISK = 1 << 12, + /* scheme */ + /* "http" or "https" scheme */ + NGHTTP2_HTTP_FLAG_SCHEME_HTTP = 1 << 13, + /* set if final response is expected */ + NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE = 1 << 14 +} nghttp2_http_flag; + +struct nghttp2_stream { + /* Intrusive Map */ + nghttp2_map_entry map_entry; + /* Entry for dep_prev->obq */ + nghttp2_pq_entry pq_entry; + /* Priority Queue storing direct descendant (nghttp2_stream). Only + streams which itself has some data to send, or has a descendant + which has some data to sent. */ + nghttp2_pq obq; + /* Content-Length of request/response body. -1 if unknown. */ + int64_t content_length; + /* Received body so far */ + int64_t recv_content_length; + /* Base last_cycle for direct descendent streams. */ + uint32_t descendant_last_cycle; + /* Next scheduled time to sent item */ + uint32_t cycle; + /* Next seq used for direct descendant streams */ + uint64_t descendant_next_seq; + /* Secondary key for prioritization to break a tie for cycle. This + value is monotonically increased for single parent stream. */ + uint64_t seq; + /* pointers to form dependency tree. If multiple streams depend on + a stream, only one stream (left most) has non-NULL dep_prev which + points to the stream it depends on. The remaining streams are + linked using sib_prev and sib_next. The stream which has + non-NULL dep_prev always NULL sib_prev. The right most stream + has NULL sib_next. If this stream is a root of dependency tree, + dep_prev and sib_prev are NULL. */ + nghttp2_stream *dep_prev, *dep_next; + nghttp2_stream *sib_prev, *sib_next; + /* When stream is kept after closure, it may be kept in doubly + linked list pointed by nghttp2_session closed_stream_head. + closed_next points to the next stream object if it is the element + of the list. */ + nghttp2_stream *closed_prev, *closed_next; + /* The arbitrary data provided by user for this stream. */ + void *stream_user_data; + /* Item to send */ + nghttp2_outbound_item *item; + /* Last written length of frame payload */ + size_t last_writelen; + /* stream ID */ + int32_t stream_id; + /* Current remote window size. This value is computed against the + current initial window size of remote endpoint. */ + int32_t remote_window_size; + /* Keep track of the number of bytes received without + WINDOW_UPDATE. This could be negative after submitting negative + value to WINDOW_UPDATE */ + int32_t recv_window_size; + /* The number of bytes consumed by the application and now is + subject to WINDOW_UPDATE. This is only used when auto + WINDOW_UPDATE is turned off. */ + int32_t consumed_size; + /* The amount of recv_window_size cut using submitting negative + value to WINDOW_UPDATE */ + int32_t recv_reduction; + /* window size for local flow control. It is initially set to + NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by + submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */ + int32_t local_window_size; + /* weight of this stream */ + int32_t weight; + /* This is unpaid penalty (offset) when calculating cycle. */ + uint32_t pending_penalty; + /* sum of weight of direct descendants */ + int32_t sum_dep_weight; + nghttp2_stream_state state; + /* status code from remote server */ + int16_t status_code; + /* Bitwise OR of zero or more nghttp2_http_flag values */ + uint16_t http_flags; + /* This is bitwise-OR of 0 or more of nghttp2_stream_flag. */ + uint8_t flags; + /* Bitwise OR of zero or more nghttp2_shut_flag values */ + uint8_t shut_flags; + /* Nonzero if this stream has been queued to stream pointed by + dep_prev. We maintain the invariant that if a stream is queued, + then its ancestors, except for root, are also queued. This + invariant may break in fatal error condition. */ + uint8_t queued; + /* This flag is used to reduce excessive queuing of WINDOW_UPDATE to + this stream. The nonzero does not necessarily mean WINDOW_UPDATE + is not queued. */ + uint8_t window_update_queued; +}; + +void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, + uint8_t flags, nghttp2_stream_state initial_state, + int32_t weight, int32_t remote_initial_window_size, + int32_t local_initial_window_size, + void *stream_user_data, nghttp2_mem *mem); + +void nghttp2_stream_free(nghttp2_stream *stream); + +/* + * Disallow either further receptions or transmissions, or both. + * |flag| is bitwise OR of one or more of nghttp2_shut_flag. + */ +void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag); + +/* + * Defer |stream->item|. We won't call this function in the situation + * where |stream->item| == NULL. The |flags| is bitwise OR of zero or + * more of NGHTTP2_STREAM_FLAG_DEFERRED_USER and + * NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL. The |flags| indicates + * the reason of this action. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags); + +/* + * Put back deferred data in this stream to active state. The |flags| + * are one or more of bitwise OR of the following values: + * NGHTTP2_STREAM_FLAG_DEFERRED_USER and + * NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL and given masks are + * cleared if they are set. So even if this function is called, if + * one of flag is still set, data does not become active. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags); + +/* + * Returns nonzero if item is deferred by whatever reason. + */ +int nghttp2_stream_check_deferred_item(nghttp2_stream *stream); + +/* + * Returns nonzero if item is deferred by flow control. + */ +int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream); + +/* + * Updates the remote window size with the new value + * |new_initial_window_size|. The |old_initial_window_size| is used to + * calculate the current window size. + * + * This function returns 0 if it succeeds or -1. The failure is due to + * overflow. + */ +int nghttp2_stream_update_remote_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size); + +/* + * Updates the local window size with the new value + * |new_initial_window_size|. The |old_initial_window_size| is used to + * calculate the current window size. + * + * This function returns 0 if it succeeds or -1. The failure is due to + * overflow. + */ +int nghttp2_stream_update_local_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size); + +/* + * Call this function if promised stream |stream| is replied with + * HEADERS. This function makes the state of the |stream| to + * NGHTTP2_STREAM_OPENED. + */ +void nghttp2_stream_promise_fulfilled(nghttp2_stream *stream); + +/* + * Returns nonzero if |target| is an ancestor of |stream|. + */ +int nghttp2_stream_dep_find_ancestor(nghttp2_stream *stream, + nghttp2_stream *target); + +/* + * Computes distributed weight of a stream of the |weight| under the + * |stream| if |stream| is removed from a dependency tree. + */ +int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream, + int32_t weight); + +/* + * Makes the |stream| depend on the |dep_stream|. This dependency is + * exclusive. All existing direct descendants of |dep_stream| become + * the descendants of the |stream|. This function assumes + * |stream->item| is NULL. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_dep_insert(nghttp2_stream *dep_stream, + nghttp2_stream *stream); + +/* + * Makes the |stream| depend on the |dep_stream|. This dependency is + * not exclusive. This function assumes |stream->item| is NULL. + */ +void nghttp2_stream_dep_add(nghttp2_stream *dep_stream, nghttp2_stream *stream); + +/* + * Removes the |stream| from the current dependency tree. This + * function assumes |stream->item| is NULL. + */ +int nghttp2_stream_dep_remove(nghttp2_stream *stream); + +/* + * Attaches |item| to |stream|. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_attach_item(nghttp2_stream *stream, + nghttp2_outbound_item *item); + +/* + * Detaches |stream->item|. This function does not free + * |stream->item|. The caller must free it. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_detach_item(nghttp2_stream *stream); + +/* + * Makes the |stream| depend on the |dep_stream|. This dependency is + * exclusive. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream, + nghttp2_stream *stream); + +/* + * Makes the |stream| depend on the |dep_stream|. This dependency is + * not exclusive. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream, + nghttp2_stream *stream); + +/* + * Removes subtree whose root stream is |stream|. The + * effective_weight of streams in removed subtree is not updated. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream); + +/* + * Returns nonzero if |stream| is in any dependency tree. + */ +int nghttp2_stream_in_dep_tree(nghttp2_stream *stream); + +/* + * Schedules transmission of |stream|'s item, assuming stream->item is + * attached, and stream->last_writelen was updated. + */ +void nghttp2_stream_reschedule(nghttp2_stream *stream); + +/* + * Changes |stream|'s weight to |weight|. If |stream| is queued, it + * will be rescheduled based on new weight. + */ +void nghttp2_stream_change_weight(nghttp2_stream *stream, int32_t weight); + +/* + * Returns a stream which has highest priority, updating + * descendant_last_cycle of selected stream's ancestors. + */ +nghttp2_outbound_item * +nghttp2_stream_next_outbound_item(nghttp2_stream *stream); + +#endif /* NGHTTP2_STREAM */ diff --git a/components/nghttp/include/nghttp2_submit.h b/components/nghttp/include/nghttp2_submit.h new file mode 100644 index 0000000000..545388cfa3 --- /dev/null +++ b/components/nghttp/include/nghttp2_submit.h @@ -0,0 +1,34 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_SUBMIT_H +#define NGHTTP2_SUBMIT_H + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +#endif /* NGHTTP2_SUBMIT_H */ diff --git a/components/nghttp/library/nghttp2_buf.c b/components/nghttp/library/nghttp2_buf.c new file mode 100644 index 0000000000..9dc2f950f9 --- /dev/null +++ b/components/nghttp/library/nghttp2_buf.c @@ -0,0 +1,494 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_buf.h" + +#include + +#include "nghttp2_helper.h" + +void nghttp2_buf_init(nghttp2_buf *buf) { + buf->begin = NULL; + buf->end = NULL; + buf->pos = NULL; + buf->last = NULL; + buf->mark = NULL; +} + +int nghttp2_buf_init2(nghttp2_buf *buf, size_t initial, nghttp2_mem *mem) { + nghttp2_buf_init(buf); + return nghttp2_buf_reserve(buf, initial, mem); +} + +void nghttp2_buf_free(nghttp2_buf *buf, nghttp2_mem *mem) { + if (buf == NULL) { + return; + } + + nghttp2_mem_free(mem, buf->begin); + buf->begin = NULL; +} + +int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap, nghttp2_mem *mem) { + uint8_t *ptr; + size_t cap; + + cap = nghttp2_buf_cap(buf); + + if (cap >= new_cap) { + return 0; + } + + new_cap = nghttp2_max(new_cap, cap * 2); + + ptr = nghttp2_mem_realloc(mem, buf->begin, new_cap); + if (ptr == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + buf->pos = ptr + (buf->pos - buf->begin); + buf->last = ptr + (buf->last - buf->begin); + buf->mark = ptr + (buf->mark - buf->begin); + buf->begin = ptr; + buf->end = ptr + new_cap; + + return 0; +} + +void nghttp2_buf_reset(nghttp2_buf *buf) { + buf->pos = buf->last = buf->mark = buf->begin; +} + +void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len) { + buf->begin = buf->pos = buf->last = buf->mark = begin; + buf->end = begin + len; +} + +static int buf_chain_new(nghttp2_buf_chain **chain, size_t chunk_length, + nghttp2_mem *mem) { + int rv; + + *chain = nghttp2_mem_malloc(mem, sizeof(nghttp2_buf_chain)); + if (*chain == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + (*chain)->next = NULL; + + rv = nghttp2_buf_init2(&(*chain)->buf, chunk_length, mem); + if (rv != 0) { + nghttp2_mem_free(mem, *chain); + return NGHTTP2_ERR_NOMEM; + } + + return 0; +} + +static void buf_chain_del(nghttp2_buf_chain *chain, nghttp2_mem *mem) { + nghttp2_buf_free(&chain->buf, mem); + nghttp2_mem_free(mem, chain); +} + +int nghttp2_bufs_init(nghttp2_bufs *bufs, size_t chunk_length, size_t max_chunk, + nghttp2_mem *mem) { + return nghttp2_bufs_init2(bufs, chunk_length, max_chunk, 0, mem); +} + +int nghttp2_bufs_init2(nghttp2_bufs *bufs, size_t chunk_length, + size_t max_chunk, size_t offset, nghttp2_mem *mem) { + return nghttp2_bufs_init3(bufs, chunk_length, max_chunk, max_chunk, offset, + mem); +} + +int nghttp2_bufs_init3(nghttp2_bufs *bufs, size_t chunk_length, + size_t max_chunk, size_t chunk_keep, size_t offset, + nghttp2_mem *mem) { + int rv; + nghttp2_buf_chain *chain; + + if (chunk_keep == 0 || max_chunk < chunk_keep || chunk_length < offset) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + rv = buf_chain_new(&chain, chunk_length, mem); + if (rv != 0) { + return rv; + } + + bufs->mem = mem; + bufs->offset = offset; + + bufs->head = chain; + bufs->cur = bufs->head; + + nghttp2_buf_shift_right(&bufs->cur->buf, offset); + + bufs->chunk_length = chunk_length; + bufs->chunk_used = 1; + bufs->max_chunk = max_chunk; + bufs->chunk_keep = chunk_keep; + + return 0; +} + +int nghttp2_bufs_realloc(nghttp2_bufs *bufs, size_t chunk_length) { + int rv; + nghttp2_buf_chain *chain; + + if (chunk_length < bufs->offset) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + rv = buf_chain_new(&chain, chunk_length, bufs->mem); + if (rv != 0) { + return rv; + } + + nghttp2_bufs_free(bufs); + + bufs->head = chain; + bufs->cur = bufs->head; + + nghttp2_buf_shift_right(&bufs->cur->buf, bufs->offset); + + bufs->chunk_length = chunk_length; + bufs->chunk_used = 1; + + return 0; +} + +void nghttp2_bufs_free(nghttp2_bufs *bufs) { + nghttp2_buf_chain *chain, *next_chain; + + if (bufs == NULL) { + return; + } + + for (chain = bufs->head; chain;) { + next_chain = chain->next; + + buf_chain_del(chain, bufs->mem); + + chain = next_chain; + } + + bufs->head = NULL; +} + +int nghttp2_bufs_wrap_init(nghttp2_bufs *bufs, uint8_t *begin, size_t len, + nghttp2_mem *mem) { + nghttp2_buf_chain *chain; + + chain = nghttp2_mem_malloc(mem, sizeof(nghttp2_buf_chain)); + if (chain == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + chain->next = NULL; + + nghttp2_buf_wrap_init(&chain->buf, begin, len); + + bufs->mem = mem; + bufs->offset = 0; + + bufs->head = chain; + bufs->cur = bufs->head; + + bufs->chunk_length = len; + bufs->chunk_used = 1; + bufs->max_chunk = 1; + bufs->chunk_keep = 1; + + return 0; +} + +void nghttp2_bufs_wrap_free(nghttp2_bufs *bufs) { + if (bufs == NULL) { + return; + } + + nghttp2_mem_free(bufs->mem, bufs->head); + bufs->head = NULL; +} + +void nghttp2_bufs_seek_last_present(nghttp2_bufs *bufs) { + nghttp2_buf_chain *ci; + + for (ci = bufs->cur; ci; ci = ci->next) { + if (nghttp2_buf_len(&ci->buf) == 0) { + return; + } else { + bufs->cur = ci; + } + } +} + +size_t nghttp2_bufs_len(nghttp2_bufs *bufs) { + nghttp2_buf_chain *ci; + size_t len; + + len = 0; + for (ci = bufs->head; ci; ci = ci->next) { + len += nghttp2_buf_len(&ci->buf); + } + + return len; +} + +static size_t bufs_avail(nghttp2_bufs *bufs) { + return nghttp2_buf_avail(&bufs->cur->buf) + + (bufs->chunk_length - bufs->offset) * + (bufs->max_chunk - bufs->chunk_used); +} + +static int bufs_alloc_chain(nghttp2_bufs *bufs) { + int rv; + nghttp2_buf_chain *chain; + + if (bufs->cur->next) { + bufs->cur = bufs->cur->next; + + return 0; + } + + if (bufs->max_chunk == bufs->chunk_used) { + return NGHTTP2_ERR_BUFFER_ERROR; + } + + rv = buf_chain_new(&chain, bufs->chunk_length, bufs->mem); + if (rv != 0) { + return rv; + } + + DEBUGF(fprintf(stderr, + "new buffer %zu bytes allocated for bufs %p, used %zu\n", + bufs->chunk_length, bufs, bufs->chunk_used)); + + ++bufs->chunk_used; + + bufs->cur->next = chain; + bufs->cur = chain; + + nghttp2_buf_shift_right(&bufs->cur->buf, bufs->offset); + + return 0; +} + +int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) { + int rv; + size_t nwrite; + nghttp2_buf *buf; + const uint8_t *p; + + if (bufs_avail(bufs) < len) { + return NGHTTP2_ERR_BUFFER_ERROR; + } + + p = data; + + while (len) { + buf = &bufs->cur->buf; + + nwrite = nghttp2_min(nghttp2_buf_avail(buf), len); + if (nwrite == 0) { + rv = bufs_alloc_chain(bufs); + if (rv != 0) { + return rv; + } + continue; + } + + buf->last = nghttp2_cpymem(buf->last, p, nwrite); + p += nwrite; + len -= nwrite; + } + + return 0; +} + +static int bufs_ensure_addb(nghttp2_bufs *bufs) { + int rv; + nghttp2_buf *buf; + + buf = &bufs->cur->buf; + + if (nghttp2_buf_avail(buf) > 0) { + return 0; + } + + rv = bufs_alloc_chain(bufs); + if (rv != 0) { + return rv; + } + + return 0; +} + +int nghttp2_bufs_addb(nghttp2_bufs *bufs, uint8_t b) { + int rv; + + rv = bufs_ensure_addb(bufs); + if (rv != 0) { + return rv; + } + + *bufs->cur->buf.last++ = b; + + return 0; +} + +int nghttp2_bufs_addb_hold(nghttp2_bufs *bufs, uint8_t b) { + int rv; + + rv = bufs_ensure_addb(bufs); + if (rv != 0) { + return rv; + } + + *bufs->cur->buf.last = b; + + return 0; +} + +int nghttp2_bufs_orb(nghttp2_bufs *bufs, uint8_t b) { + int rv; + + rv = bufs_ensure_addb(bufs); + if (rv != 0) { + return rv; + } + + *bufs->cur->buf.last++ |= b; + + return 0; +} + +int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b) { + int rv; + + rv = bufs_ensure_addb(bufs); + if (rv != 0) { + return rv; + } + + *bufs->cur->buf.last |= b; + + return 0; +} + +ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) { + size_t len; + nghttp2_buf_chain *chain; + nghttp2_buf *buf; + uint8_t *res; + nghttp2_buf resbuf; + + len = 0; + + for (chain = bufs->head; chain; chain = chain->next) { + len += nghttp2_buf_len(&chain->buf); + } + + if (len == 0) { + res = NULL; + return 0; + } + + res = nghttp2_mem_malloc(bufs->mem, len); + if (res == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_buf_wrap_init(&resbuf, res, len); + + for (chain = bufs->head; chain; chain = chain->next) { + buf = &chain->buf; + resbuf.last = nghttp2_cpymem(resbuf.last, buf->pos, nghttp2_buf_len(buf)); + } + + *out = res; + + return (ssize_t)len; +} + +size_t nghttp2_bufs_remove_copy(nghttp2_bufs *bufs, uint8_t *out) { + size_t len; + nghttp2_buf_chain *chain; + nghttp2_buf *buf; + nghttp2_buf resbuf; + + len = nghttp2_bufs_len(bufs); + + nghttp2_buf_wrap_init(&resbuf, out, len); + + for (chain = bufs->head; chain; chain = chain->next) { + buf = &chain->buf; + resbuf.last = nghttp2_cpymem(resbuf.last, buf->pos, nghttp2_buf_len(buf)); + } + + return len; +} + +void nghttp2_bufs_reset(nghttp2_bufs *bufs) { + nghttp2_buf_chain *chain, *ci; + size_t k; + + k = bufs->chunk_keep; + + for (ci = bufs->head; ci; ci = ci->next) { + nghttp2_buf_reset(&ci->buf); + nghttp2_buf_shift_right(&ci->buf, bufs->offset); + + if (--k == 0) { + break; + } + } + + if (ci) { + chain = ci->next; + ci->next = NULL; + + for (ci = chain; ci;) { + chain = ci->next; + + buf_chain_del(ci, bufs->mem); + + ci = chain; + } + + bufs->chunk_used = bufs->chunk_keep; + } + + bufs->cur = bufs->head; +} + +int nghttp2_bufs_advance(nghttp2_bufs *bufs) { return bufs_alloc_chain(bufs); } + +int nghttp2_bufs_next_present(nghttp2_bufs *bufs) { + nghttp2_buf_chain *chain; + + chain = bufs->cur->next; + + return chain && nghttp2_buf_len(&chain->buf); +} diff --git a/components/nghttp/library/nghttp2_callbacks.c b/components/nghttp/library/nghttp2_callbacks.c new file mode 100644 index 0000000000..4d5211a1e8 --- /dev/null +++ b/components/nghttp/library/nghttp2_callbacks.c @@ -0,0 +1,158 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_callbacks.h" + +#include + +int nghttp2_session_callbacks_new(nghttp2_session_callbacks **callbacks_ptr) { + *callbacks_ptr = calloc(1, sizeof(nghttp2_session_callbacks)); + + if (*callbacks_ptr == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + return 0; +} + +void nghttp2_session_callbacks_del(nghttp2_session_callbacks *callbacks) { + free(callbacks); +} + +void nghttp2_session_callbacks_set_send_callback( + nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback) { + cbs->send_callback = send_callback; +} + +void nghttp2_session_callbacks_set_recv_callback( + nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback) { + cbs->recv_callback = recv_callback; +} + +void nghttp2_session_callbacks_set_on_frame_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_recv_callback on_frame_recv_callback) { + cbs->on_frame_recv_callback = on_frame_recv_callback; +} + +void nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback) { + cbs->on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; +} + +void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback) { + cbs->on_data_chunk_recv_callback = on_data_chunk_recv_callback; +} + +void nghttp2_session_callbacks_set_before_frame_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_before_frame_send_callback before_frame_send_callback) { + cbs->before_frame_send_callback = before_frame_send_callback; +} + +void nghttp2_session_callbacks_set_on_frame_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_send_callback on_frame_send_callback) { + cbs->on_frame_send_callback = on_frame_send_callback; +} + +void nghttp2_session_callbacks_set_on_frame_not_send_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_not_send_callback on_frame_not_send_callback) { + cbs->on_frame_not_send_callback = on_frame_not_send_callback; +} + +void nghttp2_session_callbacks_set_on_stream_close_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_stream_close_callback on_stream_close_callback) { + cbs->on_stream_close_callback = on_stream_close_callback; +} + +void nghttp2_session_callbacks_set_on_begin_headers_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_headers_callback on_begin_headers_callback) { + cbs->on_begin_headers_callback = on_begin_headers_callback; +} + +void nghttp2_session_callbacks_set_on_header_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback on_header_callback) { + cbs->on_header_callback = on_header_callback; +} + +void nghttp2_session_callbacks_set_on_header_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback2 on_header_callback2) { + cbs->on_header_callback2 = on_header_callback2; +} + +void nghttp2_session_callbacks_set_select_padding_callback( + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback select_padding_callback) { + cbs->select_padding_callback = select_padding_callback; +} + +void nghttp2_session_callbacks_set_data_source_read_length_callback( + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback data_source_read_length_callback) { + cbs->read_length_callback = data_source_read_length_callback; +} + +void nghttp2_session_callbacks_set_on_begin_frame_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_frame_callback on_begin_frame_callback) { + cbs->on_begin_frame_callback = on_begin_frame_callback; +} + +void nghttp2_session_callbacks_set_send_data_callback( + nghttp2_session_callbacks *cbs, + nghttp2_send_data_callback send_data_callback) { + cbs->send_data_callback = send_data_callback; +} + +void nghttp2_session_callbacks_set_pack_extension_callback( + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback pack_extension_callback) { + cbs->pack_extension_callback = pack_extension_callback; +} + +void nghttp2_session_callbacks_set_unpack_extension_callback( + nghttp2_session_callbacks *cbs, + nghttp2_unpack_extension_callback unpack_extension_callback) { + cbs->unpack_extension_callback = unpack_extension_callback; +} + +void nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( + nghttp2_session_callbacks *cbs, + nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback) { + cbs->on_extension_chunk_recv_callback = on_extension_chunk_recv_callback; +} + +void nghttp2_session_callbacks_set_error_callback( + nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) { + cbs->error_callback = error_callback; +} diff --git a/components/nghttp/library/nghttp2_frame.c b/components/nghttp/library/nghttp2_frame.c new file mode 100644 index 0000000000..62749f32b6 --- /dev/null +++ b/components/nghttp/library/nghttp2_frame.c @@ -0,0 +1,1001 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_frame.h" + +#include +#include +#include +#include + +#include "nghttp2_helper.h" +#include "nghttp2_net.h" +#include "nghttp2_priority_spec.h" + +void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd) { + nghttp2_put_uint32be(&buf[0], (uint32_t)(hd->length << 8)); + buf[3] = hd->type; + buf[4] = hd->flags; + nghttp2_put_uint32be(&buf[5], (uint32_t)hd->stream_id); + /* ignore hd->reserved for now */ +} + +void nghttp2_frame_unpack_frame_hd(nghttp2_frame_hd *hd, const uint8_t *buf) { + hd->length = nghttp2_get_uint32(&buf[0]) >> 8; + hd->type = buf[3]; + hd->flags = buf[4]; + hd->stream_id = nghttp2_get_uint32(&buf[5]) & NGHTTP2_STREAM_ID_MASK; + hd->reserved = 0; +} + +void nghttp2_frame_hd_init(nghttp2_frame_hd *hd, size_t length, uint8_t type, + uint8_t flags, int32_t stream_id) { + hd->length = length; + hd->type = type; + hd->flags = flags; + hd->stream_id = stream_id; + hd->reserved = 0; +} + +void nghttp2_frame_headers_init(nghttp2_headers *frame, uint8_t flags, + int32_t stream_id, nghttp2_headers_category cat, + const nghttp2_priority_spec *pri_spec, + nghttp2_nv *nva, size_t nvlen) { + nghttp2_frame_hd_init(&frame->hd, 0, NGHTTP2_HEADERS, flags, stream_id); + frame->padlen = 0; + frame->nva = nva; + frame->nvlen = nvlen; + frame->cat = cat; + + if (pri_spec) { + frame->pri_spec = *pri_spec; + } else { + nghttp2_priority_spec_default_init(&frame->pri_spec); + } +} + +void nghttp2_frame_headers_free(nghttp2_headers *frame, nghttp2_mem *mem) { + nghttp2_nv_array_del(frame->nva, mem); +} + +void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + nghttp2_frame_hd_init(&frame->hd, NGHTTP2_PRIORITY_SPECLEN, NGHTTP2_PRIORITY, + NGHTTP2_FLAG_NONE, stream_id); + frame->pri_spec = *pri_spec; +} + +void nghttp2_frame_priority_free(nghttp2_priority *frame _U_) {} + +void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, int32_t stream_id, + uint32_t error_code) { + nghttp2_frame_hd_init(&frame->hd, 4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, + stream_id); + frame->error_code = error_code; +} + +void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame _U_) {} + +void nghttp2_frame_settings_init(nghttp2_settings *frame, uint8_t flags, + nghttp2_settings_entry *iv, size_t niv) { + nghttp2_frame_hd_init(&frame->hd, niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, + NGHTTP2_SETTINGS, flags, 0); + frame->niv = niv; + frame->iv = iv; +} + +void nghttp2_frame_settings_free(nghttp2_settings *frame, nghttp2_mem *mem) { + nghttp2_mem_free(mem, frame->iv); +} + +void nghttp2_frame_push_promise_init(nghttp2_push_promise *frame, uint8_t flags, + int32_t stream_id, + int32_t promised_stream_id, + nghttp2_nv *nva, size_t nvlen) { + nghttp2_frame_hd_init(&frame->hd, 0, NGHTTP2_PUSH_PROMISE, flags, stream_id); + frame->padlen = 0; + frame->nva = nva; + frame->nvlen = nvlen; + frame->promised_stream_id = promised_stream_id; + frame->reserved = 0; +} + +void nghttp2_frame_push_promise_free(nghttp2_push_promise *frame, + nghttp2_mem *mem) { + nghttp2_nv_array_del(frame->nva, mem); +} + +void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags, + const uint8_t *opaque_data) { + nghttp2_frame_hd_init(&frame->hd, 8, NGHTTP2_PING, flags, 0); + if (opaque_data) { + memcpy(frame->opaque_data, opaque_data, sizeof(frame->opaque_data)); + } else { + memset(frame->opaque_data, 0, sizeof(frame->opaque_data)); + } +} + +void nghttp2_frame_ping_free(nghttp2_ping *frame _U_) {} + +void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id, + uint32_t error_code, uint8_t *opaque_data, + size_t opaque_data_len) { + nghttp2_frame_hd_init(&frame->hd, 8 + opaque_data_len, NGHTTP2_GOAWAY, + NGHTTP2_FLAG_NONE, 0); + frame->last_stream_id = last_stream_id; + frame->error_code = error_code; + frame->opaque_data = opaque_data; + frame->opaque_data_len = opaque_data_len; + frame->reserved = 0; +} + +void nghttp2_frame_goaway_free(nghttp2_goaway *frame, nghttp2_mem *mem) { + nghttp2_mem_free(mem, frame->opaque_data); +} + +void nghttp2_frame_window_update_init(nghttp2_window_update *frame, + uint8_t flags, int32_t stream_id, + int32_t window_size_increment) { + nghttp2_frame_hd_init(&frame->hd, 4, NGHTTP2_WINDOW_UPDATE, flags, stream_id); + frame->window_size_increment = window_size_increment; + frame->reserved = 0; +} + +void nghttp2_frame_window_update_free(nghttp2_window_update *frame _U_) {} + +size_t nghttp2_frame_trail_padlen(nghttp2_frame *frame, size_t padlen) { + /* We have iframe->padlen == 0, but iframe->frame.hd.flags may have + NGHTTP2_FLAG_PADDED set. This happens when receiving + CONTINUATION frame, since we don't reset flags after HEADERS was + received. */ + if (padlen == 0) { + return 0; + } + return padlen - ((frame->hd.flags & NGHTTP2_FLAG_PADDED) > 0); +} + +void nghttp2_frame_data_init(nghttp2_data *frame, uint8_t flags, + int32_t stream_id) { + /* At this moment, the length of DATA frame is unknown */ + nghttp2_frame_hd_init(&frame->hd, 0, NGHTTP2_DATA, flags, stream_id); + frame->padlen = 0; +} + +void nghttp2_frame_data_free(nghttp2_data *frame _U_) {} + +void nghttp2_frame_extension_init(nghttp2_extension *frame, uint8_t type, + uint8_t flags, int32_t stream_id, + void *payload) { + nghttp2_frame_hd_init(&frame->hd, 0, type, flags, stream_id); + frame->payload = payload; +} + +void nghttp2_frame_extension_free(nghttp2_extension *frame _U_) {} + +void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id, + uint8_t *origin, size_t origin_len, + uint8_t *field_value, size_t field_value_len) { + nghttp2_ext_altsvc *altsvc; + + nghttp2_frame_hd_init(&frame->hd, 2 + origin_len + field_value_len, + NGHTTP2_ALTSVC, NGHTTP2_FLAG_NONE, stream_id); + + altsvc = frame->payload; + altsvc->origin = origin; + altsvc->origin_len = origin_len; + altsvc->field_value = field_value; + altsvc->field_value_len = field_value_len; +} + +void nghttp2_frame_altsvc_free(nghttp2_extension *frame, nghttp2_mem *mem) { + nghttp2_ext_altsvc *altsvc; + + altsvc = frame->payload; + /* We use the same buffer for altsvc->origin and + altsvc->field_value. */ + nghttp2_mem_free(mem, altsvc->origin); +} + +size_t nghttp2_frame_priority_len(uint8_t flags) { + if (flags & NGHTTP2_FLAG_PRIORITY) { + return NGHTTP2_PRIORITY_SPECLEN; + } + + return 0; +} + +size_t nghttp2_frame_headers_payload_nv_offset(nghttp2_headers *frame) { + return nghttp2_frame_priority_len(frame->hd.flags); +} + +/* + * Call this function after payload was serialized, but not before + * changing buf->pos and serializing frame header. + * + * This function assumes bufs->cur points to the last buf chain of the + * frame(s). + * + * This function serializes frame header for HEADERS/PUSH_PROMISE and + * handles their successive CONTINUATION frames. + * + * We don't process any padding here. + */ +static int frame_pack_headers_shared(nghttp2_bufs *bufs, + nghttp2_frame_hd *frame_hd) { + nghttp2_buf *buf; + nghttp2_buf_chain *ci, *ce; + nghttp2_frame_hd hd; + + buf = &bufs->head->buf; + + hd = *frame_hd; + hd.length = nghttp2_buf_len(buf); + + DEBUGF(fprintf(stderr, "send: HEADERS/PUSH_PROMISE, payloadlen=%zu\n", + hd.length)); + + /* We have multiple frame buffers, which means one or more + CONTINUATION frame is involved. Remove END_HEADERS flag from the + first frame. */ + if (bufs->head != bufs->cur) { + hd.flags = (uint8_t)(hd.flags & ~NGHTTP2_FLAG_END_HEADERS); + } + + buf->pos -= NGHTTP2_FRAME_HDLEN; + nghttp2_frame_pack_frame_hd(buf->pos, &hd); + + if (bufs->head != bufs->cur) { + /* 2nd and later frames are CONTINUATION frames. */ + hd.type = NGHTTP2_CONTINUATION; + /* We don't have no flags except for last CONTINUATION */ + hd.flags = NGHTTP2_FLAG_NONE; + + ce = bufs->cur; + + for (ci = bufs->head->next; ci != ce; ci = ci->next) { + buf = &ci->buf; + + hd.length = nghttp2_buf_len(buf); + + DEBUGF(fprintf(stderr, "send: int CONTINUATION, payloadlen=%zu\n", + hd.length)); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + nghttp2_frame_pack_frame_hd(buf->pos, &hd); + } + + buf = &ci->buf; + hd.length = nghttp2_buf_len(buf); + /* Set END_HEADERS flag for last CONTINUATION */ + hd.flags = NGHTTP2_FLAG_END_HEADERS; + + DEBUGF(fprintf(stderr, "send: last CONTINUATION, payloadlen=%zu\n", + hd.length)); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + nghttp2_frame_pack_frame_hd(buf->pos, &hd); + } + + return 0; +} + +int nghttp2_frame_pack_headers(nghttp2_bufs *bufs, nghttp2_headers *frame, + nghttp2_hd_deflater *deflater) { + size_t nv_offset; + int rv; + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + nv_offset = nghttp2_frame_headers_payload_nv_offset(frame); + + buf = &bufs->cur->buf; + + buf->pos += nv_offset; + buf->last = buf->pos; + + /* This call will adjust buf->last to the correct position */ + rv = nghttp2_hd_deflate_hd_bufs(deflater, bufs, frame->nva, frame->nvlen); + + if (rv == NGHTTP2_ERR_BUFFER_ERROR) { + rv = NGHTTP2_ERR_HEADER_COMP; + } + + buf->pos -= nv_offset; + + if (rv != 0) { + return rv; + } + + if (frame->hd.flags & NGHTTP2_FLAG_PRIORITY) { + nghttp2_frame_pack_priority_spec(buf->pos, &frame->pri_spec); + } + + frame->padlen = 0; + frame->hd.length = nghttp2_bufs_len(bufs); + + return frame_pack_headers_shared(bufs, &frame->hd); +} + +void nghttp2_frame_pack_priority_spec(uint8_t *buf, + const nghttp2_priority_spec *pri_spec) { + nghttp2_put_uint32be(buf, (uint32_t)pri_spec->stream_id); + if (pri_spec->exclusive) { + buf[0] |= 0x80; + } + buf[4] = (uint8_t)(pri_spec->weight - 1); +} + +void nghttp2_frame_unpack_priority_spec(nghttp2_priority_spec *pri_spec, + uint8_t flags _U_, + const uint8_t *payload, + size_t payloadlen _U_) { + int32_t dep_stream_id; + uint8_t exclusive; + int32_t weight; + + dep_stream_id = nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; + exclusive = (payload[0] & 0x80) > 0; + weight = payload[4] + 1; + + nghttp2_priority_spec_init(pri_spec, dep_stream_id, weight, exclusive); +} + +int nghttp2_frame_unpack_headers_payload(nghttp2_headers *frame, + const uint8_t *payload, + size_t payloadlen) { + if (frame->hd.flags & NGHTTP2_FLAG_PRIORITY) { + nghttp2_frame_unpack_priority_spec(&frame->pri_spec, frame->hd.flags, + payload, payloadlen); + } else { + nghttp2_priority_spec_default_init(&frame->pri_spec); + } + + frame->nva = NULL; + frame->nvlen = 0; + + return 0; +} + +int nghttp2_frame_pack_priority(nghttp2_bufs *bufs, nghttp2_priority *frame) { + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= NGHTTP2_PRIORITY_SPECLEN); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + nghttp2_frame_pack_priority_spec(buf->last, &frame->pri_spec); + + buf->last += NGHTTP2_PRIORITY_SPECLEN; + + return 0; +} + +void nghttp2_frame_unpack_priority_payload(nghttp2_priority *frame, + const uint8_t *payload, + size_t payloadlen) { + nghttp2_frame_unpack_priority_spec(&frame->pri_spec, frame->hd.flags, payload, + payloadlen); +} + +int nghttp2_frame_pack_rst_stream(nghttp2_bufs *bufs, + nghttp2_rst_stream *frame) { + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= 4); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + nghttp2_put_uint32be(buf->last, frame->error_code); + buf->last += 4; + + return 0; +} + +void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame, + const uint8_t *payload, + size_t payloadlen _U_) { + frame->error_code = nghttp2_get_uint32(payload); +} + +int nghttp2_frame_pack_settings(nghttp2_bufs *bufs, nghttp2_settings *frame) { + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + if (nghttp2_buf_avail(buf) < frame->hd.length) { + return NGHTTP2_ERR_FRAME_SIZE_ERROR; + } + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + buf->last += + nghttp2_frame_pack_settings_payload(buf->last, frame->iv, frame->niv); + + return 0; +} + +size_t nghttp2_frame_pack_settings_payload(uint8_t *buf, + const nghttp2_settings_entry *iv, + size_t niv) { + size_t i; + for (i = 0; i < niv; ++i, buf += NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) { + nghttp2_put_uint16be(buf, (uint16_t)iv[i].settings_id); + nghttp2_put_uint32be(buf + 2, iv[i].value); + } + return NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH * niv; +} + +void nghttp2_frame_unpack_settings_payload(nghttp2_settings *frame, + nghttp2_settings_entry *iv, + size_t niv) { + frame->iv = iv; + frame->niv = niv; +} + +void nghttp2_frame_unpack_settings_entry(nghttp2_settings_entry *iv, + const uint8_t *payload) { + iv->settings_id = nghttp2_get_uint16(&payload[0]); + iv->value = nghttp2_get_uint32(&payload[2]); +} + +int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr, + size_t *niv_ptr, + const uint8_t *payload, + size_t payloadlen, + nghttp2_mem *mem) { + size_t i; + + *niv_ptr = payloadlen / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH; + + if (*niv_ptr == 0) { + *iv_ptr = NULL; + + return 0; + } + + *iv_ptr = + nghttp2_mem_malloc(mem, (*niv_ptr) * sizeof(nghttp2_settings_entry)); + + if (*iv_ptr == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + for (i = 0; i < *niv_ptr; ++i) { + size_t off = i * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH; + nghttp2_frame_unpack_settings_entry(&(*iv_ptr)[i], &payload[off]); + } + + return 0; +} + +int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs, + nghttp2_push_promise *frame, + nghttp2_hd_deflater *deflater) { + size_t nv_offset = 4; + int rv; + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->cur->buf; + + buf->pos += nv_offset; + buf->last = buf->pos; + + /* This call will adjust buf->last to the correct position */ + rv = nghttp2_hd_deflate_hd_bufs(deflater, bufs, frame->nva, frame->nvlen); + + if (rv == NGHTTP2_ERR_BUFFER_ERROR) { + rv = NGHTTP2_ERR_HEADER_COMP; + } + + buf->pos -= nv_offset; + + if (rv != 0) { + return rv; + } + + nghttp2_put_uint32be(buf->pos, (uint32_t)frame->promised_stream_id); + + frame->padlen = 0; + frame->hd.length = nghttp2_bufs_len(bufs); + + return frame_pack_headers_shared(bufs, &frame->hd); +} + +int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame, + const uint8_t *payload, + size_t payloadlen _U_) { + frame->promised_stream_id = + nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; + frame->nva = NULL; + frame->nvlen = 0; + return 0; +} + +int nghttp2_frame_pack_ping(nghttp2_bufs *bufs, nghttp2_ping *frame) { + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= 8); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + buf->last = + nghttp2_cpymem(buf->last, frame->opaque_data, sizeof(frame->opaque_data)); + + return 0; +} + +void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame, + const uint8_t *payload, + size_t payloadlen _U_) { + memcpy(frame->opaque_data, payload, sizeof(frame->opaque_data)); +} + +int nghttp2_frame_pack_goaway(nghttp2_bufs *bufs, nghttp2_goaway *frame) { + int rv; + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + nghttp2_put_uint32be(buf->last, (uint32_t)frame->last_stream_id); + buf->last += 4; + + nghttp2_put_uint32be(buf->last, frame->error_code); + buf->last += 4; + + rv = nghttp2_bufs_add(bufs, frame->opaque_data, frame->opaque_data_len); + + if (rv == NGHTTP2_ERR_BUFFER_ERROR) { + return NGHTTP2_ERR_FRAME_SIZE_ERROR; + } + + if (rv != 0) { + return rv; + } + + return 0; +} + +void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame, + const uint8_t *payload, + size_t payloadlen _U_, + uint8_t *var_gift_payload, + size_t var_gift_payloadlen) { + frame->last_stream_id = nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; + frame->error_code = nghttp2_get_uint32(payload + 4); + + frame->opaque_data = var_gift_payload; + frame->opaque_data_len = var_gift_payloadlen; +} + +int nghttp2_frame_unpack_goaway_payload2(nghttp2_goaway *frame, + const uint8_t *payload, + size_t payloadlen, nghttp2_mem *mem) { + uint8_t *var_gift_payload; + size_t var_gift_payloadlen; + + if (payloadlen > 8) { + var_gift_payloadlen = payloadlen - 8; + } else { + var_gift_payloadlen = 0; + } + + payloadlen -= var_gift_payloadlen; + + if (!var_gift_payloadlen) { + var_gift_payload = NULL; + } else { + var_gift_payload = nghttp2_mem_malloc(mem, var_gift_payloadlen); + + if (var_gift_payload == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + memcpy(var_gift_payload, payload + 8, var_gift_payloadlen); + } + + nghttp2_frame_unpack_goaway_payload(frame, payload, payloadlen, + var_gift_payload, var_gift_payloadlen); + + return 0; +} + +int nghttp2_frame_pack_window_update(nghttp2_bufs *bufs, + nghttp2_window_update *frame) { + nghttp2_buf *buf; + + assert(bufs->head == bufs->cur); + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= 4); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + nghttp2_put_uint32be(buf->last, (uint32_t)frame->window_size_increment); + buf->last += 4; + + return 0; +} + +void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame, + const uint8_t *payload, + size_t payloadlen _U_) { + frame->window_size_increment = + nghttp2_get_uint32(payload) & NGHTTP2_WINDOW_SIZE_INCREMENT_MASK; +} + +int nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *frame) { + int rv; + nghttp2_buf *buf; + nghttp2_ext_altsvc *altsvc; + + altsvc = frame->payload; + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= + 2 + altsvc->origin_len + altsvc->field_value_len); + + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + nghttp2_put_uint16be(buf->last, (uint16_t)altsvc->origin_len); + buf->last += 2; + + rv = nghttp2_bufs_add(bufs, altsvc->origin, altsvc->origin_len); + + assert(rv == 0); + + rv = nghttp2_bufs_add(bufs, altsvc->field_value, altsvc->field_value_len); + + assert(rv == 0); + + return 0; +} + +void nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, + size_t origin_len, uint8_t *payload, + size_t payloadlen) { + nghttp2_ext_altsvc *altsvc; + uint8_t *p; + + altsvc = frame->payload; + p = payload; + + altsvc->origin = p; + + p += origin_len; + + altsvc->origin_len = origin_len; + + altsvc->field_value = p; + altsvc->field_value_len = (size_t)(payload + payloadlen - p); +} + +int nghttp2_frame_unpack_altsvc_payload2(nghttp2_extension *frame, + const uint8_t *payload, + size_t payloadlen, nghttp2_mem *mem) { + uint8_t *buf; + size_t origin_len; + + if (payloadlen < 2) { + return NGHTTP2_FRAME_SIZE_ERROR; + } + + origin_len = nghttp2_get_uint16(payload); + + buf = nghttp2_mem_malloc(mem, payloadlen - 2); + if (!buf) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_cpymem(buf, payload + 2, payloadlen - 2); + + nghttp2_frame_unpack_altsvc_payload(frame, origin_len, buf, payloadlen - 2); + + return 0; +} + +nghttp2_settings_entry *nghttp2_frame_iv_copy(const nghttp2_settings_entry *iv, + size_t niv, nghttp2_mem *mem) { + nghttp2_settings_entry *iv_copy; + size_t len = niv * sizeof(nghttp2_settings_entry); + + if (len == 0) { + return NULL; + } + + iv_copy = nghttp2_mem_malloc(mem, len); + + if (iv_copy == NULL) { + return NULL; + } + + memcpy(iv_copy, iv, len); + + return iv_copy; +} + +int nghttp2_nv_equal(const nghttp2_nv *a, const nghttp2_nv *b) { + return a->namelen == b->namelen && a->valuelen == b->valuelen && + memcmp(a->name, b->name, a->namelen) == 0 && + memcmp(a->value, b->value, a->valuelen) == 0; +} + +void nghttp2_nv_array_del(nghttp2_nv *nva, nghttp2_mem *mem) { + nghttp2_mem_free(mem, nva); +} + +static int bytes_compar(const uint8_t *a, size_t alen, const uint8_t *b, + size_t blen) { + int rv; + + if (alen == blen) { + return memcmp(a, b, alen); + } + + if (alen < blen) { + rv = memcmp(a, b, alen); + + if (rv == 0) { + return -1; + } + + return rv; + } + + rv = memcmp(a, b, blen); + + if (rv == 0) { + return 1; + } + + return rv; +} + +int nghttp2_nv_compare_name(const nghttp2_nv *lhs, const nghttp2_nv *rhs) { + return bytes_compar(lhs->name, lhs->namelen, rhs->name, rhs->namelen); +} + +static int nv_compar(const void *lhs, const void *rhs) { + const nghttp2_nv *a = (const nghttp2_nv *)lhs; + const nghttp2_nv *b = (const nghttp2_nv *)rhs; + int rv; + + rv = bytes_compar(a->name, a->namelen, b->name, b->namelen); + + if (rv == 0) { + return bytes_compar(a->value, a->valuelen, b->value, b->valuelen); + } + + return rv; +} + +void nghttp2_nv_array_sort(nghttp2_nv *nva, size_t nvlen) { + qsort(nva, nvlen, sizeof(nghttp2_nv), nv_compar); +} + +int nghttp2_nv_array_copy(nghttp2_nv **nva_ptr, const nghttp2_nv *nva, + size_t nvlen, nghttp2_mem *mem) { + size_t i; + uint8_t *data = NULL; + size_t buflen = 0; + nghttp2_nv *p; + + if (nvlen == 0) { + *nva_ptr = NULL; + + return 0; + } + + for (i = 0; i < nvlen; ++i) { + /* + 1 for null-termination */ + if ((nva[i].flags & NGHTTP2_NV_FLAG_NO_COPY_NAME) == 0) { + buflen += nva[i].namelen + 1; + } + if ((nva[i].flags & NGHTTP2_NV_FLAG_NO_COPY_VALUE) == 0) { + buflen += nva[i].valuelen + 1; + } + } + + buflen += sizeof(nghttp2_nv) * nvlen; + + *nva_ptr = nghttp2_mem_malloc(mem, buflen); + + if (*nva_ptr == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + p = *nva_ptr; + data = (uint8_t *)(*nva_ptr) + sizeof(nghttp2_nv) * nvlen; + + for (i = 0; i < nvlen; ++i) { + p->flags = nva[i].flags; + + if (nva[i].flags & NGHTTP2_NV_FLAG_NO_COPY_NAME) { + p->name = nva[i].name; + p->namelen = nva[i].namelen; + } else { + memcpy(data, nva[i].name, nva[i].namelen); + p->name = data; + p->namelen = nva[i].namelen; + data[p->namelen] = '\0'; + nghttp2_downcase(p->name, p->namelen); + data += nva[i].namelen + 1; + } + + if (nva[i].flags & NGHTTP2_NV_FLAG_NO_COPY_VALUE) { + p->value = nva[i].value; + p->valuelen = nva[i].valuelen; + } else { + memcpy(data, nva[i].value, nva[i].valuelen); + p->value = data; + p->valuelen = nva[i].valuelen; + data[p->valuelen] = '\0'; + data += nva[i].valuelen + 1; + } + + ++p; + } + return 0; +} + +int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) { + size_t i; + for (i = 0; i < niv; ++i) { + switch (iv[i].settings_id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + break; + case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + break; + case NGHTTP2_SETTINGS_ENABLE_PUSH: + if (iv[i].value != 0 && iv[i].value != 1) { + return 0; + } + break; + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + if (iv[i].value > (uint32_t)NGHTTP2_MAX_WINDOW_SIZE) { + return 0; + } + break; + case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: + if (iv[i].value < NGHTTP2_MAX_FRAME_SIZE_MIN || + iv[i].value > NGHTTP2_MAX_FRAME_SIZE_MAX) { + return 0; + } + break; + case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + break; + } + } + return 1; +} + +static void frame_set_pad(nghttp2_buf *buf, size_t padlen, int framehd_only) { + size_t trail_padlen; + size_t newlen; + + DEBUGF(fprintf(stderr, "send: padlen=%zu, shift left 1 bytes\n", padlen)); + + memmove(buf->pos - 1, buf->pos, NGHTTP2_FRAME_HDLEN); + + --buf->pos; + + buf->pos[4] |= NGHTTP2_FLAG_PADDED; + + newlen = (nghttp2_get_uint32(buf->pos) >> 8) + padlen; + nghttp2_put_uint32be(buf->pos, (uint32_t)((newlen << 8) + buf->pos[3])); + + if (framehd_only) { + return; + } + + trail_padlen = padlen - 1; + buf->pos[NGHTTP2_FRAME_HDLEN] = (uint8_t)trail_padlen; + + /* zero out padding */ + memset(buf->last, 0, trail_padlen); + /* extend buffers trail_padlen bytes, since we ate previous padlen - + trail_padlen byte(s) */ + buf->last += trail_padlen; +} + +int nghttp2_frame_add_pad(nghttp2_bufs *bufs, nghttp2_frame_hd *hd, + size_t padlen, int framehd_only) { + nghttp2_buf *buf; + + if (padlen == 0) { + DEBUGF(fprintf(stderr, "send: padlen = 0, nothing to do\n")); + + return 0; + } + + /* + * We have arranged bufs like this: + * + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | |Frame header | Frame payload... : + * +-+-----------------+-------------------------------------------+ + * | |Frame header | Frame payload... : + * +-+-----------------+-------------------------------------------+ + * | |Frame header | Frame payload... : + * +-+-----------------+-------------------------------------------+ + * + * We arranged padding so that it is included in the first frame + * completely. For padded frame, we are going to adjust buf->pos of + * frame which includes padding and serialize (memmove) frame header + * in the correct position. Also extends buf->last to include + * padding. + */ + + buf = &bufs->head->buf; + + assert(nghttp2_buf_avail(buf) >= padlen - 1); + + frame_set_pad(buf, padlen, framehd_only); + + hd->length += padlen; + hd->flags |= NGHTTP2_FLAG_PADDED; + + DEBUGF(fprintf(stderr, "send: final payloadlen=%zu, padlen=%zu\n", hd->length, + padlen)); + + return 0; +} diff --git a/components/nghttp/library/nghttp2_hd.c b/components/nghttp/library/nghttp2_hd.c new file mode 100644 index 0000000000..ffd33e2281 --- /dev/null +++ b/components/nghttp/library/nghttp2_hd.c @@ -0,0 +1,2330 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_hd.h" + +#include +#include +#include + +#include "nghttp2_helper.h" +#include "nghttp2_int.h" + +/* Make scalar initialization form of nghttp2_hd_entry */ +#define MAKE_STATIC_ENT(N, V, T, H) \ + { \ + { NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1 } \ + , {NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \ + {(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \ + T, H \ + } + +/* Generated by mkstatictbl.py */ +/* 3rd parameter is nghttp2_token value for header field name. We use + first enum value if same header names are repeated (e.g., + :status). */ +static nghttp2_hd_static_entry static_table[] = { + MAKE_STATIC_ENT(":authority", "", 0, 3153725150u), + MAKE_STATIC_ENT(":method", "GET", 1, 695666056u), + MAKE_STATIC_ENT(":method", "POST", 1, 695666056u), + MAKE_STATIC_ENT(":path", "/", 3, 3292848686u), + MAKE_STATIC_ENT(":path", "/index.html", 3, 3292848686u), + MAKE_STATIC_ENT(":scheme", "http", 5, 2510477674u), + MAKE_STATIC_ENT(":scheme", "https", 5, 2510477674u), + MAKE_STATIC_ENT(":status", "200", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "204", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "206", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "304", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "400", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "404", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "500", 7, 4000288983u), + MAKE_STATIC_ENT("accept-charset", "", 14, 3664010344u), + MAKE_STATIC_ENT("accept-encoding", "gzip, deflate", 15, 3379649177u), + MAKE_STATIC_ENT("accept-language", "", 16, 1979086614u), + MAKE_STATIC_ENT("accept-ranges", "", 17, 1713753958u), + MAKE_STATIC_ENT("accept", "", 18, 136609321u), + MAKE_STATIC_ENT("access-control-allow-origin", "", 19, 2710797292u), + MAKE_STATIC_ENT("age", "", 20, 742476188u), + MAKE_STATIC_ENT("allow", "", 21, 2930878514u), + MAKE_STATIC_ENT("authorization", "", 22, 2436257726u), + MAKE_STATIC_ENT("cache-control", "", 23, 1355326669u), + MAKE_STATIC_ENT("content-disposition", "", 24, 3889184348u), + MAKE_STATIC_ENT("content-encoding", "", 25, 65203592u), + MAKE_STATIC_ENT("content-language", "", 26, 24973587u), + MAKE_STATIC_ENT("content-length", "", 27, 1308181789u), + MAKE_STATIC_ENT("content-location", "", 28, 2302364718u), + MAKE_STATIC_ENT("content-range", "", 29, 3555523146u), + MAKE_STATIC_ENT("content-type", "", 30, 4244048277u), + MAKE_STATIC_ENT("cookie", "", 31, 2007449791u), + MAKE_STATIC_ENT("date", "", 32, 3564297305u), + MAKE_STATIC_ENT("etag", "", 33, 113792960u), + MAKE_STATIC_ENT("expect", "", 34, 2530896728u), + MAKE_STATIC_ENT("expires", "", 35, 1049544579u), + MAKE_STATIC_ENT("from", "", 36, 2513272949u), + MAKE_STATIC_ENT("host", "", 37, 2952701295u), + MAKE_STATIC_ENT("if-match", "", 38, 3597694698u), + MAKE_STATIC_ENT("if-modified-since", "", 39, 2213050793u), + MAKE_STATIC_ENT("if-none-match", "", 40, 2536202615u), + MAKE_STATIC_ENT("if-range", "", 41, 2340978238u), + MAKE_STATIC_ENT("if-unmodified-since", "", 42, 3794814858u), + MAKE_STATIC_ENT("last-modified", "", 43, 3226950251u), + MAKE_STATIC_ENT("link", "", 44, 232457833u), + MAKE_STATIC_ENT("location", "", 45, 200649126u), + MAKE_STATIC_ENT("max-forwards", "", 46, 1826162134u), + MAKE_STATIC_ENT("proxy-authenticate", "", 47, 2709445359u), + MAKE_STATIC_ENT("proxy-authorization", "", 48, 2686392507u), + MAKE_STATIC_ENT("range", "", 49, 4208725202u), + MAKE_STATIC_ENT("referer", "", 50, 3969579366u), + MAKE_STATIC_ENT("refresh", "", 51, 3572655668u), + MAKE_STATIC_ENT("retry-after", "", 52, 3336180598u), + MAKE_STATIC_ENT("server", "", 53, 1085029842u), + MAKE_STATIC_ENT("set-cookie", "", 54, 1848371000u), + MAKE_STATIC_ENT("strict-transport-security", "", 55, 4138147361u), + MAKE_STATIC_ENT("transfer-encoding", "", 56, 3719590988u), + MAKE_STATIC_ENT("user-agent", "", 57, 606444526u), + MAKE_STATIC_ENT("vary", "", 58, 1085005381u), + MAKE_STATIC_ENT("via", "", 59, 1762798611u), + MAKE_STATIC_ENT("www-authenticate", "", 60, 779865858u), +}; + +static int memeq(const void *s1, const void *s2, size_t n) { + return memcmp(s1, s2, n) == 0; +} + +/* + * This function was generated by genlibtokenlookup.py. Inspired by + * h2o header lookup. https://github.com/h2o/h2o + */ +static int32_t lookup_token(const uint8_t *name, size_t namelen) { + switch (namelen) { + case 2: + switch (name[1]) { + case 'e': + if (lstreq("t", name, 1)) { + return NGHTTP2_TOKEN_TE; + } + break; + } + break; + case 3: + switch (name[2]) { + case 'a': + if (lstreq("vi", name, 2)) { + return NGHTTP2_TOKEN_VIA; + } + break; + case 'e': + if (lstreq("ag", name, 2)) { + return NGHTTP2_TOKEN_AGE; + } + break; + } + break; + case 4: + switch (name[3]) { + case 'e': + if (lstreq("dat", name, 3)) { + return NGHTTP2_TOKEN_DATE; + } + break; + case 'g': + if (lstreq("eta", name, 3)) { + return NGHTTP2_TOKEN_ETAG; + } + break; + case 'k': + if (lstreq("lin", name, 3)) { + return NGHTTP2_TOKEN_LINK; + } + break; + case 'm': + if (lstreq("fro", name, 3)) { + return NGHTTP2_TOKEN_FROM; + } + break; + case 't': + if (lstreq("hos", name, 3)) { + return NGHTTP2_TOKEN_HOST; + } + break; + case 'y': + if (lstreq("var", name, 3)) { + return NGHTTP2_TOKEN_VARY; + } + break; + } + break; + case 5: + switch (name[4]) { + case 'e': + if (lstreq("rang", name, 4)) { + return NGHTTP2_TOKEN_RANGE; + } + break; + case 'h': + if (lstreq(":pat", name, 4)) { + return NGHTTP2_TOKEN__PATH; + } + break; + case 'w': + if (lstreq("allo", name, 4)) { + return NGHTTP2_TOKEN_ALLOW; + } + break; + } + break; + case 6: + switch (name[5]) { + case 'e': + if (lstreq("cooki", name, 5)) { + return NGHTTP2_TOKEN_COOKIE; + } + break; + case 'r': + if (lstreq("serve", name, 5)) { + return NGHTTP2_TOKEN_SERVER; + } + break; + case 't': + if (lstreq("accep", name, 5)) { + return NGHTTP2_TOKEN_ACCEPT; + } + if (lstreq("expec", name, 5)) { + return NGHTTP2_TOKEN_EXPECT; + } + break; + } + break; + case 7: + switch (name[6]) { + case 'd': + if (lstreq(":metho", name, 6)) { + return NGHTTP2_TOKEN__METHOD; + } + break; + case 'e': + if (lstreq(":schem", name, 6)) { + return NGHTTP2_TOKEN__SCHEME; + } + if (lstreq("upgrad", name, 6)) { + return NGHTTP2_TOKEN_UPGRADE; + } + break; + case 'h': + if (lstreq("refres", name, 6)) { + return NGHTTP2_TOKEN_REFRESH; + } + break; + case 'r': + if (lstreq("refere", name, 6)) { + return NGHTTP2_TOKEN_REFERER; + } + break; + case 's': + if (lstreq(":statu", name, 6)) { + return NGHTTP2_TOKEN__STATUS; + } + if (lstreq("expire", name, 6)) { + return NGHTTP2_TOKEN_EXPIRES; + } + break; + } + break; + case 8: + switch (name[7]) { + case 'e': + if (lstreq("if-rang", name, 7)) { + return NGHTTP2_TOKEN_IF_RANGE; + } + break; + case 'h': + if (lstreq("if-matc", name, 7)) { + return NGHTTP2_TOKEN_IF_MATCH; + } + break; + case 'n': + if (lstreq("locatio", name, 7)) { + return NGHTTP2_TOKEN_LOCATION; + } + break; + } + break; + case 10: + switch (name[9]) { + case 'e': + if (lstreq("keep-aliv", name, 9)) { + return NGHTTP2_TOKEN_KEEP_ALIVE; + } + if (lstreq("set-cooki", name, 9)) { + return NGHTTP2_TOKEN_SET_COOKIE; + } + break; + case 'n': + if (lstreq("connectio", name, 9)) { + return NGHTTP2_TOKEN_CONNECTION; + } + break; + case 't': + if (lstreq("user-agen", name, 9)) { + return NGHTTP2_TOKEN_USER_AGENT; + } + break; + case 'y': + if (lstreq(":authorit", name, 9)) { + return NGHTTP2_TOKEN__AUTHORITY; + } + break; + } + break; + case 11: + switch (name[10]) { + case 'r': + if (lstreq("retry-afte", name, 10)) { + return NGHTTP2_TOKEN_RETRY_AFTER; + } + break; + } + break; + case 12: + switch (name[11]) { + case 'e': + if (lstreq("content-typ", name, 11)) { + return NGHTTP2_TOKEN_CONTENT_TYPE; + } + break; + case 's': + if (lstreq("max-forward", name, 11)) { + return NGHTTP2_TOKEN_MAX_FORWARDS; + } + break; + } + break; + case 13: + switch (name[12]) { + case 'd': + if (lstreq("last-modifie", name, 12)) { + return NGHTTP2_TOKEN_LAST_MODIFIED; + } + break; + case 'e': + if (lstreq("content-rang", name, 12)) { + return NGHTTP2_TOKEN_CONTENT_RANGE; + } + break; + case 'h': + if (lstreq("if-none-matc", name, 12)) { + return NGHTTP2_TOKEN_IF_NONE_MATCH; + } + break; + case 'l': + if (lstreq("cache-contro", name, 12)) { + return NGHTTP2_TOKEN_CACHE_CONTROL; + } + break; + case 'n': + if (lstreq("authorizatio", name, 12)) { + return NGHTTP2_TOKEN_AUTHORIZATION; + } + break; + case 's': + if (lstreq("accept-range", name, 12)) { + return NGHTTP2_TOKEN_ACCEPT_RANGES; + } + break; + } + break; + case 14: + switch (name[13]) { + case 'h': + if (lstreq("content-lengt", name, 13)) { + return NGHTTP2_TOKEN_CONTENT_LENGTH; + } + break; + case 't': + if (lstreq("accept-charse", name, 13)) { + return NGHTTP2_TOKEN_ACCEPT_CHARSET; + } + break; + } + break; + case 15: + switch (name[14]) { + case 'e': + if (lstreq("accept-languag", name, 14)) { + return NGHTTP2_TOKEN_ACCEPT_LANGUAGE; + } + break; + case 'g': + if (lstreq("accept-encodin", name, 14)) { + return NGHTTP2_TOKEN_ACCEPT_ENCODING; + } + break; + } + break; + case 16: + switch (name[15]) { + case 'e': + if (lstreq("content-languag", name, 15)) { + return NGHTTP2_TOKEN_CONTENT_LANGUAGE; + } + if (lstreq("www-authenticat", name, 15)) { + return NGHTTP2_TOKEN_WWW_AUTHENTICATE; + } + break; + case 'g': + if (lstreq("content-encodin", name, 15)) { + return NGHTTP2_TOKEN_CONTENT_ENCODING; + } + break; + case 'n': + if (lstreq("content-locatio", name, 15)) { + return NGHTTP2_TOKEN_CONTENT_LOCATION; + } + if (lstreq("proxy-connectio", name, 15)) { + return NGHTTP2_TOKEN_PROXY_CONNECTION; + } + break; + } + break; + case 17: + switch (name[16]) { + case 'e': + if (lstreq("if-modified-sinc", name, 16)) { + return NGHTTP2_TOKEN_IF_MODIFIED_SINCE; + } + break; + case 'g': + if (lstreq("transfer-encodin", name, 16)) { + return NGHTTP2_TOKEN_TRANSFER_ENCODING; + } + break; + } + break; + case 18: + switch (name[17]) { + case 'e': + if (lstreq("proxy-authenticat", name, 17)) { + return NGHTTP2_TOKEN_PROXY_AUTHENTICATE; + } + break; + } + break; + case 19: + switch (name[18]) { + case 'e': + if (lstreq("if-unmodified-sinc", name, 18)) { + return NGHTTP2_TOKEN_IF_UNMODIFIED_SINCE; + } + break; + case 'n': + if (lstreq("content-dispositio", name, 18)) { + return NGHTTP2_TOKEN_CONTENT_DISPOSITION; + } + if (lstreq("proxy-authorizatio", name, 18)) { + return NGHTTP2_TOKEN_PROXY_AUTHORIZATION; + } + break; + } + break; + case 25: + switch (name[24]) { + case 'y': + if (lstreq("strict-transport-securit", name, 24)) { + return NGHTTP2_TOKEN_STRICT_TRANSPORT_SECURITY; + } + break; + } + break; + case 27: + switch (name[26]) { + case 'n': + if (lstreq("access-control-allow-origi", name, 26)) { + return NGHTTP2_TOKEN_ACCESS_CONTROL_ALLOW_ORIGIN; + } + break; + } + break; + } + return -1; +} + +void nghttp2_hd_entry_init(nghttp2_hd_entry *ent, nghttp2_hd_nv *nv) { + ent->nv = *nv; + ent->cnv.name = nv->name->base; + ent->cnv.namelen = nv->name->len; + ent->cnv.value = nv->value->base; + ent->cnv.valuelen = nv->value->len; + ent->cnv.flags = nv->flags; + ent->next = NULL; + ent->hash = 0; + + nghttp2_rcbuf_incref(ent->nv.name); + nghttp2_rcbuf_incref(ent->nv.value); +} + +void nghttp2_hd_entry_free(nghttp2_hd_entry *ent) { + nghttp2_rcbuf_decref(ent->nv.value); + nghttp2_rcbuf_decref(ent->nv.name); +} + +static int name_eq(const nghttp2_hd_nv *a, const nghttp2_nv *b) { + return a->name->len == b->namelen && + memeq(a->name->base, b->name, b->namelen); +} + +static int value_eq(const nghttp2_hd_nv *a, const nghttp2_nv *b) { + return a->value->len == b->valuelen && + memeq(a->value->base, b->value, b->valuelen); +} + +static uint32_t name_hash(const nghttp2_nv *nv) { + /* 32 bit FNV-1a: http://isthe.com/chongo/tech/comp/fnv/ */ + uint32_t h = 2166136261u; + size_t i; + + for (i = 0; i < nv->namelen; ++i) { + h ^= nv->name[i]; + h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24); + } + + return h; +} + +static void hd_map_init(nghttp2_hd_map *map) { + memset(map, 0, sizeof(nghttp2_hd_map)); +} + +static void hd_map_insert(nghttp2_hd_map *map, nghttp2_hd_entry *ent) { + nghttp2_hd_entry **bucket; + + bucket = &map->table[ent->hash & (HD_MAP_SIZE - 1)]; + + if (*bucket == NULL) { + *bucket = ent; + return; + } + + /* lower index is linked near the root */ + ent->next = *bucket; + *bucket = ent; +} + +static nghttp2_hd_entry *hd_map_find(nghttp2_hd_map *map, int *exact_match, + const nghttp2_nv *nv, int32_t token, + uint32_t hash, int name_only) { + nghttp2_hd_entry *p; + nghttp2_hd_entry *res = NULL; + + *exact_match = 0; + + for (p = map->table[hash & (HD_MAP_SIZE - 1)]; p; p = p->next) { + if (token != p->nv.token || + (token == -1 && (hash != p->hash || !name_eq(&p->nv, nv)))) { + continue; + } + if (!res) { + res = p; + if (name_only) { + break; + } + } + if (value_eq(&p->nv, nv)) { + res = p; + *exact_match = 1; + break; + } + } + + return res; +} + +static void hd_map_remove(nghttp2_hd_map *map, nghttp2_hd_entry *ent) { + nghttp2_hd_entry **dst; + + dst = &map->table[ent->hash & (HD_MAP_SIZE - 1)]; + + for (; *dst; dst = &(*dst)->next) { + if (*dst != ent) { + continue; + } + + *dst = ent->next; + ent->next = NULL; + return; + } +} + +static int hd_ringbuf_init(nghttp2_hd_ringbuf *ringbuf, size_t bufsize, + nghttp2_mem *mem) { + size_t size; + for (size = 1; size < bufsize; size <<= 1) + ; + ringbuf->buffer = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_entry *) * size); + if (ringbuf->buffer == NULL) { + return NGHTTP2_ERR_NOMEM; + } + ringbuf->mask = size - 1; + ringbuf->first = 0; + ringbuf->len = 0; + return 0; +} + +static nghttp2_hd_entry *hd_ringbuf_get(nghttp2_hd_ringbuf *ringbuf, + size_t idx) { + assert(idx < ringbuf->len); + return ringbuf->buffer[(ringbuf->first + idx) & ringbuf->mask]; +} + +static int hd_ringbuf_reserve(nghttp2_hd_ringbuf *ringbuf, size_t bufsize, + nghttp2_mem *mem) { + size_t i; + size_t size; + nghttp2_hd_entry **buffer; + + if (ringbuf->mask + 1 >= bufsize) { + return 0; + } + for (size = 1; size < bufsize; size <<= 1) + ; + buffer = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_entry *) * size); + if (buffer == NULL) { + return NGHTTP2_ERR_NOMEM; + } + for (i = 0; i < ringbuf->len; ++i) { + buffer[i] = hd_ringbuf_get(ringbuf, i); + } + nghttp2_mem_free(mem, ringbuf->buffer); + ringbuf->buffer = buffer; + ringbuf->mask = size - 1; + ringbuf->first = 0; + return 0; +} + +static void hd_ringbuf_free(nghttp2_hd_ringbuf *ringbuf, nghttp2_mem *mem) { + size_t i; + if (ringbuf == NULL) { + return; + } + for (i = 0; i < ringbuf->len; ++i) { + nghttp2_hd_entry *ent = hd_ringbuf_get(ringbuf, i); + + nghttp2_hd_entry_free(ent); + nghttp2_mem_free(mem, ent); + } + nghttp2_mem_free(mem, ringbuf->buffer); +} + +static int hd_ringbuf_push_front(nghttp2_hd_ringbuf *ringbuf, + nghttp2_hd_entry *ent, nghttp2_mem *mem) { + int rv; + + rv = hd_ringbuf_reserve(ringbuf, ringbuf->len + 1, mem); + + if (rv != 0) { + return rv; + } + + ringbuf->buffer[--ringbuf->first & ringbuf->mask] = ent; + ++ringbuf->len; + + return 0; +} + +static void hd_ringbuf_pop_back(nghttp2_hd_ringbuf *ringbuf) { + assert(ringbuf->len > 0); + --ringbuf->len; +} + +static int hd_context_init(nghttp2_hd_context *context, nghttp2_mem *mem) { + int rv; + context->mem = mem; + context->bad = 0; + context->hd_table_bufsize_max = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE; + rv = hd_ringbuf_init(&context->hd_table, context->hd_table_bufsize_max / + NGHTTP2_HD_ENTRY_OVERHEAD, + mem); + if (rv != 0) { + return rv; + } + + context->hd_table_bufsize = 0; + context->next_seq = 0; + + return 0; +} + +static void hd_context_free(nghttp2_hd_context *context) { + hd_ringbuf_free(&context->hd_table, context->mem); +} + +int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem) { + return nghttp2_hd_deflate_init2( + deflater, NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE, mem); +} + +int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, + size_t deflate_hd_table_bufsize_max, + nghttp2_mem *mem) { + int rv; + rv = hd_context_init(&deflater->ctx, mem); + if (rv != 0) { + return rv; + } + + hd_map_init(&deflater->map); + + if (deflate_hd_table_bufsize_max < NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE) { + deflater->notify_table_size_change = 1; + deflater->ctx.hd_table_bufsize_max = deflate_hd_table_bufsize_max; + } else { + deflater->notify_table_size_change = 0; + } + + deflater->deflate_hd_table_bufsize_max = deflate_hd_table_bufsize_max; + deflater->min_hd_table_bufsize_max = UINT32_MAX; + + return 0; +} + +int nghttp2_hd_inflate_init(nghttp2_hd_inflater *inflater, nghttp2_mem *mem) { + int rv; + + rv = hd_context_init(&inflater->ctx, mem); + if (rv != 0) { + goto fail; + } + + inflater->settings_hd_table_bufsize_max = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE; + inflater->min_hd_table_bufsize_max = UINT32_MAX; + + inflater->nv_name_keep = NULL; + inflater->nv_value_keep = NULL; + + inflater->opcode = NGHTTP2_HD_OPCODE_NONE; + inflater->state = NGHTTP2_HD_STATE_INFLATE_START; + + nghttp2_buf_init(&inflater->namebuf); + nghttp2_buf_init(&inflater->valuebuf); + + inflater->namercbuf = NULL; + inflater->valuercbuf = NULL; + + inflater->huffman_encoded = 0; + inflater->index = 0; + inflater->left = 0; + inflater->shift = 0; + inflater->index_required = 0; + inflater->no_index = 0; + + return 0; + +fail: + return rv; +} + +static void hd_inflate_keep_free(nghttp2_hd_inflater *inflater) { + nghttp2_rcbuf_decref(inflater->nv_value_keep); + nghttp2_rcbuf_decref(inflater->nv_name_keep); + + inflater->nv_value_keep = NULL; + inflater->nv_name_keep = NULL; +} + +void nghttp2_hd_deflate_free(nghttp2_hd_deflater *deflater) { + hd_context_free(&deflater->ctx); +} + +void nghttp2_hd_inflate_free(nghttp2_hd_inflater *inflater) { + hd_inflate_keep_free(inflater); + + nghttp2_rcbuf_decref(inflater->valuercbuf); + nghttp2_rcbuf_decref(inflater->namercbuf); + + hd_context_free(&inflater->ctx); +} + +static size_t entry_room(size_t namelen, size_t valuelen) { + return NGHTTP2_HD_ENTRY_OVERHEAD + namelen + valuelen; +} + +static int emit_header(nghttp2_hd_nv *nv_out, nghttp2_hd_nv *nv) { + DEBUGF(fprintf(stderr, "inflatehd: header emission: %s: %s\n", nv->name->base, + nv->value->base)); + /* ent->ref may be 0. This happens if the encoder emits literal + block larger than header table capacity with indexing. */ + *nv_out = *nv; + + return 0; +} + +static size_t count_encoded_length(size_t n, size_t prefix) { + size_t k = (size_t)((1 << prefix) - 1); + size_t len = 0; + + if (n < k) { + return 1; + } + + n -= k; + ++len; + + for (; n >= 128; n >>= 7, ++len) + ; + + return len + 1; +} + +static size_t encode_length(uint8_t *buf, size_t n, size_t prefix) { + size_t k = (size_t)((1 << prefix) - 1); + uint8_t *begin = buf; + + *buf = (uint8_t)(*buf & ~k); + + if (n < k) { + *buf = (uint8_t)(*buf | n); + return 1; + } + + *buf = (uint8_t)(*buf | k); + ++buf; + + n -= k; + + for (; n >= 128; n >>= 7) { + *buf++ = (uint8_t)((1 << 7) | (n & 0x7f)); + } + + *buf++ = (uint8_t)n; + + return (size_t)(buf - begin); +} + +/* + * Decodes |prefix| prefixed integer stored from |in|. The |last| + * represents the 1 beyond the last of the valid contiguous memory + * region from |in|. The decoded integer must be less than or equal + * to UINT32_MAX. + * + * If the |initial| is nonzero, it is used as a initial value, this + * function assumes the |in| starts with intermediate data. + * + * An entire integer is decoded successfully, decoded, the |*final| is + * set to nonzero. + * + * This function stores the decoded integer in |*res| if it succeed, + * including partial decoding (in this case, number of shift to make + * in the next call will be stored in |*shift_ptr|) and returns number + * of bytes processed, or returns -1, indicating decoding error. + */ +static ssize_t decode_length(uint32_t *res, size_t *shift_ptr, int *final, + uint32_t initial, size_t shift, const uint8_t *in, + const uint8_t *last, size_t prefix) { + uint32_t k = (uint8_t)((1 << prefix) - 1); + uint32_t n = initial; + const uint8_t *start = in; + + *shift_ptr = 0; + *final = 0; + + if (n == 0) { + if ((*in & k) != k) { + *res = (*in) & k; + *final = 1; + return 1; + } + + n = k; + + if (++in == last) { + *res = n; + return (ssize_t)(in - start); + } + } + + for (; in != last; ++in, shift += 7) { + uint32_t add = *in & 0x7f; + + if ((UINT32_MAX >> shift) < add) { + DEBUGF(fprintf(stderr, "inflate: integer overflow on shift\n")); + return -1; + } + + add <<= shift; + + if (UINT32_MAX - add < n) { + DEBUGF(fprintf(stderr, "inflate: integer overflow on addition\n")); + return -1; + } + + n += add; + + if ((*in & (1 << 7)) == 0) { + break; + } + } + + *shift_ptr = shift; + + if (in == last) { + *res = n; + return (ssize_t)(in - start); + } + + *res = n; + *final = 1; + return (ssize_t)(in + 1 - start); +} + +static int emit_table_size(nghttp2_bufs *bufs, size_t table_size) { + int rv; + uint8_t *bufp; + size_t blocklen; + uint8_t sb[16]; + + DEBUGF(fprintf(stderr, "deflatehd: emit table_size=%zu\n", table_size)); + + blocklen = count_encoded_length(table_size, 5); + + if (sizeof(sb) < blocklen) { + return NGHTTP2_ERR_HEADER_COMP; + } + + bufp = sb; + + *bufp = 0x20u; + + encode_length(bufp, table_size, 5); + + rv = nghttp2_bufs_add(bufs, sb, blocklen); + if (rv != 0) { + return rv; + } + + return 0; +} + +static int emit_indexed_block(nghttp2_bufs *bufs, size_t idx) { + int rv; + size_t blocklen; + uint8_t sb[16]; + uint8_t *bufp; + + blocklen = count_encoded_length(idx + 1, 7); + + DEBUGF(fprintf(stderr, "deflatehd: emit indexed index=%zu, %zu bytes\n", idx, + blocklen)); + + if (sizeof(sb) < blocklen) { + return NGHTTP2_ERR_HEADER_COMP; + } + + bufp = sb; + *bufp = 0x80u; + encode_length(bufp, idx + 1, 7); + + rv = nghttp2_bufs_add(bufs, sb, blocklen); + if (rv != 0) { + return rv; + } + + return 0; +} + +static int emit_string(nghttp2_bufs *bufs, const uint8_t *str, size_t len) { + int rv; + uint8_t sb[16]; + uint8_t *bufp; + size_t blocklen; + size_t enclen; + int huffman = 0; + + enclen = nghttp2_hd_huff_encode_count(str, len); + + if (enclen < len) { + huffman = 1; + } else { + enclen = len; + } + + blocklen = count_encoded_length(enclen, 7); + + DEBUGF(fprintf(stderr, "deflatehd: emit string str=")); + DEBUGF(fwrite(str, 1, len, stderr)); + DEBUGF(fprintf(stderr, ", length=%zu, huffman=%d, encoded_length=%zu\n", len, + huffman, enclen)); + + if (sizeof(sb) < blocklen) { + return NGHTTP2_ERR_HEADER_COMP; + } + + bufp = sb; + *bufp = huffman ? 1 << 7 : 0; + encode_length(bufp, enclen, 7); + + rv = nghttp2_bufs_add(bufs, sb, blocklen); + if (rv != 0) { + return rv; + } + + if (huffman) { + rv = nghttp2_hd_huff_encode(bufs, str, len); + } else { + assert(enclen == len); + rv = nghttp2_bufs_add(bufs, str, len); + } + + return rv; +} + +static uint8_t pack_first_byte(int indexing_mode) { + switch (indexing_mode) { + case NGHTTP2_HD_WITH_INDEXING: + return 0x40u; + case NGHTTP2_HD_WITHOUT_INDEXING: + return 0; + case NGHTTP2_HD_NEVER_INDEXING: + return 0x10u; + default: + assert(0); + } + /* This is required to compile with android NDK r10d + + --enable-werror */ + return 0; +} + +static int emit_indname_block(nghttp2_bufs *bufs, size_t idx, + const nghttp2_nv *nv, int indexing_mode) { + int rv; + uint8_t *bufp; + size_t blocklen; + uint8_t sb[16]; + size_t prefixlen; + + if (indexing_mode == NGHTTP2_HD_WITH_INDEXING) { + prefixlen = 6; + } else { + prefixlen = 4; + } + + DEBUGF(fprintf(stderr, "deflatehd: emit indname index=%zu, valuelen=%zu, " + "indexing_mode=%d\n", + idx, nv->valuelen, indexing_mode)); + + blocklen = count_encoded_length(idx + 1, prefixlen); + + if (sizeof(sb) < blocklen) { + return NGHTTP2_ERR_HEADER_COMP; + } + + bufp = sb; + + *bufp = pack_first_byte(indexing_mode); + + encode_length(bufp, idx + 1, prefixlen); + + rv = nghttp2_bufs_add(bufs, sb, blocklen); + if (rv != 0) { + return rv; + } + + rv = emit_string(bufs, nv->value, nv->valuelen); + if (rv != 0) { + return rv; + } + + return 0; +} + +static int emit_newname_block(nghttp2_bufs *bufs, const nghttp2_nv *nv, + int indexing_mode) { + int rv; + + DEBUGF(fprintf(stderr, "deflatehd: emit newname namelen=%zu, valuelen=%zu, " + "indexing_mode=%d\n", + nv->namelen, nv->valuelen, indexing_mode)); + + rv = nghttp2_bufs_addb(bufs, pack_first_byte(indexing_mode)); + if (rv != 0) { + return rv; + } + + rv = emit_string(bufs, nv->name, nv->namelen); + if (rv != 0) { + return rv; + } + + rv = emit_string(bufs, nv->value, nv->valuelen); + if (rv != 0) { + return rv; + } + + return 0; +} + +static int add_hd_table_incremental(nghttp2_hd_context *context, + nghttp2_hd_nv *nv, nghttp2_hd_map *map, + uint32_t hash) { + int rv; + nghttp2_hd_entry *new_ent; + size_t room; + nghttp2_mem *mem; + + mem = context->mem; + room = entry_room(nv->name->len, nv->value->len); + + while (context->hd_table_bufsize + room > context->hd_table_bufsize_max && + context->hd_table.len > 0) { + + size_t idx = context->hd_table.len - 1; + nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx); + + context->hd_table_bufsize -= + entry_room(ent->nv.name->len, ent->nv.value->len); + + DEBUGF(fprintf(stderr, "hpack: remove item from header table: %s: %s\n", + (char *)ent->nv.name->base, (char *)ent->nv.value->base)); + + hd_ringbuf_pop_back(&context->hd_table); + if (map) { + hd_map_remove(map, ent); + } + + nghttp2_hd_entry_free(ent); + nghttp2_mem_free(mem, ent); + } + + if (room > context->hd_table_bufsize_max) { + /* The entry taking more than NGHTTP2_HD_MAX_BUFFER_SIZE is + immediately evicted. So we don't allocate memory for it. */ + return 0; + } + + new_ent = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_entry)); + if (new_ent == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_hd_entry_init(new_ent, nv); + + rv = hd_ringbuf_push_front(&context->hd_table, new_ent, mem); + + if (rv != 0) { + nghttp2_hd_entry_free(new_ent); + nghttp2_mem_free(mem, new_ent); + + return rv; + } + + new_ent->seq = context->next_seq++; + new_ent->hash = hash; + + if (map) { + hd_map_insert(map, new_ent); + } + + context->hd_table_bufsize += room; + + return 0; +} + +typedef struct { + ssize_t index; + /* Nonzero if both name and value are matched. */ + int name_value_match; +} search_result; + +static search_result search_static_table(const nghttp2_nv *nv, int32_t token, + int name_only) { + search_result res = {token, 0}; + int i; + nghttp2_hd_static_entry *ent; + + if (name_only) { + return res; + } + + for (i = token; + i <= NGHTTP2_TOKEN_WWW_AUTHENTICATE && static_table[i].token == token; + ++i) { + ent = &static_table[i]; + if (ent->value.len == nv->valuelen && + memcmp(ent->value.base, nv->value, nv->valuelen) == 0) { + res.index = i; + res.name_value_match = 1; + return res; + } + } + return res; +} + +static search_result search_hd_table(nghttp2_hd_context *context, + const nghttp2_nv *nv, int32_t token, + int indexing_mode, nghttp2_hd_map *map, + uint32_t hash) { + search_result res = {-1, 0}; + nghttp2_hd_entry *ent; + int exact_match; + int name_only = indexing_mode == NGHTTP2_HD_NEVER_INDEXING; + + exact_match = 0; + ent = hd_map_find(map, &exact_match, nv, token, hash, name_only); + + if (!exact_match && token >= 0 && token <= NGHTTP2_TOKEN_WWW_AUTHENTICATE) { + return search_static_table(nv, token, name_only); + } + + if (ent == NULL) { + return res; + } + + res.index = + (ssize_t)(context->next_seq - 1 - ent->seq + NGHTTP2_STATIC_TABLE_LENGTH); + res.name_value_match = exact_match; + + return res; +} + +static void hd_context_shrink_table_size(nghttp2_hd_context *context, + nghttp2_hd_map *map) { + nghttp2_mem *mem; + + mem = context->mem; + + while (context->hd_table_bufsize > context->hd_table_bufsize_max && + context->hd_table.len > 0) { + size_t idx = context->hd_table.len - 1; + nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx); + context->hd_table_bufsize -= + entry_room(ent->nv.name->len, ent->nv.value->len); + hd_ringbuf_pop_back(&context->hd_table); + if (map) { + hd_map_remove(map, ent); + } + + nghttp2_hd_entry_free(ent); + nghttp2_mem_free(mem, ent); + } +} + +int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, + size_t settings_hd_table_bufsize_max) { + size_t next_bufsize = nghttp2_min(settings_hd_table_bufsize_max, + deflater->deflate_hd_table_bufsize_max); + + deflater->ctx.hd_table_bufsize_max = next_bufsize; + + deflater->min_hd_table_bufsize_max = + nghttp2_min(deflater->min_hd_table_bufsize_max, next_bufsize); + + deflater->notify_table_size_change = 1; + + hd_context_shrink_table_size(&deflater->ctx, &deflater->map); + return 0; +} + +int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, + size_t settings_hd_table_bufsize_max) { + switch (inflater->state) { + case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE: + case NGHTTP2_HD_STATE_INFLATE_START: + break; + default: + return NGHTTP2_ERR_INVALID_STATE; + } + + /* It seems that encoder is not required to send dynamic table size + update if the table size is not changed after applying + SETTINGS_HEADER_TABLE_SIZE. RFC 7541 is ambiguous here, but this + is the intention of the editor. If new maximum table size is + strictly smaller than the current negotiated maximum size, + encoder must send dynamic table size update. In other cases, we + cannot expect it to do so. */ + if (inflater->ctx.hd_table_bufsize_max > settings_hd_table_bufsize_max) { + inflater->state = NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE; + /* Remember minimum value, and validate that encoder sends the + value less than or equal to this. */ + inflater->min_hd_table_bufsize_max = settings_hd_table_bufsize_max; + } + + inflater->settings_hd_table_bufsize_max = settings_hd_table_bufsize_max; + + inflater->ctx.hd_table_bufsize_max = settings_hd_table_bufsize_max; + + hd_context_shrink_table_size(&inflater->ctx, NULL); + return 0; +} + +#define INDEX_RANGE_VALID(context, idx) \ + ((idx) < (context)->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH) + +static size_t get_max_index(nghttp2_hd_context *context) { + return context->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH; +} + +nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t idx) { + assert(INDEX_RANGE_VALID(context, idx)); + if (idx >= NGHTTP2_STATIC_TABLE_LENGTH) { + return hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH) + ->nv; + } else { + nghttp2_hd_static_entry *ent = &static_table[idx]; + nghttp2_hd_nv nv = {&ent->name, &ent->value, ent->token, + NGHTTP2_NV_FLAG_NONE}; + return nv; + } +} + +static const nghttp2_nv *nghttp2_hd_table_get2(nghttp2_hd_context *context, + size_t idx) { + assert(INDEX_RANGE_VALID(context, idx)); + if (idx >= NGHTTP2_STATIC_TABLE_LENGTH) { + return &hd_ringbuf_get(&context->hd_table, + idx - NGHTTP2_STATIC_TABLE_LENGTH)->cnv; + } + + return &static_table[idx].cnv; +} + +static int hd_deflate_decide_indexing(nghttp2_hd_deflater *deflater, + const nghttp2_nv *nv, int32_t token) { + if (token == NGHTTP2_TOKEN__PATH || token == NGHTTP2_TOKEN_AGE || + token == NGHTTP2_TOKEN_CONTENT_LENGTH || token == NGHTTP2_TOKEN_ETAG || + token == NGHTTP2_TOKEN_IF_MODIFIED_SINCE || + token == NGHTTP2_TOKEN_IF_NONE_MATCH || token == NGHTTP2_TOKEN_LOCATION || + token == NGHTTP2_TOKEN_SET_COOKIE || + entry_room(nv->namelen, nv->valuelen) > + deflater->ctx.hd_table_bufsize_max * 3 / 4) { + return NGHTTP2_HD_WITHOUT_INDEXING; + } + + return NGHTTP2_HD_WITH_INDEXING; +} + +static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs, + const nghttp2_nv *nv) { + int rv; + search_result res; + ssize_t idx; + int indexing_mode; + int32_t token; + nghttp2_mem *mem; + uint32_t hash = 0; + + DEBUGF(fprintf(stderr, "deflatehd: deflating %.*s: %.*s\n", (int)nv->namelen, + nv->name, (int)nv->valuelen, nv->value)); + + mem = deflater->ctx.mem; + + token = lookup_token(nv->name, nv->namelen); + if (token == -1) { + hash = name_hash(nv); + } else if (token <= NGHTTP2_TOKEN_WWW_AUTHENTICATE) { + hash = static_table[token].hash; + } + + /* Don't index authorization header field since it may contain low + entropy secret data (e.g., id/password). Also cookie header + field with less than 20 bytes value is also never indexed. This + is the same criteria used in Firefox codebase. */ + indexing_mode = + token == NGHTTP2_TOKEN_AUTHORIZATION || + (token == NGHTTP2_TOKEN_COOKIE && nv->valuelen < 20) || + (nv->flags & NGHTTP2_NV_FLAG_NO_INDEX) + ? NGHTTP2_HD_NEVER_INDEXING + : hd_deflate_decide_indexing(deflater, nv, token); + + res = search_hd_table(&deflater->ctx, nv, token, indexing_mode, + &deflater->map, hash); + + idx = res.index; + + if (res.name_value_match) { + + DEBUGF(fprintf(stderr, "deflatehd: name/value match index=%zd\n", idx)); + + rv = emit_indexed_block(bufs, (size_t)idx); + if (rv != 0) { + return rv; + } + + return 0; + } + + if (res.index != -1) { + DEBUGF(fprintf(stderr, "deflatehd: name match index=%zd\n", res.index)); + } + + if (indexing_mode == NGHTTP2_HD_WITH_INDEXING) { + nghttp2_hd_nv hd_nv; + + if (idx != -1 && idx < (ssize_t)NGHTTP2_STATIC_TABLE_LENGTH) { + hd_nv.name = nghttp2_hd_table_get(&deflater->ctx, (size_t)idx).name; + nghttp2_rcbuf_incref(hd_nv.name); + } else { + rv = nghttp2_rcbuf_new2(&hd_nv.name, nv->name, nv->namelen, mem); + if (rv != 0) { + return rv; + } + } + + rv = nghttp2_rcbuf_new2(&hd_nv.value, nv->value, nv->valuelen, mem); + + if (rv != 0) { + nghttp2_rcbuf_decref(hd_nv.name); + return rv; + } + + hd_nv.token = token; + hd_nv.flags = NGHTTP2_NV_FLAG_NONE; + + rv = add_hd_table_incremental(&deflater->ctx, &hd_nv, &deflater->map, hash); + + nghttp2_rcbuf_decref(hd_nv.value); + nghttp2_rcbuf_decref(hd_nv.name); + + if (rv != 0) { + return NGHTTP2_ERR_HEADER_COMP; + } + } + if (idx == -1) { + rv = emit_newname_block(bufs, nv, indexing_mode); + } else { + rv = emit_indname_block(bufs, (size_t)idx, nv, indexing_mode); + } + if (rv != 0) { + return rv; + } + + return 0; +} + +int nghttp2_hd_deflate_hd_bufs(nghttp2_hd_deflater *deflater, + nghttp2_bufs *bufs, const nghttp2_nv *nv, + size_t nvlen) { + size_t i; + int rv = 0; + + if (deflater->ctx.bad) { + return NGHTTP2_ERR_HEADER_COMP; + } + + if (deflater->notify_table_size_change) { + size_t min_hd_table_bufsize_max; + + min_hd_table_bufsize_max = deflater->min_hd_table_bufsize_max; + + deflater->notify_table_size_change = 0; + deflater->min_hd_table_bufsize_max = UINT32_MAX; + + if (deflater->ctx.hd_table_bufsize_max > min_hd_table_bufsize_max) { + + rv = emit_table_size(bufs, min_hd_table_bufsize_max); + + if (rv != 0) { + goto fail; + } + } + + rv = emit_table_size(bufs, deflater->ctx.hd_table_bufsize_max); + + if (rv != 0) { + goto fail; + } + } + + for (i = 0; i < nvlen; ++i) { + rv = deflate_nv(deflater, bufs, &nv[i]); + if (rv != 0) { + goto fail; + } + } + + DEBUGF( + fprintf(stderr, "deflatehd: all input name/value pairs were deflated\n")); + + return 0; +fail: + DEBUGF(fprintf(stderr, "deflatehd: error return %d\n", rv)); + + deflater->ctx.bad = 1; + return rv; +} + +ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, + size_t buflen, const nghttp2_nv *nv, + size_t nvlen) { + nghttp2_bufs bufs; + int rv; + nghttp2_mem *mem; + + mem = deflater->ctx.mem; + + rv = nghttp2_bufs_wrap_init(&bufs, buf, buflen, mem); + + if (rv != 0) { + return rv; + } + + rv = nghttp2_hd_deflate_hd_bufs(deflater, &bufs, nv, nvlen); + + buflen = nghttp2_bufs_len(&bufs); + + nghttp2_bufs_wrap_free(&bufs); + + if (rv == NGHTTP2_ERR_BUFFER_ERROR) { + return NGHTTP2_ERR_INSUFF_BUFSIZE; + } + + if (rv != 0) { + return rv; + } + + return (ssize_t)buflen; +} + +size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater _U_, + const nghttp2_nv *nva, size_t nvlen) { + size_t n = 0; + size_t i; + + /* Possible Maximum Header Table Size Change. Encoding (1u << 31) - + 1 using 4 bit prefix requires 6 bytes. We may emit this at most + twice. */ + n += 12; + + /* Use Literal Header Field without indexing - New Name, since it is + most space consuming format. Also we choose the less one between + non-huffman and huffman, so using literal byte count is + sufficient for upper bound. + + Encoding (1u << 31) - 1 using 7 bit prefix requires 6 bytes. We + need 2 of this for |nvlen| header fields. */ + n += 6 * 2 * nvlen; + + for (i = 0; i < nvlen; ++i) { + n += nva[i].namelen + nva[i].valuelen; + } + + return n; +} + +int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, + size_t deflate_hd_table_bufsize_max) { + return nghttp2_hd_deflate_new2(deflater_ptr, deflate_hd_table_bufsize_max, + NULL); +} + +int nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr, + size_t deflate_hd_table_bufsize_max, + nghttp2_mem *mem) { + int rv; + nghttp2_hd_deflater *deflater; + + if (mem == NULL) { + mem = nghttp2_mem_default(); + } + + deflater = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_deflater)); + + if (deflater == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + rv = nghttp2_hd_deflate_init2(deflater, deflate_hd_table_bufsize_max, mem); + + if (rv != 0) { + nghttp2_mem_free(mem, deflater); + + return rv; + } + + *deflater_ptr = deflater; + + return 0; +} + +void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater) { + nghttp2_mem *mem; + + mem = deflater->ctx.mem; + + nghttp2_hd_deflate_free(deflater); + + nghttp2_mem_free(mem, deflater); +} + +static void hd_inflate_set_huffman_encoded(nghttp2_hd_inflater *inflater, + const uint8_t *in) { + inflater->huffman_encoded = (*in & (1 << 7)) != 0; +} + +/* + * Decodes the integer from the range [in, last). The result is + * assigned to |inflater->left|. If the |inflater->left| is 0, then + * it performs variable integer decoding from scratch. Otherwise, it + * uses the |inflater->left| as the initial value and continues to + * decode assuming that [in, last) begins with intermediary sequence. + * + * This function returns the number of bytes read if it succeeds, or + * one of the following negative error codes: + * + * NGHTTP2_ERR_HEADER_COMP + * Integer decoding failed + */ +static ssize_t hd_inflate_read_len(nghttp2_hd_inflater *inflater, int *rfin, + const uint8_t *in, const uint8_t *last, + size_t prefix, size_t maxlen) { + ssize_t rv; + uint32_t out; + + *rfin = 0; + + rv = decode_length(&out, &inflater->shift, rfin, (uint32_t)inflater->left, + inflater->shift, in, last, prefix); + + if (rv == -1) { + DEBUGF(fprintf(stderr, "inflatehd: integer decoding failed\n")); + return NGHTTP2_ERR_HEADER_COMP; + } + + if (out > maxlen) { + DEBUGF(fprintf( + stderr, "inflatehd: integer exceeded the maximum value %zu\n", maxlen)); + return NGHTTP2_ERR_HEADER_COMP; + } + + inflater->left = out; + + DEBUGF(fprintf(stderr, "inflatehd: decoded integer is %u\n", out)); + + return rv; +} + +/* + * Reads |inflater->left| bytes from the range [in, last) and performs + * huffman decoding against them and pushes the result into the + * |buffer|. + * + * This function returns the number of bytes read if it succeeds, or + * one of the following negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_HEADER_COMP + * Huffman decoding failed + */ +static ssize_t hd_inflate_read_huff(nghttp2_hd_inflater *inflater, + nghttp2_buf *buf, const uint8_t *in, + const uint8_t *last) { + ssize_t readlen; + int final = 0; + if ((size_t)(last - in) >= inflater->left) { + last = in + inflater->left; + final = 1; + } + readlen = nghttp2_hd_huff_decode(&inflater->huff_decode_ctx, buf, in, + (size_t)(last - in), final); + + if (readlen < 0) { + DEBUGF(fprintf(stderr, "inflatehd: huffman decoding failed\n")); + return readlen; + } + inflater->left -= (size_t)readlen; + return readlen; +} + +/* + * Reads |inflater->left| bytes from the range [in, last) and copies + * them into the |buffer|. + * + * This function returns the number of bytes read if it succeeds, or + * one of the following negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + * NGHTTP2_ERR_HEADER_COMP + * Header decompression failed + */ +static ssize_t hd_inflate_read(nghttp2_hd_inflater *inflater, nghttp2_buf *buf, + const uint8_t *in, const uint8_t *last) { + size_t len = nghttp2_min((size_t)(last - in), inflater->left); + + buf->last = nghttp2_cpymem(buf->last, in, len); + + inflater->left -= len; + return (ssize_t)len; +} + +/* + * Finalize indexed header representation reception. If header is + * emitted, |*nv_out| is filled with that value and 0 is returned. If + * no header is emitted, 1 is returned. + * + * This function returns either 0 or 1 if it succeeds, or one of the + * following negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +static int hd_inflate_commit_indexed(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out) { + nghttp2_hd_nv nv = nghttp2_hd_table_get(&inflater->ctx, inflater->index); + + emit_header(nv_out, &nv); + + return 0; +} + +/* + * Finalize literal header representation - new name- reception. If + * header is emitted, |*nv_out| is filled with that value and 0 is + * returned. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +static int hd_inflate_commit_newname(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out) { + nghttp2_hd_nv nv; + int rv; + + if (inflater->no_index) { + nv.flags = NGHTTP2_NV_FLAG_NO_INDEX; + } else { + nv.flags = NGHTTP2_NV_FLAG_NONE; + } + + nv.name = inflater->namercbuf; + nv.value = inflater->valuercbuf; + nv.token = lookup_token(inflater->namercbuf->base, inflater->namercbuf->len); + + if (inflater->index_required) { + rv = add_hd_table_incremental(&inflater->ctx, &nv, NULL, 0); + + if (rv != 0) { + return rv; + } + } + + emit_header(nv_out, &nv); + + inflater->nv_name_keep = nv.name; + inflater->nv_value_keep = nv.value; + + inflater->namercbuf = NULL; + inflater->valuercbuf = NULL; + + return 0; +} + +/* + * Finalize literal header representation - indexed name- + * reception. If header is emitted, |*nv_out| is filled with that + * value and 0 is returned. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +static int hd_inflate_commit_indname(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out) { + nghttp2_hd_nv nv; + int rv; + + nv = nghttp2_hd_table_get(&inflater->ctx, inflater->index); + + if (inflater->no_index) { + nv.flags = NGHTTP2_NV_FLAG_NO_INDEX; + } else { + nv.flags = NGHTTP2_NV_FLAG_NONE; + } + + nghttp2_rcbuf_incref(nv.name); + + nv.value = inflater->valuercbuf; + + if (inflater->index_required) { + rv = add_hd_table_incremental(&inflater->ctx, &nv, NULL, 0); + if (rv != 0) { + nghttp2_rcbuf_decref(nv.name); + return NGHTTP2_ERR_NOMEM; + } + } + + emit_header(nv_out, &nv); + + inflater->nv_name_keep = nv.name; + inflater->nv_value_keep = nv.value; + + inflater->valuercbuf = NULL; + + return 0; +} + +ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, + int *inflate_flags, uint8_t *in, size_t inlen, + int in_final) { + return nghttp2_hd_inflate_hd2(inflater, nv_out, inflate_flags, in, inlen, + in_final); +} + +ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, + nghttp2_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, int in_final) { + ssize_t rv; + nghttp2_hd_nv hd_nv; + + rv = nghttp2_hd_inflate_hd_nv(inflater, &hd_nv, inflate_flags, in, inlen, + in_final); + + if (rv < 0) { + return rv; + } + + if (*inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + nv_out->name = hd_nv.name->base; + nv_out->namelen = hd_nv.name->len; + + nv_out->value = hd_nv.value->base; + nv_out->valuelen = hd_nv.value->len; + + nv_out->flags = hd_nv.flags; + } + + return rv; +} + +ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, + int in_final) { + ssize_t rv = 0; + const uint8_t *first = in; + const uint8_t *last = in + inlen; + int rfin = 0; + int busy = 0; + nghttp2_mem *mem; + + mem = inflater->ctx.mem; + + if (inflater->ctx.bad) { + return NGHTTP2_ERR_HEADER_COMP; + } + + DEBUGF(fprintf(stderr, "inflatehd: start state=%d\n", inflater->state)); + hd_inflate_keep_free(inflater); + *inflate_flags = NGHTTP2_HD_INFLATE_NONE; + for (; in != last || busy;) { + busy = 0; + switch (inflater->state) { + case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE: + if ((*in & 0xe0u) != 0x20u) { + DEBUGF(fprintf(stderr, "inflatehd: header table size change was " + "expected, but saw 0x%02x as first byte", + *in)); + rv = NGHTTP2_ERR_HEADER_COMP; + goto fail; + } + /* fall through */ + case NGHTTP2_HD_STATE_INFLATE_START: + case NGHTTP2_HD_STATE_OPCODE: + if ((*in & 0xe0u) == 0x20u) { + DEBUGF(fprintf(stderr, "inflatehd: header table size change\n")); + if (inflater->state == NGHTTP2_HD_STATE_OPCODE) { + DEBUGF(fprintf(stderr, "inflatehd: header table size change must " + "appear at the head of header block\n")); + rv = NGHTTP2_ERR_HEADER_COMP; + goto fail; + } + inflater->opcode = NGHTTP2_HD_OPCODE_INDEXED; + inflater->state = NGHTTP2_HD_STATE_READ_TABLE_SIZE; + } else if (*in & 0x80u) { + DEBUGF(fprintf(stderr, "inflatehd: indexed repr\n")); + inflater->opcode = NGHTTP2_HD_OPCODE_INDEXED; + inflater->state = NGHTTP2_HD_STATE_READ_INDEX; + } else { + if (*in == 0x40u || *in == 0 || *in == 0x10u) { + DEBUGF( + fprintf(stderr, "inflatehd: literal header repr - new name\n")); + inflater->opcode = NGHTTP2_HD_OPCODE_NEWNAME; + inflater->state = NGHTTP2_HD_STATE_NEWNAME_CHECK_NAMELEN; + } else { + DEBUGF(fprintf(stderr, + "inflatehd: literal header repr - indexed name\n")); + inflater->opcode = NGHTTP2_HD_OPCODE_INDNAME; + inflater->state = NGHTTP2_HD_STATE_READ_INDEX; + } + inflater->index_required = (*in & 0x40) != 0; + inflater->no_index = (*in & 0xf0u) == 0x10u; + DEBUGF(fprintf(stderr, "inflatehd: indexing required=%d, no_index=%d\n", + inflater->index_required, inflater->no_index)); + if (inflater->opcode == NGHTTP2_HD_OPCODE_NEWNAME) { + ++in; + } + } + inflater->left = 0; + inflater->shift = 0; + break; + case NGHTTP2_HD_STATE_READ_TABLE_SIZE: + rfin = 0; + rv = hd_inflate_read_len( + inflater, &rfin, in, last, 5, + nghttp2_min(inflater->min_hd_table_bufsize_max, + inflater->settings_hd_table_bufsize_max)); + if (rv < 0) { + goto fail; + } + in += rv; + if (!rfin) { + goto almost_ok; + } + DEBUGF(fprintf(stderr, "inflatehd: table_size=%zu\n", inflater->left)); + inflater->min_hd_table_bufsize_max = UINT32_MAX; + inflater->ctx.hd_table_bufsize_max = inflater->left; + hd_context_shrink_table_size(&inflater->ctx, NULL); + inflater->state = NGHTTP2_HD_STATE_INFLATE_START; + break; + case NGHTTP2_HD_STATE_READ_INDEX: { + size_t prefixlen; + + if (inflater->opcode == NGHTTP2_HD_OPCODE_INDEXED) { + prefixlen = 7; + } else if (inflater->index_required) { + prefixlen = 6; + } else { + prefixlen = 4; + } + + rfin = 0; + rv = hd_inflate_read_len(inflater, &rfin, in, last, prefixlen, + get_max_index(&inflater->ctx)); + if (rv < 0) { + goto fail; + } + + in += rv; + + if (!rfin) { + goto almost_ok; + } + + if (inflater->left == 0) { + rv = NGHTTP2_ERR_HEADER_COMP; + goto fail; + } + + DEBUGF(fprintf(stderr, "inflatehd: index=%zu\n", inflater->left)); + if (inflater->opcode == NGHTTP2_HD_OPCODE_INDEXED) { + inflater->index = inflater->left; + --inflater->index; + + rv = hd_inflate_commit_indexed(inflater, nv_out); + if (rv < 0) { + goto fail; + } + inflater->state = NGHTTP2_HD_STATE_OPCODE; + /* If rv == 1, no header was emitted */ + if (rv == 0) { + *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; + return (ssize_t)(in - first); + } + } else { + inflater->index = inflater->left; + --inflater->index; + + inflater->state = NGHTTP2_HD_STATE_CHECK_VALUELEN; + } + break; + } + case NGHTTP2_HD_STATE_NEWNAME_CHECK_NAMELEN: + hd_inflate_set_huffman_encoded(inflater, in); + inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN; + inflater->left = 0; + inflater->shift = 0; + DEBUGF(fprintf(stderr, "inflatehd: huffman encoded=%d\n", + inflater->huffman_encoded != 0)); + /* Fall through */ + case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN: + rfin = 0; + rv = hd_inflate_read_len(inflater, &rfin, in, last, 7, NGHTTP2_HD_MAX_NV); + if (rv < 0) { + goto fail; + } + in += rv; + if (!rfin) { + DEBUGF(fprintf(stderr, + "inflatehd: integer not fully decoded. current=%zu\n", + inflater->left)); + + goto almost_ok; + } + + if (inflater->huffman_encoded) { + nghttp2_hd_huff_decode_context_init(&inflater->huff_decode_ctx); + + inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF; + + rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, + mem); + } else { + inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME; + rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left + 1, mem); + } + + if (rv != 0) { + goto fail; + } + + nghttp2_buf_wrap_init(&inflater->namebuf, inflater->namercbuf->base, + inflater->namercbuf->len); + + break; + case NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF: + rv = hd_inflate_read_huff(inflater, &inflater->namebuf, in, last); + if (rv < 0) { + goto fail; + } + + in += rv; + + DEBUGF(fprintf(stderr, "inflatehd: %zd bytes read\n", rv)); + + if (inflater->left) { + DEBUGF(fprintf(stderr, "inflatehd: still %zu bytes to go\n", + inflater->left)); + + goto almost_ok; + } + + *inflater->namebuf.last = '\0'; + inflater->namercbuf->len = nghttp2_buf_len(&inflater->namebuf); + + inflater->state = NGHTTP2_HD_STATE_CHECK_VALUELEN; + + break; + case NGHTTP2_HD_STATE_NEWNAME_READ_NAME: + rv = hd_inflate_read(inflater, &inflater->namebuf, in, last); + if (rv < 0) { + goto fail; + } + + in += rv; + + DEBUGF(fprintf(stderr, "inflatehd: %zd bytes read\n", rv)); + if (inflater->left) { + DEBUGF(fprintf(stderr, "inflatehd: still %zu bytes to go\n", + inflater->left)); + + goto almost_ok; + } + + *inflater->namebuf.last = '\0'; + inflater->namercbuf->len = nghttp2_buf_len(&inflater->namebuf); + + inflater->state = NGHTTP2_HD_STATE_CHECK_VALUELEN; + + break; + case NGHTTP2_HD_STATE_CHECK_VALUELEN: + hd_inflate_set_huffman_encoded(inflater, in); + inflater->state = NGHTTP2_HD_STATE_READ_VALUELEN; + inflater->left = 0; + inflater->shift = 0; + DEBUGF(fprintf(stderr, "inflatehd: huffman encoded=%d\n", + inflater->huffman_encoded != 0)); + /* Fall through */ + case NGHTTP2_HD_STATE_READ_VALUELEN: + rfin = 0; + rv = hd_inflate_read_len(inflater, &rfin, in, last, 7, NGHTTP2_HD_MAX_NV); + if (rv < 0) { + goto fail; + } + + in += rv; + + if (!rfin) { + goto almost_ok; + } + + DEBUGF(fprintf(stderr, "inflatehd: valuelen=%zu\n", inflater->left)); + + if (inflater->huffman_encoded) { + nghttp2_hd_huff_decode_context_init(&inflater->huff_decode_ctx); + + inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF; + + rv = nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, + mem); + } else { + inflater->state = NGHTTP2_HD_STATE_READ_VALUE; + + rv = nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left + 1, mem); + } + + if (rv != 0) { + goto fail; + } + + nghttp2_buf_wrap_init(&inflater->valuebuf, inflater->valuercbuf->base, + inflater->valuercbuf->len); + + busy = 1; + + break; + case NGHTTP2_HD_STATE_READ_VALUEHUFF: + rv = hd_inflate_read_huff(inflater, &inflater->valuebuf, in, last); + if (rv < 0) { + goto fail; + } + + in += rv; + + DEBUGF(fprintf(stderr, "inflatehd: %zd bytes read\n", rv)); + + if (inflater->left) { + DEBUGF(fprintf(stderr, "inflatehd: still %zu bytes to go\n", + inflater->left)); + + goto almost_ok; + } + + *inflater->valuebuf.last = '\0'; + inflater->valuercbuf->len = nghttp2_buf_len(&inflater->valuebuf); + + if (inflater->opcode == NGHTTP2_HD_OPCODE_NEWNAME) { + rv = hd_inflate_commit_newname(inflater, nv_out); + } else { + rv = hd_inflate_commit_indname(inflater, nv_out); + } + + if (rv != 0) { + goto fail; + } + + inflater->state = NGHTTP2_HD_STATE_OPCODE; + *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; + + return (ssize_t)(in - first); + case NGHTTP2_HD_STATE_READ_VALUE: + rv = hd_inflate_read(inflater, &inflater->valuebuf, in, last); + if (rv < 0) { + DEBUGF(fprintf(stderr, "inflatehd: value read failure %zd: %s\n", rv, + nghttp2_strerror((int)rv))); + goto fail; + } + + in += rv; + + DEBUGF(fprintf(stderr, "inflatehd: %zd bytes read\n", rv)); + + if (inflater->left) { + DEBUGF(fprintf(stderr, "inflatehd: still %zu bytes to go\n", + inflater->left)); + goto almost_ok; + } + + *inflater->valuebuf.last = '\0'; + inflater->valuercbuf->len = nghttp2_buf_len(&inflater->valuebuf); + + if (inflater->opcode == NGHTTP2_HD_OPCODE_NEWNAME) { + rv = hd_inflate_commit_newname(inflater, nv_out); + } else { + rv = hd_inflate_commit_indname(inflater, nv_out); + } + + if (rv != 0) { + goto fail; + } + + inflater->state = NGHTTP2_HD_STATE_OPCODE; + *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; + + return (ssize_t)(in - first); + } + } + + assert(in == last); + + DEBUGF(fprintf(stderr, "inflatehd: all input bytes were processed\n")); + + if (in_final) { + DEBUGF(fprintf(stderr, "inflatehd: in_final set\n")); + + if (inflater->state != NGHTTP2_HD_STATE_OPCODE && + inflater->state != NGHTTP2_HD_STATE_INFLATE_START) { + DEBUGF(fprintf(stderr, "inflatehd: unacceptable state=%d\n", + inflater->state)); + rv = NGHTTP2_ERR_HEADER_COMP; + + goto fail; + } + *inflate_flags |= NGHTTP2_HD_INFLATE_FINAL; + } + return (ssize_t)(in - first); + +almost_ok: + if (in_final) { + DEBUGF(fprintf(stderr, "inflatehd: input ended prematurely\n")); + + rv = NGHTTP2_ERR_HEADER_COMP; + + goto fail; + } + return (ssize_t)(in - first); + +fail: + DEBUGF(fprintf(stderr, "inflatehd: error return %zd\n", rv)); + + inflater->ctx.bad = 1; + return rv; +} + +int nghttp2_hd_inflate_end_headers(nghttp2_hd_inflater *inflater) { + hd_inflate_keep_free(inflater); + inflater->state = NGHTTP2_HD_STATE_INFLATE_START; + return 0; +} + +int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr) { + return nghttp2_hd_inflate_new2(inflater_ptr, NULL); +} + +int nghttp2_hd_inflate_new2(nghttp2_hd_inflater **inflater_ptr, + nghttp2_mem *mem) { + int rv; + nghttp2_hd_inflater *inflater; + + if (mem == NULL) { + mem = nghttp2_mem_default(); + } + + inflater = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_inflater)); + + if (inflater == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + rv = nghttp2_hd_inflate_init(inflater, mem); + + if (rv != 0) { + nghttp2_mem_free(mem, inflater); + + return rv; + } + + *inflater_ptr = inflater; + + return 0; +} + +void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater) { + nghttp2_mem *mem; + + mem = inflater->ctx.mem; + nghttp2_hd_inflate_free(inflater); + + nghttp2_mem_free(mem, inflater); +} + +int nghttp2_hd_emit_indname_block(nghttp2_bufs *bufs, size_t idx, + nghttp2_nv *nv, int indexing_mode) { + + return emit_indname_block(bufs, idx, nv, indexing_mode); +} + +int nghttp2_hd_emit_newname_block(nghttp2_bufs *bufs, nghttp2_nv *nv, + int indexing_mode) { + return emit_newname_block(bufs, nv, indexing_mode); +} + +int nghttp2_hd_emit_table_size(nghttp2_bufs *bufs, size_t table_size) { + return emit_table_size(bufs, table_size); +} + +ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *final, + uint32_t initial, size_t shift, uint8_t *in, + uint8_t *last, size_t prefix) { + return decode_length(res, shift_ptr, final, initial, shift, in, last, prefix); +} + +static size_t hd_get_num_table_entries(nghttp2_hd_context *context) { + return context->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH; +} + +static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context, + size_t idx) { + if (idx == 0) { + return NULL; + } + + --idx; + + if (!INDEX_RANGE_VALID(context, idx)) { + return NULL; + } + + return nghttp2_hd_table_get2(context, idx); +} + +size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) { + return hd_get_num_table_entries(&deflater->ctx); +} + +const nghttp2_nv * +nghttp2_hd_deflate_get_table_entry(nghttp2_hd_deflater *deflater, size_t idx) { + return hd_get_table_entry(&deflater->ctx, idx); +} + +size_t +nghttp2_hd_deflate_get_dynamic_table_size(nghttp2_hd_deflater *deflater) { + return deflater->ctx.hd_table_bufsize; +} + +size_t +nghttp2_hd_deflate_get_max_dynamic_table_size(nghttp2_hd_deflater *deflater) { + return deflater->ctx.hd_table_bufsize_max; +} + +size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) { + return hd_get_num_table_entries(&inflater->ctx); +} + +const nghttp2_nv * +nghttp2_hd_inflate_get_table_entry(nghttp2_hd_inflater *inflater, size_t idx) { + return hd_get_table_entry(&inflater->ctx, idx); +} + +size_t +nghttp2_hd_inflate_get_dynamic_table_size(nghttp2_hd_inflater *inflater) { + return inflater->ctx.hd_table_bufsize; +} + +size_t +nghttp2_hd_inflate_get_max_dynamic_table_size(nghttp2_hd_inflater *inflater) { + return inflater->ctx.hd_table_bufsize_max; +} diff --git a/components/nghttp/library/nghttp2_hd_huffman.c b/components/nghttp/library/nghttp2_hd_huffman.c new file mode 100644 index 0000000000..3fb0d8863d --- /dev/null +++ b/components/nghttp/library/nghttp2_hd_huffman.c @@ -0,0 +1,202 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_hd_huffman.h" + +#include +#include +#include + +#include "nghttp2_hd.h" + +/* + * Encodes huffman code |sym| into |*dest_ptr|, whose least |rembits| + * bits are not filled yet. The |rembits| must be in range [1, 8], + * inclusive. At the end of the process, the |*dest_ptr| is updated + * and points where next output should be placed. The number of + * unfilled bits in the pointed location is returned. + */ +static ssize_t huff_encode_sym(nghttp2_bufs *bufs, size_t *avail_ptr, + size_t rembits, const nghttp2_huff_sym *sym) { + int rv; + size_t nbits = sym->nbits; + uint32_t code = sym->code; + + /* We assume that sym->nbits <= 32 */ + if (rembits > nbits) { + nghttp2_bufs_fast_orb_hold(bufs, (uint8_t)(code << (rembits - nbits))); + return (ssize_t)(rembits - nbits); + } + + if (rembits == nbits) { + nghttp2_bufs_fast_orb(bufs, (uint8_t)code); + --*avail_ptr; + return 8; + } + + nghttp2_bufs_fast_orb(bufs, (uint8_t)(code >> (nbits - rembits))); + --*avail_ptr; + + nbits -= rembits; + if (nbits & 0x7) { + /* align code to MSB byte boundary */ + code <<= 8 - (nbits & 0x7); + } + + /* we lose at most 3 bytes, but it is not critical in practice */ + if (*avail_ptr < (nbits + 7) / 8) { + rv = nghttp2_bufs_advance(bufs); + if (rv != 0) { + return rv; + } + *avail_ptr = nghttp2_bufs_cur_avail(bufs); + /* we assume that we at least 3 buffer space available */ + assert(*avail_ptr >= 3); + } + + /* fast path, since most code is less than 8 */ + if (nbits < 8) { + nghttp2_bufs_fast_addb_hold(bufs, (uint8_t)code); + *avail_ptr = nghttp2_bufs_cur_avail(bufs); + return (ssize_t)(8 - nbits); + } + + /* handle longer code path */ + if (nbits > 24) { + nghttp2_bufs_fast_addb(bufs, (uint8_t)(code >> 24)); + nbits -= 8; + } + + if (nbits > 16) { + nghttp2_bufs_fast_addb(bufs, (uint8_t)(code >> 16)); + nbits -= 8; + } + + if (nbits > 8) { + nghttp2_bufs_fast_addb(bufs, (uint8_t)(code >> 8)); + nbits -= 8; + } + + if (nbits == 8) { + nghttp2_bufs_fast_addb(bufs, (uint8_t)code); + *avail_ptr = nghttp2_bufs_cur_avail(bufs); + return 8; + } + + nghttp2_bufs_fast_addb_hold(bufs, (uint8_t)code); + *avail_ptr = nghttp2_bufs_cur_avail(bufs); + return (ssize_t)(8 - nbits); +} + +size_t nghttp2_hd_huff_encode_count(const uint8_t *src, size_t len) { + size_t i; + size_t nbits = 0; + + for (i = 0; i < len; ++i) { + nbits += huff_sym_table[src[i]].nbits; + } + /* pad the prefix of EOS (256) */ + return (nbits + 7) / 8; +} + +int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src, + size_t srclen) { + int rv; + ssize_t rembits = 8; + size_t i; + size_t avail; + + avail = nghttp2_bufs_cur_avail(bufs); + + for (i = 0; i < srclen; ++i) { + const nghttp2_huff_sym *sym = &huff_sym_table[src[i]]; + if (rembits == 8) { + if (avail) { + nghttp2_bufs_fast_addb_hold(bufs, 0); + } else { + rv = nghttp2_bufs_addb_hold(bufs, 0); + if (rv != 0) { + return rv; + } + avail = nghttp2_bufs_cur_avail(bufs); + } + } + rembits = huff_encode_sym(bufs, &avail, (size_t)rembits, sym); + if (rembits < 0) { + return (int)rembits; + } + } + /* 256 is special terminal symbol, pad with its prefix */ + if (rembits < 8) { + /* if rembits < 8, we should have at least 1 buffer space + available */ + const nghttp2_huff_sym *sym = &huff_sym_table[256]; + assert(avail); + /* Caution we no longer adjust avail here */ + nghttp2_bufs_fast_orb( + bufs, (uint8_t)(sym->code >> (sym->nbits - (size_t)rembits))); + } + + return 0; +} + +void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx) { + ctx->state = 0; + ctx->accept = 1; +} + +ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, + nghttp2_buf *buf, const uint8_t *src, + size_t srclen, int final) { + size_t i; + + /* We use the decoding algorithm described in + http://graphics.ics.uci.edu/pub/Prefix.pdf */ + for (i = 0; i < srclen; ++i) { + const nghttp2_huff_decode *t; + + t = &huff_decode_table[ctx->state][src[i] >> 4]; + if (t->flags & NGHTTP2_HUFF_FAIL) { + return NGHTTP2_ERR_HEADER_COMP; + } + if (t->flags & NGHTTP2_HUFF_SYM) { + *buf->last++ = t->sym; + } + + t = &huff_decode_table[t->state][src[i] & 0xf]; + if (t->flags & NGHTTP2_HUFF_FAIL) { + return NGHTTP2_ERR_HEADER_COMP; + } + if (t->flags & NGHTTP2_HUFF_SYM) { + *buf->last++ = t->sym; + } + + ctx->state = t->state; + ctx->accept = (t->flags & NGHTTP2_HUFF_ACCEPTED) != 0; + } + if (final && !ctx->accept) { + return NGHTTP2_ERR_HEADER_COMP; + } + return (ssize_t)i; +} diff --git a/components/nghttp/library/nghttp2_hd_huffman_data.c b/components/nghttp/library/nghttp2_hd_huffman_data.c new file mode 100644 index 0000000000..4a4251bdfc --- /dev/null +++ b/components/nghttp/library/nghttp2_hd_huffman_data.c @@ -0,0 +1,5152 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_hd_huffman.h" + +/* Generated by mkhufftbl.py */ + +const nghttp2_huff_sym huff_sym_table[] = {{13, 0x1ff8u}, + {23, 0x7fffd8u}, + {28, 0xfffffe2u}, + {28, 0xfffffe3u}, + {28, 0xfffffe4u}, + {28, 0xfffffe5u}, + {28, 0xfffffe6u}, + {28, 0xfffffe7u}, + {28, 0xfffffe8u}, + {24, 0xffffeau}, + {30, 0x3ffffffcu}, + {28, 0xfffffe9u}, + {28, 0xfffffeau}, + {30, 0x3ffffffdu}, + {28, 0xfffffebu}, + {28, 0xfffffecu}, + {28, 0xfffffedu}, + {28, 0xfffffeeu}, + {28, 0xfffffefu}, + {28, 0xffffff0u}, + {28, 0xffffff1u}, + {28, 0xffffff2u}, + {30, 0x3ffffffeu}, + {28, 0xffffff3u}, + {28, 0xffffff4u}, + {28, 0xffffff5u}, + {28, 0xffffff6u}, + {28, 0xffffff7u}, + {28, 0xffffff8u}, + {28, 0xffffff9u}, + {28, 0xffffffau}, + {28, 0xffffffbu}, + {6, 0x14u}, + {10, 0x3f8u}, + {10, 0x3f9u}, + {12, 0xffau}, + {13, 0x1ff9u}, + {6, 0x15u}, + {8, 0xf8u}, + {11, 0x7fau}, + {10, 0x3fau}, + {10, 0x3fbu}, + {8, 0xf9u}, + {11, 0x7fbu}, + {8, 0xfau}, + {6, 0x16u}, + {6, 0x17u}, + {6, 0x18u}, + {5, 0x0u}, + {5, 0x1u}, + {5, 0x2u}, + {6, 0x19u}, + {6, 0x1au}, + {6, 0x1bu}, + {6, 0x1cu}, + {6, 0x1du}, + {6, 0x1eu}, + {6, 0x1fu}, + {7, 0x5cu}, + {8, 0xfbu}, + {15, 0x7ffcu}, + {6, 0x20u}, + {12, 0xffbu}, + {10, 0x3fcu}, + {13, 0x1ffau}, + {6, 0x21u}, + {7, 0x5du}, + {7, 0x5eu}, + {7, 0x5fu}, + {7, 0x60u}, + {7, 0x61u}, + {7, 0x62u}, + {7, 0x63u}, + {7, 0x64u}, + {7, 0x65u}, + {7, 0x66u}, + {7, 0x67u}, + {7, 0x68u}, + {7, 0x69u}, + {7, 0x6au}, + {7, 0x6bu}, + {7, 0x6cu}, + {7, 0x6du}, + {7, 0x6eu}, + {7, 0x6fu}, + {7, 0x70u}, + {7, 0x71u}, + {7, 0x72u}, + {8, 0xfcu}, + {7, 0x73u}, + {8, 0xfdu}, + {13, 0x1ffbu}, + {19, 0x7fff0u}, + {13, 0x1ffcu}, + {14, 0x3ffcu}, + {6, 0x22u}, + {15, 0x7ffdu}, + {5, 0x3u}, + {6, 0x23u}, + {5, 0x4u}, + {6, 0x24u}, + {5, 0x5u}, + {6, 0x25u}, + {6, 0x26u}, + {6, 0x27u}, + {5, 0x6u}, + {7, 0x74u}, + {7, 0x75u}, + {6, 0x28u}, + {6, 0x29u}, + {6, 0x2au}, + {5, 0x7u}, + {6, 0x2bu}, + {7, 0x76u}, + {6, 0x2cu}, + {5, 0x8u}, + {5, 0x9u}, + {6, 0x2du}, + {7, 0x77u}, + {7, 0x78u}, + {7, 0x79u}, + {7, 0x7au}, + {7, 0x7bu}, + {15, 0x7ffeu}, + {11, 0x7fcu}, + {14, 0x3ffdu}, + {13, 0x1ffdu}, + {28, 0xffffffcu}, + {20, 0xfffe6u}, + {22, 0x3fffd2u}, + {20, 0xfffe7u}, + {20, 0xfffe8u}, + {22, 0x3fffd3u}, + {22, 0x3fffd4u}, + {22, 0x3fffd5u}, + {23, 0x7fffd9u}, + {22, 0x3fffd6u}, + {23, 0x7fffdau}, + {23, 0x7fffdbu}, + {23, 0x7fffdcu}, + {23, 0x7fffddu}, + {23, 0x7fffdeu}, + {24, 0xffffebu}, + {23, 0x7fffdfu}, + {24, 0xffffecu}, + {24, 0xffffedu}, + {22, 0x3fffd7u}, + {23, 0x7fffe0u}, + {24, 0xffffeeu}, + {23, 0x7fffe1u}, + {23, 0x7fffe2u}, + {23, 0x7fffe3u}, + {23, 0x7fffe4u}, + {21, 0x1fffdcu}, + {22, 0x3fffd8u}, + {23, 0x7fffe5u}, + {22, 0x3fffd9u}, + {23, 0x7fffe6u}, + {23, 0x7fffe7u}, + {24, 0xffffefu}, + {22, 0x3fffdau}, + {21, 0x1fffddu}, + {20, 0xfffe9u}, + {22, 0x3fffdbu}, + {22, 0x3fffdcu}, + {23, 0x7fffe8u}, + {23, 0x7fffe9u}, + {21, 0x1fffdeu}, + {23, 0x7fffeau}, + {22, 0x3fffddu}, + {22, 0x3fffdeu}, + {24, 0xfffff0u}, + {21, 0x1fffdfu}, + {22, 0x3fffdfu}, + {23, 0x7fffebu}, + {23, 0x7fffecu}, + {21, 0x1fffe0u}, + {21, 0x1fffe1u}, + {22, 0x3fffe0u}, + {21, 0x1fffe2u}, + {23, 0x7fffedu}, + {22, 0x3fffe1u}, + {23, 0x7fffeeu}, + {23, 0x7fffefu}, + {20, 0xfffeau}, + {22, 0x3fffe2u}, + {22, 0x3fffe3u}, + {22, 0x3fffe4u}, + {23, 0x7ffff0u}, + {22, 0x3fffe5u}, + {22, 0x3fffe6u}, + {23, 0x7ffff1u}, + {26, 0x3ffffe0u}, + {26, 0x3ffffe1u}, + {20, 0xfffebu}, + {19, 0x7fff1u}, + {22, 0x3fffe7u}, + {23, 0x7ffff2u}, + {22, 0x3fffe8u}, + {25, 0x1ffffecu}, + {26, 0x3ffffe2u}, + {26, 0x3ffffe3u}, + {26, 0x3ffffe4u}, + {27, 0x7ffffdeu}, + {27, 0x7ffffdfu}, + {26, 0x3ffffe5u}, + {24, 0xfffff1u}, + {25, 0x1ffffedu}, + {19, 0x7fff2u}, + {21, 0x1fffe3u}, + {26, 0x3ffffe6u}, + {27, 0x7ffffe0u}, + {27, 0x7ffffe1u}, + {26, 0x3ffffe7u}, + {27, 0x7ffffe2u}, + {24, 0xfffff2u}, + {21, 0x1fffe4u}, + {21, 0x1fffe5u}, + {26, 0x3ffffe8u}, + {26, 0x3ffffe9u}, + {28, 0xffffffdu}, + {27, 0x7ffffe3u}, + {27, 0x7ffffe4u}, + {27, 0x7ffffe5u}, + {20, 0xfffecu}, + {24, 0xfffff3u}, + {20, 0xfffedu}, + {21, 0x1fffe6u}, + {22, 0x3fffe9u}, + {21, 0x1fffe7u}, + {21, 0x1fffe8u}, + {23, 0x7ffff3u}, + {22, 0x3fffeau}, + {22, 0x3fffebu}, + {25, 0x1ffffeeu}, + {25, 0x1ffffefu}, + {24, 0xfffff4u}, + {24, 0xfffff5u}, + {26, 0x3ffffeau}, + {23, 0x7ffff4u}, + {26, 0x3ffffebu}, + {27, 0x7ffffe6u}, + {26, 0x3ffffecu}, + {26, 0x3ffffedu}, + {27, 0x7ffffe7u}, + {27, 0x7ffffe8u}, + {27, 0x7ffffe9u}, + {27, 0x7ffffeau}, + {27, 0x7ffffebu}, + {28, 0xffffffeu}, + {27, 0x7ffffecu}, + {27, 0x7ffffedu}, + {27, 0x7ffffeeu}, + {27, 0x7ffffefu}, + {27, 0x7fffff0u}, + {26, 0x3ffffeeu}, + {30, 0x3fffffffu}}; + +const nghttp2_huff_decode huff_decode_table[][16] = { + /* 0 */ + { + {4, 0x00, 0}, + {5, 0x00, 0}, + {7, 0x00, 0}, + {8, 0x00, 0}, + {11, 0x00, 0}, + {12, 0x00, 0}, + {16, 0x00, 0}, + {19, 0x00, 0}, + {25, 0x00, 0}, + {28, 0x00, 0}, + {32, 0x00, 0}, + {35, 0x00, 0}, + {42, 0x00, 0}, + {49, 0x00, 0}, + {57, 0x00, 0}, + {64, 0x01, 0}, + }, + /* 1 */ + { + {0, 0x03, 48}, + {0, 0x03, 49}, + {0, 0x03, 50}, + {0, 0x03, 97}, + {0, 0x03, 99}, + {0, 0x03, 101}, + {0, 0x03, 105}, + {0, 0x03, 111}, + {0, 0x03, 115}, + {0, 0x03, 116}, + {13, 0x00, 0}, + {14, 0x00, 0}, + {17, 0x00, 0}, + {18, 0x00, 0}, + {20, 0x00, 0}, + {21, 0x00, 0}, + }, + /* 2 */ + { + {1, 0x02, 48}, + {22, 0x03, 48}, + {1, 0x02, 49}, + {22, 0x03, 49}, + {1, 0x02, 50}, + {22, 0x03, 50}, + {1, 0x02, 97}, + {22, 0x03, 97}, + {1, 0x02, 99}, + {22, 0x03, 99}, + {1, 0x02, 101}, + {22, 0x03, 101}, + {1, 0x02, 105}, + {22, 0x03, 105}, + {1, 0x02, 111}, + {22, 0x03, 111}, + }, + /* 3 */ + { + {2, 0x02, 48}, + {9, 0x02, 48}, + {23, 0x02, 48}, + {40, 0x03, 48}, + {2, 0x02, 49}, + {9, 0x02, 49}, + {23, 0x02, 49}, + {40, 0x03, 49}, + {2, 0x02, 50}, + {9, 0x02, 50}, + {23, 0x02, 50}, + {40, 0x03, 50}, + {2, 0x02, 97}, + {9, 0x02, 97}, + {23, 0x02, 97}, + {40, 0x03, 97}, + }, + /* 4 */ + { + {3, 0x02, 48}, + {6, 0x02, 48}, + {10, 0x02, 48}, + {15, 0x02, 48}, + {24, 0x02, 48}, + {31, 0x02, 48}, + {41, 0x02, 48}, + {56, 0x03, 48}, + {3, 0x02, 49}, + {6, 0x02, 49}, + {10, 0x02, 49}, + {15, 0x02, 49}, + {24, 0x02, 49}, + {31, 0x02, 49}, + {41, 0x02, 49}, + {56, 0x03, 49}, + }, + /* 5 */ + { + {3, 0x02, 50}, + {6, 0x02, 50}, + {10, 0x02, 50}, + {15, 0x02, 50}, + {24, 0x02, 50}, + {31, 0x02, 50}, + {41, 0x02, 50}, + {56, 0x03, 50}, + {3, 0x02, 97}, + {6, 0x02, 97}, + {10, 0x02, 97}, + {15, 0x02, 97}, + {24, 0x02, 97}, + {31, 0x02, 97}, + {41, 0x02, 97}, + {56, 0x03, 97}, + }, + /* 6 */ + { + {2, 0x02, 99}, + {9, 0x02, 99}, + {23, 0x02, 99}, + {40, 0x03, 99}, + {2, 0x02, 101}, + {9, 0x02, 101}, + {23, 0x02, 101}, + {40, 0x03, 101}, + {2, 0x02, 105}, + {9, 0x02, 105}, + {23, 0x02, 105}, + {40, 0x03, 105}, + {2, 0x02, 111}, + {9, 0x02, 111}, + {23, 0x02, 111}, + {40, 0x03, 111}, + }, + /* 7 */ + { + {3, 0x02, 99}, + {6, 0x02, 99}, + {10, 0x02, 99}, + {15, 0x02, 99}, + {24, 0x02, 99}, + {31, 0x02, 99}, + {41, 0x02, 99}, + {56, 0x03, 99}, + {3, 0x02, 101}, + {6, 0x02, 101}, + {10, 0x02, 101}, + {15, 0x02, 101}, + {24, 0x02, 101}, + {31, 0x02, 101}, + {41, 0x02, 101}, + {56, 0x03, 101}, + }, + /* 8 */ + { + {3, 0x02, 105}, + {6, 0x02, 105}, + {10, 0x02, 105}, + {15, 0x02, 105}, + {24, 0x02, 105}, + {31, 0x02, 105}, + {41, 0x02, 105}, + {56, 0x03, 105}, + {3, 0x02, 111}, + {6, 0x02, 111}, + {10, 0x02, 111}, + {15, 0x02, 111}, + {24, 0x02, 111}, + {31, 0x02, 111}, + {41, 0x02, 111}, + {56, 0x03, 111}, + }, + /* 9 */ + { + {1, 0x02, 115}, + {22, 0x03, 115}, + {1, 0x02, 116}, + {22, 0x03, 116}, + {0, 0x03, 32}, + {0, 0x03, 37}, + {0, 0x03, 45}, + {0, 0x03, 46}, + {0, 0x03, 47}, + {0, 0x03, 51}, + {0, 0x03, 52}, + {0, 0x03, 53}, + {0, 0x03, 54}, + {0, 0x03, 55}, + {0, 0x03, 56}, + {0, 0x03, 57}, + }, + /* 10 */ + { + {2, 0x02, 115}, + {9, 0x02, 115}, + {23, 0x02, 115}, + {40, 0x03, 115}, + {2, 0x02, 116}, + {9, 0x02, 116}, + {23, 0x02, 116}, + {40, 0x03, 116}, + {1, 0x02, 32}, + {22, 0x03, 32}, + {1, 0x02, 37}, + {22, 0x03, 37}, + {1, 0x02, 45}, + {22, 0x03, 45}, + {1, 0x02, 46}, + {22, 0x03, 46}, + }, + /* 11 */ + { + {3, 0x02, 115}, + {6, 0x02, 115}, + {10, 0x02, 115}, + {15, 0x02, 115}, + {24, 0x02, 115}, + {31, 0x02, 115}, + {41, 0x02, 115}, + {56, 0x03, 115}, + {3, 0x02, 116}, + {6, 0x02, 116}, + {10, 0x02, 116}, + {15, 0x02, 116}, + {24, 0x02, 116}, + {31, 0x02, 116}, + {41, 0x02, 116}, + {56, 0x03, 116}, + }, + /* 12 */ + { + {2, 0x02, 32}, + {9, 0x02, 32}, + {23, 0x02, 32}, + {40, 0x03, 32}, + {2, 0x02, 37}, + {9, 0x02, 37}, + {23, 0x02, 37}, + {40, 0x03, 37}, + {2, 0x02, 45}, + {9, 0x02, 45}, + {23, 0x02, 45}, + {40, 0x03, 45}, + {2, 0x02, 46}, + {9, 0x02, 46}, + {23, 0x02, 46}, + {40, 0x03, 46}, + }, + /* 13 */ + { + {3, 0x02, 32}, + {6, 0x02, 32}, + {10, 0x02, 32}, + {15, 0x02, 32}, + {24, 0x02, 32}, + {31, 0x02, 32}, + {41, 0x02, 32}, + {56, 0x03, 32}, + {3, 0x02, 37}, + {6, 0x02, 37}, + {10, 0x02, 37}, + {15, 0x02, 37}, + {24, 0x02, 37}, + {31, 0x02, 37}, + {41, 0x02, 37}, + {56, 0x03, 37}, + }, + /* 14 */ + { + {3, 0x02, 45}, + {6, 0x02, 45}, + {10, 0x02, 45}, + {15, 0x02, 45}, + {24, 0x02, 45}, + {31, 0x02, 45}, + {41, 0x02, 45}, + {56, 0x03, 45}, + {3, 0x02, 46}, + {6, 0x02, 46}, + {10, 0x02, 46}, + {15, 0x02, 46}, + {24, 0x02, 46}, + {31, 0x02, 46}, + {41, 0x02, 46}, + {56, 0x03, 46}, + }, + /* 15 */ + { + {1, 0x02, 47}, + {22, 0x03, 47}, + {1, 0x02, 51}, + {22, 0x03, 51}, + {1, 0x02, 52}, + {22, 0x03, 52}, + {1, 0x02, 53}, + {22, 0x03, 53}, + {1, 0x02, 54}, + {22, 0x03, 54}, + {1, 0x02, 55}, + {22, 0x03, 55}, + {1, 0x02, 56}, + {22, 0x03, 56}, + {1, 0x02, 57}, + {22, 0x03, 57}, + }, + /* 16 */ + { + {2, 0x02, 47}, + {9, 0x02, 47}, + {23, 0x02, 47}, + {40, 0x03, 47}, + {2, 0x02, 51}, + {9, 0x02, 51}, + {23, 0x02, 51}, + {40, 0x03, 51}, + {2, 0x02, 52}, + {9, 0x02, 52}, + {23, 0x02, 52}, + {40, 0x03, 52}, + {2, 0x02, 53}, + {9, 0x02, 53}, + {23, 0x02, 53}, + {40, 0x03, 53}, + }, + /* 17 */ + { + {3, 0x02, 47}, + {6, 0x02, 47}, + {10, 0x02, 47}, + {15, 0x02, 47}, + {24, 0x02, 47}, + {31, 0x02, 47}, + {41, 0x02, 47}, + {56, 0x03, 47}, + {3, 0x02, 51}, + {6, 0x02, 51}, + {10, 0x02, 51}, + {15, 0x02, 51}, + {24, 0x02, 51}, + {31, 0x02, 51}, + {41, 0x02, 51}, + {56, 0x03, 51}, + }, + /* 18 */ + { + {3, 0x02, 52}, + {6, 0x02, 52}, + {10, 0x02, 52}, + {15, 0x02, 52}, + {24, 0x02, 52}, + {31, 0x02, 52}, + {41, 0x02, 52}, + {56, 0x03, 52}, + {3, 0x02, 53}, + {6, 0x02, 53}, + {10, 0x02, 53}, + {15, 0x02, 53}, + {24, 0x02, 53}, + {31, 0x02, 53}, + {41, 0x02, 53}, + {56, 0x03, 53}, + }, + /* 19 */ + { + {2, 0x02, 54}, + {9, 0x02, 54}, + {23, 0x02, 54}, + {40, 0x03, 54}, + {2, 0x02, 55}, + {9, 0x02, 55}, + {23, 0x02, 55}, + {40, 0x03, 55}, + {2, 0x02, 56}, + {9, 0x02, 56}, + {23, 0x02, 56}, + {40, 0x03, 56}, + {2, 0x02, 57}, + {9, 0x02, 57}, + {23, 0x02, 57}, + {40, 0x03, 57}, + }, + /* 20 */ + { + {3, 0x02, 54}, + {6, 0x02, 54}, + {10, 0x02, 54}, + {15, 0x02, 54}, + {24, 0x02, 54}, + {31, 0x02, 54}, + {41, 0x02, 54}, + {56, 0x03, 54}, + {3, 0x02, 55}, + {6, 0x02, 55}, + {10, 0x02, 55}, + {15, 0x02, 55}, + {24, 0x02, 55}, + {31, 0x02, 55}, + {41, 0x02, 55}, + {56, 0x03, 55}, + }, + /* 21 */ + { + {3, 0x02, 56}, + {6, 0x02, 56}, + {10, 0x02, 56}, + {15, 0x02, 56}, + {24, 0x02, 56}, + {31, 0x02, 56}, + {41, 0x02, 56}, + {56, 0x03, 56}, + {3, 0x02, 57}, + {6, 0x02, 57}, + {10, 0x02, 57}, + {15, 0x02, 57}, + {24, 0x02, 57}, + {31, 0x02, 57}, + {41, 0x02, 57}, + {56, 0x03, 57}, + }, + /* 22 */ + { + {26, 0x00, 0}, + {27, 0x00, 0}, + {29, 0x00, 0}, + {30, 0x00, 0}, + {33, 0x00, 0}, + {34, 0x00, 0}, + {36, 0x00, 0}, + {37, 0x00, 0}, + {43, 0x00, 0}, + {46, 0x00, 0}, + {50, 0x00, 0}, + {53, 0x00, 0}, + {58, 0x00, 0}, + {61, 0x00, 0}, + {65, 0x00, 0}, + {68, 0x01, 0}, + }, + /* 23 */ + { + {0, 0x03, 61}, + {0, 0x03, 65}, + {0, 0x03, 95}, + {0, 0x03, 98}, + {0, 0x03, 100}, + {0, 0x03, 102}, + {0, 0x03, 103}, + {0, 0x03, 104}, + {0, 0x03, 108}, + {0, 0x03, 109}, + {0, 0x03, 110}, + {0, 0x03, 112}, + {0, 0x03, 114}, + {0, 0x03, 117}, + {38, 0x00, 0}, + {39, 0x00, 0}, + }, + /* 24 */ + { + {1, 0x02, 61}, + {22, 0x03, 61}, + {1, 0x02, 65}, + {22, 0x03, 65}, + {1, 0x02, 95}, + {22, 0x03, 95}, + {1, 0x02, 98}, + {22, 0x03, 98}, + {1, 0x02, 100}, + {22, 0x03, 100}, + {1, 0x02, 102}, + {22, 0x03, 102}, + {1, 0x02, 103}, + {22, 0x03, 103}, + {1, 0x02, 104}, + {22, 0x03, 104}, + }, + /* 25 */ + { + {2, 0x02, 61}, + {9, 0x02, 61}, + {23, 0x02, 61}, + {40, 0x03, 61}, + {2, 0x02, 65}, + {9, 0x02, 65}, + {23, 0x02, 65}, + {40, 0x03, 65}, + {2, 0x02, 95}, + {9, 0x02, 95}, + {23, 0x02, 95}, + {40, 0x03, 95}, + {2, 0x02, 98}, + {9, 0x02, 98}, + {23, 0x02, 98}, + {40, 0x03, 98}, + }, + /* 26 */ + { + {3, 0x02, 61}, + {6, 0x02, 61}, + {10, 0x02, 61}, + {15, 0x02, 61}, + {24, 0x02, 61}, + {31, 0x02, 61}, + {41, 0x02, 61}, + {56, 0x03, 61}, + {3, 0x02, 65}, + {6, 0x02, 65}, + {10, 0x02, 65}, + {15, 0x02, 65}, + {24, 0x02, 65}, + {31, 0x02, 65}, + {41, 0x02, 65}, + {56, 0x03, 65}, + }, + /* 27 */ + { + {3, 0x02, 95}, + {6, 0x02, 95}, + {10, 0x02, 95}, + {15, 0x02, 95}, + {24, 0x02, 95}, + {31, 0x02, 95}, + {41, 0x02, 95}, + {56, 0x03, 95}, + {3, 0x02, 98}, + {6, 0x02, 98}, + {10, 0x02, 98}, + {15, 0x02, 98}, + {24, 0x02, 98}, + {31, 0x02, 98}, + {41, 0x02, 98}, + {56, 0x03, 98}, + }, + /* 28 */ + { + {2, 0x02, 100}, + {9, 0x02, 100}, + {23, 0x02, 100}, + {40, 0x03, 100}, + {2, 0x02, 102}, + {9, 0x02, 102}, + {23, 0x02, 102}, + {40, 0x03, 102}, + {2, 0x02, 103}, + {9, 0x02, 103}, + {23, 0x02, 103}, + {40, 0x03, 103}, + {2, 0x02, 104}, + {9, 0x02, 104}, + {23, 0x02, 104}, + {40, 0x03, 104}, + }, + /* 29 */ + { + {3, 0x02, 100}, + {6, 0x02, 100}, + {10, 0x02, 100}, + {15, 0x02, 100}, + {24, 0x02, 100}, + {31, 0x02, 100}, + {41, 0x02, 100}, + {56, 0x03, 100}, + {3, 0x02, 102}, + {6, 0x02, 102}, + {10, 0x02, 102}, + {15, 0x02, 102}, + {24, 0x02, 102}, + {31, 0x02, 102}, + {41, 0x02, 102}, + {56, 0x03, 102}, + }, + /* 30 */ + { + {3, 0x02, 103}, + {6, 0x02, 103}, + {10, 0x02, 103}, + {15, 0x02, 103}, + {24, 0x02, 103}, + {31, 0x02, 103}, + {41, 0x02, 103}, + {56, 0x03, 103}, + {3, 0x02, 104}, + {6, 0x02, 104}, + {10, 0x02, 104}, + {15, 0x02, 104}, + {24, 0x02, 104}, + {31, 0x02, 104}, + {41, 0x02, 104}, + {56, 0x03, 104}, + }, + /* 31 */ + { + {1, 0x02, 108}, + {22, 0x03, 108}, + {1, 0x02, 109}, + {22, 0x03, 109}, + {1, 0x02, 110}, + {22, 0x03, 110}, + {1, 0x02, 112}, + {22, 0x03, 112}, + {1, 0x02, 114}, + {22, 0x03, 114}, + {1, 0x02, 117}, + {22, 0x03, 117}, + {0, 0x03, 58}, + {0, 0x03, 66}, + {0, 0x03, 67}, + {0, 0x03, 68}, + }, + /* 32 */ + { + {2, 0x02, 108}, + {9, 0x02, 108}, + {23, 0x02, 108}, + {40, 0x03, 108}, + {2, 0x02, 109}, + {9, 0x02, 109}, + {23, 0x02, 109}, + {40, 0x03, 109}, + {2, 0x02, 110}, + {9, 0x02, 110}, + {23, 0x02, 110}, + {40, 0x03, 110}, + {2, 0x02, 112}, + {9, 0x02, 112}, + {23, 0x02, 112}, + {40, 0x03, 112}, + }, + /* 33 */ + { + {3, 0x02, 108}, + {6, 0x02, 108}, + {10, 0x02, 108}, + {15, 0x02, 108}, + {24, 0x02, 108}, + {31, 0x02, 108}, + {41, 0x02, 108}, + {56, 0x03, 108}, + {3, 0x02, 109}, + {6, 0x02, 109}, + {10, 0x02, 109}, + {15, 0x02, 109}, + {24, 0x02, 109}, + {31, 0x02, 109}, + {41, 0x02, 109}, + {56, 0x03, 109}, + }, + /* 34 */ + { + {3, 0x02, 110}, + {6, 0x02, 110}, + {10, 0x02, 110}, + {15, 0x02, 110}, + {24, 0x02, 110}, + {31, 0x02, 110}, + {41, 0x02, 110}, + {56, 0x03, 110}, + {3, 0x02, 112}, + {6, 0x02, 112}, + {10, 0x02, 112}, + {15, 0x02, 112}, + {24, 0x02, 112}, + {31, 0x02, 112}, + {41, 0x02, 112}, + {56, 0x03, 112}, + }, + /* 35 */ + { + {2, 0x02, 114}, + {9, 0x02, 114}, + {23, 0x02, 114}, + {40, 0x03, 114}, + {2, 0x02, 117}, + {9, 0x02, 117}, + {23, 0x02, 117}, + {40, 0x03, 117}, + {1, 0x02, 58}, + {22, 0x03, 58}, + {1, 0x02, 66}, + {22, 0x03, 66}, + {1, 0x02, 67}, + {22, 0x03, 67}, + {1, 0x02, 68}, + {22, 0x03, 68}, + }, + /* 36 */ + { + {3, 0x02, 114}, + {6, 0x02, 114}, + {10, 0x02, 114}, + {15, 0x02, 114}, + {24, 0x02, 114}, + {31, 0x02, 114}, + {41, 0x02, 114}, + {56, 0x03, 114}, + {3, 0x02, 117}, + {6, 0x02, 117}, + {10, 0x02, 117}, + {15, 0x02, 117}, + {24, 0x02, 117}, + {31, 0x02, 117}, + {41, 0x02, 117}, + {56, 0x03, 117}, + }, + /* 37 */ + { + {2, 0x02, 58}, + {9, 0x02, 58}, + {23, 0x02, 58}, + {40, 0x03, 58}, + {2, 0x02, 66}, + {9, 0x02, 66}, + {23, 0x02, 66}, + {40, 0x03, 66}, + {2, 0x02, 67}, + {9, 0x02, 67}, + {23, 0x02, 67}, + {40, 0x03, 67}, + {2, 0x02, 68}, + {9, 0x02, 68}, + {23, 0x02, 68}, + {40, 0x03, 68}, + }, + /* 38 */ + { + {3, 0x02, 58}, + {6, 0x02, 58}, + {10, 0x02, 58}, + {15, 0x02, 58}, + {24, 0x02, 58}, + {31, 0x02, 58}, + {41, 0x02, 58}, + {56, 0x03, 58}, + {3, 0x02, 66}, + {6, 0x02, 66}, + {10, 0x02, 66}, + {15, 0x02, 66}, + {24, 0x02, 66}, + {31, 0x02, 66}, + {41, 0x02, 66}, + {56, 0x03, 66}, + }, + /* 39 */ + { + {3, 0x02, 67}, + {6, 0x02, 67}, + {10, 0x02, 67}, + {15, 0x02, 67}, + {24, 0x02, 67}, + {31, 0x02, 67}, + {41, 0x02, 67}, + {56, 0x03, 67}, + {3, 0x02, 68}, + {6, 0x02, 68}, + {10, 0x02, 68}, + {15, 0x02, 68}, + {24, 0x02, 68}, + {31, 0x02, 68}, + {41, 0x02, 68}, + {56, 0x03, 68}, + }, + /* 40 */ + { + {44, 0x00, 0}, + {45, 0x00, 0}, + {47, 0x00, 0}, + {48, 0x00, 0}, + {51, 0x00, 0}, + {52, 0x00, 0}, + {54, 0x00, 0}, + {55, 0x00, 0}, + {59, 0x00, 0}, + {60, 0x00, 0}, + {62, 0x00, 0}, + {63, 0x00, 0}, + {66, 0x00, 0}, + {67, 0x00, 0}, + {69, 0x00, 0}, + {72, 0x01, 0}, + }, + /* 41 */ + { + {0, 0x03, 69}, + {0, 0x03, 70}, + {0, 0x03, 71}, + {0, 0x03, 72}, + {0, 0x03, 73}, + {0, 0x03, 74}, + {0, 0x03, 75}, + {0, 0x03, 76}, + {0, 0x03, 77}, + {0, 0x03, 78}, + {0, 0x03, 79}, + {0, 0x03, 80}, + {0, 0x03, 81}, + {0, 0x03, 82}, + {0, 0x03, 83}, + {0, 0x03, 84}, + }, + /* 42 */ + { + {1, 0x02, 69}, + {22, 0x03, 69}, + {1, 0x02, 70}, + {22, 0x03, 70}, + {1, 0x02, 71}, + {22, 0x03, 71}, + {1, 0x02, 72}, + {22, 0x03, 72}, + {1, 0x02, 73}, + {22, 0x03, 73}, + {1, 0x02, 74}, + {22, 0x03, 74}, + {1, 0x02, 75}, + {22, 0x03, 75}, + {1, 0x02, 76}, + {22, 0x03, 76}, + }, + /* 43 */ + { + {2, 0x02, 69}, + {9, 0x02, 69}, + {23, 0x02, 69}, + {40, 0x03, 69}, + {2, 0x02, 70}, + {9, 0x02, 70}, + {23, 0x02, 70}, + {40, 0x03, 70}, + {2, 0x02, 71}, + {9, 0x02, 71}, + {23, 0x02, 71}, + {40, 0x03, 71}, + {2, 0x02, 72}, + {9, 0x02, 72}, + {23, 0x02, 72}, + {40, 0x03, 72}, + }, + /* 44 */ + { + {3, 0x02, 69}, + {6, 0x02, 69}, + {10, 0x02, 69}, + {15, 0x02, 69}, + {24, 0x02, 69}, + {31, 0x02, 69}, + {41, 0x02, 69}, + {56, 0x03, 69}, + {3, 0x02, 70}, + {6, 0x02, 70}, + {10, 0x02, 70}, + {15, 0x02, 70}, + {24, 0x02, 70}, + {31, 0x02, 70}, + {41, 0x02, 70}, + {56, 0x03, 70}, + }, + /* 45 */ + { + {3, 0x02, 71}, + {6, 0x02, 71}, + {10, 0x02, 71}, + {15, 0x02, 71}, + {24, 0x02, 71}, + {31, 0x02, 71}, + {41, 0x02, 71}, + {56, 0x03, 71}, + {3, 0x02, 72}, + {6, 0x02, 72}, + {10, 0x02, 72}, + {15, 0x02, 72}, + {24, 0x02, 72}, + {31, 0x02, 72}, + {41, 0x02, 72}, + {56, 0x03, 72}, + }, + /* 46 */ + { + {2, 0x02, 73}, + {9, 0x02, 73}, + {23, 0x02, 73}, + {40, 0x03, 73}, + {2, 0x02, 74}, + {9, 0x02, 74}, + {23, 0x02, 74}, + {40, 0x03, 74}, + {2, 0x02, 75}, + {9, 0x02, 75}, + {23, 0x02, 75}, + {40, 0x03, 75}, + {2, 0x02, 76}, + {9, 0x02, 76}, + {23, 0x02, 76}, + {40, 0x03, 76}, + }, + /* 47 */ + { + {3, 0x02, 73}, + {6, 0x02, 73}, + {10, 0x02, 73}, + {15, 0x02, 73}, + {24, 0x02, 73}, + {31, 0x02, 73}, + {41, 0x02, 73}, + {56, 0x03, 73}, + {3, 0x02, 74}, + {6, 0x02, 74}, + {10, 0x02, 74}, + {15, 0x02, 74}, + {24, 0x02, 74}, + {31, 0x02, 74}, + {41, 0x02, 74}, + {56, 0x03, 74}, + }, + /* 48 */ + { + {3, 0x02, 75}, + {6, 0x02, 75}, + {10, 0x02, 75}, + {15, 0x02, 75}, + {24, 0x02, 75}, + {31, 0x02, 75}, + {41, 0x02, 75}, + {56, 0x03, 75}, + {3, 0x02, 76}, + {6, 0x02, 76}, + {10, 0x02, 76}, + {15, 0x02, 76}, + {24, 0x02, 76}, + {31, 0x02, 76}, + {41, 0x02, 76}, + {56, 0x03, 76}, + }, + /* 49 */ + { + {1, 0x02, 77}, + {22, 0x03, 77}, + {1, 0x02, 78}, + {22, 0x03, 78}, + {1, 0x02, 79}, + {22, 0x03, 79}, + {1, 0x02, 80}, + {22, 0x03, 80}, + {1, 0x02, 81}, + {22, 0x03, 81}, + {1, 0x02, 82}, + {22, 0x03, 82}, + {1, 0x02, 83}, + {22, 0x03, 83}, + {1, 0x02, 84}, + {22, 0x03, 84}, + }, + /* 50 */ + { + {2, 0x02, 77}, + {9, 0x02, 77}, + {23, 0x02, 77}, + {40, 0x03, 77}, + {2, 0x02, 78}, + {9, 0x02, 78}, + {23, 0x02, 78}, + {40, 0x03, 78}, + {2, 0x02, 79}, + {9, 0x02, 79}, + {23, 0x02, 79}, + {40, 0x03, 79}, + {2, 0x02, 80}, + {9, 0x02, 80}, + {23, 0x02, 80}, + {40, 0x03, 80}, + }, + /* 51 */ + { + {3, 0x02, 77}, + {6, 0x02, 77}, + {10, 0x02, 77}, + {15, 0x02, 77}, + {24, 0x02, 77}, + {31, 0x02, 77}, + {41, 0x02, 77}, + {56, 0x03, 77}, + {3, 0x02, 78}, + {6, 0x02, 78}, + {10, 0x02, 78}, + {15, 0x02, 78}, + {24, 0x02, 78}, + {31, 0x02, 78}, + {41, 0x02, 78}, + {56, 0x03, 78}, + }, + /* 52 */ + { + {3, 0x02, 79}, + {6, 0x02, 79}, + {10, 0x02, 79}, + {15, 0x02, 79}, + {24, 0x02, 79}, + {31, 0x02, 79}, + {41, 0x02, 79}, + {56, 0x03, 79}, + {3, 0x02, 80}, + {6, 0x02, 80}, + {10, 0x02, 80}, + {15, 0x02, 80}, + {24, 0x02, 80}, + {31, 0x02, 80}, + {41, 0x02, 80}, + {56, 0x03, 80}, + }, + /* 53 */ + { + {2, 0x02, 81}, + {9, 0x02, 81}, + {23, 0x02, 81}, + {40, 0x03, 81}, + {2, 0x02, 82}, + {9, 0x02, 82}, + {23, 0x02, 82}, + {40, 0x03, 82}, + {2, 0x02, 83}, + {9, 0x02, 83}, + {23, 0x02, 83}, + {40, 0x03, 83}, + {2, 0x02, 84}, + {9, 0x02, 84}, + {23, 0x02, 84}, + {40, 0x03, 84}, + }, + /* 54 */ + { + {3, 0x02, 81}, + {6, 0x02, 81}, + {10, 0x02, 81}, + {15, 0x02, 81}, + {24, 0x02, 81}, + {31, 0x02, 81}, + {41, 0x02, 81}, + {56, 0x03, 81}, + {3, 0x02, 82}, + {6, 0x02, 82}, + {10, 0x02, 82}, + {15, 0x02, 82}, + {24, 0x02, 82}, + {31, 0x02, 82}, + {41, 0x02, 82}, + {56, 0x03, 82}, + }, + /* 55 */ + { + {3, 0x02, 83}, + {6, 0x02, 83}, + {10, 0x02, 83}, + {15, 0x02, 83}, + {24, 0x02, 83}, + {31, 0x02, 83}, + {41, 0x02, 83}, + {56, 0x03, 83}, + {3, 0x02, 84}, + {6, 0x02, 84}, + {10, 0x02, 84}, + {15, 0x02, 84}, + {24, 0x02, 84}, + {31, 0x02, 84}, + {41, 0x02, 84}, + {56, 0x03, 84}, + }, + /* 56 */ + { + {0, 0x03, 85}, + {0, 0x03, 86}, + {0, 0x03, 87}, + {0, 0x03, 89}, + {0, 0x03, 106}, + {0, 0x03, 107}, + {0, 0x03, 113}, + {0, 0x03, 118}, + {0, 0x03, 119}, + {0, 0x03, 120}, + {0, 0x03, 121}, + {0, 0x03, 122}, + {70, 0x00, 0}, + {71, 0x00, 0}, + {73, 0x00, 0}, + {74, 0x01, 0}, + }, + /* 57 */ + { + {1, 0x02, 85}, + {22, 0x03, 85}, + {1, 0x02, 86}, + {22, 0x03, 86}, + {1, 0x02, 87}, + {22, 0x03, 87}, + {1, 0x02, 89}, + {22, 0x03, 89}, + {1, 0x02, 106}, + {22, 0x03, 106}, + {1, 0x02, 107}, + {22, 0x03, 107}, + {1, 0x02, 113}, + {22, 0x03, 113}, + {1, 0x02, 118}, + {22, 0x03, 118}, + }, + /* 58 */ + { + {2, 0x02, 85}, + {9, 0x02, 85}, + {23, 0x02, 85}, + {40, 0x03, 85}, + {2, 0x02, 86}, + {9, 0x02, 86}, + {23, 0x02, 86}, + {40, 0x03, 86}, + {2, 0x02, 87}, + {9, 0x02, 87}, + {23, 0x02, 87}, + {40, 0x03, 87}, + {2, 0x02, 89}, + {9, 0x02, 89}, + {23, 0x02, 89}, + {40, 0x03, 89}, + }, + /* 59 */ + { + {3, 0x02, 85}, + {6, 0x02, 85}, + {10, 0x02, 85}, + {15, 0x02, 85}, + {24, 0x02, 85}, + {31, 0x02, 85}, + {41, 0x02, 85}, + {56, 0x03, 85}, + {3, 0x02, 86}, + {6, 0x02, 86}, + {10, 0x02, 86}, + {15, 0x02, 86}, + {24, 0x02, 86}, + {31, 0x02, 86}, + {41, 0x02, 86}, + {56, 0x03, 86}, + }, + /* 60 */ + { + {3, 0x02, 87}, + {6, 0x02, 87}, + {10, 0x02, 87}, + {15, 0x02, 87}, + {24, 0x02, 87}, + {31, 0x02, 87}, + {41, 0x02, 87}, + {56, 0x03, 87}, + {3, 0x02, 89}, + {6, 0x02, 89}, + {10, 0x02, 89}, + {15, 0x02, 89}, + {24, 0x02, 89}, + {31, 0x02, 89}, + {41, 0x02, 89}, + {56, 0x03, 89}, + }, + /* 61 */ + { + {2, 0x02, 106}, + {9, 0x02, 106}, + {23, 0x02, 106}, + {40, 0x03, 106}, + {2, 0x02, 107}, + {9, 0x02, 107}, + {23, 0x02, 107}, + {40, 0x03, 107}, + {2, 0x02, 113}, + {9, 0x02, 113}, + {23, 0x02, 113}, + {40, 0x03, 113}, + {2, 0x02, 118}, + {9, 0x02, 118}, + {23, 0x02, 118}, + {40, 0x03, 118}, + }, + /* 62 */ + { + {3, 0x02, 106}, + {6, 0x02, 106}, + {10, 0x02, 106}, + {15, 0x02, 106}, + {24, 0x02, 106}, + {31, 0x02, 106}, + {41, 0x02, 106}, + {56, 0x03, 106}, + {3, 0x02, 107}, + {6, 0x02, 107}, + {10, 0x02, 107}, + {15, 0x02, 107}, + {24, 0x02, 107}, + {31, 0x02, 107}, + {41, 0x02, 107}, + {56, 0x03, 107}, + }, + /* 63 */ + { + {3, 0x02, 113}, + {6, 0x02, 113}, + {10, 0x02, 113}, + {15, 0x02, 113}, + {24, 0x02, 113}, + {31, 0x02, 113}, + {41, 0x02, 113}, + {56, 0x03, 113}, + {3, 0x02, 118}, + {6, 0x02, 118}, + {10, 0x02, 118}, + {15, 0x02, 118}, + {24, 0x02, 118}, + {31, 0x02, 118}, + {41, 0x02, 118}, + {56, 0x03, 118}, + }, + /* 64 */ + { + {1, 0x02, 119}, + {22, 0x03, 119}, + {1, 0x02, 120}, + {22, 0x03, 120}, + {1, 0x02, 121}, + {22, 0x03, 121}, + {1, 0x02, 122}, + {22, 0x03, 122}, + {0, 0x03, 38}, + {0, 0x03, 42}, + {0, 0x03, 44}, + {0, 0x03, 59}, + {0, 0x03, 88}, + {0, 0x03, 90}, + {75, 0x00, 0}, + {78, 0x00, 0}, + }, + /* 65 */ + { + {2, 0x02, 119}, + {9, 0x02, 119}, + {23, 0x02, 119}, + {40, 0x03, 119}, + {2, 0x02, 120}, + {9, 0x02, 120}, + {23, 0x02, 120}, + {40, 0x03, 120}, + {2, 0x02, 121}, + {9, 0x02, 121}, + {23, 0x02, 121}, + {40, 0x03, 121}, + {2, 0x02, 122}, + {9, 0x02, 122}, + {23, 0x02, 122}, + {40, 0x03, 122}, + }, + /* 66 */ + { + {3, 0x02, 119}, + {6, 0x02, 119}, + {10, 0x02, 119}, + {15, 0x02, 119}, + {24, 0x02, 119}, + {31, 0x02, 119}, + {41, 0x02, 119}, + {56, 0x03, 119}, + {3, 0x02, 120}, + {6, 0x02, 120}, + {10, 0x02, 120}, + {15, 0x02, 120}, + {24, 0x02, 120}, + {31, 0x02, 120}, + {41, 0x02, 120}, + {56, 0x03, 120}, + }, + /* 67 */ + { + {3, 0x02, 121}, + {6, 0x02, 121}, + {10, 0x02, 121}, + {15, 0x02, 121}, + {24, 0x02, 121}, + {31, 0x02, 121}, + {41, 0x02, 121}, + {56, 0x03, 121}, + {3, 0x02, 122}, + {6, 0x02, 122}, + {10, 0x02, 122}, + {15, 0x02, 122}, + {24, 0x02, 122}, + {31, 0x02, 122}, + {41, 0x02, 122}, + {56, 0x03, 122}, + }, + /* 68 */ + { + {1, 0x02, 38}, + {22, 0x03, 38}, + {1, 0x02, 42}, + {22, 0x03, 42}, + {1, 0x02, 44}, + {22, 0x03, 44}, + {1, 0x02, 59}, + {22, 0x03, 59}, + {1, 0x02, 88}, + {22, 0x03, 88}, + {1, 0x02, 90}, + {22, 0x03, 90}, + {76, 0x00, 0}, + {77, 0x00, 0}, + {79, 0x00, 0}, + {81, 0x00, 0}, + }, + /* 69 */ + { + {2, 0x02, 38}, + {9, 0x02, 38}, + {23, 0x02, 38}, + {40, 0x03, 38}, + {2, 0x02, 42}, + {9, 0x02, 42}, + {23, 0x02, 42}, + {40, 0x03, 42}, + {2, 0x02, 44}, + {9, 0x02, 44}, + {23, 0x02, 44}, + {40, 0x03, 44}, + {2, 0x02, 59}, + {9, 0x02, 59}, + {23, 0x02, 59}, + {40, 0x03, 59}, + }, + /* 70 */ + { + {3, 0x02, 38}, + {6, 0x02, 38}, + {10, 0x02, 38}, + {15, 0x02, 38}, + {24, 0x02, 38}, + {31, 0x02, 38}, + {41, 0x02, 38}, + {56, 0x03, 38}, + {3, 0x02, 42}, + {6, 0x02, 42}, + {10, 0x02, 42}, + {15, 0x02, 42}, + {24, 0x02, 42}, + {31, 0x02, 42}, + {41, 0x02, 42}, + {56, 0x03, 42}, + }, + /* 71 */ + { + {3, 0x02, 44}, + {6, 0x02, 44}, + {10, 0x02, 44}, + {15, 0x02, 44}, + {24, 0x02, 44}, + {31, 0x02, 44}, + {41, 0x02, 44}, + {56, 0x03, 44}, + {3, 0x02, 59}, + {6, 0x02, 59}, + {10, 0x02, 59}, + {15, 0x02, 59}, + {24, 0x02, 59}, + {31, 0x02, 59}, + {41, 0x02, 59}, + {56, 0x03, 59}, + }, + /* 72 */ + { + {2, 0x02, 88}, + {9, 0x02, 88}, + {23, 0x02, 88}, + {40, 0x03, 88}, + {2, 0x02, 90}, + {9, 0x02, 90}, + {23, 0x02, 90}, + {40, 0x03, 90}, + {0, 0x03, 33}, + {0, 0x03, 34}, + {0, 0x03, 40}, + {0, 0x03, 41}, + {0, 0x03, 63}, + {80, 0x00, 0}, + {82, 0x00, 0}, + {84, 0x00, 0}, + }, + /* 73 */ + { + {3, 0x02, 88}, + {6, 0x02, 88}, + {10, 0x02, 88}, + {15, 0x02, 88}, + {24, 0x02, 88}, + {31, 0x02, 88}, + {41, 0x02, 88}, + {56, 0x03, 88}, + {3, 0x02, 90}, + {6, 0x02, 90}, + {10, 0x02, 90}, + {15, 0x02, 90}, + {24, 0x02, 90}, + {31, 0x02, 90}, + {41, 0x02, 90}, + {56, 0x03, 90}, + }, + /* 74 */ + { + {1, 0x02, 33}, + {22, 0x03, 33}, + {1, 0x02, 34}, + {22, 0x03, 34}, + {1, 0x02, 40}, + {22, 0x03, 40}, + {1, 0x02, 41}, + {22, 0x03, 41}, + {1, 0x02, 63}, + {22, 0x03, 63}, + {0, 0x03, 39}, + {0, 0x03, 43}, + {0, 0x03, 124}, + {83, 0x00, 0}, + {85, 0x00, 0}, + {88, 0x00, 0}, + }, + /* 75 */ + { + {2, 0x02, 33}, + {9, 0x02, 33}, + {23, 0x02, 33}, + {40, 0x03, 33}, + {2, 0x02, 34}, + {9, 0x02, 34}, + {23, 0x02, 34}, + {40, 0x03, 34}, + {2, 0x02, 40}, + {9, 0x02, 40}, + {23, 0x02, 40}, + {40, 0x03, 40}, + {2, 0x02, 41}, + {9, 0x02, 41}, + {23, 0x02, 41}, + {40, 0x03, 41}, + }, + /* 76 */ + { + {3, 0x02, 33}, + {6, 0x02, 33}, + {10, 0x02, 33}, + {15, 0x02, 33}, + {24, 0x02, 33}, + {31, 0x02, 33}, + {41, 0x02, 33}, + {56, 0x03, 33}, + {3, 0x02, 34}, + {6, 0x02, 34}, + {10, 0x02, 34}, + {15, 0x02, 34}, + {24, 0x02, 34}, + {31, 0x02, 34}, + {41, 0x02, 34}, + {56, 0x03, 34}, + }, + /* 77 */ + { + {3, 0x02, 40}, + {6, 0x02, 40}, + {10, 0x02, 40}, + {15, 0x02, 40}, + {24, 0x02, 40}, + {31, 0x02, 40}, + {41, 0x02, 40}, + {56, 0x03, 40}, + {3, 0x02, 41}, + {6, 0x02, 41}, + {10, 0x02, 41}, + {15, 0x02, 41}, + {24, 0x02, 41}, + {31, 0x02, 41}, + {41, 0x02, 41}, + {56, 0x03, 41}, + }, + /* 78 */ + { + {2, 0x02, 63}, + {9, 0x02, 63}, + {23, 0x02, 63}, + {40, 0x03, 63}, + {1, 0x02, 39}, + {22, 0x03, 39}, + {1, 0x02, 43}, + {22, 0x03, 43}, + {1, 0x02, 124}, + {22, 0x03, 124}, + {0, 0x03, 35}, + {0, 0x03, 62}, + {86, 0x00, 0}, + {87, 0x00, 0}, + {89, 0x00, 0}, + {90, 0x00, 0}, + }, + /* 79 */ + { + {3, 0x02, 63}, + {6, 0x02, 63}, + {10, 0x02, 63}, + {15, 0x02, 63}, + {24, 0x02, 63}, + {31, 0x02, 63}, + {41, 0x02, 63}, + {56, 0x03, 63}, + {2, 0x02, 39}, + {9, 0x02, 39}, + {23, 0x02, 39}, + {40, 0x03, 39}, + {2, 0x02, 43}, + {9, 0x02, 43}, + {23, 0x02, 43}, + {40, 0x03, 43}, + }, + /* 80 */ + { + {3, 0x02, 39}, + {6, 0x02, 39}, + {10, 0x02, 39}, + {15, 0x02, 39}, + {24, 0x02, 39}, + {31, 0x02, 39}, + {41, 0x02, 39}, + {56, 0x03, 39}, + {3, 0x02, 43}, + {6, 0x02, 43}, + {10, 0x02, 43}, + {15, 0x02, 43}, + {24, 0x02, 43}, + {31, 0x02, 43}, + {41, 0x02, 43}, + {56, 0x03, 43}, + }, + /* 81 */ + { + {2, 0x02, 124}, + {9, 0x02, 124}, + {23, 0x02, 124}, + {40, 0x03, 124}, + {1, 0x02, 35}, + {22, 0x03, 35}, + {1, 0x02, 62}, + {22, 0x03, 62}, + {0, 0x03, 0}, + {0, 0x03, 36}, + {0, 0x03, 64}, + {0, 0x03, 91}, + {0, 0x03, 93}, + {0, 0x03, 126}, + {91, 0x00, 0}, + {92, 0x00, 0}, + }, + /* 82 */ + { + {3, 0x02, 124}, + {6, 0x02, 124}, + {10, 0x02, 124}, + {15, 0x02, 124}, + {24, 0x02, 124}, + {31, 0x02, 124}, + {41, 0x02, 124}, + {56, 0x03, 124}, + {2, 0x02, 35}, + {9, 0x02, 35}, + {23, 0x02, 35}, + {40, 0x03, 35}, + {2, 0x02, 62}, + {9, 0x02, 62}, + {23, 0x02, 62}, + {40, 0x03, 62}, + }, + /* 83 */ + { + {3, 0x02, 35}, + {6, 0x02, 35}, + {10, 0x02, 35}, + {15, 0x02, 35}, + {24, 0x02, 35}, + {31, 0x02, 35}, + {41, 0x02, 35}, + {56, 0x03, 35}, + {3, 0x02, 62}, + {6, 0x02, 62}, + {10, 0x02, 62}, + {15, 0x02, 62}, + {24, 0x02, 62}, + {31, 0x02, 62}, + {41, 0x02, 62}, + {56, 0x03, 62}, + }, + /* 84 */ + { + {1, 0x02, 0}, + {22, 0x03, 0}, + {1, 0x02, 36}, + {22, 0x03, 36}, + {1, 0x02, 64}, + {22, 0x03, 64}, + {1, 0x02, 91}, + {22, 0x03, 91}, + {1, 0x02, 93}, + {22, 0x03, 93}, + {1, 0x02, 126}, + {22, 0x03, 126}, + {0, 0x03, 94}, + {0, 0x03, 125}, + {93, 0x00, 0}, + {94, 0x00, 0}, + }, + /* 85 */ + { + {2, 0x02, 0}, + {9, 0x02, 0}, + {23, 0x02, 0}, + {40, 0x03, 0}, + {2, 0x02, 36}, + {9, 0x02, 36}, + {23, 0x02, 36}, + {40, 0x03, 36}, + {2, 0x02, 64}, + {9, 0x02, 64}, + {23, 0x02, 64}, + {40, 0x03, 64}, + {2, 0x02, 91}, + {9, 0x02, 91}, + {23, 0x02, 91}, + {40, 0x03, 91}, + }, + /* 86 */ + { + {3, 0x02, 0}, + {6, 0x02, 0}, + {10, 0x02, 0}, + {15, 0x02, 0}, + {24, 0x02, 0}, + {31, 0x02, 0}, + {41, 0x02, 0}, + {56, 0x03, 0}, + {3, 0x02, 36}, + {6, 0x02, 36}, + {10, 0x02, 36}, + {15, 0x02, 36}, + {24, 0x02, 36}, + {31, 0x02, 36}, + {41, 0x02, 36}, + {56, 0x03, 36}, + }, + /* 87 */ + { + {3, 0x02, 64}, + {6, 0x02, 64}, + {10, 0x02, 64}, + {15, 0x02, 64}, + {24, 0x02, 64}, + {31, 0x02, 64}, + {41, 0x02, 64}, + {56, 0x03, 64}, + {3, 0x02, 91}, + {6, 0x02, 91}, + {10, 0x02, 91}, + {15, 0x02, 91}, + {24, 0x02, 91}, + {31, 0x02, 91}, + {41, 0x02, 91}, + {56, 0x03, 91}, + }, + /* 88 */ + { + {2, 0x02, 93}, + {9, 0x02, 93}, + {23, 0x02, 93}, + {40, 0x03, 93}, + {2, 0x02, 126}, + {9, 0x02, 126}, + {23, 0x02, 126}, + {40, 0x03, 126}, + {1, 0x02, 94}, + {22, 0x03, 94}, + {1, 0x02, 125}, + {22, 0x03, 125}, + {0, 0x03, 60}, + {0, 0x03, 96}, + {0, 0x03, 123}, + {95, 0x00, 0}, + }, + /* 89 */ + { + {3, 0x02, 93}, + {6, 0x02, 93}, + {10, 0x02, 93}, + {15, 0x02, 93}, + {24, 0x02, 93}, + {31, 0x02, 93}, + {41, 0x02, 93}, + {56, 0x03, 93}, + {3, 0x02, 126}, + {6, 0x02, 126}, + {10, 0x02, 126}, + {15, 0x02, 126}, + {24, 0x02, 126}, + {31, 0x02, 126}, + {41, 0x02, 126}, + {56, 0x03, 126}, + }, + /* 90 */ + { + {2, 0x02, 94}, + {9, 0x02, 94}, + {23, 0x02, 94}, + {40, 0x03, 94}, + {2, 0x02, 125}, + {9, 0x02, 125}, + {23, 0x02, 125}, + {40, 0x03, 125}, + {1, 0x02, 60}, + {22, 0x03, 60}, + {1, 0x02, 96}, + {22, 0x03, 96}, + {1, 0x02, 123}, + {22, 0x03, 123}, + {96, 0x00, 0}, + {110, 0x00, 0}, + }, + /* 91 */ + { + {3, 0x02, 94}, + {6, 0x02, 94}, + {10, 0x02, 94}, + {15, 0x02, 94}, + {24, 0x02, 94}, + {31, 0x02, 94}, + {41, 0x02, 94}, + {56, 0x03, 94}, + {3, 0x02, 125}, + {6, 0x02, 125}, + {10, 0x02, 125}, + {15, 0x02, 125}, + {24, 0x02, 125}, + {31, 0x02, 125}, + {41, 0x02, 125}, + {56, 0x03, 125}, + }, + /* 92 */ + { + {2, 0x02, 60}, + {9, 0x02, 60}, + {23, 0x02, 60}, + {40, 0x03, 60}, + {2, 0x02, 96}, + {9, 0x02, 96}, + {23, 0x02, 96}, + {40, 0x03, 96}, + {2, 0x02, 123}, + {9, 0x02, 123}, + {23, 0x02, 123}, + {40, 0x03, 123}, + {97, 0x00, 0}, + {101, 0x00, 0}, + {111, 0x00, 0}, + {133, 0x00, 0}, + }, + /* 93 */ + { + {3, 0x02, 60}, + {6, 0x02, 60}, + {10, 0x02, 60}, + {15, 0x02, 60}, + {24, 0x02, 60}, + {31, 0x02, 60}, + {41, 0x02, 60}, + {56, 0x03, 60}, + {3, 0x02, 96}, + {6, 0x02, 96}, + {10, 0x02, 96}, + {15, 0x02, 96}, + {24, 0x02, 96}, + {31, 0x02, 96}, + {41, 0x02, 96}, + {56, 0x03, 96}, + }, + /* 94 */ + { + {3, 0x02, 123}, + {6, 0x02, 123}, + {10, 0x02, 123}, + {15, 0x02, 123}, + {24, 0x02, 123}, + {31, 0x02, 123}, + {41, 0x02, 123}, + {56, 0x03, 123}, + {98, 0x00, 0}, + {99, 0x00, 0}, + {102, 0x00, 0}, + {105, 0x00, 0}, + {112, 0x00, 0}, + {119, 0x00, 0}, + {134, 0x00, 0}, + {153, 0x00, 0}, + }, + /* 95 */ + { + {0, 0x03, 92}, + {0, 0x03, 195}, + {0, 0x03, 208}, + {100, 0x00, 0}, + {103, 0x00, 0}, + {104, 0x00, 0}, + {106, 0x00, 0}, + {107, 0x00, 0}, + {113, 0x00, 0}, + {116, 0x00, 0}, + {120, 0x00, 0}, + {126, 0x00, 0}, + {135, 0x00, 0}, + {142, 0x00, 0}, + {154, 0x00, 0}, + {169, 0x00, 0}, + }, + /* 96 */ + { + {1, 0x02, 92}, + {22, 0x03, 92}, + {1, 0x02, 195}, + {22, 0x03, 195}, + {1, 0x02, 208}, + {22, 0x03, 208}, + {0, 0x03, 128}, + {0, 0x03, 130}, + {0, 0x03, 131}, + {0, 0x03, 162}, + {0, 0x03, 184}, + {0, 0x03, 194}, + {0, 0x03, 224}, + {0, 0x03, 226}, + {108, 0x00, 0}, + {109, 0x00, 0}, + }, + /* 97 */ + { + {2, 0x02, 92}, + {9, 0x02, 92}, + {23, 0x02, 92}, + {40, 0x03, 92}, + {2, 0x02, 195}, + {9, 0x02, 195}, + {23, 0x02, 195}, + {40, 0x03, 195}, + {2, 0x02, 208}, + {9, 0x02, 208}, + {23, 0x02, 208}, + {40, 0x03, 208}, + {1, 0x02, 128}, + {22, 0x03, 128}, + {1, 0x02, 130}, + {22, 0x03, 130}, + }, + /* 98 */ + { + {3, 0x02, 92}, + {6, 0x02, 92}, + {10, 0x02, 92}, + {15, 0x02, 92}, + {24, 0x02, 92}, + {31, 0x02, 92}, + {41, 0x02, 92}, + {56, 0x03, 92}, + {3, 0x02, 195}, + {6, 0x02, 195}, + {10, 0x02, 195}, + {15, 0x02, 195}, + {24, 0x02, 195}, + {31, 0x02, 195}, + {41, 0x02, 195}, + {56, 0x03, 195}, + }, + /* 99 */ + { + {3, 0x02, 208}, + {6, 0x02, 208}, + {10, 0x02, 208}, + {15, 0x02, 208}, + {24, 0x02, 208}, + {31, 0x02, 208}, + {41, 0x02, 208}, + {56, 0x03, 208}, + {2, 0x02, 128}, + {9, 0x02, 128}, + {23, 0x02, 128}, + {40, 0x03, 128}, + {2, 0x02, 130}, + {9, 0x02, 130}, + {23, 0x02, 130}, + {40, 0x03, 130}, + }, + /* 100 */ + { + {3, 0x02, 128}, + {6, 0x02, 128}, + {10, 0x02, 128}, + {15, 0x02, 128}, + {24, 0x02, 128}, + {31, 0x02, 128}, + {41, 0x02, 128}, + {56, 0x03, 128}, + {3, 0x02, 130}, + {6, 0x02, 130}, + {10, 0x02, 130}, + {15, 0x02, 130}, + {24, 0x02, 130}, + {31, 0x02, 130}, + {41, 0x02, 130}, + {56, 0x03, 130}, + }, + /* 101 */ + { + {1, 0x02, 131}, + {22, 0x03, 131}, + {1, 0x02, 162}, + {22, 0x03, 162}, + {1, 0x02, 184}, + {22, 0x03, 184}, + {1, 0x02, 194}, + {22, 0x03, 194}, + {1, 0x02, 224}, + {22, 0x03, 224}, + {1, 0x02, 226}, + {22, 0x03, 226}, + {0, 0x03, 153}, + {0, 0x03, 161}, + {0, 0x03, 167}, + {0, 0x03, 172}, + }, + /* 102 */ + { + {2, 0x02, 131}, + {9, 0x02, 131}, + {23, 0x02, 131}, + {40, 0x03, 131}, + {2, 0x02, 162}, + {9, 0x02, 162}, + {23, 0x02, 162}, + {40, 0x03, 162}, + {2, 0x02, 184}, + {9, 0x02, 184}, + {23, 0x02, 184}, + {40, 0x03, 184}, + {2, 0x02, 194}, + {9, 0x02, 194}, + {23, 0x02, 194}, + {40, 0x03, 194}, + }, + /* 103 */ + { + {3, 0x02, 131}, + {6, 0x02, 131}, + {10, 0x02, 131}, + {15, 0x02, 131}, + {24, 0x02, 131}, + {31, 0x02, 131}, + {41, 0x02, 131}, + {56, 0x03, 131}, + {3, 0x02, 162}, + {6, 0x02, 162}, + {10, 0x02, 162}, + {15, 0x02, 162}, + {24, 0x02, 162}, + {31, 0x02, 162}, + {41, 0x02, 162}, + {56, 0x03, 162}, + }, + /* 104 */ + { + {3, 0x02, 184}, + {6, 0x02, 184}, + {10, 0x02, 184}, + {15, 0x02, 184}, + {24, 0x02, 184}, + {31, 0x02, 184}, + {41, 0x02, 184}, + {56, 0x03, 184}, + {3, 0x02, 194}, + {6, 0x02, 194}, + {10, 0x02, 194}, + {15, 0x02, 194}, + {24, 0x02, 194}, + {31, 0x02, 194}, + {41, 0x02, 194}, + {56, 0x03, 194}, + }, + /* 105 */ + { + {2, 0x02, 224}, + {9, 0x02, 224}, + {23, 0x02, 224}, + {40, 0x03, 224}, + {2, 0x02, 226}, + {9, 0x02, 226}, + {23, 0x02, 226}, + {40, 0x03, 226}, + {1, 0x02, 153}, + {22, 0x03, 153}, + {1, 0x02, 161}, + {22, 0x03, 161}, + {1, 0x02, 167}, + {22, 0x03, 167}, + {1, 0x02, 172}, + {22, 0x03, 172}, + }, + /* 106 */ + { + {3, 0x02, 224}, + {6, 0x02, 224}, + {10, 0x02, 224}, + {15, 0x02, 224}, + {24, 0x02, 224}, + {31, 0x02, 224}, + {41, 0x02, 224}, + {56, 0x03, 224}, + {3, 0x02, 226}, + {6, 0x02, 226}, + {10, 0x02, 226}, + {15, 0x02, 226}, + {24, 0x02, 226}, + {31, 0x02, 226}, + {41, 0x02, 226}, + {56, 0x03, 226}, + }, + /* 107 */ + { + {2, 0x02, 153}, + {9, 0x02, 153}, + {23, 0x02, 153}, + {40, 0x03, 153}, + {2, 0x02, 161}, + {9, 0x02, 161}, + {23, 0x02, 161}, + {40, 0x03, 161}, + {2, 0x02, 167}, + {9, 0x02, 167}, + {23, 0x02, 167}, + {40, 0x03, 167}, + {2, 0x02, 172}, + {9, 0x02, 172}, + {23, 0x02, 172}, + {40, 0x03, 172}, + }, + /* 108 */ + { + {3, 0x02, 153}, + {6, 0x02, 153}, + {10, 0x02, 153}, + {15, 0x02, 153}, + {24, 0x02, 153}, + {31, 0x02, 153}, + {41, 0x02, 153}, + {56, 0x03, 153}, + {3, 0x02, 161}, + {6, 0x02, 161}, + {10, 0x02, 161}, + {15, 0x02, 161}, + {24, 0x02, 161}, + {31, 0x02, 161}, + {41, 0x02, 161}, + {56, 0x03, 161}, + }, + /* 109 */ + { + {3, 0x02, 167}, + {6, 0x02, 167}, + {10, 0x02, 167}, + {15, 0x02, 167}, + {24, 0x02, 167}, + {31, 0x02, 167}, + {41, 0x02, 167}, + {56, 0x03, 167}, + {3, 0x02, 172}, + {6, 0x02, 172}, + {10, 0x02, 172}, + {15, 0x02, 172}, + {24, 0x02, 172}, + {31, 0x02, 172}, + {41, 0x02, 172}, + {56, 0x03, 172}, + }, + /* 110 */ + { + {114, 0x00, 0}, + {115, 0x00, 0}, + {117, 0x00, 0}, + {118, 0x00, 0}, + {121, 0x00, 0}, + {123, 0x00, 0}, + {127, 0x00, 0}, + {130, 0x00, 0}, + {136, 0x00, 0}, + {139, 0x00, 0}, + {143, 0x00, 0}, + {146, 0x00, 0}, + {155, 0x00, 0}, + {162, 0x00, 0}, + {170, 0x00, 0}, + {180, 0x00, 0}, + }, + /* 111 */ + { + {0, 0x03, 176}, + {0, 0x03, 177}, + {0, 0x03, 179}, + {0, 0x03, 209}, + {0, 0x03, 216}, + {0, 0x03, 217}, + {0, 0x03, 227}, + {0, 0x03, 229}, + {0, 0x03, 230}, + {122, 0x00, 0}, + {124, 0x00, 0}, + {125, 0x00, 0}, + {128, 0x00, 0}, + {129, 0x00, 0}, + {131, 0x00, 0}, + {132, 0x00, 0}, + }, + /* 112 */ + { + {1, 0x02, 176}, + {22, 0x03, 176}, + {1, 0x02, 177}, + {22, 0x03, 177}, + {1, 0x02, 179}, + {22, 0x03, 179}, + {1, 0x02, 209}, + {22, 0x03, 209}, + {1, 0x02, 216}, + {22, 0x03, 216}, + {1, 0x02, 217}, + {22, 0x03, 217}, + {1, 0x02, 227}, + {22, 0x03, 227}, + {1, 0x02, 229}, + {22, 0x03, 229}, + }, + /* 113 */ + { + {2, 0x02, 176}, + {9, 0x02, 176}, + {23, 0x02, 176}, + {40, 0x03, 176}, + {2, 0x02, 177}, + {9, 0x02, 177}, + {23, 0x02, 177}, + {40, 0x03, 177}, + {2, 0x02, 179}, + {9, 0x02, 179}, + {23, 0x02, 179}, + {40, 0x03, 179}, + {2, 0x02, 209}, + {9, 0x02, 209}, + {23, 0x02, 209}, + {40, 0x03, 209}, + }, + /* 114 */ + { + {3, 0x02, 176}, + {6, 0x02, 176}, + {10, 0x02, 176}, + {15, 0x02, 176}, + {24, 0x02, 176}, + {31, 0x02, 176}, + {41, 0x02, 176}, + {56, 0x03, 176}, + {3, 0x02, 177}, + {6, 0x02, 177}, + {10, 0x02, 177}, + {15, 0x02, 177}, + {24, 0x02, 177}, + {31, 0x02, 177}, + {41, 0x02, 177}, + {56, 0x03, 177}, + }, + /* 115 */ + { + {3, 0x02, 179}, + {6, 0x02, 179}, + {10, 0x02, 179}, + {15, 0x02, 179}, + {24, 0x02, 179}, + {31, 0x02, 179}, + {41, 0x02, 179}, + {56, 0x03, 179}, + {3, 0x02, 209}, + {6, 0x02, 209}, + {10, 0x02, 209}, + {15, 0x02, 209}, + {24, 0x02, 209}, + {31, 0x02, 209}, + {41, 0x02, 209}, + {56, 0x03, 209}, + }, + /* 116 */ + { + {2, 0x02, 216}, + {9, 0x02, 216}, + {23, 0x02, 216}, + {40, 0x03, 216}, + {2, 0x02, 217}, + {9, 0x02, 217}, + {23, 0x02, 217}, + {40, 0x03, 217}, + {2, 0x02, 227}, + {9, 0x02, 227}, + {23, 0x02, 227}, + {40, 0x03, 227}, + {2, 0x02, 229}, + {9, 0x02, 229}, + {23, 0x02, 229}, + {40, 0x03, 229}, + }, + /* 117 */ + { + {3, 0x02, 216}, + {6, 0x02, 216}, + {10, 0x02, 216}, + {15, 0x02, 216}, + {24, 0x02, 216}, + {31, 0x02, 216}, + {41, 0x02, 216}, + {56, 0x03, 216}, + {3, 0x02, 217}, + {6, 0x02, 217}, + {10, 0x02, 217}, + {15, 0x02, 217}, + {24, 0x02, 217}, + {31, 0x02, 217}, + {41, 0x02, 217}, + {56, 0x03, 217}, + }, + /* 118 */ + { + {3, 0x02, 227}, + {6, 0x02, 227}, + {10, 0x02, 227}, + {15, 0x02, 227}, + {24, 0x02, 227}, + {31, 0x02, 227}, + {41, 0x02, 227}, + {56, 0x03, 227}, + {3, 0x02, 229}, + {6, 0x02, 229}, + {10, 0x02, 229}, + {15, 0x02, 229}, + {24, 0x02, 229}, + {31, 0x02, 229}, + {41, 0x02, 229}, + {56, 0x03, 229}, + }, + /* 119 */ + { + {1, 0x02, 230}, + {22, 0x03, 230}, + {0, 0x03, 129}, + {0, 0x03, 132}, + {0, 0x03, 133}, + {0, 0x03, 134}, + {0, 0x03, 136}, + {0, 0x03, 146}, + {0, 0x03, 154}, + {0, 0x03, 156}, + {0, 0x03, 160}, + {0, 0x03, 163}, + {0, 0x03, 164}, + {0, 0x03, 169}, + {0, 0x03, 170}, + {0, 0x03, 173}, + }, + /* 120 */ + { + {2, 0x02, 230}, + {9, 0x02, 230}, + {23, 0x02, 230}, + {40, 0x03, 230}, + {1, 0x02, 129}, + {22, 0x03, 129}, + {1, 0x02, 132}, + {22, 0x03, 132}, + {1, 0x02, 133}, + {22, 0x03, 133}, + {1, 0x02, 134}, + {22, 0x03, 134}, + {1, 0x02, 136}, + {22, 0x03, 136}, + {1, 0x02, 146}, + {22, 0x03, 146}, + }, + /* 121 */ + { + {3, 0x02, 230}, + {6, 0x02, 230}, + {10, 0x02, 230}, + {15, 0x02, 230}, + {24, 0x02, 230}, + {31, 0x02, 230}, + {41, 0x02, 230}, + {56, 0x03, 230}, + {2, 0x02, 129}, + {9, 0x02, 129}, + {23, 0x02, 129}, + {40, 0x03, 129}, + {2, 0x02, 132}, + {9, 0x02, 132}, + {23, 0x02, 132}, + {40, 0x03, 132}, + }, + /* 122 */ + { + {3, 0x02, 129}, + {6, 0x02, 129}, + {10, 0x02, 129}, + {15, 0x02, 129}, + {24, 0x02, 129}, + {31, 0x02, 129}, + {41, 0x02, 129}, + {56, 0x03, 129}, + {3, 0x02, 132}, + {6, 0x02, 132}, + {10, 0x02, 132}, + {15, 0x02, 132}, + {24, 0x02, 132}, + {31, 0x02, 132}, + {41, 0x02, 132}, + {56, 0x03, 132}, + }, + /* 123 */ + { + {2, 0x02, 133}, + {9, 0x02, 133}, + {23, 0x02, 133}, + {40, 0x03, 133}, + {2, 0x02, 134}, + {9, 0x02, 134}, + {23, 0x02, 134}, + {40, 0x03, 134}, + {2, 0x02, 136}, + {9, 0x02, 136}, + {23, 0x02, 136}, + {40, 0x03, 136}, + {2, 0x02, 146}, + {9, 0x02, 146}, + {23, 0x02, 146}, + {40, 0x03, 146}, + }, + /* 124 */ + { + {3, 0x02, 133}, + {6, 0x02, 133}, + {10, 0x02, 133}, + {15, 0x02, 133}, + {24, 0x02, 133}, + {31, 0x02, 133}, + {41, 0x02, 133}, + {56, 0x03, 133}, + {3, 0x02, 134}, + {6, 0x02, 134}, + {10, 0x02, 134}, + {15, 0x02, 134}, + {24, 0x02, 134}, + {31, 0x02, 134}, + {41, 0x02, 134}, + {56, 0x03, 134}, + }, + /* 125 */ + { + {3, 0x02, 136}, + {6, 0x02, 136}, + {10, 0x02, 136}, + {15, 0x02, 136}, + {24, 0x02, 136}, + {31, 0x02, 136}, + {41, 0x02, 136}, + {56, 0x03, 136}, + {3, 0x02, 146}, + {6, 0x02, 146}, + {10, 0x02, 146}, + {15, 0x02, 146}, + {24, 0x02, 146}, + {31, 0x02, 146}, + {41, 0x02, 146}, + {56, 0x03, 146}, + }, + /* 126 */ + { + {1, 0x02, 154}, + {22, 0x03, 154}, + {1, 0x02, 156}, + {22, 0x03, 156}, + {1, 0x02, 160}, + {22, 0x03, 160}, + {1, 0x02, 163}, + {22, 0x03, 163}, + {1, 0x02, 164}, + {22, 0x03, 164}, + {1, 0x02, 169}, + {22, 0x03, 169}, + {1, 0x02, 170}, + {22, 0x03, 170}, + {1, 0x02, 173}, + {22, 0x03, 173}, + }, + /* 127 */ + { + {2, 0x02, 154}, + {9, 0x02, 154}, + {23, 0x02, 154}, + {40, 0x03, 154}, + {2, 0x02, 156}, + {9, 0x02, 156}, + {23, 0x02, 156}, + {40, 0x03, 156}, + {2, 0x02, 160}, + {9, 0x02, 160}, + {23, 0x02, 160}, + {40, 0x03, 160}, + {2, 0x02, 163}, + {9, 0x02, 163}, + {23, 0x02, 163}, + {40, 0x03, 163}, + }, + /* 128 */ + { + {3, 0x02, 154}, + {6, 0x02, 154}, + {10, 0x02, 154}, + {15, 0x02, 154}, + {24, 0x02, 154}, + {31, 0x02, 154}, + {41, 0x02, 154}, + {56, 0x03, 154}, + {3, 0x02, 156}, + {6, 0x02, 156}, + {10, 0x02, 156}, + {15, 0x02, 156}, + {24, 0x02, 156}, + {31, 0x02, 156}, + {41, 0x02, 156}, + {56, 0x03, 156}, + }, + /* 129 */ + { + {3, 0x02, 160}, + {6, 0x02, 160}, + {10, 0x02, 160}, + {15, 0x02, 160}, + {24, 0x02, 160}, + {31, 0x02, 160}, + {41, 0x02, 160}, + {56, 0x03, 160}, + {3, 0x02, 163}, + {6, 0x02, 163}, + {10, 0x02, 163}, + {15, 0x02, 163}, + {24, 0x02, 163}, + {31, 0x02, 163}, + {41, 0x02, 163}, + {56, 0x03, 163}, + }, + /* 130 */ + { + {2, 0x02, 164}, + {9, 0x02, 164}, + {23, 0x02, 164}, + {40, 0x03, 164}, + {2, 0x02, 169}, + {9, 0x02, 169}, + {23, 0x02, 169}, + {40, 0x03, 169}, + {2, 0x02, 170}, + {9, 0x02, 170}, + {23, 0x02, 170}, + {40, 0x03, 170}, + {2, 0x02, 173}, + {9, 0x02, 173}, + {23, 0x02, 173}, + {40, 0x03, 173}, + }, + /* 131 */ + { + {3, 0x02, 164}, + {6, 0x02, 164}, + {10, 0x02, 164}, + {15, 0x02, 164}, + {24, 0x02, 164}, + {31, 0x02, 164}, + {41, 0x02, 164}, + {56, 0x03, 164}, + {3, 0x02, 169}, + {6, 0x02, 169}, + {10, 0x02, 169}, + {15, 0x02, 169}, + {24, 0x02, 169}, + {31, 0x02, 169}, + {41, 0x02, 169}, + {56, 0x03, 169}, + }, + /* 132 */ + { + {3, 0x02, 170}, + {6, 0x02, 170}, + {10, 0x02, 170}, + {15, 0x02, 170}, + {24, 0x02, 170}, + {31, 0x02, 170}, + {41, 0x02, 170}, + {56, 0x03, 170}, + {3, 0x02, 173}, + {6, 0x02, 173}, + {10, 0x02, 173}, + {15, 0x02, 173}, + {24, 0x02, 173}, + {31, 0x02, 173}, + {41, 0x02, 173}, + {56, 0x03, 173}, + }, + /* 133 */ + { + {137, 0x00, 0}, + {138, 0x00, 0}, + {140, 0x00, 0}, + {141, 0x00, 0}, + {144, 0x00, 0}, + {145, 0x00, 0}, + {147, 0x00, 0}, + {150, 0x00, 0}, + {156, 0x00, 0}, + {159, 0x00, 0}, + {163, 0x00, 0}, + {166, 0x00, 0}, + {171, 0x00, 0}, + {174, 0x00, 0}, + {181, 0x00, 0}, + {190, 0x00, 0}, + }, + /* 134 */ + { + {0, 0x03, 178}, + {0, 0x03, 181}, + {0, 0x03, 185}, + {0, 0x03, 186}, + {0, 0x03, 187}, + {0, 0x03, 189}, + {0, 0x03, 190}, + {0, 0x03, 196}, + {0, 0x03, 198}, + {0, 0x03, 228}, + {0, 0x03, 232}, + {0, 0x03, 233}, + {148, 0x00, 0}, + {149, 0x00, 0}, + {151, 0x00, 0}, + {152, 0x00, 0}, + }, + /* 135 */ + { + {1, 0x02, 178}, + {22, 0x03, 178}, + {1, 0x02, 181}, + {22, 0x03, 181}, + {1, 0x02, 185}, + {22, 0x03, 185}, + {1, 0x02, 186}, + {22, 0x03, 186}, + {1, 0x02, 187}, + {22, 0x03, 187}, + {1, 0x02, 189}, + {22, 0x03, 189}, + {1, 0x02, 190}, + {22, 0x03, 190}, + {1, 0x02, 196}, + {22, 0x03, 196}, + }, + /* 136 */ + { + {2, 0x02, 178}, + {9, 0x02, 178}, + {23, 0x02, 178}, + {40, 0x03, 178}, + {2, 0x02, 181}, + {9, 0x02, 181}, + {23, 0x02, 181}, + {40, 0x03, 181}, + {2, 0x02, 185}, + {9, 0x02, 185}, + {23, 0x02, 185}, + {40, 0x03, 185}, + {2, 0x02, 186}, + {9, 0x02, 186}, + {23, 0x02, 186}, + {40, 0x03, 186}, + }, + /* 137 */ + { + {3, 0x02, 178}, + {6, 0x02, 178}, + {10, 0x02, 178}, + {15, 0x02, 178}, + {24, 0x02, 178}, + {31, 0x02, 178}, + {41, 0x02, 178}, + {56, 0x03, 178}, + {3, 0x02, 181}, + {6, 0x02, 181}, + {10, 0x02, 181}, + {15, 0x02, 181}, + {24, 0x02, 181}, + {31, 0x02, 181}, + {41, 0x02, 181}, + {56, 0x03, 181}, + }, + /* 138 */ + { + {3, 0x02, 185}, + {6, 0x02, 185}, + {10, 0x02, 185}, + {15, 0x02, 185}, + {24, 0x02, 185}, + {31, 0x02, 185}, + {41, 0x02, 185}, + {56, 0x03, 185}, + {3, 0x02, 186}, + {6, 0x02, 186}, + {10, 0x02, 186}, + {15, 0x02, 186}, + {24, 0x02, 186}, + {31, 0x02, 186}, + {41, 0x02, 186}, + {56, 0x03, 186}, + }, + /* 139 */ + { + {2, 0x02, 187}, + {9, 0x02, 187}, + {23, 0x02, 187}, + {40, 0x03, 187}, + {2, 0x02, 189}, + {9, 0x02, 189}, + {23, 0x02, 189}, + {40, 0x03, 189}, + {2, 0x02, 190}, + {9, 0x02, 190}, + {23, 0x02, 190}, + {40, 0x03, 190}, + {2, 0x02, 196}, + {9, 0x02, 196}, + {23, 0x02, 196}, + {40, 0x03, 196}, + }, + /* 140 */ + { + {3, 0x02, 187}, + {6, 0x02, 187}, + {10, 0x02, 187}, + {15, 0x02, 187}, + {24, 0x02, 187}, + {31, 0x02, 187}, + {41, 0x02, 187}, + {56, 0x03, 187}, + {3, 0x02, 189}, + {6, 0x02, 189}, + {10, 0x02, 189}, + {15, 0x02, 189}, + {24, 0x02, 189}, + {31, 0x02, 189}, + {41, 0x02, 189}, + {56, 0x03, 189}, + }, + /* 141 */ + { + {3, 0x02, 190}, + {6, 0x02, 190}, + {10, 0x02, 190}, + {15, 0x02, 190}, + {24, 0x02, 190}, + {31, 0x02, 190}, + {41, 0x02, 190}, + {56, 0x03, 190}, + {3, 0x02, 196}, + {6, 0x02, 196}, + {10, 0x02, 196}, + {15, 0x02, 196}, + {24, 0x02, 196}, + {31, 0x02, 196}, + {41, 0x02, 196}, + {56, 0x03, 196}, + }, + /* 142 */ + { + {1, 0x02, 198}, + {22, 0x03, 198}, + {1, 0x02, 228}, + {22, 0x03, 228}, + {1, 0x02, 232}, + {22, 0x03, 232}, + {1, 0x02, 233}, + {22, 0x03, 233}, + {0, 0x03, 1}, + {0, 0x03, 135}, + {0, 0x03, 137}, + {0, 0x03, 138}, + {0, 0x03, 139}, + {0, 0x03, 140}, + {0, 0x03, 141}, + {0, 0x03, 143}, + }, + /* 143 */ + { + {2, 0x02, 198}, + {9, 0x02, 198}, + {23, 0x02, 198}, + {40, 0x03, 198}, + {2, 0x02, 228}, + {9, 0x02, 228}, + {23, 0x02, 228}, + {40, 0x03, 228}, + {2, 0x02, 232}, + {9, 0x02, 232}, + {23, 0x02, 232}, + {40, 0x03, 232}, + {2, 0x02, 233}, + {9, 0x02, 233}, + {23, 0x02, 233}, + {40, 0x03, 233}, + }, + /* 144 */ + { + {3, 0x02, 198}, + {6, 0x02, 198}, + {10, 0x02, 198}, + {15, 0x02, 198}, + {24, 0x02, 198}, + {31, 0x02, 198}, + {41, 0x02, 198}, + {56, 0x03, 198}, + {3, 0x02, 228}, + {6, 0x02, 228}, + {10, 0x02, 228}, + {15, 0x02, 228}, + {24, 0x02, 228}, + {31, 0x02, 228}, + {41, 0x02, 228}, + {56, 0x03, 228}, + }, + /* 145 */ + { + {3, 0x02, 232}, + {6, 0x02, 232}, + {10, 0x02, 232}, + {15, 0x02, 232}, + {24, 0x02, 232}, + {31, 0x02, 232}, + {41, 0x02, 232}, + {56, 0x03, 232}, + {3, 0x02, 233}, + {6, 0x02, 233}, + {10, 0x02, 233}, + {15, 0x02, 233}, + {24, 0x02, 233}, + {31, 0x02, 233}, + {41, 0x02, 233}, + {56, 0x03, 233}, + }, + /* 146 */ + { + {1, 0x02, 1}, + {22, 0x03, 1}, + {1, 0x02, 135}, + {22, 0x03, 135}, + {1, 0x02, 137}, + {22, 0x03, 137}, + {1, 0x02, 138}, + {22, 0x03, 138}, + {1, 0x02, 139}, + {22, 0x03, 139}, + {1, 0x02, 140}, + {22, 0x03, 140}, + {1, 0x02, 141}, + {22, 0x03, 141}, + {1, 0x02, 143}, + {22, 0x03, 143}, + }, + /* 147 */ + { + {2, 0x02, 1}, + {9, 0x02, 1}, + {23, 0x02, 1}, + {40, 0x03, 1}, + {2, 0x02, 135}, + {9, 0x02, 135}, + {23, 0x02, 135}, + {40, 0x03, 135}, + {2, 0x02, 137}, + {9, 0x02, 137}, + {23, 0x02, 137}, + {40, 0x03, 137}, + {2, 0x02, 138}, + {9, 0x02, 138}, + {23, 0x02, 138}, + {40, 0x03, 138}, + }, + /* 148 */ + { + {3, 0x02, 1}, + {6, 0x02, 1}, + {10, 0x02, 1}, + {15, 0x02, 1}, + {24, 0x02, 1}, + {31, 0x02, 1}, + {41, 0x02, 1}, + {56, 0x03, 1}, + {3, 0x02, 135}, + {6, 0x02, 135}, + {10, 0x02, 135}, + {15, 0x02, 135}, + {24, 0x02, 135}, + {31, 0x02, 135}, + {41, 0x02, 135}, + {56, 0x03, 135}, + }, + /* 149 */ + { + {3, 0x02, 137}, + {6, 0x02, 137}, + {10, 0x02, 137}, + {15, 0x02, 137}, + {24, 0x02, 137}, + {31, 0x02, 137}, + {41, 0x02, 137}, + {56, 0x03, 137}, + {3, 0x02, 138}, + {6, 0x02, 138}, + {10, 0x02, 138}, + {15, 0x02, 138}, + {24, 0x02, 138}, + {31, 0x02, 138}, + {41, 0x02, 138}, + {56, 0x03, 138}, + }, + /* 150 */ + { + {2, 0x02, 139}, + {9, 0x02, 139}, + {23, 0x02, 139}, + {40, 0x03, 139}, + {2, 0x02, 140}, + {9, 0x02, 140}, + {23, 0x02, 140}, + {40, 0x03, 140}, + {2, 0x02, 141}, + {9, 0x02, 141}, + {23, 0x02, 141}, + {40, 0x03, 141}, + {2, 0x02, 143}, + {9, 0x02, 143}, + {23, 0x02, 143}, + {40, 0x03, 143}, + }, + /* 151 */ + { + {3, 0x02, 139}, + {6, 0x02, 139}, + {10, 0x02, 139}, + {15, 0x02, 139}, + {24, 0x02, 139}, + {31, 0x02, 139}, + {41, 0x02, 139}, + {56, 0x03, 139}, + {3, 0x02, 140}, + {6, 0x02, 140}, + {10, 0x02, 140}, + {15, 0x02, 140}, + {24, 0x02, 140}, + {31, 0x02, 140}, + {41, 0x02, 140}, + {56, 0x03, 140}, + }, + /* 152 */ + { + {3, 0x02, 141}, + {6, 0x02, 141}, + {10, 0x02, 141}, + {15, 0x02, 141}, + {24, 0x02, 141}, + {31, 0x02, 141}, + {41, 0x02, 141}, + {56, 0x03, 141}, + {3, 0x02, 143}, + {6, 0x02, 143}, + {10, 0x02, 143}, + {15, 0x02, 143}, + {24, 0x02, 143}, + {31, 0x02, 143}, + {41, 0x02, 143}, + {56, 0x03, 143}, + }, + /* 153 */ + { + {157, 0x00, 0}, + {158, 0x00, 0}, + {160, 0x00, 0}, + {161, 0x00, 0}, + {164, 0x00, 0}, + {165, 0x00, 0}, + {167, 0x00, 0}, + {168, 0x00, 0}, + {172, 0x00, 0}, + {173, 0x00, 0}, + {175, 0x00, 0}, + {177, 0x00, 0}, + {182, 0x00, 0}, + {185, 0x00, 0}, + {191, 0x00, 0}, + {207, 0x00, 0}, + }, + /* 154 */ + { + {0, 0x03, 147}, + {0, 0x03, 149}, + {0, 0x03, 150}, + {0, 0x03, 151}, + {0, 0x03, 152}, + {0, 0x03, 155}, + {0, 0x03, 157}, + {0, 0x03, 158}, + {0, 0x03, 165}, + {0, 0x03, 166}, + {0, 0x03, 168}, + {0, 0x03, 174}, + {0, 0x03, 175}, + {0, 0x03, 180}, + {0, 0x03, 182}, + {0, 0x03, 183}, + }, + /* 155 */ + { + {1, 0x02, 147}, + {22, 0x03, 147}, + {1, 0x02, 149}, + {22, 0x03, 149}, + {1, 0x02, 150}, + {22, 0x03, 150}, + {1, 0x02, 151}, + {22, 0x03, 151}, + {1, 0x02, 152}, + {22, 0x03, 152}, + {1, 0x02, 155}, + {22, 0x03, 155}, + {1, 0x02, 157}, + {22, 0x03, 157}, + {1, 0x02, 158}, + {22, 0x03, 158}, + }, + /* 156 */ + { + {2, 0x02, 147}, + {9, 0x02, 147}, + {23, 0x02, 147}, + {40, 0x03, 147}, + {2, 0x02, 149}, + {9, 0x02, 149}, + {23, 0x02, 149}, + {40, 0x03, 149}, + {2, 0x02, 150}, + {9, 0x02, 150}, + {23, 0x02, 150}, + {40, 0x03, 150}, + {2, 0x02, 151}, + {9, 0x02, 151}, + {23, 0x02, 151}, + {40, 0x03, 151}, + }, + /* 157 */ + { + {3, 0x02, 147}, + {6, 0x02, 147}, + {10, 0x02, 147}, + {15, 0x02, 147}, + {24, 0x02, 147}, + {31, 0x02, 147}, + {41, 0x02, 147}, + {56, 0x03, 147}, + {3, 0x02, 149}, + {6, 0x02, 149}, + {10, 0x02, 149}, + {15, 0x02, 149}, + {24, 0x02, 149}, + {31, 0x02, 149}, + {41, 0x02, 149}, + {56, 0x03, 149}, + }, + /* 158 */ + { + {3, 0x02, 150}, + {6, 0x02, 150}, + {10, 0x02, 150}, + {15, 0x02, 150}, + {24, 0x02, 150}, + {31, 0x02, 150}, + {41, 0x02, 150}, + {56, 0x03, 150}, + {3, 0x02, 151}, + {6, 0x02, 151}, + {10, 0x02, 151}, + {15, 0x02, 151}, + {24, 0x02, 151}, + {31, 0x02, 151}, + {41, 0x02, 151}, + {56, 0x03, 151}, + }, + /* 159 */ + { + {2, 0x02, 152}, + {9, 0x02, 152}, + {23, 0x02, 152}, + {40, 0x03, 152}, + {2, 0x02, 155}, + {9, 0x02, 155}, + {23, 0x02, 155}, + {40, 0x03, 155}, + {2, 0x02, 157}, + {9, 0x02, 157}, + {23, 0x02, 157}, + {40, 0x03, 157}, + {2, 0x02, 158}, + {9, 0x02, 158}, + {23, 0x02, 158}, + {40, 0x03, 158}, + }, + /* 160 */ + { + {3, 0x02, 152}, + {6, 0x02, 152}, + {10, 0x02, 152}, + {15, 0x02, 152}, + {24, 0x02, 152}, + {31, 0x02, 152}, + {41, 0x02, 152}, + {56, 0x03, 152}, + {3, 0x02, 155}, + {6, 0x02, 155}, + {10, 0x02, 155}, + {15, 0x02, 155}, + {24, 0x02, 155}, + {31, 0x02, 155}, + {41, 0x02, 155}, + {56, 0x03, 155}, + }, + /* 161 */ + { + {3, 0x02, 157}, + {6, 0x02, 157}, + {10, 0x02, 157}, + {15, 0x02, 157}, + {24, 0x02, 157}, + {31, 0x02, 157}, + {41, 0x02, 157}, + {56, 0x03, 157}, + {3, 0x02, 158}, + {6, 0x02, 158}, + {10, 0x02, 158}, + {15, 0x02, 158}, + {24, 0x02, 158}, + {31, 0x02, 158}, + {41, 0x02, 158}, + {56, 0x03, 158}, + }, + /* 162 */ + { + {1, 0x02, 165}, + {22, 0x03, 165}, + {1, 0x02, 166}, + {22, 0x03, 166}, + {1, 0x02, 168}, + {22, 0x03, 168}, + {1, 0x02, 174}, + {22, 0x03, 174}, + {1, 0x02, 175}, + {22, 0x03, 175}, + {1, 0x02, 180}, + {22, 0x03, 180}, + {1, 0x02, 182}, + {22, 0x03, 182}, + {1, 0x02, 183}, + {22, 0x03, 183}, + }, + /* 163 */ + { + {2, 0x02, 165}, + {9, 0x02, 165}, + {23, 0x02, 165}, + {40, 0x03, 165}, + {2, 0x02, 166}, + {9, 0x02, 166}, + {23, 0x02, 166}, + {40, 0x03, 166}, + {2, 0x02, 168}, + {9, 0x02, 168}, + {23, 0x02, 168}, + {40, 0x03, 168}, + {2, 0x02, 174}, + {9, 0x02, 174}, + {23, 0x02, 174}, + {40, 0x03, 174}, + }, + /* 164 */ + { + {3, 0x02, 165}, + {6, 0x02, 165}, + {10, 0x02, 165}, + {15, 0x02, 165}, + {24, 0x02, 165}, + {31, 0x02, 165}, + {41, 0x02, 165}, + {56, 0x03, 165}, + {3, 0x02, 166}, + {6, 0x02, 166}, + {10, 0x02, 166}, + {15, 0x02, 166}, + {24, 0x02, 166}, + {31, 0x02, 166}, + {41, 0x02, 166}, + {56, 0x03, 166}, + }, + /* 165 */ + { + {3, 0x02, 168}, + {6, 0x02, 168}, + {10, 0x02, 168}, + {15, 0x02, 168}, + {24, 0x02, 168}, + {31, 0x02, 168}, + {41, 0x02, 168}, + {56, 0x03, 168}, + {3, 0x02, 174}, + {6, 0x02, 174}, + {10, 0x02, 174}, + {15, 0x02, 174}, + {24, 0x02, 174}, + {31, 0x02, 174}, + {41, 0x02, 174}, + {56, 0x03, 174}, + }, + /* 166 */ + { + {2, 0x02, 175}, + {9, 0x02, 175}, + {23, 0x02, 175}, + {40, 0x03, 175}, + {2, 0x02, 180}, + {9, 0x02, 180}, + {23, 0x02, 180}, + {40, 0x03, 180}, + {2, 0x02, 182}, + {9, 0x02, 182}, + {23, 0x02, 182}, + {40, 0x03, 182}, + {2, 0x02, 183}, + {9, 0x02, 183}, + {23, 0x02, 183}, + {40, 0x03, 183}, + }, + /* 167 */ + { + {3, 0x02, 175}, + {6, 0x02, 175}, + {10, 0x02, 175}, + {15, 0x02, 175}, + {24, 0x02, 175}, + {31, 0x02, 175}, + {41, 0x02, 175}, + {56, 0x03, 175}, + {3, 0x02, 180}, + {6, 0x02, 180}, + {10, 0x02, 180}, + {15, 0x02, 180}, + {24, 0x02, 180}, + {31, 0x02, 180}, + {41, 0x02, 180}, + {56, 0x03, 180}, + }, + /* 168 */ + { + {3, 0x02, 182}, + {6, 0x02, 182}, + {10, 0x02, 182}, + {15, 0x02, 182}, + {24, 0x02, 182}, + {31, 0x02, 182}, + {41, 0x02, 182}, + {56, 0x03, 182}, + {3, 0x02, 183}, + {6, 0x02, 183}, + {10, 0x02, 183}, + {15, 0x02, 183}, + {24, 0x02, 183}, + {31, 0x02, 183}, + {41, 0x02, 183}, + {56, 0x03, 183}, + }, + /* 169 */ + { + {0, 0x03, 188}, + {0, 0x03, 191}, + {0, 0x03, 197}, + {0, 0x03, 231}, + {0, 0x03, 239}, + {176, 0x00, 0}, + {178, 0x00, 0}, + {179, 0x00, 0}, + {183, 0x00, 0}, + {184, 0x00, 0}, + {186, 0x00, 0}, + {187, 0x00, 0}, + {192, 0x00, 0}, + {199, 0x00, 0}, + {208, 0x00, 0}, + {223, 0x00, 0}, + }, + /* 170 */ + { + {1, 0x02, 188}, + {22, 0x03, 188}, + {1, 0x02, 191}, + {22, 0x03, 191}, + {1, 0x02, 197}, + {22, 0x03, 197}, + {1, 0x02, 231}, + {22, 0x03, 231}, + {1, 0x02, 239}, + {22, 0x03, 239}, + {0, 0x03, 9}, + {0, 0x03, 142}, + {0, 0x03, 144}, + {0, 0x03, 145}, + {0, 0x03, 148}, + {0, 0x03, 159}, + }, + /* 171 */ + { + {2, 0x02, 188}, + {9, 0x02, 188}, + {23, 0x02, 188}, + {40, 0x03, 188}, + {2, 0x02, 191}, + {9, 0x02, 191}, + {23, 0x02, 191}, + {40, 0x03, 191}, + {2, 0x02, 197}, + {9, 0x02, 197}, + {23, 0x02, 197}, + {40, 0x03, 197}, + {2, 0x02, 231}, + {9, 0x02, 231}, + {23, 0x02, 231}, + {40, 0x03, 231}, + }, + /* 172 */ + { + {3, 0x02, 188}, + {6, 0x02, 188}, + {10, 0x02, 188}, + {15, 0x02, 188}, + {24, 0x02, 188}, + {31, 0x02, 188}, + {41, 0x02, 188}, + {56, 0x03, 188}, + {3, 0x02, 191}, + {6, 0x02, 191}, + {10, 0x02, 191}, + {15, 0x02, 191}, + {24, 0x02, 191}, + {31, 0x02, 191}, + {41, 0x02, 191}, + {56, 0x03, 191}, + }, + /* 173 */ + { + {3, 0x02, 197}, + {6, 0x02, 197}, + {10, 0x02, 197}, + {15, 0x02, 197}, + {24, 0x02, 197}, + {31, 0x02, 197}, + {41, 0x02, 197}, + {56, 0x03, 197}, + {3, 0x02, 231}, + {6, 0x02, 231}, + {10, 0x02, 231}, + {15, 0x02, 231}, + {24, 0x02, 231}, + {31, 0x02, 231}, + {41, 0x02, 231}, + {56, 0x03, 231}, + }, + /* 174 */ + { + {2, 0x02, 239}, + {9, 0x02, 239}, + {23, 0x02, 239}, + {40, 0x03, 239}, + {1, 0x02, 9}, + {22, 0x03, 9}, + {1, 0x02, 142}, + {22, 0x03, 142}, + {1, 0x02, 144}, + {22, 0x03, 144}, + {1, 0x02, 145}, + {22, 0x03, 145}, + {1, 0x02, 148}, + {22, 0x03, 148}, + {1, 0x02, 159}, + {22, 0x03, 159}, + }, + /* 175 */ + { + {3, 0x02, 239}, + {6, 0x02, 239}, + {10, 0x02, 239}, + {15, 0x02, 239}, + {24, 0x02, 239}, + {31, 0x02, 239}, + {41, 0x02, 239}, + {56, 0x03, 239}, + {2, 0x02, 9}, + {9, 0x02, 9}, + {23, 0x02, 9}, + {40, 0x03, 9}, + {2, 0x02, 142}, + {9, 0x02, 142}, + {23, 0x02, 142}, + {40, 0x03, 142}, + }, + /* 176 */ + { + {3, 0x02, 9}, + {6, 0x02, 9}, + {10, 0x02, 9}, + {15, 0x02, 9}, + {24, 0x02, 9}, + {31, 0x02, 9}, + {41, 0x02, 9}, + {56, 0x03, 9}, + {3, 0x02, 142}, + {6, 0x02, 142}, + {10, 0x02, 142}, + {15, 0x02, 142}, + {24, 0x02, 142}, + {31, 0x02, 142}, + {41, 0x02, 142}, + {56, 0x03, 142}, + }, + /* 177 */ + { + {2, 0x02, 144}, + {9, 0x02, 144}, + {23, 0x02, 144}, + {40, 0x03, 144}, + {2, 0x02, 145}, + {9, 0x02, 145}, + {23, 0x02, 145}, + {40, 0x03, 145}, + {2, 0x02, 148}, + {9, 0x02, 148}, + {23, 0x02, 148}, + {40, 0x03, 148}, + {2, 0x02, 159}, + {9, 0x02, 159}, + {23, 0x02, 159}, + {40, 0x03, 159}, + }, + /* 178 */ + { + {3, 0x02, 144}, + {6, 0x02, 144}, + {10, 0x02, 144}, + {15, 0x02, 144}, + {24, 0x02, 144}, + {31, 0x02, 144}, + {41, 0x02, 144}, + {56, 0x03, 144}, + {3, 0x02, 145}, + {6, 0x02, 145}, + {10, 0x02, 145}, + {15, 0x02, 145}, + {24, 0x02, 145}, + {31, 0x02, 145}, + {41, 0x02, 145}, + {56, 0x03, 145}, + }, + /* 179 */ + { + {3, 0x02, 148}, + {6, 0x02, 148}, + {10, 0x02, 148}, + {15, 0x02, 148}, + {24, 0x02, 148}, + {31, 0x02, 148}, + {41, 0x02, 148}, + {56, 0x03, 148}, + {3, 0x02, 159}, + {6, 0x02, 159}, + {10, 0x02, 159}, + {15, 0x02, 159}, + {24, 0x02, 159}, + {31, 0x02, 159}, + {41, 0x02, 159}, + {56, 0x03, 159}, + }, + /* 180 */ + { + {0, 0x03, 171}, + {0, 0x03, 206}, + {0, 0x03, 215}, + {0, 0x03, 225}, + {0, 0x03, 236}, + {0, 0x03, 237}, + {188, 0x00, 0}, + {189, 0x00, 0}, + {193, 0x00, 0}, + {196, 0x00, 0}, + {200, 0x00, 0}, + {203, 0x00, 0}, + {209, 0x00, 0}, + {216, 0x00, 0}, + {224, 0x00, 0}, + {238, 0x00, 0}, + }, + /* 181 */ + { + {1, 0x02, 171}, + {22, 0x03, 171}, + {1, 0x02, 206}, + {22, 0x03, 206}, + {1, 0x02, 215}, + {22, 0x03, 215}, + {1, 0x02, 225}, + {22, 0x03, 225}, + {1, 0x02, 236}, + {22, 0x03, 236}, + {1, 0x02, 237}, + {22, 0x03, 237}, + {0, 0x03, 199}, + {0, 0x03, 207}, + {0, 0x03, 234}, + {0, 0x03, 235}, + }, + /* 182 */ + { + {2, 0x02, 171}, + {9, 0x02, 171}, + {23, 0x02, 171}, + {40, 0x03, 171}, + {2, 0x02, 206}, + {9, 0x02, 206}, + {23, 0x02, 206}, + {40, 0x03, 206}, + {2, 0x02, 215}, + {9, 0x02, 215}, + {23, 0x02, 215}, + {40, 0x03, 215}, + {2, 0x02, 225}, + {9, 0x02, 225}, + {23, 0x02, 225}, + {40, 0x03, 225}, + }, + /* 183 */ + { + {3, 0x02, 171}, + {6, 0x02, 171}, + {10, 0x02, 171}, + {15, 0x02, 171}, + {24, 0x02, 171}, + {31, 0x02, 171}, + {41, 0x02, 171}, + {56, 0x03, 171}, + {3, 0x02, 206}, + {6, 0x02, 206}, + {10, 0x02, 206}, + {15, 0x02, 206}, + {24, 0x02, 206}, + {31, 0x02, 206}, + {41, 0x02, 206}, + {56, 0x03, 206}, + }, + /* 184 */ + { + {3, 0x02, 215}, + {6, 0x02, 215}, + {10, 0x02, 215}, + {15, 0x02, 215}, + {24, 0x02, 215}, + {31, 0x02, 215}, + {41, 0x02, 215}, + {56, 0x03, 215}, + {3, 0x02, 225}, + {6, 0x02, 225}, + {10, 0x02, 225}, + {15, 0x02, 225}, + {24, 0x02, 225}, + {31, 0x02, 225}, + {41, 0x02, 225}, + {56, 0x03, 225}, + }, + /* 185 */ + { + {2, 0x02, 236}, + {9, 0x02, 236}, + {23, 0x02, 236}, + {40, 0x03, 236}, + {2, 0x02, 237}, + {9, 0x02, 237}, + {23, 0x02, 237}, + {40, 0x03, 237}, + {1, 0x02, 199}, + {22, 0x03, 199}, + {1, 0x02, 207}, + {22, 0x03, 207}, + {1, 0x02, 234}, + {22, 0x03, 234}, + {1, 0x02, 235}, + {22, 0x03, 235}, + }, + /* 186 */ + { + {3, 0x02, 236}, + {6, 0x02, 236}, + {10, 0x02, 236}, + {15, 0x02, 236}, + {24, 0x02, 236}, + {31, 0x02, 236}, + {41, 0x02, 236}, + {56, 0x03, 236}, + {3, 0x02, 237}, + {6, 0x02, 237}, + {10, 0x02, 237}, + {15, 0x02, 237}, + {24, 0x02, 237}, + {31, 0x02, 237}, + {41, 0x02, 237}, + {56, 0x03, 237}, + }, + /* 187 */ + { + {2, 0x02, 199}, + {9, 0x02, 199}, + {23, 0x02, 199}, + {40, 0x03, 199}, + {2, 0x02, 207}, + {9, 0x02, 207}, + {23, 0x02, 207}, + {40, 0x03, 207}, + {2, 0x02, 234}, + {9, 0x02, 234}, + {23, 0x02, 234}, + {40, 0x03, 234}, + {2, 0x02, 235}, + {9, 0x02, 235}, + {23, 0x02, 235}, + {40, 0x03, 235}, + }, + /* 188 */ + { + {3, 0x02, 199}, + {6, 0x02, 199}, + {10, 0x02, 199}, + {15, 0x02, 199}, + {24, 0x02, 199}, + {31, 0x02, 199}, + {41, 0x02, 199}, + {56, 0x03, 199}, + {3, 0x02, 207}, + {6, 0x02, 207}, + {10, 0x02, 207}, + {15, 0x02, 207}, + {24, 0x02, 207}, + {31, 0x02, 207}, + {41, 0x02, 207}, + {56, 0x03, 207}, + }, + /* 189 */ + { + {3, 0x02, 234}, + {6, 0x02, 234}, + {10, 0x02, 234}, + {15, 0x02, 234}, + {24, 0x02, 234}, + {31, 0x02, 234}, + {41, 0x02, 234}, + {56, 0x03, 234}, + {3, 0x02, 235}, + {6, 0x02, 235}, + {10, 0x02, 235}, + {15, 0x02, 235}, + {24, 0x02, 235}, + {31, 0x02, 235}, + {41, 0x02, 235}, + {56, 0x03, 235}, + }, + /* 190 */ + { + {194, 0x00, 0}, + {195, 0x00, 0}, + {197, 0x00, 0}, + {198, 0x00, 0}, + {201, 0x00, 0}, + {202, 0x00, 0}, + {204, 0x00, 0}, + {205, 0x00, 0}, + {210, 0x00, 0}, + {213, 0x00, 0}, + {217, 0x00, 0}, + {220, 0x00, 0}, + {225, 0x00, 0}, + {231, 0x00, 0}, + {239, 0x00, 0}, + {246, 0x00, 0}, + }, + /* 191 */ + { + {0, 0x03, 192}, + {0, 0x03, 193}, + {0, 0x03, 200}, + {0, 0x03, 201}, + {0, 0x03, 202}, + {0, 0x03, 205}, + {0, 0x03, 210}, + {0, 0x03, 213}, + {0, 0x03, 218}, + {0, 0x03, 219}, + {0, 0x03, 238}, + {0, 0x03, 240}, + {0, 0x03, 242}, + {0, 0x03, 243}, + {0, 0x03, 255}, + {206, 0x00, 0}, + }, + /* 192 */ + { + {1, 0x02, 192}, + {22, 0x03, 192}, + {1, 0x02, 193}, + {22, 0x03, 193}, + {1, 0x02, 200}, + {22, 0x03, 200}, + {1, 0x02, 201}, + {22, 0x03, 201}, + {1, 0x02, 202}, + {22, 0x03, 202}, + {1, 0x02, 205}, + {22, 0x03, 205}, + {1, 0x02, 210}, + {22, 0x03, 210}, + {1, 0x02, 213}, + {22, 0x03, 213}, + }, + /* 193 */ + { + {2, 0x02, 192}, + {9, 0x02, 192}, + {23, 0x02, 192}, + {40, 0x03, 192}, + {2, 0x02, 193}, + {9, 0x02, 193}, + {23, 0x02, 193}, + {40, 0x03, 193}, + {2, 0x02, 200}, + {9, 0x02, 200}, + {23, 0x02, 200}, + {40, 0x03, 200}, + {2, 0x02, 201}, + {9, 0x02, 201}, + {23, 0x02, 201}, + {40, 0x03, 201}, + }, + /* 194 */ + { + {3, 0x02, 192}, + {6, 0x02, 192}, + {10, 0x02, 192}, + {15, 0x02, 192}, + {24, 0x02, 192}, + {31, 0x02, 192}, + {41, 0x02, 192}, + {56, 0x03, 192}, + {3, 0x02, 193}, + {6, 0x02, 193}, + {10, 0x02, 193}, + {15, 0x02, 193}, + {24, 0x02, 193}, + {31, 0x02, 193}, + {41, 0x02, 193}, + {56, 0x03, 193}, + }, + /* 195 */ + { + {3, 0x02, 200}, + {6, 0x02, 200}, + {10, 0x02, 200}, + {15, 0x02, 200}, + {24, 0x02, 200}, + {31, 0x02, 200}, + {41, 0x02, 200}, + {56, 0x03, 200}, + {3, 0x02, 201}, + {6, 0x02, 201}, + {10, 0x02, 201}, + {15, 0x02, 201}, + {24, 0x02, 201}, + {31, 0x02, 201}, + {41, 0x02, 201}, + {56, 0x03, 201}, + }, + /* 196 */ + { + {2, 0x02, 202}, + {9, 0x02, 202}, + {23, 0x02, 202}, + {40, 0x03, 202}, + {2, 0x02, 205}, + {9, 0x02, 205}, + {23, 0x02, 205}, + {40, 0x03, 205}, + {2, 0x02, 210}, + {9, 0x02, 210}, + {23, 0x02, 210}, + {40, 0x03, 210}, + {2, 0x02, 213}, + {9, 0x02, 213}, + {23, 0x02, 213}, + {40, 0x03, 213}, + }, + /* 197 */ + { + {3, 0x02, 202}, + {6, 0x02, 202}, + {10, 0x02, 202}, + {15, 0x02, 202}, + {24, 0x02, 202}, + {31, 0x02, 202}, + {41, 0x02, 202}, + {56, 0x03, 202}, + {3, 0x02, 205}, + {6, 0x02, 205}, + {10, 0x02, 205}, + {15, 0x02, 205}, + {24, 0x02, 205}, + {31, 0x02, 205}, + {41, 0x02, 205}, + {56, 0x03, 205}, + }, + /* 198 */ + { + {3, 0x02, 210}, + {6, 0x02, 210}, + {10, 0x02, 210}, + {15, 0x02, 210}, + {24, 0x02, 210}, + {31, 0x02, 210}, + {41, 0x02, 210}, + {56, 0x03, 210}, + {3, 0x02, 213}, + {6, 0x02, 213}, + {10, 0x02, 213}, + {15, 0x02, 213}, + {24, 0x02, 213}, + {31, 0x02, 213}, + {41, 0x02, 213}, + {56, 0x03, 213}, + }, + /* 199 */ + { + {1, 0x02, 218}, + {22, 0x03, 218}, + {1, 0x02, 219}, + {22, 0x03, 219}, + {1, 0x02, 238}, + {22, 0x03, 238}, + {1, 0x02, 240}, + {22, 0x03, 240}, + {1, 0x02, 242}, + {22, 0x03, 242}, + {1, 0x02, 243}, + {22, 0x03, 243}, + {1, 0x02, 255}, + {22, 0x03, 255}, + {0, 0x03, 203}, + {0, 0x03, 204}, + }, + /* 200 */ + { + {2, 0x02, 218}, + {9, 0x02, 218}, + {23, 0x02, 218}, + {40, 0x03, 218}, + {2, 0x02, 219}, + {9, 0x02, 219}, + {23, 0x02, 219}, + {40, 0x03, 219}, + {2, 0x02, 238}, + {9, 0x02, 238}, + {23, 0x02, 238}, + {40, 0x03, 238}, + {2, 0x02, 240}, + {9, 0x02, 240}, + {23, 0x02, 240}, + {40, 0x03, 240}, + }, + /* 201 */ + { + {3, 0x02, 218}, + {6, 0x02, 218}, + {10, 0x02, 218}, + {15, 0x02, 218}, + {24, 0x02, 218}, + {31, 0x02, 218}, + {41, 0x02, 218}, + {56, 0x03, 218}, + {3, 0x02, 219}, + {6, 0x02, 219}, + {10, 0x02, 219}, + {15, 0x02, 219}, + {24, 0x02, 219}, + {31, 0x02, 219}, + {41, 0x02, 219}, + {56, 0x03, 219}, + }, + /* 202 */ + { + {3, 0x02, 238}, + {6, 0x02, 238}, + {10, 0x02, 238}, + {15, 0x02, 238}, + {24, 0x02, 238}, + {31, 0x02, 238}, + {41, 0x02, 238}, + {56, 0x03, 238}, + {3, 0x02, 240}, + {6, 0x02, 240}, + {10, 0x02, 240}, + {15, 0x02, 240}, + {24, 0x02, 240}, + {31, 0x02, 240}, + {41, 0x02, 240}, + {56, 0x03, 240}, + }, + /* 203 */ + { + {2, 0x02, 242}, + {9, 0x02, 242}, + {23, 0x02, 242}, + {40, 0x03, 242}, + {2, 0x02, 243}, + {9, 0x02, 243}, + {23, 0x02, 243}, + {40, 0x03, 243}, + {2, 0x02, 255}, + {9, 0x02, 255}, + {23, 0x02, 255}, + {40, 0x03, 255}, + {1, 0x02, 203}, + {22, 0x03, 203}, + {1, 0x02, 204}, + {22, 0x03, 204}, + }, + /* 204 */ + { + {3, 0x02, 242}, + {6, 0x02, 242}, + {10, 0x02, 242}, + {15, 0x02, 242}, + {24, 0x02, 242}, + {31, 0x02, 242}, + {41, 0x02, 242}, + {56, 0x03, 242}, + {3, 0x02, 243}, + {6, 0x02, 243}, + {10, 0x02, 243}, + {15, 0x02, 243}, + {24, 0x02, 243}, + {31, 0x02, 243}, + {41, 0x02, 243}, + {56, 0x03, 243}, + }, + /* 205 */ + { + {3, 0x02, 255}, + {6, 0x02, 255}, + {10, 0x02, 255}, + {15, 0x02, 255}, + {24, 0x02, 255}, + {31, 0x02, 255}, + {41, 0x02, 255}, + {56, 0x03, 255}, + {2, 0x02, 203}, + {9, 0x02, 203}, + {23, 0x02, 203}, + {40, 0x03, 203}, + {2, 0x02, 204}, + {9, 0x02, 204}, + {23, 0x02, 204}, + {40, 0x03, 204}, + }, + /* 206 */ + { + {3, 0x02, 203}, + {6, 0x02, 203}, + {10, 0x02, 203}, + {15, 0x02, 203}, + {24, 0x02, 203}, + {31, 0x02, 203}, + {41, 0x02, 203}, + {56, 0x03, 203}, + {3, 0x02, 204}, + {6, 0x02, 204}, + {10, 0x02, 204}, + {15, 0x02, 204}, + {24, 0x02, 204}, + {31, 0x02, 204}, + {41, 0x02, 204}, + {56, 0x03, 204}, + }, + /* 207 */ + { + {211, 0x00, 0}, + {212, 0x00, 0}, + {214, 0x00, 0}, + {215, 0x00, 0}, + {218, 0x00, 0}, + {219, 0x00, 0}, + {221, 0x00, 0}, + {222, 0x00, 0}, + {226, 0x00, 0}, + {228, 0x00, 0}, + {232, 0x00, 0}, + {235, 0x00, 0}, + {240, 0x00, 0}, + {243, 0x00, 0}, + {247, 0x00, 0}, + {250, 0x00, 0}, + }, + /* 208 */ + { + {0, 0x03, 211}, + {0, 0x03, 212}, + {0, 0x03, 214}, + {0, 0x03, 221}, + {0, 0x03, 222}, + {0, 0x03, 223}, + {0, 0x03, 241}, + {0, 0x03, 244}, + {0, 0x03, 245}, + {0, 0x03, 246}, + {0, 0x03, 247}, + {0, 0x03, 248}, + {0, 0x03, 250}, + {0, 0x03, 251}, + {0, 0x03, 252}, + {0, 0x03, 253}, + }, + /* 209 */ + { + {1, 0x02, 211}, + {22, 0x03, 211}, + {1, 0x02, 212}, + {22, 0x03, 212}, + {1, 0x02, 214}, + {22, 0x03, 214}, + {1, 0x02, 221}, + {22, 0x03, 221}, + {1, 0x02, 222}, + {22, 0x03, 222}, + {1, 0x02, 223}, + {22, 0x03, 223}, + {1, 0x02, 241}, + {22, 0x03, 241}, + {1, 0x02, 244}, + {22, 0x03, 244}, + }, + /* 210 */ + { + {2, 0x02, 211}, + {9, 0x02, 211}, + {23, 0x02, 211}, + {40, 0x03, 211}, + {2, 0x02, 212}, + {9, 0x02, 212}, + {23, 0x02, 212}, + {40, 0x03, 212}, + {2, 0x02, 214}, + {9, 0x02, 214}, + {23, 0x02, 214}, + {40, 0x03, 214}, + {2, 0x02, 221}, + {9, 0x02, 221}, + {23, 0x02, 221}, + {40, 0x03, 221}, + }, + /* 211 */ + { + {3, 0x02, 211}, + {6, 0x02, 211}, + {10, 0x02, 211}, + {15, 0x02, 211}, + {24, 0x02, 211}, + {31, 0x02, 211}, + {41, 0x02, 211}, + {56, 0x03, 211}, + {3, 0x02, 212}, + {6, 0x02, 212}, + {10, 0x02, 212}, + {15, 0x02, 212}, + {24, 0x02, 212}, + {31, 0x02, 212}, + {41, 0x02, 212}, + {56, 0x03, 212}, + }, + /* 212 */ + { + {3, 0x02, 214}, + {6, 0x02, 214}, + {10, 0x02, 214}, + {15, 0x02, 214}, + {24, 0x02, 214}, + {31, 0x02, 214}, + {41, 0x02, 214}, + {56, 0x03, 214}, + {3, 0x02, 221}, + {6, 0x02, 221}, + {10, 0x02, 221}, + {15, 0x02, 221}, + {24, 0x02, 221}, + {31, 0x02, 221}, + {41, 0x02, 221}, + {56, 0x03, 221}, + }, + /* 213 */ + { + {2, 0x02, 222}, + {9, 0x02, 222}, + {23, 0x02, 222}, + {40, 0x03, 222}, + {2, 0x02, 223}, + {9, 0x02, 223}, + {23, 0x02, 223}, + {40, 0x03, 223}, + {2, 0x02, 241}, + {9, 0x02, 241}, + {23, 0x02, 241}, + {40, 0x03, 241}, + {2, 0x02, 244}, + {9, 0x02, 244}, + {23, 0x02, 244}, + {40, 0x03, 244}, + }, + /* 214 */ + { + {3, 0x02, 222}, + {6, 0x02, 222}, + {10, 0x02, 222}, + {15, 0x02, 222}, + {24, 0x02, 222}, + {31, 0x02, 222}, + {41, 0x02, 222}, + {56, 0x03, 222}, + {3, 0x02, 223}, + {6, 0x02, 223}, + {10, 0x02, 223}, + {15, 0x02, 223}, + {24, 0x02, 223}, + {31, 0x02, 223}, + {41, 0x02, 223}, + {56, 0x03, 223}, + }, + /* 215 */ + { + {3, 0x02, 241}, + {6, 0x02, 241}, + {10, 0x02, 241}, + {15, 0x02, 241}, + {24, 0x02, 241}, + {31, 0x02, 241}, + {41, 0x02, 241}, + {56, 0x03, 241}, + {3, 0x02, 244}, + {6, 0x02, 244}, + {10, 0x02, 244}, + {15, 0x02, 244}, + {24, 0x02, 244}, + {31, 0x02, 244}, + {41, 0x02, 244}, + {56, 0x03, 244}, + }, + /* 216 */ + { + {1, 0x02, 245}, + {22, 0x03, 245}, + {1, 0x02, 246}, + {22, 0x03, 246}, + {1, 0x02, 247}, + {22, 0x03, 247}, + {1, 0x02, 248}, + {22, 0x03, 248}, + {1, 0x02, 250}, + {22, 0x03, 250}, + {1, 0x02, 251}, + {22, 0x03, 251}, + {1, 0x02, 252}, + {22, 0x03, 252}, + {1, 0x02, 253}, + {22, 0x03, 253}, + }, + /* 217 */ + { + {2, 0x02, 245}, + {9, 0x02, 245}, + {23, 0x02, 245}, + {40, 0x03, 245}, + {2, 0x02, 246}, + {9, 0x02, 246}, + {23, 0x02, 246}, + {40, 0x03, 246}, + {2, 0x02, 247}, + {9, 0x02, 247}, + {23, 0x02, 247}, + {40, 0x03, 247}, + {2, 0x02, 248}, + {9, 0x02, 248}, + {23, 0x02, 248}, + {40, 0x03, 248}, + }, + /* 218 */ + { + {3, 0x02, 245}, + {6, 0x02, 245}, + {10, 0x02, 245}, + {15, 0x02, 245}, + {24, 0x02, 245}, + {31, 0x02, 245}, + {41, 0x02, 245}, + {56, 0x03, 245}, + {3, 0x02, 246}, + {6, 0x02, 246}, + {10, 0x02, 246}, + {15, 0x02, 246}, + {24, 0x02, 246}, + {31, 0x02, 246}, + {41, 0x02, 246}, + {56, 0x03, 246}, + }, + /* 219 */ + { + {3, 0x02, 247}, + {6, 0x02, 247}, + {10, 0x02, 247}, + {15, 0x02, 247}, + {24, 0x02, 247}, + {31, 0x02, 247}, + {41, 0x02, 247}, + {56, 0x03, 247}, + {3, 0x02, 248}, + {6, 0x02, 248}, + {10, 0x02, 248}, + {15, 0x02, 248}, + {24, 0x02, 248}, + {31, 0x02, 248}, + {41, 0x02, 248}, + {56, 0x03, 248}, + }, + /* 220 */ + { + {2, 0x02, 250}, + {9, 0x02, 250}, + {23, 0x02, 250}, + {40, 0x03, 250}, + {2, 0x02, 251}, + {9, 0x02, 251}, + {23, 0x02, 251}, + {40, 0x03, 251}, + {2, 0x02, 252}, + {9, 0x02, 252}, + {23, 0x02, 252}, + {40, 0x03, 252}, + {2, 0x02, 253}, + {9, 0x02, 253}, + {23, 0x02, 253}, + {40, 0x03, 253}, + }, + /* 221 */ + { + {3, 0x02, 250}, + {6, 0x02, 250}, + {10, 0x02, 250}, + {15, 0x02, 250}, + {24, 0x02, 250}, + {31, 0x02, 250}, + {41, 0x02, 250}, + {56, 0x03, 250}, + {3, 0x02, 251}, + {6, 0x02, 251}, + {10, 0x02, 251}, + {15, 0x02, 251}, + {24, 0x02, 251}, + {31, 0x02, 251}, + {41, 0x02, 251}, + {56, 0x03, 251}, + }, + /* 222 */ + { + {3, 0x02, 252}, + {6, 0x02, 252}, + {10, 0x02, 252}, + {15, 0x02, 252}, + {24, 0x02, 252}, + {31, 0x02, 252}, + {41, 0x02, 252}, + {56, 0x03, 252}, + {3, 0x02, 253}, + {6, 0x02, 253}, + {10, 0x02, 253}, + {15, 0x02, 253}, + {24, 0x02, 253}, + {31, 0x02, 253}, + {41, 0x02, 253}, + {56, 0x03, 253}, + }, + /* 223 */ + { + {0, 0x03, 254}, + {227, 0x00, 0}, + {229, 0x00, 0}, + {230, 0x00, 0}, + {233, 0x00, 0}, + {234, 0x00, 0}, + {236, 0x00, 0}, + {237, 0x00, 0}, + {241, 0x00, 0}, + {242, 0x00, 0}, + {244, 0x00, 0}, + {245, 0x00, 0}, + {248, 0x00, 0}, + {249, 0x00, 0}, + {251, 0x00, 0}, + {252, 0x00, 0}, + }, + /* 224 */ + { + {1, 0x02, 254}, + {22, 0x03, 254}, + {0, 0x03, 2}, + {0, 0x03, 3}, + {0, 0x03, 4}, + {0, 0x03, 5}, + {0, 0x03, 6}, + {0, 0x03, 7}, + {0, 0x03, 8}, + {0, 0x03, 11}, + {0, 0x03, 12}, + {0, 0x03, 14}, + {0, 0x03, 15}, + {0, 0x03, 16}, + {0, 0x03, 17}, + {0, 0x03, 18}, + }, + /* 225 */ + { + {2, 0x02, 254}, + {9, 0x02, 254}, + {23, 0x02, 254}, + {40, 0x03, 254}, + {1, 0x02, 2}, + {22, 0x03, 2}, + {1, 0x02, 3}, + {22, 0x03, 3}, + {1, 0x02, 4}, + {22, 0x03, 4}, + {1, 0x02, 5}, + {22, 0x03, 5}, + {1, 0x02, 6}, + {22, 0x03, 6}, + {1, 0x02, 7}, + {22, 0x03, 7}, + }, + /* 226 */ + { + {3, 0x02, 254}, + {6, 0x02, 254}, + {10, 0x02, 254}, + {15, 0x02, 254}, + {24, 0x02, 254}, + {31, 0x02, 254}, + {41, 0x02, 254}, + {56, 0x03, 254}, + {2, 0x02, 2}, + {9, 0x02, 2}, + {23, 0x02, 2}, + {40, 0x03, 2}, + {2, 0x02, 3}, + {9, 0x02, 3}, + {23, 0x02, 3}, + {40, 0x03, 3}, + }, + /* 227 */ + { + {3, 0x02, 2}, + {6, 0x02, 2}, + {10, 0x02, 2}, + {15, 0x02, 2}, + {24, 0x02, 2}, + {31, 0x02, 2}, + {41, 0x02, 2}, + {56, 0x03, 2}, + {3, 0x02, 3}, + {6, 0x02, 3}, + {10, 0x02, 3}, + {15, 0x02, 3}, + {24, 0x02, 3}, + {31, 0x02, 3}, + {41, 0x02, 3}, + {56, 0x03, 3}, + }, + /* 228 */ + { + {2, 0x02, 4}, + {9, 0x02, 4}, + {23, 0x02, 4}, + {40, 0x03, 4}, + {2, 0x02, 5}, + {9, 0x02, 5}, + {23, 0x02, 5}, + {40, 0x03, 5}, + {2, 0x02, 6}, + {9, 0x02, 6}, + {23, 0x02, 6}, + {40, 0x03, 6}, + {2, 0x02, 7}, + {9, 0x02, 7}, + {23, 0x02, 7}, + {40, 0x03, 7}, + }, + /* 229 */ + { + {3, 0x02, 4}, + {6, 0x02, 4}, + {10, 0x02, 4}, + {15, 0x02, 4}, + {24, 0x02, 4}, + {31, 0x02, 4}, + {41, 0x02, 4}, + {56, 0x03, 4}, + {3, 0x02, 5}, + {6, 0x02, 5}, + {10, 0x02, 5}, + {15, 0x02, 5}, + {24, 0x02, 5}, + {31, 0x02, 5}, + {41, 0x02, 5}, + {56, 0x03, 5}, + }, + /* 230 */ + { + {3, 0x02, 6}, + {6, 0x02, 6}, + {10, 0x02, 6}, + {15, 0x02, 6}, + {24, 0x02, 6}, + {31, 0x02, 6}, + {41, 0x02, 6}, + {56, 0x03, 6}, + {3, 0x02, 7}, + {6, 0x02, 7}, + {10, 0x02, 7}, + {15, 0x02, 7}, + {24, 0x02, 7}, + {31, 0x02, 7}, + {41, 0x02, 7}, + {56, 0x03, 7}, + }, + /* 231 */ + { + {1, 0x02, 8}, + {22, 0x03, 8}, + {1, 0x02, 11}, + {22, 0x03, 11}, + {1, 0x02, 12}, + {22, 0x03, 12}, + {1, 0x02, 14}, + {22, 0x03, 14}, + {1, 0x02, 15}, + {22, 0x03, 15}, + {1, 0x02, 16}, + {22, 0x03, 16}, + {1, 0x02, 17}, + {22, 0x03, 17}, + {1, 0x02, 18}, + {22, 0x03, 18}, + }, + /* 232 */ + { + {2, 0x02, 8}, + {9, 0x02, 8}, + {23, 0x02, 8}, + {40, 0x03, 8}, + {2, 0x02, 11}, + {9, 0x02, 11}, + {23, 0x02, 11}, + {40, 0x03, 11}, + {2, 0x02, 12}, + {9, 0x02, 12}, + {23, 0x02, 12}, + {40, 0x03, 12}, + {2, 0x02, 14}, + {9, 0x02, 14}, + {23, 0x02, 14}, + {40, 0x03, 14}, + }, + /* 233 */ + { + {3, 0x02, 8}, + {6, 0x02, 8}, + {10, 0x02, 8}, + {15, 0x02, 8}, + {24, 0x02, 8}, + {31, 0x02, 8}, + {41, 0x02, 8}, + {56, 0x03, 8}, + {3, 0x02, 11}, + {6, 0x02, 11}, + {10, 0x02, 11}, + {15, 0x02, 11}, + {24, 0x02, 11}, + {31, 0x02, 11}, + {41, 0x02, 11}, + {56, 0x03, 11}, + }, + /* 234 */ + { + {3, 0x02, 12}, + {6, 0x02, 12}, + {10, 0x02, 12}, + {15, 0x02, 12}, + {24, 0x02, 12}, + {31, 0x02, 12}, + {41, 0x02, 12}, + {56, 0x03, 12}, + {3, 0x02, 14}, + {6, 0x02, 14}, + {10, 0x02, 14}, + {15, 0x02, 14}, + {24, 0x02, 14}, + {31, 0x02, 14}, + {41, 0x02, 14}, + {56, 0x03, 14}, + }, + /* 235 */ + { + {2, 0x02, 15}, + {9, 0x02, 15}, + {23, 0x02, 15}, + {40, 0x03, 15}, + {2, 0x02, 16}, + {9, 0x02, 16}, + {23, 0x02, 16}, + {40, 0x03, 16}, + {2, 0x02, 17}, + {9, 0x02, 17}, + {23, 0x02, 17}, + {40, 0x03, 17}, + {2, 0x02, 18}, + {9, 0x02, 18}, + {23, 0x02, 18}, + {40, 0x03, 18}, + }, + /* 236 */ + { + {3, 0x02, 15}, + {6, 0x02, 15}, + {10, 0x02, 15}, + {15, 0x02, 15}, + {24, 0x02, 15}, + {31, 0x02, 15}, + {41, 0x02, 15}, + {56, 0x03, 15}, + {3, 0x02, 16}, + {6, 0x02, 16}, + {10, 0x02, 16}, + {15, 0x02, 16}, + {24, 0x02, 16}, + {31, 0x02, 16}, + {41, 0x02, 16}, + {56, 0x03, 16}, + }, + /* 237 */ + { + {3, 0x02, 17}, + {6, 0x02, 17}, + {10, 0x02, 17}, + {15, 0x02, 17}, + {24, 0x02, 17}, + {31, 0x02, 17}, + {41, 0x02, 17}, + {56, 0x03, 17}, + {3, 0x02, 18}, + {6, 0x02, 18}, + {10, 0x02, 18}, + {15, 0x02, 18}, + {24, 0x02, 18}, + {31, 0x02, 18}, + {41, 0x02, 18}, + {56, 0x03, 18}, + }, + /* 238 */ + { + {0, 0x03, 19}, + {0, 0x03, 20}, + {0, 0x03, 21}, + {0, 0x03, 23}, + {0, 0x03, 24}, + {0, 0x03, 25}, + {0, 0x03, 26}, + {0, 0x03, 27}, + {0, 0x03, 28}, + {0, 0x03, 29}, + {0, 0x03, 30}, + {0, 0x03, 31}, + {0, 0x03, 127}, + {0, 0x03, 220}, + {0, 0x03, 249}, + {253, 0x00, 0}, + }, + /* 239 */ + { + {1, 0x02, 19}, + {22, 0x03, 19}, + {1, 0x02, 20}, + {22, 0x03, 20}, + {1, 0x02, 21}, + {22, 0x03, 21}, + {1, 0x02, 23}, + {22, 0x03, 23}, + {1, 0x02, 24}, + {22, 0x03, 24}, + {1, 0x02, 25}, + {22, 0x03, 25}, + {1, 0x02, 26}, + {22, 0x03, 26}, + {1, 0x02, 27}, + {22, 0x03, 27}, + }, + /* 240 */ + { + {2, 0x02, 19}, + {9, 0x02, 19}, + {23, 0x02, 19}, + {40, 0x03, 19}, + {2, 0x02, 20}, + {9, 0x02, 20}, + {23, 0x02, 20}, + {40, 0x03, 20}, + {2, 0x02, 21}, + {9, 0x02, 21}, + {23, 0x02, 21}, + {40, 0x03, 21}, + {2, 0x02, 23}, + {9, 0x02, 23}, + {23, 0x02, 23}, + {40, 0x03, 23}, + }, + /* 241 */ + { + {3, 0x02, 19}, + {6, 0x02, 19}, + {10, 0x02, 19}, + {15, 0x02, 19}, + {24, 0x02, 19}, + {31, 0x02, 19}, + {41, 0x02, 19}, + {56, 0x03, 19}, + {3, 0x02, 20}, + {6, 0x02, 20}, + {10, 0x02, 20}, + {15, 0x02, 20}, + {24, 0x02, 20}, + {31, 0x02, 20}, + {41, 0x02, 20}, + {56, 0x03, 20}, + }, + /* 242 */ + { + {3, 0x02, 21}, + {6, 0x02, 21}, + {10, 0x02, 21}, + {15, 0x02, 21}, + {24, 0x02, 21}, + {31, 0x02, 21}, + {41, 0x02, 21}, + {56, 0x03, 21}, + {3, 0x02, 23}, + {6, 0x02, 23}, + {10, 0x02, 23}, + {15, 0x02, 23}, + {24, 0x02, 23}, + {31, 0x02, 23}, + {41, 0x02, 23}, + {56, 0x03, 23}, + }, + /* 243 */ + { + {2, 0x02, 24}, + {9, 0x02, 24}, + {23, 0x02, 24}, + {40, 0x03, 24}, + {2, 0x02, 25}, + {9, 0x02, 25}, + {23, 0x02, 25}, + {40, 0x03, 25}, + {2, 0x02, 26}, + {9, 0x02, 26}, + {23, 0x02, 26}, + {40, 0x03, 26}, + {2, 0x02, 27}, + {9, 0x02, 27}, + {23, 0x02, 27}, + {40, 0x03, 27}, + }, + /* 244 */ + { + {3, 0x02, 24}, + {6, 0x02, 24}, + {10, 0x02, 24}, + {15, 0x02, 24}, + {24, 0x02, 24}, + {31, 0x02, 24}, + {41, 0x02, 24}, + {56, 0x03, 24}, + {3, 0x02, 25}, + {6, 0x02, 25}, + {10, 0x02, 25}, + {15, 0x02, 25}, + {24, 0x02, 25}, + {31, 0x02, 25}, + {41, 0x02, 25}, + {56, 0x03, 25}, + }, + /* 245 */ + { + {3, 0x02, 26}, + {6, 0x02, 26}, + {10, 0x02, 26}, + {15, 0x02, 26}, + {24, 0x02, 26}, + {31, 0x02, 26}, + {41, 0x02, 26}, + {56, 0x03, 26}, + {3, 0x02, 27}, + {6, 0x02, 27}, + {10, 0x02, 27}, + {15, 0x02, 27}, + {24, 0x02, 27}, + {31, 0x02, 27}, + {41, 0x02, 27}, + {56, 0x03, 27}, + }, + /* 246 */ + { + {1, 0x02, 28}, + {22, 0x03, 28}, + {1, 0x02, 29}, + {22, 0x03, 29}, + {1, 0x02, 30}, + {22, 0x03, 30}, + {1, 0x02, 31}, + {22, 0x03, 31}, + {1, 0x02, 127}, + {22, 0x03, 127}, + {1, 0x02, 220}, + {22, 0x03, 220}, + {1, 0x02, 249}, + {22, 0x03, 249}, + {254, 0x00, 0}, + {255, 0x00, 0}, + }, + /* 247 */ + { + {2, 0x02, 28}, + {9, 0x02, 28}, + {23, 0x02, 28}, + {40, 0x03, 28}, + {2, 0x02, 29}, + {9, 0x02, 29}, + {23, 0x02, 29}, + {40, 0x03, 29}, + {2, 0x02, 30}, + {9, 0x02, 30}, + {23, 0x02, 30}, + {40, 0x03, 30}, + {2, 0x02, 31}, + {9, 0x02, 31}, + {23, 0x02, 31}, + {40, 0x03, 31}, + }, + /* 248 */ + { + {3, 0x02, 28}, + {6, 0x02, 28}, + {10, 0x02, 28}, + {15, 0x02, 28}, + {24, 0x02, 28}, + {31, 0x02, 28}, + {41, 0x02, 28}, + {56, 0x03, 28}, + {3, 0x02, 29}, + {6, 0x02, 29}, + {10, 0x02, 29}, + {15, 0x02, 29}, + {24, 0x02, 29}, + {31, 0x02, 29}, + {41, 0x02, 29}, + {56, 0x03, 29}, + }, + /* 249 */ + { + {3, 0x02, 30}, + {6, 0x02, 30}, + {10, 0x02, 30}, + {15, 0x02, 30}, + {24, 0x02, 30}, + {31, 0x02, 30}, + {41, 0x02, 30}, + {56, 0x03, 30}, + {3, 0x02, 31}, + {6, 0x02, 31}, + {10, 0x02, 31}, + {15, 0x02, 31}, + {24, 0x02, 31}, + {31, 0x02, 31}, + {41, 0x02, 31}, + {56, 0x03, 31}, + }, + /* 250 */ + { + {2, 0x02, 127}, + {9, 0x02, 127}, + {23, 0x02, 127}, + {40, 0x03, 127}, + {2, 0x02, 220}, + {9, 0x02, 220}, + {23, 0x02, 220}, + {40, 0x03, 220}, + {2, 0x02, 249}, + {9, 0x02, 249}, + {23, 0x02, 249}, + {40, 0x03, 249}, + {0, 0x03, 10}, + {0, 0x03, 13}, + {0, 0x03, 22}, + {0, 0x04, 0}, + }, + /* 251 */ + { + {3, 0x02, 127}, + {6, 0x02, 127}, + {10, 0x02, 127}, + {15, 0x02, 127}, + {24, 0x02, 127}, + {31, 0x02, 127}, + {41, 0x02, 127}, + {56, 0x03, 127}, + {3, 0x02, 220}, + {6, 0x02, 220}, + {10, 0x02, 220}, + {15, 0x02, 220}, + {24, 0x02, 220}, + {31, 0x02, 220}, + {41, 0x02, 220}, + {56, 0x03, 220}, + }, + /* 252 */ + { + {3, 0x02, 249}, + {6, 0x02, 249}, + {10, 0x02, 249}, + {15, 0x02, 249}, + {24, 0x02, 249}, + {31, 0x02, 249}, + {41, 0x02, 249}, + {56, 0x03, 249}, + {1, 0x02, 10}, + {22, 0x03, 10}, + {1, 0x02, 13}, + {22, 0x03, 13}, + {1, 0x02, 22}, + {22, 0x03, 22}, + {0, 0x04, 0}, + {0, 0x04, 0}, + }, + /* 253 */ + { + {2, 0x02, 10}, + {9, 0x02, 10}, + {23, 0x02, 10}, + {40, 0x03, 10}, + {2, 0x02, 13}, + {9, 0x02, 13}, + {23, 0x02, 13}, + {40, 0x03, 13}, + {2, 0x02, 22}, + {9, 0x02, 22}, + {23, 0x02, 22}, + {40, 0x03, 22}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + }, + /* 254 */ + { + {3, 0x02, 10}, + {6, 0x02, 10}, + {10, 0x02, 10}, + {15, 0x02, 10}, + {24, 0x02, 10}, + {31, 0x02, 10}, + {41, 0x02, 10}, + {56, 0x03, 10}, + {3, 0x02, 13}, + {6, 0x02, 13}, + {10, 0x02, 13}, + {15, 0x02, 13}, + {24, 0x02, 13}, + {31, 0x02, 13}, + {41, 0x02, 13}, + {56, 0x03, 13}, + }, + /* 255 */ + { + {3, 0x02, 22}, + {6, 0x02, 22}, + {10, 0x02, 22}, + {15, 0x02, 22}, + {24, 0x02, 22}, + {31, 0x02, 22}, + {41, 0x02, 22}, + {56, 0x03, 22}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + {0, 0x04, 0}, + }, +}; diff --git a/components/nghttp/library/nghttp2_helper.c b/components/nghttp/library/nghttp2_helper.c new file mode 100644 index 0000000000..e133d0b035 --- /dev/null +++ b/components/nghttp/library/nghttp2_helper.c @@ -0,0 +1,520 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_helper.h" + +#include +#include + +#include "nghttp2_net.h" + +void nghttp2_put_uint16be(uint8_t *buf, uint16_t n) { + uint16_t x = htons(n); + memcpy(buf, &x, sizeof(uint16_t)); +} + +void nghttp2_put_uint32be(uint8_t *buf, uint32_t n) { + uint32_t x = htonl(n); + memcpy(buf, &x, sizeof(uint32_t)); +} + +uint16_t nghttp2_get_uint16(const uint8_t *data) { + uint16_t n; + memcpy(&n, data, sizeof(uint16_t)); + return ntohs(n); +} + +uint32_t nghttp2_get_uint32(const uint8_t *data) { + uint32_t n; + memcpy(&n, data, sizeof(uint32_t)); + return ntohl(n); +} + +/* Generated by gendowncasetbl.py */ +static const uint8_t DOWNCASE_TBL[] = { + 0 /* NUL */, 1 /* SOH */, 2 /* STX */, 3 /* ETX */, + 4 /* EOT */, 5 /* ENQ */, 6 /* ACK */, 7 /* BEL */, + 8 /* BS */, 9 /* HT */, 10 /* LF */, 11 /* VT */, + 12 /* FF */, 13 /* CR */, 14 /* SO */, 15 /* SI */, + 16 /* DLE */, 17 /* DC1 */, 18 /* DC2 */, 19 /* DC3 */, + 20 /* DC4 */, 21 /* NAK */, 22 /* SYN */, 23 /* ETB */, + 24 /* CAN */, 25 /* EM */, 26 /* SUB */, 27 /* ESC */, + 28 /* FS */, 29 /* GS */, 30 /* RS */, 31 /* US */, + 32 /* SPC */, 33 /* ! */, 34 /* " */, 35 /* # */, + 36 /* $ */, 37 /* % */, 38 /* & */, 39 /* ' */, + 40 /* ( */, 41 /* ) */, 42 /* * */, 43 /* + */, + 44 /* , */, 45 /* - */, 46 /* . */, 47 /* / */, + 48 /* 0 */, 49 /* 1 */, 50 /* 2 */, 51 /* 3 */, + 52 /* 4 */, 53 /* 5 */, 54 /* 6 */, 55 /* 7 */, + 56 /* 8 */, 57 /* 9 */, 58 /* : */, 59 /* ; */, + 60 /* < */, 61 /* = */, 62 /* > */, 63 /* ? */, + 64 /* @ */, 97 /* A */, 98 /* B */, 99 /* C */, + 100 /* D */, 101 /* E */, 102 /* F */, 103 /* G */, + 104 /* H */, 105 /* I */, 106 /* J */, 107 /* K */, + 108 /* L */, 109 /* M */, 110 /* N */, 111 /* O */, + 112 /* P */, 113 /* Q */, 114 /* R */, 115 /* S */, + 116 /* T */, 117 /* U */, 118 /* V */, 119 /* W */, + 120 /* X */, 121 /* Y */, 122 /* Z */, 91 /* [ */, + 92 /* \ */, 93 /* ] */, 94 /* ^ */, 95 /* _ */, + 96 /* ` */, 97 /* a */, 98 /* b */, 99 /* c */, + 100 /* d */, 101 /* e */, 102 /* f */, 103 /* g */, + 104 /* h */, 105 /* i */, 106 /* j */, 107 /* k */, + 108 /* l */, 109 /* m */, 110 /* n */, 111 /* o */, + 112 /* p */, 113 /* q */, 114 /* r */, 115 /* s */, + 116 /* t */, 117 /* u */, 118 /* v */, 119 /* w */, + 120 /* x */, 121 /* y */, 122 /* z */, 123 /* { */, + 124 /* | */, 125 /* } */, 126 /* ~ */, 127 /* DEL */, + 128 /* 0x80 */, 129 /* 0x81 */, 130 /* 0x82 */, 131 /* 0x83 */, + 132 /* 0x84 */, 133 /* 0x85 */, 134 /* 0x86 */, 135 /* 0x87 */, + 136 /* 0x88 */, 137 /* 0x89 */, 138 /* 0x8a */, 139 /* 0x8b */, + 140 /* 0x8c */, 141 /* 0x8d */, 142 /* 0x8e */, 143 /* 0x8f */, + 144 /* 0x90 */, 145 /* 0x91 */, 146 /* 0x92 */, 147 /* 0x93 */, + 148 /* 0x94 */, 149 /* 0x95 */, 150 /* 0x96 */, 151 /* 0x97 */, + 152 /* 0x98 */, 153 /* 0x99 */, 154 /* 0x9a */, 155 /* 0x9b */, + 156 /* 0x9c */, 157 /* 0x9d */, 158 /* 0x9e */, 159 /* 0x9f */, + 160 /* 0xa0 */, 161 /* 0xa1 */, 162 /* 0xa2 */, 163 /* 0xa3 */, + 164 /* 0xa4 */, 165 /* 0xa5 */, 166 /* 0xa6 */, 167 /* 0xa7 */, + 168 /* 0xa8 */, 169 /* 0xa9 */, 170 /* 0xaa */, 171 /* 0xab */, + 172 /* 0xac */, 173 /* 0xad */, 174 /* 0xae */, 175 /* 0xaf */, + 176 /* 0xb0 */, 177 /* 0xb1 */, 178 /* 0xb2 */, 179 /* 0xb3 */, + 180 /* 0xb4 */, 181 /* 0xb5 */, 182 /* 0xb6 */, 183 /* 0xb7 */, + 184 /* 0xb8 */, 185 /* 0xb9 */, 186 /* 0xba */, 187 /* 0xbb */, + 188 /* 0xbc */, 189 /* 0xbd */, 190 /* 0xbe */, 191 /* 0xbf */, + 192 /* 0xc0 */, 193 /* 0xc1 */, 194 /* 0xc2 */, 195 /* 0xc3 */, + 196 /* 0xc4 */, 197 /* 0xc5 */, 198 /* 0xc6 */, 199 /* 0xc7 */, + 200 /* 0xc8 */, 201 /* 0xc9 */, 202 /* 0xca */, 203 /* 0xcb */, + 204 /* 0xcc */, 205 /* 0xcd */, 206 /* 0xce */, 207 /* 0xcf */, + 208 /* 0xd0 */, 209 /* 0xd1 */, 210 /* 0xd2 */, 211 /* 0xd3 */, + 212 /* 0xd4 */, 213 /* 0xd5 */, 214 /* 0xd6 */, 215 /* 0xd7 */, + 216 /* 0xd8 */, 217 /* 0xd9 */, 218 /* 0xda */, 219 /* 0xdb */, + 220 /* 0xdc */, 221 /* 0xdd */, 222 /* 0xde */, 223 /* 0xdf */, + 224 /* 0xe0 */, 225 /* 0xe1 */, 226 /* 0xe2 */, 227 /* 0xe3 */, + 228 /* 0xe4 */, 229 /* 0xe5 */, 230 /* 0xe6 */, 231 /* 0xe7 */, + 232 /* 0xe8 */, 233 /* 0xe9 */, 234 /* 0xea */, 235 /* 0xeb */, + 236 /* 0xec */, 237 /* 0xed */, 238 /* 0xee */, 239 /* 0xef */, + 240 /* 0xf0 */, 241 /* 0xf1 */, 242 /* 0xf2 */, 243 /* 0xf3 */, + 244 /* 0xf4 */, 245 /* 0xf5 */, 246 /* 0xf6 */, 247 /* 0xf7 */, + 248 /* 0xf8 */, 249 /* 0xf9 */, 250 /* 0xfa */, 251 /* 0xfb */, + 252 /* 0xfc */, 253 /* 0xfd */, 254 /* 0xfe */, 255 /* 0xff */, +}; + +void nghttp2_downcase(uint8_t *s, size_t len) { + size_t i; + for (i = 0; i < len; ++i) { + s[i] = DOWNCASE_TBL[s[i]]; + } +} + +/* + * local_window_size + * ^ * + * | * recv_window_size + * | * * ^ + * | * * | + * 0+++++++++ + * | * * \ + * | * * | This rage is hidden in flow control. But it must be + * v * * / kept in order to restore it when window size is enlarged. + * recv_reduction + * (+ for negative direction) + * + * recv_window_size could be negative if we decrease + * local_window_size more than recv_window_size: + * + * local_window_size + * ^ * + * | * + * | * + * 0++++++++ + * | * ^ recv_window_size (negative) + * | * | + * v * * + * recv_reduction + */ +int nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr) { + if (*delta_ptr > 0) { + int32_t recv_reduction_delta; + int32_t delta; + int32_t new_recv_window_size = + nghttp2_max(0, *recv_window_size_ptr) - *delta_ptr; + + if (new_recv_window_size >= 0) { + *recv_window_size_ptr = new_recv_window_size; + return 0; + } + + delta = -new_recv_window_size; + + /* The delta size is strictly more than received bytes. Increase + local_window_size by that difference |delta|. */ + if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + *local_window_size_ptr += delta; + /* If there is recv_reduction due to earlier window_size + reduction, we have to adjust it too. */ + recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta); + *recv_reduction_ptr -= recv_reduction_delta; + if (*recv_window_size_ptr < 0) { + *recv_window_size_ptr += recv_reduction_delta; + } else { + /* If *recv_window_size_ptr > 0, then those bytes are going to + be returned to the remote peer (by WINDOW_UPDATE with the + adjusted *delta_ptr), so it is effectively 0 now. We set to + *recv_reduction_delta, because caller does not take into + account it in *delta_ptr. */ + *recv_window_size_ptr = recv_reduction_delta; + } + /* recv_reduction_delta must be paied from *delta_ptr, since it + was added in window size reduction (see below). */ + *delta_ptr -= recv_reduction_delta; + + return 0; + } + + if (*local_window_size_ptr + *delta_ptr < 0 || + *recv_window_size_ptr < INT32_MIN - *delta_ptr || + *recv_reduction_ptr > INT32_MAX + *delta_ptr) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + /* Decreasing local window size. Note that we achieve this without + noticing to the remote peer. To do this, we cut + recv_window_size by -delta. This means that we don't send + WINDOW_UPDATE for -delta bytes. */ + *local_window_size_ptr += *delta_ptr; + *recv_window_size_ptr += *delta_ptr; + *recv_reduction_ptr -= *delta_ptr; + *delta_ptr = 0; + + return 0; +} + +int nghttp2_increase_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr) { + int32_t recv_reduction_delta; + int32_t delta; + + delta = *delta_ptr; + + assert(delta >= 0); + + /* The delta size is strictly more than received bytes. Increase + local_window_size by that difference |delta|. */ + if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + + *local_window_size_ptr += delta; + /* If there is recv_reduction due to earlier window_size + reduction, we have to adjust it too. */ + recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta); + *recv_reduction_ptr -= recv_reduction_delta; + + *recv_window_size_ptr += recv_reduction_delta; + + /* recv_reduction_delta must be paied from *delta_ptr, since it was + added in window size reduction (see below). */ + *delta_ptr -= recv_reduction_delta; + + return 0; +} + +int nghttp2_should_send_window_update(int32_t local_window_size, + int32_t recv_window_size) { + return recv_window_size > 0 && recv_window_size >= local_window_size / 2; +} + +const char *nghttp2_strerror(int error_code) { + switch (error_code) { + case 0: + return "Success"; + case NGHTTP2_ERR_INVALID_ARGUMENT: + return "Invalid argument"; + case NGHTTP2_ERR_BUFFER_ERROR: + return "Out of buffer space"; + case NGHTTP2_ERR_UNSUPPORTED_VERSION: + return "Unsupported SPDY version"; + case NGHTTP2_ERR_WOULDBLOCK: + return "Operation would block"; + case NGHTTP2_ERR_PROTO: + return "Protocol error"; + case NGHTTP2_ERR_INVALID_FRAME: + return "Invalid frame octets"; + case NGHTTP2_ERR_EOF: + return "EOF"; + case NGHTTP2_ERR_DEFERRED: + return "Data transfer deferred"; + case NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE: + return "No more Stream ID available"; + case NGHTTP2_ERR_STREAM_CLOSED: + return "Stream was already closed or invalid"; + case NGHTTP2_ERR_STREAM_CLOSING: + return "Stream is closing"; + case NGHTTP2_ERR_STREAM_SHUT_WR: + return "The transmission is not allowed for this stream"; + case NGHTTP2_ERR_INVALID_STREAM_ID: + return "Stream ID is invalid"; + case NGHTTP2_ERR_INVALID_STREAM_STATE: + return "Invalid stream state"; + case NGHTTP2_ERR_DEFERRED_DATA_EXIST: + return "Another DATA frame has already been deferred"; + case NGHTTP2_ERR_START_STREAM_NOT_ALLOWED: + return "request HEADERS is not allowed"; + case NGHTTP2_ERR_GOAWAY_ALREADY_SENT: + return "GOAWAY has already been sent"; + case NGHTTP2_ERR_INVALID_HEADER_BLOCK: + return "Invalid header block"; + case NGHTTP2_ERR_INVALID_STATE: + return "Invalid state"; + case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE: + return "The user callback function failed due to the temporal error"; + case NGHTTP2_ERR_FRAME_SIZE_ERROR: + return "The length of the frame is invalid"; + case NGHTTP2_ERR_HEADER_COMP: + return "Header compression/decompression error"; + case NGHTTP2_ERR_FLOW_CONTROL: + return "Flow control error"; + case NGHTTP2_ERR_INSUFF_BUFSIZE: + return "Insufficient buffer size given to function"; + case NGHTTP2_ERR_PAUSE: + return "Callback was paused by the application"; + case NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS: + return "Too many inflight SETTINGS"; + case NGHTTP2_ERR_PUSH_DISABLED: + return "Server push is disabled by peer"; + case NGHTTP2_ERR_DATA_EXIST: + return "DATA or HEADERS frame has already been submitted for the stream"; + case NGHTTP2_ERR_SESSION_CLOSING: + return "The current session is closing"; + case NGHTTP2_ERR_HTTP_HEADER: + return "Invalid HTTP header field was received"; + case NGHTTP2_ERR_HTTP_MESSAGING: + return "Violation in HTTP messaging rule"; + case NGHTTP2_ERR_REFUSED_STREAM: + return "Stream was refused"; + case NGHTTP2_ERR_INTERNAL: + return "Internal error"; + case NGHTTP2_ERR_CANCEL: + return "Cancel"; + case NGHTTP2_ERR_NOMEM: + return "Out of memory"; + case NGHTTP2_ERR_CALLBACK_FAILURE: + return "The user callback function failed"; + case NGHTTP2_ERR_BAD_CLIENT_MAGIC: + return "Received bad client magic byte string"; + case NGHTTP2_ERR_FLOODED: + return "Flooding was detected in this HTTP/2 session, and it must be " + "closed"; + default: + return "Unknown error code"; + } +} + +/* Generated by gennmchartbl.py */ +static int VALID_HD_NAME_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */, + 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 0 /* HT */, + 0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */, + 0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */, + 0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */, + 0 /* RS */, 0 /* US */, 0 /* SPC */, 1 /* ! */, 0 /* " */, + 1 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 0 /* ( */, 0 /* ) */, 1 /* * */, 1 /* + */, 0 /* , */, + 1 /* - */, 1 /* . */, 0 /* / */, 1 /* 0 */, 1 /* 1 */, + 1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, + 1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 0 /* : */, 0 /* ; */, + 0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, 0 /* @ */, + 0 /* A */, 0 /* B */, 0 /* C */, 0 /* D */, 0 /* E */, + 0 /* F */, 0 /* G */, 0 /* H */, 0 /* I */, 0 /* J */, + 0 /* K */, 0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */, + 0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */, 0 /* T */, + 0 /* U */, 0 /* V */, 0 /* W */, 0 /* X */, 0 /* Y */, + 0 /* Z */, 0 /* [ */, 0 /* \ */, 0 /* ] */, 1 /* ^ */, + 1 /* _ */, 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */, + 1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */, + 1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */, + 1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, 1 /* | */, + 0 /* } */, 1 /* ~ */, 0 /* DEL */, 0 /* 0x80 */, 0 /* 0x81 */, + 0 /* 0x82 */, 0 /* 0x83 */, 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, + 0 /* 0x87 */, 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, 0 /* 0x90 */, + 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, 0 /* 0x94 */, 0 /* 0x95 */, + 0 /* 0x96 */, 0 /* 0x97 */, 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, + 0 /* 0x9b */, 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, 0 /* 0xa4 */, + 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, 0 /* 0xa8 */, 0 /* 0xa9 */, + 0 /* 0xaa */, 0 /* 0xab */, 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, + 0 /* 0xaf */, 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, 0 /* 0xb8 */, + 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, 0 /* 0xbc */, 0 /* 0xbd */, + 0 /* 0xbe */, 0 /* 0xbf */, 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, + 0 /* 0xc3 */, 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, 0 /* 0xcc */, + 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, 0 /* 0xd0 */, 0 /* 0xd1 */, + 0 /* 0xd2 */, 0 /* 0xd3 */, 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, + 0 /* 0xd7 */, 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, 0 /* 0xe0 */, + 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, 0 /* 0xe4 */, 0 /* 0xe5 */, + 0 /* 0xe6 */, 0 /* 0xe7 */, 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, + 0 /* 0xeb */, 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, 0 /* 0xf4 */, + 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, 0 /* 0xf8 */, 0 /* 0xf9 */, + 0 /* 0xfa */, 0 /* 0xfb */, 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, + 0 /* 0xff */ +}; + +int nghttp2_check_header_name(const uint8_t *name, size_t len) { + const uint8_t *last; + if (len == 0) { + return 0; + } + if (*name == ':') { + if (len == 1) { + return 0; + } + ++name; + --len; + } + for (last = name + len; name != last; ++name) { + if (!VALID_HD_NAME_CHARS[*name]) { + return 0; + } + } + return 1; +} + +/* Generated by genvchartbl.py */ +static int VALID_HD_VALUE_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */, + 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 1 /* HT */, + 0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */, + 0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */, + 0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */, + 0 /* RS */, 0 /* US */, 1 /* SPC */, 1 /* ! */, 1 /* " */, + 1 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, 1 /* , */, + 1 /* - */, 1 /* . */, 1 /* / */, 1 /* 0 */, 1 /* 1 */, + 1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, + 1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 1 /* < */, 1 /* = */, 1 /* > */, 1 /* ? */, 1 /* @ */, + 1 /* A */, 1 /* B */, 1 /* C */, 1 /* D */, 1 /* E */, + 1 /* F */, 1 /* G */, 1 /* H */, 1 /* I */, 1 /* J */, + 1 /* K */, 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, 1 /* T */, + 1 /* U */, 1 /* V */, 1 /* W */, 1 /* X */, 1 /* Y */, + 1 /* Z */, 1 /* [ */, 1 /* \ */, 1 /* ] */, 1 /* ^ */, + 1 /* _ */, 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */, + 1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */, + 1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */, + 1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 1 /* { */, 1 /* | */, + 1 /* } */, 1 /* ~ */, 0 /* DEL */, 1 /* 0x80 */, 1 /* 0x81 */, + 1 /* 0x82 */, 1 /* 0x83 */, 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, + 1 /* 0x87 */, 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */, + 1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, 1 /* 0x90 */, + 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, 1 /* 0x94 */, 1 /* 0x95 */, + 1 /* 0x96 */, 1 /* 0x97 */, 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, + 1 /* 0x9b */, 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */, + 1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, 1 /* 0xa4 */, + 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, 1 /* 0xa8 */, 1 /* 0xa9 */, + 1 /* 0xaa */, 1 /* 0xab */, 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, + 1 /* 0xaf */, 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */, + 1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, 1 /* 0xb8 */, + 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, 1 /* 0xbc */, 1 /* 0xbd */, + 1 /* 0xbe */, 1 /* 0xbf */, 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, + 1 /* 0xc3 */, 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */, + 1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, 1 /* 0xcc */, + 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, 1 /* 0xd0 */, 1 /* 0xd1 */, + 1 /* 0xd2 */, 1 /* 0xd3 */, 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, + 1 /* 0xd7 */, 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */, + 1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, 1 /* 0xe0 */, + 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, 1 /* 0xe4 */, 1 /* 0xe5 */, + 1 /* 0xe6 */, 1 /* 0xe7 */, 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, + 1 /* 0xeb */, 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */, + 1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, 1 /* 0xf4 */, + 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, 1 /* 0xf8 */, 1 /* 0xf9 */, + 1 /* 0xfa */, 1 /* 0xfb */, 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, + 1 /* 0xff */ +}; + +int nghttp2_check_header_value(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_HD_VALUE_CHARS[*value]) { + return 0; + } + } + return 1; +} + +uint8_t *nghttp2_cpymem(uint8_t *dest, const void *src, size_t len) { + memcpy(dest, src, len); + + return dest + len; +} + +const char *nghttp2_http2_strerror(uint32_t error_code) { + switch (error_code) { + case NGHTTP2_NO_ERROR: + return "NO_ERROR"; + case NGHTTP2_PROTOCOL_ERROR: + return "PROTOCOL_ERROR"; + case NGHTTP2_INTERNAL_ERROR: + return "INTERNAL_ERROR"; + case NGHTTP2_FLOW_CONTROL_ERROR: + return "FLOW_CONTROL_ERROR"; + case NGHTTP2_SETTINGS_TIMEOUT: + return "SETTINGS_TIMEOUT"; + case NGHTTP2_STREAM_CLOSED: + return "STREAM_CLOSED"; + case NGHTTP2_FRAME_SIZE_ERROR: + return "FRAME_SIZE_ERROR"; + case NGHTTP2_REFUSED_STREAM: + return "REFUSED_STREAM"; + case NGHTTP2_CANCEL: + return "CANCEL"; + case NGHTTP2_COMPRESSION_ERROR: + return "COMPRESSION_ERROR"; + case NGHTTP2_CONNECT_ERROR: + return "CONNECT_ERROR"; + case NGHTTP2_ENHANCE_YOUR_CALM: + return "ENHANCE_YOUR_CALM"; + case NGHTTP2_INADEQUATE_SECURITY: + return "INADEQUATE_SECURITY"; + case NGHTTP2_HTTP_1_1_REQUIRED: + return "HTTP_1_1_REQUIRED"; + default: + return "unknown"; + } +} diff --git a/components/nghttp/library/nghttp2_http.c b/components/nghttp/library/nghttp2_http.c new file mode 100644 index 0000000000..f993c16767 --- /dev/null +++ b/components/nghttp/library/nghttp2_http.c @@ -0,0 +1,563 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2015 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_http.h" + +#include +#include +#include + +#include "nghttp2_hd.h" +#include "nghttp2_helper.h" + +static uint8_t downcase(uint8_t c) { + return 'A' <= c && c <= 'Z' ? (uint8_t)(c - 'A' + 'a') : c; +} + +static int memieq(const void *a, const void *b, size_t n) { + size_t i; + const uint8_t *aa = a, *bb = b; + + for (i = 0; i < n; ++i) { + if (downcase(aa[i]) != downcase(bb[i])) { + return 0; + } + } + return 1; +} + +#define lstrieq(A, B, N) ((sizeof((A)) - 1) == (N) && memieq((A), (B), (N))) + +static int64_t parse_uint(const uint8_t *s, size_t len) { + int64_t n = 0; + size_t i; + if (len == 0) { + return -1; + } + for (i = 0; i < len; ++i) { + if ('0' <= s[i] && s[i] <= '9') { + if (n > INT64_MAX / 10) { + return -1; + } + n *= 10; + if (n > INT64_MAX - (s[i] - '0')) { + return -1; + } + n += s[i] - '0'; + continue; + } + return -1; + } + return n; +} + +static int lws(const uint8_t *s, size_t n) { + size_t i; + for (i = 0; i < n; ++i) { + if (s[i] != ' ' && s[i] != '\t') { + return 0; + } + } + return 1; +} + +static int check_pseudo_header(nghttp2_stream *stream, const nghttp2_hd_nv *nv, + int flag) { + if (stream->http_flags & flag) { + return 0; + } + if (lws(nv->value->base, nv->value->len)) { + return 0; + } + stream->http_flags = (uint16_t)(stream->http_flags | flag); + return 1; +} + +static int expect_response_body(nghttp2_stream *stream) { + return (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_HEAD) == 0 && + stream->status_code / 100 != 1 && stream->status_code != 304 && + stream->status_code != 204; +} + +/* For "http" or "https" URIs, OPTIONS request may have "*" in :path + header field to represent system-wide OPTIONS request. Otherwise, + :path header field value must start with "/". This function must + be called after ":method" header field was received. This function + returns nonzero if path is valid.*/ +static int check_path(nghttp2_stream *stream) { + return (stream->http_flags & NGHTTP2_HTTP_FLAG_SCHEME_HTTP) == 0 || + ((stream->http_flags & NGHTTP2_HTTP_FLAG_PATH_REGULAR) || + ((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_OPTIONS) && + (stream->http_flags & NGHTTP2_HTTP_FLAG_PATH_ASTERISK))); +} + +static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, + int trailer) { + if (nv->name->base[0] == ':') { + if (trailer || + (stream->http_flags & NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + + switch (nv->token) { + case NGHTTP2_TOKEN__AUTHORITY: + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__AUTHORITY)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + case NGHTTP2_TOKEN__METHOD: + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__METHOD)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + switch (nv->value->len) { + case 4: + if (lstreq("HEAD", nv->value->base, nv->value->len)) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_HEAD; + } + break; + case 7: + switch (nv->value->base[6]) { + case 'T': + if (lstreq("CONNECT", nv->value->base, nv->value->len)) { + if (stream->stream_id % 2 == 0) { + /* we won't allow CONNECT for push */ + return NGHTTP2_ERR_HTTP_HEADER; + } + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT; + if (stream->http_flags & + (NGHTTP2_HTTP_FLAG__PATH | NGHTTP2_HTTP_FLAG__SCHEME)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + break; + case 'S': + if (lstreq("OPTIONS", nv->value->base, nv->value->len)) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_OPTIONS; + } + break; + } + break; + } + break; + case NGHTTP2_TOKEN__PATH: + if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { + return NGHTTP2_ERR_HTTP_HEADER; + } + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PATH)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + if (nv->value->base[0] == '/') { + stream->http_flags |= NGHTTP2_HTTP_FLAG_PATH_REGULAR; + } else if (nv->value->len == 1 && nv->value->base[0] == '*') { + stream->http_flags |= NGHTTP2_HTTP_FLAG_PATH_ASTERISK; + } + break; + case NGHTTP2_TOKEN__SCHEME: + if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { + return NGHTTP2_ERR_HTTP_HEADER; + } + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__SCHEME)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + if ((nv->value->len == 4 && memieq("http", nv->value->base, 4)) || + (nv->value->len == 5 && memieq("https", nv->value->base, 5))) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_SCHEME_HTTP; + } + break; + case NGHTTP2_TOKEN_HOST: + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_HOST)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + case NGHTTP2_TOKEN_CONTENT_LENGTH: { + if (stream->content_length != -1) { + return NGHTTP2_ERR_HTTP_HEADER; + } + stream->content_length = parse_uint(nv->value->base, nv->value->len); + if (stream->content_length == -1) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + } + /* disallowed header fields */ + case NGHTTP2_TOKEN_CONNECTION: + case NGHTTP2_TOKEN_KEEP_ALIVE: + case NGHTTP2_TOKEN_PROXY_CONNECTION: + case NGHTTP2_TOKEN_TRANSFER_ENCODING: + case NGHTTP2_TOKEN_UPGRADE: + return NGHTTP2_ERR_HTTP_HEADER; + case NGHTTP2_TOKEN_TE: + if (!lstrieq("trailers", nv->value->base, nv->value->len)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + default: + if (nv->name->base[0] == ':') { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + + if (nv->name->base[0] != ':') { + stream->http_flags |= NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED; + } + + return 0; +} + +static int http_response_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, + int trailer) { + if (nv->name->base[0] == ':') { + if (trailer || + (stream->http_flags & NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + + switch (nv->token) { + case NGHTTP2_TOKEN__STATUS: { + if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__STATUS)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + if (nv->value->len != 3) { + return NGHTTP2_ERR_HTTP_HEADER; + } + stream->status_code = (int16_t)parse_uint(nv->value->base, nv->value->len); + if (stream->status_code == -1) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + } + case NGHTTP2_TOKEN_CONTENT_LENGTH: { + if (stream->content_length != -1) { + return NGHTTP2_ERR_HTTP_HEADER; + } + stream->content_length = parse_uint(nv->value->base, nv->value->len); + if (stream->content_length == -1) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + } + /* disallowed header fields */ + case NGHTTP2_TOKEN_CONNECTION: + case NGHTTP2_TOKEN_KEEP_ALIVE: + case NGHTTP2_TOKEN_PROXY_CONNECTION: + case NGHTTP2_TOKEN_TRANSFER_ENCODING: + case NGHTTP2_TOKEN_UPGRADE: + return NGHTTP2_ERR_HTTP_HEADER; + case NGHTTP2_TOKEN_TE: + if (!lstrieq("trailers", nv->value->base, nv->value->len)) { + return NGHTTP2_ERR_HTTP_HEADER; + } + break; + default: + if (nv->name->base[0] == ':') { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + + if (nv->name->base[0] != ':') { + stream->http_flags |= NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED; + } + + return 0; +} + +/* Generated by genauthroitychartbl.py */ +static char VALID_AUTHORITY_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */, + 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 0 /* HT */, + 0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */, + 0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */, + 0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */, + 0 /* RS */, 0 /* US */, 0 /* SPC */, 1 /* ! */, 0 /* " */, + 0 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, 1 /* , */, + 1 /* - */, 1 /* . */, 0 /* / */, 1 /* 0 */, 1 /* 1 */, + 1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, + 1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */, 1 /* @ */, + 1 /* A */, 1 /* B */, 1 /* C */, 1 /* D */, 1 /* E */, + 1 /* F */, 1 /* G */, 1 /* H */, 1 /* I */, 1 /* J */, + 1 /* K */, 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, 1 /* T */, + 1 /* U */, 1 /* V */, 1 /* W */, 1 /* X */, 1 /* Y */, + 1 /* Z */, 1 /* [ */, 0 /* \ */, 1 /* ] */, 0 /* ^ */, + 1 /* _ */, 0 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */, + 1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */, + 1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */, + 1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, 0 /* | */, + 0 /* } */, 1 /* ~ */, 0 /* DEL */, 0 /* 0x80 */, 0 /* 0x81 */, + 0 /* 0x82 */, 0 /* 0x83 */, 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, + 0 /* 0x87 */, 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, 0 /* 0x90 */, + 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, 0 /* 0x94 */, 0 /* 0x95 */, + 0 /* 0x96 */, 0 /* 0x97 */, 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, + 0 /* 0x9b */, 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, 0 /* 0xa4 */, + 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, 0 /* 0xa8 */, 0 /* 0xa9 */, + 0 /* 0xaa */, 0 /* 0xab */, 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, + 0 /* 0xaf */, 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, 0 /* 0xb8 */, + 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, 0 /* 0xbc */, 0 /* 0xbd */, + 0 /* 0xbe */, 0 /* 0xbf */, 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, + 0 /* 0xc3 */, 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, 0 /* 0xcc */, + 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, 0 /* 0xd0 */, 0 /* 0xd1 */, + 0 /* 0xd2 */, 0 /* 0xd3 */, 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, + 0 /* 0xd7 */, 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, 0 /* 0xe0 */, + 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, 0 /* 0xe4 */, 0 /* 0xe5 */, + 0 /* 0xe6 */, 0 /* 0xe7 */, 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, + 0 /* 0xeb */, 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, 0 /* 0xf4 */, + 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, 0 /* 0xf8 */, 0 /* 0xf9 */, + 0 /* 0xfa */, 0 /* 0xfb */, 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, + 0 /* 0xff */ +}; + +static int check_authority(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_AUTHORITY_CHARS[*value]) { + return 0; + } + } + return 1; +} + +static int check_scheme(const uint8_t *value, size_t len) { + const uint8_t *last; + if (len == 0) { + return 0; + } + + if (!(('A' <= *value && *value <= 'Z') || ('a' <= *value && *value <= 'z'))) { + return 0; + } + + last = value + len; + ++value; + + for (; value != last; ++value) { + if (!(('A' <= *value && *value <= 'Z') || + ('a' <= *value && *value <= 'z') || + ('0' <= *value && *value <= '9') || *value == '+' || *value == '-' || + *value == '.')) { + return 0; + } + } + return 1; +} + +int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, + nghttp2_frame *frame, nghttp2_hd_nv *nv, + int trailer) { + int rv; + + /* We are strict for pseudo header field. One bad character should + lead to fail. OTOH, we should be a bit forgiving for regular + headers, since existing public internet has so much illegal + headers floating around and if we kill the stream because of + this, we may disrupt many web sites and/or libraries. So we + become conservative here, and just ignore those illegal regular + headers. */ + if (!nghttp2_check_header_name(nv->name->base, nv->name->len)) { + size_t i; + if (nv->name->len > 0 && nv->name->base[0] == ':') { + return NGHTTP2_ERR_HTTP_HEADER; + } + /* header field name must be lower-cased without exception */ + for (i = 0; i < nv->name->len; ++i) { + uint8_t c = nv->name->base[i]; + if ('A' <= c && c <= 'Z') { + return NGHTTP2_ERR_HTTP_HEADER; + } + } + /* When ignoring regular headers, we set this flag so that we + still enforce header field ordering rule for pseudo header + fields. */ + stream->http_flags |= NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED; + return NGHTTP2_ERR_IGN_HTTP_HEADER; + } + + if (nv->token == NGHTTP2_TOKEN__AUTHORITY || + nv->token == NGHTTP2_TOKEN_HOST) { + rv = check_authority(nv->value->base, nv->value->len); + } else if (nv->token == NGHTTP2_TOKEN__SCHEME) { + rv = check_scheme(nv->value->base, nv->value->len); + } else { + rv = nghttp2_check_header_value(nv->value->base, nv->value->len); + } + + if (rv == 0) { + assert(nv->name->len > 0); + if (nv->name->base[0] == ':') { + return NGHTTP2_ERR_HTTP_HEADER; + } + /* When ignoring regular headers, we set this flag so that we + still enforce header field ordering rule for pseudo header + fields. */ + stream->http_flags |= NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED; + return NGHTTP2_ERR_IGN_HTTP_HEADER; + } + + if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) { + return http_request_on_header(stream, nv, trailer); + } + + return http_response_on_header(stream, nv, trailer); +} + +int nghttp2_http_on_request_headers(nghttp2_stream *stream, + nghttp2_frame *frame) { + if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { + if ((stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) { + return -1; + } + stream->content_length = -1; + } else { + if ((stream->http_flags & NGHTTP2_HTTP_FLAG_REQ_HEADERS) != + NGHTTP2_HTTP_FLAG_REQ_HEADERS || + (stream->http_flags & + (NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) { + return -1; + } + if (!check_path(stream)) { + return -1; + } + } + + if (frame->hd.type == NGHTTP2_PUSH_PROMISE) { + /* we are going to reuse data fields for upcoming response. Clear + them now, except for method flags. */ + stream->http_flags &= NGHTTP2_HTTP_FLAG_METH_ALL; + stream->content_length = -1; + } + + return 0; +} + +int nghttp2_http_on_response_headers(nghttp2_stream *stream) { + if ((stream->http_flags & NGHTTP2_HTTP_FLAG__STATUS) == 0) { + return -1; + } + + if (stream->status_code / 100 == 1) { + /* non-final response */ + stream->http_flags = + (uint16_t)((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_ALL) | + NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE); + stream->content_length = -1; + stream->status_code = -1; + return 0; + } + + stream->http_flags = + (uint16_t)(stream->http_flags & ~NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE); + + if (!expect_response_body(stream)) { + stream->content_length = 0; + } else if (stream->http_flags & (NGHTTP2_HTTP_FLAG_METH_CONNECT | + NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND)) { + stream->content_length = -1; + } + + return 0; +} + +int nghttp2_http_on_trailer_headers(nghttp2_stream *stream _U_, + nghttp2_frame *frame) { + if ((frame->hd.flags & NGHTTP2_FLAG_END_STREAM) == 0) { + return -1; + } + + return 0; +} + +int nghttp2_http_on_remote_end_stream(nghttp2_stream *stream) { + if (stream->http_flags & NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE) { + return -1; + } + + if (stream->content_length != -1 && + stream->content_length != stream->recv_content_length) { + return -1; + } + + return 0; +} + +int nghttp2_http_on_data_chunk(nghttp2_stream *stream, size_t n) { + stream->recv_content_length += (int64_t)n; + + if ((stream->http_flags & NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE) || + (stream->content_length != -1 && + stream->recv_content_length > stream->content_length)) { + return -1; + } + + return 0; +} + +void nghttp2_http_record_request_method(nghttp2_stream *stream, + nghttp2_frame *frame) { + const nghttp2_nv *nva; + size_t nvlen; + size_t i; + + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + nva = frame->headers.nva; + nvlen = frame->headers.nvlen; + break; + case NGHTTP2_PUSH_PROMISE: + nva = frame->push_promise.nva; + nvlen = frame->push_promise.nvlen; + break; + default: + return; + } + + /* TODO we should do this strictly. */ + for (i = 0; i < nvlen; ++i) { + const nghttp2_nv *nv = &nva[i]; + if (!(nv->namelen == 7 && nv->name[6] == 'd' && + memcmp(":metho", nv->name, nv->namelen - 1) == 0)) { + continue; + } + if (lstreq("CONNECT", nv->value, nv->valuelen)) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT; + return; + } + if (lstreq("HEAD", nv->value, nv->valuelen)) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_HEAD; + return; + } + return; + } +} diff --git a/components/nghttp/library/nghttp2_map.c b/components/nghttp/library/nghttp2_map.c new file mode 100644 index 0000000000..4d9f97b47e --- /dev/null +++ b/components/nghttp/library/nghttp2_map.c @@ -0,0 +1,189 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_map.h" + +#include + +#define INITIAL_TABLE_LENGTH 256 + +int nghttp2_map_init(nghttp2_map *map, nghttp2_mem *mem) { + map->mem = mem; + map->tablelen = INITIAL_TABLE_LENGTH; + map->table = + nghttp2_mem_calloc(mem, map->tablelen, sizeof(nghttp2_map_entry *)); + if (map->table == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + map->size = 0; + + return 0; +} + +void nghttp2_map_free(nghttp2_map *map) { + nghttp2_mem_free(map->mem, map->table); +} + +void nghttp2_map_each_free(nghttp2_map *map, + int (*func)(nghttp2_map_entry *entry, void *ptr), + void *ptr) { + uint32_t i; + for (i = 0; i < map->tablelen; ++i) { + nghttp2_map_entry *entry; + for (entry = map->table[i]; entry;) { + nghttp2_map_entry *next = entry->next; + func(entry, ptr); + entry = next; + } + map->table[i] = NULL; + } +} + +int nghttp2_map_each(nghttp2_map *map, + int (*func)(nghttp2_map_entry *entry, void *ptr), + void *ptr) { + int rv; + uint32_t i; + for (i = 0; i < map->tablelen; ++i) { + nghttp2_map_entry *entry; + for (entry = map->table[i]; entry; entry = entry->next) { + rv = func(entry, ptr); + if (rv != 0) { + return rv; + } + } + } + return 0; +} + +void nghttp2_map_entry_init(nghttp2_map_entry *entry, key_type key) { + entry->key = key; + entry->next = NULL; +} + +/* Same hash function in android HashMap source code. */ +/* The |mod| must be power of 2 */ +static uint32_t hash(int32_t key, uint32_t mod) { + uint32_t h = (uint32_t)key; + h ^= (h >> 20) ^ (h >> 12); + h ^= (h >> 7) ^ (h >> 4); + return h & (mod - 1); +} + +static int insert(nghttp2_map_entry **table, uint32_t tablelen, + nghttp2_map_entry *entry) { + uint32_t h = hash(entry->key, tablelen); + if (table[h] == NULL) { + table[h] = entry; + } else { + nghttp2_map_entry *p; + /* We won't allow duplicated key, so check it out. */ + for (p = table[h]; p; p = p->next) { + if (p->key == entry->key) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + } + entry->next = table[h]; + table[h] = entry; + } + return 0; +} + +/* new_tablelen must be power of 2 */ +static int resize(nghttp2_map *map, uint32_t new_tablelen) { + uint32_t i; + nghttp2_map_entry **new_table; + + new_table = + nghttp2_mem_calloc(map->mem, new_tablelen, sizeof(nghttp2_map_entry *)); + if (new_table == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + for (i = 0; i < map->tablelen; ++i) { + nghttp2_map_entry *entry; + for (entry = map->table[i]; entry;) { + nghttp2_map_entry *next = entry->next; + entry->next = NULL; + /* This function must succeed */ + insert(new_table, new_tablelen, entry); + entry = next; + } + } + nghttp2_mem_free(map->mem, map->table); + map->tablelen = new_tablelen; + map->table = new_table; + + return 0; +} + +int nghttp2_map_insert(nghttp2_map *map, nghttp2_map_entry *new_entry) { + int rv; + /* Load factor is 0.75 */ + if ((map->size + 1) * 4 > map->tablelen * 3) { + rv = resize(map, map->tablelen * 2); + if (rv != 0) { + return rv; + } + } + rv = insert(map->table, map->tablelen, new_entry); + if (rv != 0) { + return rv; + } + ++map->size; + return 0; +} + +nghttp2_map_entry *nghttp2_map_find(nghttp2_map *map, key_type key) { + uint32_t h; + nghttp2_map_entry *entry; + h = hash(key, map->tablelen); + for (entry = map->table[h]; entry; entry = entry->next) { + if (entry->key == key) { + return entry; + } + } + return NULL; +} + +int nghttp2_map_remove(nghttp2_map *map, key_type key) { + uint32_t h; + nghttp2_map_entry **dst; + + h = hash(key, map->tablelen); + + for (dst = &map->table[h]; *dst; dst = &(*dst)->next) { + if ((*dst)->key != key) { + continue; + } + + *dst = (*dst)->next; + --map->size; + return 0; + } + return NGHTTP2_ERR_INVALID_ARGUMENT; +} + +size_t nghttp2_map_size(nghttp2_map *map) { return map->size; } diff --git a/components/nghttp/library/nghttp2_mem.c b/components/nghttp/library/nghttp2_mem.c new file mode 100644 index 0000000000..e0b7c29e96 --- /dev/null +++ b/components/nghttp/library/nghttp2_mem.c @@ -0,0 +1,65 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_mem.h" + +static void *default_malloc(size_t size, void *mem_user_data _U_) { + return malloc(size); +} + +static void default_free(void *ptr, void *mem_user_data _U_) { free(ptr); } + +static void *default_calloc(size_t nmemb, size_t size, + void *mem_user_data _U_) { + return calloc(nmemb, size); +} + +static void *default_realloc(void *ptr, size_t size, void *mem_user_data _U_) { + return realloc(ptr, size); +} + +static nghttp2_mem mem_default = {NULL, default_malloc, default_free, + default_calloc, default_realloc}; + +nghttp2_mem *nghttp2_mem_default(void) { return &mem_default; } + +void *nghttp2_mem_malloc(nghttp2_mem *mem, size_t size) { + return mem->malloc(size, mem->mem_user_data); +} + +void nghttp2_mem_free(nghttp2_mem *mem, void *ptr) { + mem->free(ptr, mem->mem_user_data); +} + +void nghttp2_mem_free2(nghttp2_free free_func, void *ptr, void *mem_user_data) { + free_func(ptr, mem_user_data); +} + +void *nghttp2_mem_calloc(nghttp2_mem *mem, size_t nmemb, size_t size) { + return mem->calloc(nmemb, size, mem->mem_user_data); +} + +void *nghttp2_mem_realloc(nghttp2_mem *mem, void *ptr, size_t size) { + return mem->realloc(ptr, size, mem->mem_user_data); +} diff --git a/components/nghttp/library/nghttp2_npn.c b/components/nghttp/library/nghttp2_npn.c new file mode 100644 index 0000000000..91fca06c47 --- /dev/null +++ b/components/nghttp/library/nghttp2_npn.c @@ -0,0 +1,57 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_npn.h" + +#include + +static int select_next_protocol(unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const char *key, unsigned int keylen) { + unsigned int i; + for (i = 0; i + keylen <= inlen; i += (unsigned int)(in [i] + 1)) { + if (memcmp(&in[i], key, keylen) == 0) { + *out = (unsigned char *)&in[i + 1]; + *outlen = in[i]; + return 0; + } + } + return -1; +} + +#define NGHTTP2_HTTP_1_1_ALPN "\x8http/1.1" +#define NGHTTP2_HTTP_1_1_ALPN_LEN (sizeof(NGHTTP2_HTTP_1_1_ALPN) - 1) + +int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen) { + if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_PROTO_ALPN, + NGHTTP2_PROTO_ALPN_LEN) == 0) { + return 1; + } + if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_HTTP_1_1_ALPN, + NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { + return 0; + } + return -1; +} diff --git a/components/nghttp/library/nghttp2_option.c b/components/nghttp/library/nghttp2_option.c new file mode 100644 index 0000000000..860c9f1768 --- /dev/null +++ b/components/nghttp/library/nghttp2_option.c @@ -0,0 +1,103 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_option.h" + +#include "nghttp2_session.h" + +int nghttp2_option_new(nghttp2_option **option_ptr) { + *option_ptr = calloc(1, sizeof(nghttp2_option)); + + if (*option_ptr == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + return 0; +} + +void nghttp2_option_del(nghttp2_option *option) { free(option); } + +void nghttp2_option_set_no_auto_window_update(nghttp2_option *option, int val) { + option->opt_set_mask |= NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE; + option->no_auto_window_update = val; +} + +void nghttp2_option_set_peer_max_concurrent_streams(nghttp2_option *option, + uint32_t val) { + option->opt_set_mask |= NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS; + option->peer_max_concurrent_streams = val; +} + +void nghttp2_option_set_no_recv_client_magic(nghttp2_option *option, int val) { + option->opt_set_mask |= NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC; + option->no_recv_client_magic = val; +} + +void nghttp2_option_set_no_http_messaging(nghttp2_option *option, int val) { + option->opt_set_mask |= NGHTTP2_OPT_NO_HTTP_MESSAGING; + option->no_http_messaging = val; +} + +void nghttp2_option_set_max_reserved_remote_streams(nghttp2_option *option, + uint32_t val) { + option->opt_set_mask |= NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS; + option->max_reserved_remote_streams = val; +} + +static void set_ext_type(uint8_t *ext_types, uint8_t type) { + ext_types[type / 8] = (uint8_t)(ext_types[type / 8] | (1 << (type & 0x7))); +} + +void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option, + uint8_t type) { + if (type < 10) { + return; + } + + option->opt_set_mask |= NGHTTP2_OPT_USER_RECV_EXT_TYPES; + set_ext_type(option->user_recv_ext_types, type); +} + +void nghttp2_option_set_builtin_recv_extension_type(nghttp2_option *option, + uint8_t type) { + switch (type) { + case NGHTTP2_ALTSVC: + option->opt_set_mask |= NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES; + option->builtin_recv_ext_types |= NGHTTP2_TYPEMASK_ALTSVC; + return; + default: + return; + } +} + +void nghttp2_option_set_no_auto_ping_ack(nghttp2_option *option, int val) { + option->opt_set_mask |= NGHTTP2_OPT_NO_AUTO_PING_ACK; + option->no_auto_ping_ack = val; +} + +void nghttp2_option_set_max_send_header_block_length(nghttp2_option *option, + size_t val) { + option->opt_set_mask |= NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH; + option->max_send_header_block_length = val; +} diff --git a/components/nghttp/library/nghttp2_outbound_item.c b/components/nghttp/library/nghttp2_outbound_item.c new file mode 100644 index 0000000000..1633cc3685 --- /dev/null +++ b/components/nghttp/library/nghttp2_outbound_item.c @@ -0,0 +1,124 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_outbound_item.h" + +#include +#include + +void nghttp2_outbound_item_init(nghttp2_outbound_item *item) { + item->cycle = 0; + item->qnext = NULL; + item->queued = 0; + + memset(&item->aux_data, 0, sizeof(nghttp2_aux_data)); +} + +void nghttp2_outbound_item_free(nghttp2_outbound_item *item, nghttp2_mem *mem) { + nghttp2_frame *frame; + + if (item == NULL) { + return; + } + + frame = &item->frame; + + switch (frame->hd.type) { + case NGHTTP2_DATA: + nghttp2_frame_data_free(&frame->data); + break; + case NGHTTP2_HEADERS: + nghttp2_frame_headers_free(&frame->headers, mem); + break; + case NGHTTP2_PRIORITY: + nghttp2_frame_priority_free(&frame->priority); + break; + case NGHTTP2_RST_STREAM: + nghttp2_frame_rst_stream_free(&frame->rst_stream); + break; + case NGHTTP2_SETTINGS: + nghttp2_frame_settings_free(&frame->settings, mem); + break; + case NGHTTP2_PUSH_PROMISE: + nghttp2_frame_push_promise_free(&frame->push_promise, mem); + break; + case NGHTTP2_PING: + nghttp2_frame_ping_free(&frame->ping); + break; + case NGHTTP2_GOAWAY: + nghttp2_frame_goaway_free(&frame->goaway, mem); + break; + case NGHTTP2_WINDOW_UPDATE: + nghttp2_frame_window_update_free(&frame->window_update); + break; + default: { + nghttp2_ext_aux_data *aux_data; + + aux_data = &item->aux_data.ext; + + if (aux_data->builtin == 0) { + nghttp2_frame_extension_free(&frame->ext); + break; + } + + switch (frame->hd.type) { + case NGHTTP2_ALTSVC: + nghttp2_frame_altsvc_free(&frame->ext, mem); + break; + default: + assert(0); + break; + } + } + } +} + +void nghttp2_outbound_queue_init(nghttp2_outbound_queue *q) { + q->head = q->tail = NULL; + q->n = 0; +} + +void nghttp2_outbound_queue_push(nghttp2_outbound_queue *q, + nghttp2_outbound_item *item) { + if (q->tail) { + q->tail = q->tail->qnext = item; + } else { + q->head = q->tail = item; + } + ++q->n; +} + +void nghttp2_outbound_queue_pop(nghttp2_outbound_queue *q) { + nghttp2_outbound_item *item; + if (!q->head) { + return; + } + item = q->head; + q->head = q->head->qnext; + item->qnext = NULL; + if (!q->head) { + q->tail = NULL; + } + --q->n; +} diff --git a/components/nghttp/library/nghttp2_pq.c b/components/nghttp/library/nghttp2_pq.c new file mode 100644 index 0000000000..bebccc7606 --- /dev/null +++ b/components/nghttp/library/nghttp2_pq.c @@ -0,0 +1,184 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_pq.h" + +#include +#include + +#include "nghttp2_helper.h" + +int nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem) { + pq->mem = mem; + pq->capacity = 0; + pq->q = NULL; + pq->length = 0; + pq->less = less; + return 0; +} + +void nghttp2_pq_free(nghttp2_pq *pq) { + nghttp2_mem_free(pq->mem, pq->q); + pq->q = NULL; +} + +static void swap(nghttp2_pq *pq, size_t i, size_t j) { + nghttp2_pq_entry *a = pq->q[i]; + nghttp2_pq_entry *b = pq->q[j]; + + pq->q[i] = b; + b->index = i; + pq->q[j] = a; + a->index = j; +} + +static void bubble_up(nghttp2_pq *pq, size_t index) { + size_t parent; + while (index != 0) { + parent = (index - 1) / 2; + if (!pq->less(pq->q[index], pq->q[parent])) { + return; + } + swap(pq, parent, index); + index = parent; + } +} + +int nghttp2_pq_push(nghttp2_pq *pq, nghttp2_pq_entry *item) { + if (pq->capacity <= pq->length) { + void *nq; + size_t ncapacity; + + ncapacity = nghttp2_max(4, (pq->capacity * 2)); + + nq = nghttp2_mem_realloc(pq->mem, pq->q, + ncapacity * sizeof(nghttp2_pq_entry *)); + if (nq == NULL) { + return NGHTTP2_ERR_NOMEM; + } + pq->capacity = ncapacity; + pq->q = nq; + } + pq->q[pq->length] = item; + item->index = pq->length; + ++pq->length; + bubble_up(pq, pq->length - 1); + return 0; +} + +nghttp2_pq_entry *nghttp2_pq_top(nghttp2_pq *pq) { + if (pq->length == 0) { + return NULL; + } else { + return pq->q[0]; + } +} + +static void bubble_down(nghttp2_pq *pq, size_t index) { + size_t i, j, minindex; + for (;;) { + j = index * 2 + 1; + minindex = index; + for (i = 0; i < 2; ++i, ++j) { + if (j >= pq->length) { + break; + } + if (pq->less(pq->q[j], pq->q[minindex])) { + minindex = j; + } + } + if (minindex == index) { + return; + } + swap(pq, index, minindex); + index = minindex; + } +} + +void nghttp2_pq_pop(nghttp2_pq *pq) { + if (pq->length > 0) { + pq->q[0] = pq->q[pq->length - 1]; + pq->q[0]->index = 0; + --pq->length; + bubble_down(pq, 0); + } +} + +void nghttp2_pq_remove(nghttp2_pq *pq, nghttp2_pq_entry *item) { + assert(pq->q[item->index] == item); + + if (item->index == 0) { + nghttp2_pq_pop(pq); + return; + } + + if (item->index == pq->length - 1) { + --pq->length; + return; + } + + pq->q[item->index] = pq->q[pq->length - 1]; + pq->q[item->index]->index = item->index; + --pq->length; + + if (pq->less(item, pq->q[item->index])) { + bubble_down(pq, item->index); + } else { + bubble_up(pq, item->index); + } +} + +int nghttp2_pq_empty(nghttp2_pq *pq) { return pq->length == 0; } + +size_t nghttp2_pq_size(nghttp2_pq *pq) { return pq->length; } + +void nghttp2_pq_update(nghttp2_pq *pq, nghttp2_pq_item_cb fun, void *arg) { + size_t i; + int rv = 0; + if (pq->length == 0) { + return; + } + for (i = 0; i < pq->length; ++i) { + rv |= (*fun)(pq->q[i], arg); + } + if (rv) { + for (i = pq->length; i > 0; --i) { + bubble_down(pq, i - 1); + } + } +} + +int nghttp2_pq_each(nghttp2_pq *pq, nghttp2_pq_item_cb fun, void *arg) { + size_t i; + + if (pq->length == 0) { + return 0; + } + for (i = 0; i < pq->length; ++i) { + if ((*fun)(pq->q[i], arg)) { + return 1; + } + } + return 0; +} diff --git a/components/nghttp/library/nghttp2_priority_spec.c b/components/nghttp/library/nghttp2_priority_spec.c new file mode 100644 index 0000000000..c2196e3063 --- /dev/null +++ b/components/nghttp/library/nghttp2_priority_spec.c @@ -0,0 +1,52 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_priority_spec.h" + +void nghttp2_priority_spec_init(nghttp2_priority_spec *pri_spec, + int32_t stream_id, int32_t weight, + int exclusive) { + pri_spec->stream_id = stream_id; + pri_spec->weight = weight; + pri_spec->exclusive = exclusive != 0; +} + +void nghttp2_priority_spec_default_init(nghttp2_priority_spec *pri_spec) { + pri_spec->stream_id = 0; + pri_spec->weight = NGHTTP2_DEFAULT_WEIGHT; + pri_spec->exclusive = 0; +} + +int nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec) { + return pri_spec->stream_id == 0 && + pri_spec->weight == NGHTTP2_DEFAULT_WEIGHT && pri_spec->exclusive == 0; +} + +void nghttp2_priority_spec_normalize_weight(nghttp2_priority_spec *pri_spec) { + if (pri_spec->weight < NGHTTP2_MIN_WEIGHT) { + pri_spec->weight = NGHTTP2_MIN_WEIGHT; + } else if (pri_spec->weight > NGHTTP2_MAX_WEIGHT) { + pri_spec->weight = NGHTTP2_MAX_WEIGHT; + } +} diff --git a/components/nghttp/library/nghttp2_queue.c b/components/nghttp/library/nghttp2_queue.c new file mode 100644 index 0000000000..055eb69c7e --- /dev/null +++ b/components/nghttp/library/nghttp2_queue.c @@ -0,0 +1,85 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_queue.h" + +#include +#include + +void nghttp2_queue_init(nghttp2_queue *queue) { + queue->front = queue->back = NULL; +} + +void nghttp2_queue_free(nghttp2_queue *queue) { + if (!queue) { + return; + } else { + nghttp2_queue_cell *p = queue->front; + while (p) { + nghttp2_queue_cell *next = p->next; + free(p); + p = next; + } + } +} + +int nghttp2_queue_push(nghttp2_queue *queue, void *data) { + nghttp2_queue_cell *new_cell = + (nghttp2_queue_cell *)malloc(sizeof(nghttp2_queue_cell)); + if (!new_cell) { + return NGHTTP2_ERR_NOMEM; + } + new_cell->data = data; + new_cell->next = NULL; + if (queue->back) { + queue->back->next = new_cell; + queue->back = new_cell; + + } else { + queue->front = queue->back = new_cell; + } + return 0; +} + +void nghttp2_queue_pop(nghttp2_queue *queue) { + nghttp2_queue_cell *front = queue->front; + assert(front); + queue->front = front->next; + if (front == queue->back) { + queue->back = NULL; + } + free(front); +} + +void *nghttp2_queue_front(nghttp2_queue *queue) { + assert(queue->front); + return queue->front->data; +} + +void *nghttp2_queue_back(nghttp2_queue *queue) { + assert(queue->back); + return queue->back->data; +} + +int nghttp2_queue_empty(nghttp2_queue *queue) { return queue->front == NULL; } diff --git a/components/nghttp/library/nghttp2_rcbuf.c b/components/nghttp/library/nghttp2_rcbuf.c new file mode 100644 index 0000000000..053f0dfa8f --- /dev/null +++ b/components/nghttp/library/nghttp2_rcbuf.c @@ -0,0 +1,99 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_rcbuf.h" + +#include +#include + +#include "nghttp2_mem.h" + +int nghttp2_rcbuf_new(nghttp2_rcbuf **rcbuf_ptr, size_t size, + nghttp2_mem *mem) { + uint8_t *p; + + p = nghttp2_mem_malloc(mem, sizeof(nghttp2_rcbuf) + size); + if (p == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + *rcbuf_ptr = (void *)p; + + (*rcbuf_ptr)->mem_user_data = mem->mem_user_data; + (*rcbuf_ptr)->free = mem->free; + (*rcbuf_ptr)->base = p + sizeof(nghttp2_rcbuf); + (*rcbuf_ptr)->len = size; + (*rcbuf_ptr)->ref = 1; + + return 0; +} + +int nghttp2_rcbuf_new2(nghttp2_rcbuf **rcbuf_ptr, const uint8_t *src, + size_t srclen, nghttp2_mem *mem) { + int rv; + + rv = nghttp2_rcbuf_new(rcbuf_ptr, srclen + 1, mem); + if (rv != 0) { + return rv; + } + + memcpy((*rcbuf_ptr)->base, src, srclen); + + (*rcbuf_ptr)->len = srclen; + (*rcbuf_ptr)->base[srclen] = '\0'; + + return 0; +} + +/* + * Frees |rcbuf| itself, regardless of its reference cout. + */ +void nghttp2_rcbuf_del(nghttp2_rcbuf *rcbuf) { + nghttp2_mem_free2(rcbuf->free, rcbuf, rcbuf->mem_user_data); +} + +void nghttp2_rcbuf_incref(nghttp2_rcbuf *rcbuf) { + if (rcbuf->ref == -1) { + return; + } + + ++rcbuf->ref; +} + +void nghttp2_rcbuf_decref(nghttp2_rcbuf *rcbuf) { + if (rcbuf == NULL || rcbuf->ref == -1) { + return; + } + + assert(rcbuf->ref > 0); + + if (--rcbuf->ref == 0) { + nghttp2_rcbuf_del(rcbuf); + } +} + +nghttp2_vec nghttp2_rcbuf_get_buf(nghttp2_rcbuf *rcbuf) { + nghttp2_vec res = {rcbuf->base, rcbuf->len}; + return res; +} diff --git a/components/nghttp/library/nghttp2_session.c b/components/nghttp/library/nghttp2_session.c new file mode 100644 index 0000000000..f93cd1729b --- /dev/null +++ b/components/nghttp/library/nghttp2_session.c @@ -0,0 +1,7513 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_session.h" + +#include +#include +#include +#include +#include + +#include "nghttp2_helper.h" +#include "nghttp2_net.h" +#include "nghttp2_priority_spec.h" +#include "nghttp2_option.h" +#include "nghttp2_http.h" +#include "nghttp2_pq.h" + +/* + * Returns non-zero if the number of outgoing opened streams is larger + * than or equal to + * remote_settings.max_concurrent_streams. + */ +static int +session_is_outgoing_concurrent_streams_max(nghttp2_session *session) { + return session->remote_settings.max_concurrent_streams <= + session->num_outgoing_streams; +} + +/* + * Returns non-zero if the number of incoming opened streams is larger + * than or equal to + * local_settings.max_concurrent_streams. + */ +static int +session_is_incoming_concurrent_streams_max(nghttp2_session *session) { + return session->local_settings.max_concurrent_streams <= + session->num_incoming_streams; +} + +/* + * Returns non-zero if the number of incoming opened streams is larger + * than or equal to + * session->pending_local_max_concurrent_stream. + */ +static int +session_is_incoming_concurrent_streams_pending_max(nghttp2_session *session) { + return session->pending_local_max_concurrent_stream <= + session->num_incoming_streams; +} + +/* + * Returns non-zero if |lib_error| is non-fatal error. + */ +static int is_non_fatal(int lib_error_code) { + return lib_error_code < 0 && lib_error_code > NGHTTP2_ERR_FATAL; +} + +int nghttp2_is_fatal(int lib_error_code) { + return lib_error_code < NGHTTP2_ERR_FATAL; +} + +static int session_enforce_http_messaging(nghttp2_session *session) { + return (session->opt_flags & NGHTTP2_OPTMASK_NO_HTTP_MESSAGING) == 0; +} + +/* + * Returns nonzero if |frame| is trailer headers. + */ +static int session_trailer_headers(nghttp2_session *session, + nghttp2_stream *stream, + nghttp2_frame *frame) { + if (!stream || frame->hd.type != NGHTTP2_HEADERS) { + return 0; + } + if (session->server) { + return frame->headers.cat == NGHTTP2_HCAT_HEADERS; + } + + return frame->headers.cat == NGHTTP2_HCAT_HEADERS && + (stream->http_flags & NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE) == 0; +} + +/* Returns nonzero if the |stream| is in reserved(remote) state */ +static int state_reserved_remote(nghttp2_session *session, + nghttp2_stream *stream) { + return stream->state == NGHTTP2_STREAM_RESERVED && + !nghttp2_session_is_my_stream_id(session, stream->stream_id); +} + +/* Returns nonzero if the |stream| is in reserved(local) state */ +static int state_reserved_local(nghttp2_session *session, + nghttp2_stream *stream) { + return stream->state == NGHTTP2_STREAM_RESERVED && + nghttp2_session_is_my_stream_id(session, stream->stream_id); +} + +/* + * Checks whether received stream_id is valid. This function returns + * 1 if it succeeds, or 0. + */ +static int session_is_new_peer_stream_id(nghttp2_session *session, + int32_t stream_id) { + return stream_id != 0 && + !nghttp2_session_is_my_stream_id(session, stream_id) && + session->last_recv_stream_id < stream_id; +} + +static int session_detect_idle_stream(nghttp2_session *session, + int32_t stream_id) { + /* Assume that stream object with stream_id does not exist */ + if (nghttp2_session_is_my_stream_id(session, stream_id)) { + if (session->last_sent_stream_id < stream_id) { + return 1; + } + return 0; + } + if (session_is_new_peer_stream_id(session, stream_id)) { + return 1; + } + return 0; +} + +static int check_ext_type_set(const uint8_t *ext_types, uint8_t type) { + return (ext_types[type / 8] & (1 << (type & 0x7))) > 0; +} + +static int session_call_error_callback(nghttp2_session *session, + const char *fmt, ...) { + size_t bufsize; + va_list ap; + char *buf; + int rv; + nghttp2_mem *mem; + + if (!session->callbacks.error_callback) { + return 0; + } + + mem = &session->mem; + + va_start(ap, fmt); + rv = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + if (rv < 0) { + return NGHTTP2_ERR_NOMEM; + } + + bufsize = (size_t)(rv + 1); + + buf = nghttp2_mem_malloc(mem, bufsize); + if (buf == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + va_start(ap, fmt); + rv = vsnprintf(buf, bufsize, fmt, ap); + va_end(ap); + + if (rv < 0) { + nghttp2_mem_free(mem, buf); + /* vsnprintf may return error because of various things we can + imagine, but typically we don't want to drop session just for + debug callback. */ + DEBUGF(fprintf(stderr, + "error_callback: vsnprintf failed. The template was %s\n", + fmt)); + return 0; + } + + rv = session->callbacks.error_callback(session, buf, (size_t)rv, + session->user_data); + + nghttp2_mem_free(mem, buf); + + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + return 0; +} + +static int session_terminate_session(nghttp2_session *session, + int32_t last_stream_id, + uint32_t error_code, const char *reason) { + int rv; + const uint8_t *debug_data; + size_t debug_datalen; + + if (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) { + return 0; + } + + if (reason == NULL) { + debug_data = NULL; + debug_datalen = 0; + } else { + debug_data = (const uint8_t *)reason; + debug_datalen = strlen(reason); + } + + rv = nghttp2_session_add_goaway(session, last_stream_id, error_code, + debug_data, debug_datalen, + NGHTTP2_GOAWAY_AUX_TERM_ON_SEND); + + if (rv != 0) { + return rv; + } + + session->goaway_flags |= NGHTTP2_GOAWAY_TERM_ON_SEND; + + return 0; +} + +int nghttp2_session_terminate_session(nghttp2_session *session, + uint32_t error_code) { + return session_terminate_session(session, session->last_proc_stream_id, + error_code, NULL); +} + +int nghttp2_session_terminate_session2(nghttp2_session *session, + int32_t last_stream_id, + uint32_t error_code) { + return session_terminate_session(session, last_stream_id, error_code, NULL); +} + +int nghttp2_session_terminate_session_with_reason(nghttp2_session *session, + uint32_t error_code, + const char *reason) { + return session_terminate_session(session, session->last_proc_stream_id, + error_code, reason); +} + +int nghttp2_session_is_my_stream_id(nghttp2_session *session, + int32_t stream_id) { + int rem; + if (stream_id == 0) { + return 0; + } + rem = stream_id & 0x1; + if (session->server) { + return rem == 0; + } + return rem == 1; +} + +nghttp2_stream *nghttp2_session_get_stream(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + stream = (nghttp2_stream *)nghttp2_map_find(&session->streams, stream_id); + + if (stream == NULL || (stream->flags & NGHTTP2_STREAM_FLAG_CLOSED) || + stream->state == NGHTTP2_STREAM_IDLE) { + return NULL; + } + + return stream; +} + +nghttp2_stream *nghttp2_session_get_stream_raw(nghttp2_session *session, + int32_t stream_id) { + return (nghttp2_stream *)nghttp2_map_find(&session->streams, stream_id); +} + +static void session_inbound_frame_reset(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_mem *mem = &session->mem; + /* A bit risky code, since if this function is called from + nghttp2_session_new(), we rely on the fact that + iframe->frame.hd.type is 0, so that no free is performed. */ + switch (iframe->frame.hd.type) { + case NGHTTP2_DATA: + break; + case NGHTTP2_HEADERS: + nghttp2_frame_headers_free(&iframe->frame.headers, mem); + break; + case NGHTTP2_PRIORITY: + nghttp2_frame_priority_free(&iframe->frame.priority); + break; + case NGHTTP2_RST_STREAM: + nghttp2_frame_rst_stream_free(&iframe->frame.rst_stream); + break; + case NGHTTP2_SETTINGS: + nghttp2_frame_settings_free(&iframe->frame.settings, mem); + + nghttp2_mem_free(mem, iframe->iv); + + iframe->iv = NULL; + iframe->niv = 0; + iframe->max_niv = 0; + + break; + case NGHTTP2_PUSH_PROMISE: + nghttp2_frame_push_promise_free(&iframe->frame.push_promise, mem); + break; + case NGHTTP2_PING: + nghttp2_frame_ping_free(&iframe->frame.ping); + break; + case NGHTTP2_GOAWAY: + nghttp2_frame_goaway_free(&iframe->frame.goaway, mem); + break; + case NGHTTP2_WINDOW_UPDATE: + nghttp2_frame_window_update_free(&iframe->frame.window_update); + break; + default: + /* extension frame */ + if (check_ext_type_set(session->user_recv_ext_types, + iframe->frame.hd.type)) { + nghttp2_frame_extension_free(&iframe->frame.ext); + } else { + switch (iframe->frame.hd.type) { + case NGHTTP2_ALTSVC: + if ((session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ALTSVC) == 0) { + break; + } + nghttp2_frame_altsvc_free(&iframe->frame.ext, mem); + break; + } + } + + break; + } + + memset(&iframe->frame, 0, sizeof(nghttp2_frame)); + memset(&iframe->ext_frame_payload, 0, sizeof(nghttp2_ext_frame_payload)); + + iframe->state = NGHTTP2_IB_READ_HEAD; + + nghttp2_buf_wrap_init(&iframe->sbuf, iframe->raw_sbuf, + sizeof(iframe->raw_sbuf)); + iframe->sbuf.mark += NGHTTP2_FRAME_HDLEN; + + nghttp2_buf_free(&iframe->lbuf, mem); + nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); + + iframe->raw_lbuf = NULL; + + iframe->payloadleft = 0; + iframe->padlen = 0; +} + +static void init_settings(nghttp2_settings_storage *settings) { + settings->header_table_size = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE; + settings->enable_push = 1; + settings->max_concurrent_streams = NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; + settings->initial_window_size = NGHTTP2_INITIAL_WINDOW_SIZE; + settings->max_frame_size = NGHTTP2_MAX_FRAME_SIZE_MIN; + settings->max_header_list_size = UINT32_MAX; +} + +static void active_outbound_item_reset(nghttp2_active_outbound_item *aob, + nghttp2_mem *mem) { + DEBUGF(fprintf(stderr, "send: reset nghttp2_active_outbound_item\n")); + DEBUGF(fprintf(stderr, "send: aob->item = %p\n", aob->item)); + nghttp2_outbound_item_free(aob->item, mem); + nghttp2_mem_free(mem, aob->item); + aob->item = NULL; + nghttp2_bufs_reset(&aob->framebufs); + aob->state = NGHTTP2_OB_POP_ITEM; +} + +int nghttp2_enable_strict_preface = 1; + +static int session_new(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, int server, + const nghttp2_option *option, nghttp2_mem *mem) { + int rv; + size_t nbuffer; + + if (mem == NULL) { + mem = nghttp2_mem_default(); + } + + *session_ptr = nghttp2_mem_calloc(mem, 1, sizeof(nghttp2_session)); + if (*session_ptr == NULL) { + rv = NGHTTP2_ERR_NOMEM; + goto fail_session; + } + + (*session_ptr)->mem = *mem; + mem = &(*session_ptr)->mem; + + /* next_stream_id is initialized in either + nghttp2_session_client_new2 or nghttp2_session_server_new2 */ + + rv = nghttp2_hd_deflate_init(&(*session_ptr)->hd_deflater, mem); + if (rv != 0) { + goto fail_hd_deflater; + } + rv = nghttp2_hd_inflate_init(&(*session_ptr)->hd_inflater, mem); + if (rv != 0) { + goto fail_hd_inflater; + } + rv = nghttp2_map_init(&(*session_ptr)->streams, mem); + if (rv != 0) { + goto fail_map; + } + + nghttp2_stream_init(&(*session_ptr)->root, 0, NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_IDLE, NGHTTP2_DEFAULT_WEIGHT, 0, 0, NULL, + mem); + + (*session_ptr)->remote_window_size = NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE; + (*session_ptr)->recv_window_size = 0; + (*session_ptr)->consumed_size = 0; + (*session_ptr)->recv_reduction = 0; + (*session_ptr)->local_window_size = NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE; + + (*session_ptr)->goaway_flags = NGHTTP2_GOAWAY_NONE; + (*session_ptr)->local_last_stream_id = (1u << 31) - 1; + (*session_ptr)->remote_last_stream_id = (1u << 31) - 1; + + (*session_ptr)->pending_local_max_concurrent_stream = + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; + (*session_ptr)->pending_enable_push = 1; + + if (server) { + (*session_ptr)->server = 1; + } + + init_settings(&(*session_ptr)->remote_settings); + init_settings(&(*session_ptr)->local_settings); + + (*session_ptr)->max_incoming_reserved_streams = + NGHTTP2_MAX_INCOMING_RESERVED_STREAMS; + + /* Limit max outgoing concurrent streams to sensible value */ + (*session_ptr)->remote_settings.max_concurrent_streams = 100; + + (*session_ptr)->max_send_header_block_length = NGHTTP2_MAX_HEADERSLEN; + + if (option) { + if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) && + option->no_auto_window_update) { + + (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE; + } + + if (option->opt_set_mask & NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS) { + + (*session_ptr)->remote_settings.max_concurrent_streams = + option->peer_max_concurrent_streams; + } + + if (option->opt_set_mask & NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS) { + + (*session_ptr)->max_incoming_reserved_streams = + option->max_reserved_remote_streams; + } + + if ((option->opt_set_mask & NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC) && + option->no_recv_client_magic) { + + (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC; + } + + if ((option->opt_set_mask & NGHTTP2_OPT_NO_HTTP_MESSAGING) && + option->no_http_messaging) { + + (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_HTTP_MESSAGING; + } + + if (option->opt_set_mask & NGHTTP2_OPT_USER_RECV_EXT_TYPES) { + memcpy((*session_ptr)->user_recv_ext_types, option->user_recv_ext_types, + sizeof((*session_ptr)->user_recv_ext_types)); + } + + if (option->opt_set_mask & NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES) { + (*session_ptr)->builtin_recv_ext_types = option->builtin_recv_ext_types; + } + + if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_PING_ACK) && + option->no_auto_ping_ack) { + (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_AUTO_PING_ACK; + } + + if (option->opt_set_mask & NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH) { + (*session_ptr)->max_send_header_block_length = + option->max_send_header_block_length; + } + } + + nbuffer = ((*session_ptr)->max_send_header_block_length + + NGHTTP2_FRAMEBUF_CHUNKLEN - 1) / + NGHTTP2_FRAMEBUF_CHUNKLEN; + + if (nbuffer == 0) { + nbuffer = 1; + } + + /* 1 for Pad Field. */ + rv = nghttp2_bufs_init3(&(*session_ptr)->aob.framebufs, + NGHTTP2_FRAMEBUF_CHUNKLEN, nbuffer, 1, + NGHTTP2_FRAME_HDLEN + 1, mem); + if (rv != 0) { + goto fail_aob_framebuf; + } + + active_outbound_item_reset(&(*session_ptr)->aob, mem); + + (*session_ptr)->callbacks = *callbacks; + (*session_ptr)->user_data = user_data; + + session_inbound_frame_reset(*session_ptr); + + if (nghttp2_enable_strict_preface) { + nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe; + + if (server && + ((*session_ptr)->opt_flags & NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC) == + 0) { + iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC; + iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN; + } else { + iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; + } + + if (!server) { + (*session_ptr)->aob.state = NGHTTP2_OB_SEND_CLIENT_MAGIC; + nghttp2_bufs_add(&(*session_ptr)->aob.framebufs, NGHTTP2_CLIENT_MAGIC, + NGHTTP2_CLIENT_MAGIC_LEN); + } + } + + return 0; + +fail_aob_framebuf: + nghttp2_map_free(&(*session_ptr)->streams); +fail_map: + nghttp2_hd_inflate_free(&(*session_ptr)->hd_inflater); +fail_hd_inflater: + nghttp2_hd_deflate_free(&(*session_ptr)->hd_deflater); +fail_hd_deflater: + nghttp2_mem_free(mem, *session_ptr); +fail_session: + return rv; +} + +int nghttp2_session_client_new(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data) { + return nghttp2_session_client_new3(session_ptr, callbacks, user_data, NULL, + NULL); +} + +int nghttp2_session_client_new2(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option) { + return nghttp2_session_client_new3(session_ptr, callbacks, user_data, option, + NULL); +} + +int nghttp2_session_client_new3(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, + nghttp2_mem *mem) { + int rv; + nghttp2_session *session; + + rv = session_new(&session, callbacks, user_data, 0, option, mem); + + if (rv != 0) { + return rv; + } + /* IDs for use in client */ + session->next_stream_id = 1; + + *session_ptr = session; + + return 0; +} + +int nghttp2_session_server_new(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data) { + return nghttp2_session_server_new3(session_ptr, callbacks, user_data, NULL, + NULL); +} + +int nghttp2_session_server_new2(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option) { + return nghttp2_session_server_new3(session_ptr, callbacks, user_data, option, + NULL); +} + +int nghttp2_session_server_new3(nghttp2_session **session_ptr, + const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, + nghttp2_mem *mem) { + int rv; + nghttp2_session *session; + + rv = session_new(&session, callbacks, user_data, 1, option, mem); + + if (rv != 0) { + return rv; + } + /* IDs for use in client */ + session->next_stream_id = 2; + + *session_ptr = session; + + return 0; +} + +static int free_streams(nghttp2_map_entry *entry, void *ptr) { + nghttp2_session *session; + nghttp2_stream *stream; + nghttp2_outbound_item *item; + nghttp2_mem *mem; + + session = (nghttp2_session *)ptr; + mem = &session->mem; + stream = (nghttp2_stream *)entry; + item = stream->item; + + if (item && !item->queued && item != session->aob.item) { + nghttp2_outbound_item_free(item, mem); + nghttp2_mem_free(mem, item); + } + + nghttp2_stream_free(stream); + nghttp2_mem_free(mem, stream); + + return 0; +} + +static void ob_q_free(nghttp2_outbound_queue *q, nghttp2_mem *mem) { + nghttp2_outbound_item *item, *next; + for (item = q->head; item;) { + next = item->qnext; + nghttp2_outbound_item_free(item, mem); + nghttp2_mem_free(mem, item); + item = next; + } +} + +static int inflight_settings_new(nghttp2_inflight_settings **settings_ptr, + const nghttp2_settings_entry *iv, size_t niv, + nghttp2_mem *mem) { + *settings_ptr = nghttp2_mem_malloc(mem, sizeof(nghttp2_inflight_settings)); + if (!*settings_ptr) { + return NGHTTP2_ERR_NOMEM; + } + + if (niv > 0) { + (*settings_ptr)->iv = nghttp2_frame_iv_copy(iv, niv, mem); + if (!(*settings_ptr)->iv) { + return NGHTTP2_ERR_NOMEM; + } + } else { + (*settings_ptr)->iv = NULL; + } + + (*settings_ptr)->niv = niv; + (*settings_ptr)->next = NULL; + + return 0; +} + +static void inflight_settings_del(nghttp2_inflight_settings *settings, + nghttp2_mem *mem) { + if (!settings) { + return; + } + + nghttp2_mem_free(mem, settings->iv); + nghttp2_mem_free(mem, settings); +} + +void nghttp2_session_del(nghttp2_session *session) { + nghttp2_mem *mem; + nghttp2_inflight_settings *settings; + + if (session == NULL) { + return; + } + + mem = &session->mem; + + for (settings = session->inflight_settings_head; settings;) { + nghttp2_inflight_settings *next = settings->next; + inflight_settings_del(settings, mem); + settings = next; + } + + nghttp2_stream_free(&session->root); + + /* Have to free streams first, so that we can check + stream->item->queued */ + nghttp2_map_each_free(&session->streams, free_streams, session); + nghttp2_map_free(&session->streams); + + ob_q_free(&session->ob_urgent, mem); + ob_q_free(&session->ob_reg, mem); + ob_q_free(&session->ob_syn, mem); + + active_outbound_item_reset(&session->aob, mem); + session_inbound_frame_reset(session); + nghttp2_hd_deflate_free(&session->hd_deflater); + nghttp2_hd_inflate_free(&session->hd_inflater); + nghttp2_bufs_free(&session->aob.framebufs); + nghttp2_mem_free(mem, session); +} + +int nghttp2_session_reprioritize_stream( + nghttp2_session *session, nghttp2_stream *stream, + const nghttp2_priority_spec *pri_spec_in) { + int rv; + nghttp2_stream *dep_stream = NULL; + nghttp2_priority_spec pri_spec_default; + const nghttp2_priority_spec *pri_spec = pri_spec_in; + + assert(pri_spec->stream_id != stream->stream_id); + + if (!nghttp2_stream_in_dep_tree(stream)) { + return 0; + } + + if (pri_spec->stream_id != 0) { + dep_stream = nghttp2_session_get_stream_raw(session, pri_spec->stream_id); + + if (!dep_stream && + session_detect_idle_stream(session, pri_spec->stream_id)) { + + nghttp2_priority_spec_default_init(&pri_spec_default); + + dep_stream = nghttp2_session_open_stream( + session, pri_spec->stream_id, NGHTTP2_FLAG_NONE, &pri_spec_default, + NGHTTP2_STREAM_IDLE, NULL); + + if (dep_stream == NULL) { + return NGHTTP2_ERR_NOMEM; + } + } else if (!dep_stream || !nghttp2_stream_in_dep_tree(dep_stream)) { + nghttp2_priority_spec_default_init(&pri_spec_default); + pri_spec = &pri_spec_default; + } + } + + if (pri_spec->stream_id == 0) { + dep_stream = &session->root; + } else if (nghttp2_stream_dep_find_ancestor(dep_stream, stream)) { + DEBUGF(fprintf(stderr, "stream: cycle detected, dep_stream(%p)=%d " + "stream(%p)=%d\n", + dep_stream, dep_stream->stream_id, stream, + stream->stream_id)); + + nghttp2_stream_dep_remove_subtree(dep_stream); + rv = nghttp2_stream_dep_add_subtree(stream->dep_prev, dep_stream); + if (rv != 0) { + return rv; + } + } + + assert(dep_stream); + + if (dep_stream == stream->dep_prev && !pri_spec->exclusive) { + /* This is minor optimization when just weight is changed. */ + nghttp2_stream_change_weight(stream, pri_spec->weight); + + return 0; + } + + nghttp2_stream_dep_remove_subtree(stream); + + /* We have to update weight after removing stream from tree */ + stream->weight = pri_spec->weight; + + if (pri_spec->exclusive) { + rv = nghttp2_stream_dep_insert_subtree(dep_stream, stream); + } else { + rv = nghttp2_stream_dep_add_subtree(dep_stream, stream); + } + + if (rv != 0) { + return rv; + } + + return 0; +} + +int nghttp2_session_add_item(nghttp2_session *session, + nghttp2_outbound_item *item) { + /* TODO Return error if stream is not found for the frame requiring + stream presence. */ + int rv = 0; + nghttp2_stream *stream; + nghttp2_frame *frame; + + frame = &item->frame; + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + if (frame->hd.type != NGHTTP2_DATA) { + + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + /* We push request HEADERS and push response HEADERS to + dedicated queue because their transmission is affected by + SETTINGS_MAX_CONCURRENT_STREAMS */ + /* TODO If 2 HEADERS are submitted for reserved stream, then + both of them are queued into ob_syn, which is not + desirable. */ + if (frame->headers.cat == NGHTTP2_HCAT_REQUEST || + (stream && stream->state == NGHTTP2_STREAM_RESERVED)) { + nghttp2_outbound_queue_push(&session->ob_syn, item); + item->queued = 1; + break; + } + + nghttp2_outbound_queue_push(&session->ob_reg, item); + item->queued = 1; + break; + case NGHTTP2_SETTINGS: + case NGHTTP2_PING: + nghttp2_outbound_queue_push(&session->ob_urgent, item); + item->queued = 1; + break; + case NGHTTP2_RST_STREAM: + if (stream) { + stream->state = NGHTTP2_STREAM_CLOSING; + } + nghttp2_outbound_queue_push(&session->ob_reg, item); + item->queued = 1; + break; + case NGHTTP2_PUSH_PROMISE: { + nghttp2_headers_aux_data *aux_data; + nghttp2_priority_spec pri_spec; + + aux_data = &item->aux_data.headers; + + if (!stream) { + return NGHTTP2_ERR_STREAM_CLOSED; + } + + nghttp2_priority_spec_init(&pri_spec, stream->stream_id, + NGHTTP2_DEFAULT_WEIGHT, 0); + + if (!nghttp2_session_open_stream( + session, frame->push_promise.promised_stream_id, + NGHTTP2_STREAM_FLAG_NONE, &pri_spec, NGHTTP2_STREAM_RESERVED, + aux_data->stream_user_data)) { + return NGHTTP2_ERR_NOMEM; + } + + /* We don't have to call nghttp2_session_adjust_closed_stream() + here, since stream->stream_id is local stream_id, and it does + not affect closed stream count. */ + + nghttp2_outbound_queue_push(&session->ob_reg, item); + item->queued = 1; + + break; + } + case NGHTTP2_WINDOW_UPDATE: + if (stream) { + stream->window_update_queued = 1; + } else if (frame->hd.stream_id == 0) { + session->window_update_queued = 1; + } + nghttp2_outbound_queue_push(&session->ob_reg, item); + item->queued = 1; + break; + default: + nghttp2_outbound_queue_push(&session->ob_reg, item); + item->queued = 1; + } + + return 0; + } + + if (!stream) { + return NGHTTP2_ERR_STREAM_CLOSED; + } + + if (stream->item) { + return NGHTTP2_ERR_DATA_EXIST; + } + + rv = nghttp2_stream_attach_item(stream, item); + + if (rv != 0) { + return rv; + } + + return 0; +} + +int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id, + uint32_t error_code) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_stream *stream; + nghttp2_mem *mem; + + mem = &session->mem; + stream = nghttp2_session_get_stream(session, stream_id); + if (stream && stream->state == NGHTTP2_STREAM_CLOSING) { + return 0; + } + + /* Cancel pending request HEADERS in ob_syn if this RST_STREAM + refers to that stream. */ + if (!session->server && nghttp2_session_is_my_stream_id(session, stream_id) && + nghttp2_outbound_queue_top(&session->ob_syn)) { + nghttp2_headers_aux_data *aux_data; + nghttp2_frame *headers_frame; + + headers_frame = &nghttp2_outbound_queue_top(&session->ob_syn)->frame; + assert(headers_frame->hd.type == NGHTTP2_HEADERS); + + if (headers_frame->hd.stream_id <= stream_id && + (uint32_t)stream_id < session->next_stream_id) { + + for (item = session->ob_syn.head; item; item = item->qnext) { + aux_data = &item->aux_data.headers; + + if (item->frame.hd.stream_id < stream_id) { + continue; + } + + /* stream_id in ob_syn queue must be strictly increasing. If + we found larger ID, then we can break here. */ + if (item->frame.hd.stream_id > stream_id || aux_data->canceled) { + break; + } + + aux_data->error_code = error_code; + aux_data->canceled = 1; + + return 0; + } + } + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + nghttp2_frame_rst_stream_init(&frame->rst_stream, stream_id, error_code); + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + nghttp2_frame_rst_stream_free(&frame->rst_stream); + nghttp2_mem_free(mem, item); + return rv; + } + return 0; +} + +nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, + int32_t stream_id, uint8_t flags, + nghttp2_priority_spec *pri_spec_in, + nghttp2_stream_state initial_state, + void *stream_user_data) { + int rv; + nghttp2_stream *stream; + nghttp2_stream *dep_stream = NULL; + int stream_alloc = 0; + nghttp2_priority_spec pri_spec_default; + nghttp2_priority_spec *pri_spec = pri_spec_in; + nghttp2_mem *mem; + + mem = &session->mem; + stream = nghttp2_session_get_stream_raw(session, stream_id); + + if (stream) { + assert(stream->state == NGHTTP2_STREAM_IDLE); + assert(nghttp2_stream_in_dep_tree(stream)); + nghttp2_session_detach_idle_stream(session, stream); + rv = nghttp2_stream_dep_remove(stream); + if (rv != 0) { + return NULL; + } + } else { + stream = nghttp2_mem_malloc(mem, sizeof(nghttp2_stream)); + if (stream == NULL) { + return NULL; + } + + stream_alloc = 1; + } + + if (pri_spec->stream_id != 0) { + dep_stream = nghttp2_session_get_stream_raw(session, pri_spec->stream_id); + + if (!dep_stream && + session_detect_idle_stream(session, pri_spec->stream_id)) { + /* Depends on idle stream, which does not exist in memory. + Assign default priority for it. */ + nghttp2_priority_spec_default_init(&pri_spec_default); + + dep_stream = nghttp2_session_open_stream( + session, pri_spec->stream_id, NGHTTP2_FLAG_NONE, &pri_spec_default, + NGHTTP2_STREAM_IDLE, NULL); + + if (dep_stream == NULL) { + if (stream_alloc) { + nghttp2_mem_free(mem, stream); + } + + return NULL; + } + } else if (!dep_stream || !nghttp2_stream_in_dep_tree(dep_stream)) { + /* If dep_stream is not part of dependency tree, stream will get + default priority. This handles the case when + pri_spec->stream_id == stream_id. This happens because we + don't check pri_spec->stream_id against new stream ID in + nghttp2_submit_request. This also handles the case when idle + stream created by PRIORITY frame was opened. Somehow we + first remove the idle stream from dependency tree. This is + done to simplify code base, but ideally we should retain old + dependency. But I'm not sure this adds values. */ + nghttp2_priority_spec_default_init(&pri_spec_default); + pri_spec = &pri_spec_default; + } + } + + if (initial_state == NGHTTP2_STREAM_RESERVED) { + flags |= NGHTTP2_STREAM_FLAG_PUSH; + } + + nghttp2_stream_init(stream, stream_id, flags, initial_state, pri_spec->weight, + (int32_t)session->remote_settings.initial_window_size, + (int32_t)session->local_settings.initial_window_size, + stream_user_data, mem); + + if (stream_alloc) { + rv = nghttp2_map_insert(&session->streams, &stream->map_entry); + if (rv != 0) { + nghttp2_mem_free(mem, stream); + return NULL; + } + } + + switch (initial_state) { + case NGHTTP2_STREAM_RESERVED: + if (nghttp2_session_is_my_stream_id(session, stream_id)) { + /* reserved (local) */ + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); + } else { + /* reserved (remote) */ + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); + ++session->num_incoming_reserved_streams; + } + /* Reserved stream does not count in the concurrent streams + limit. That is one of the DOS vector. */ + break; + case NGHTTP2_STREAM_IDLE: + /* Idle stream does not count toward the concurrent streams limit. + This is used as anchor node in dependency tree. */ + nghttp2_session_keep_idle_stream(session, stream); + break; + default: + if (nghttp2_session_is_my_stream_id(session, stream_id)) { + ++session->num_outgoing_streams; + } else { + ++session->num_incoming_streams; + } + } + + if (pri_spec->stream_id == 0) { + dep_stream = &session->root; + } + + assert(dep_stream); + + if (pri_spec->exclusive) { + rv = nghttp2_stream_dep_insert(dep_stream, stream); + if (rv != 0) { + return NULL; + } + } else { + nghttp2_stream_dep_add(dep_stream, stream); + } + + return stream; +} + +int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, + uint32_t error_code) { + int rv; + nghttp2_stream *stream; + nghttp2_mem *mem; + int is_my_stream_id; + + mem = &session->mem; + stream = nghttp2_session_get_stream(session, stream_id); + + if (!stream) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + DEBUGF(fprintf(stderr, "stream: stream(%p)=%d close\n", stream, + stream->stream_id)); + + if (stream->item) { + nghttp2_outbound_item *item; + + item = stream->item; + + rv = nghttp2_stream_detach_item(stream); + + if (rv != 0) { + return rv; + } + + /* If item is queued, it will be deleted when it is popped + (nghttp2_session_prep_frame() will fail). If session->aob.item + points to this item, let active_outbound_item_reset() + free the item. */ + if (!item->queued && item != session->aob.item) { + nghttp2_outbound_item_free(item, mem); + nghttp2_mem_free(mem, item); + } + } + + /* We call on_stream_close_callback even if stream->state is + NGHTTP2_STREAM_INITIAL. This will happen while sending request + HEADERS, a local endpoint receives RST_STREAM for that stream. It + may be PROTOCOL_ERROR, but without notifying stream closure will + hang the stream in a local endpoint. + */ + + if (session->callbacks.on_stream_close_callback) { + if (session->callbacks.on_stream_close_callback( + session, stream_id, error_code, session->user_data) != 0) { + + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + + is_my_stream_id = nghttp2_session_is_my_stream_id(session, stream_id); + + /* pushed streams which is not opened yet is not counted toward max + concurrent limits */ + if ((stream->flags & NGHTTP2_STREAM_FLAG_PUSH)) { + if (!is_my_stream_id) { + --session->num_incoming_reserved_streams; + } + } else { + if (is_my_stream_id) { + --session->num_outgoing_streams; + } else { + --session->num_incoming_streams; + } + } + + /* Closes both directions just in case they are not closed yet */ + stream->flags |= NGHTTP2_STREAM_FLAG_CLOSED; + + if (session->server && !is_my_stream_id && + nghttp2_stream_in_dep_tree(stream)) { + /* On server side, retain stream at most MAX_CONCURRENT_STREAMS + combined with the current active incoming streams to make + dependency tree work better. */ + nghttp2_session_keep_closed_stream(session, stream); + } else { + rv = nghttp2_session_destroy_stream(session, stream); + if (rv != 0) { + return rv; + } + } + + return 0; +} + +int nghttp2_session_destroy_stream(nghttp2_session *session, + nghttp2_stream *stream) { + nghttp2_mem *mem; + int rv; + + DEBUGF(fprintf(stderr, "stream: destroy closed stream(%p)=%d\n", stream, + stream->stream_id)); + + mem = &session->mem; + + if (nghttp2_stream_in_dep_tree(stream)) { + rv = nghttp2_stream_dep_remove(stream); + if (rv != 0) { + return rv; + } + } + + nghttp2_map_remove(&session->streams, stream->stream_id); + nghttp2_stream_free(stream); + nghttp2_mem_free(mem, stream); + + return 0; +} + +void nghttp2_session_keep_closed_stream(nghttp2_session *session, + nghttp2_stream *stream) { + DEBUGF(fprintf(stderr, "stream: keep closed stream(%p)=%d, state=%d\n", + stream, stream->stream_id, stream->state)); + + if (session->closed_stream_tail) { + session->closed_stream_tail->closed_next = stream; + stream->closed_prev = session->closed_stream_tail; + } else { + session->closed_stream_head = stream; + } + session->closed_stream_tail = stream; + + ++session->num_closed_streams; +} + +void nghttp2_session_keep_idle_stream(nghttp2_session *session, + nghttp2_stream *stream) { + DEBUGF(fprintf(stderr, "stream: keep idle stream(%p)=%d, state=%d\n", stream, + stream->stream_id, stream->state)); + + if (session->idle_stream_tail) { + session->idle_stream_tail->closed_next = stream; + stream->closed_prev = session->idle_stream_tail; + } else { + session->idle_stream_head = stream; + } + session->idle_stream_tail = stream; + + ++session->num_idle_streams; +} + +void nghttp2_session_detach_idle_stream(nghttp2_session *session, + nghttp2_stream *stream) { + nghttp2_stream *prev_stream, *next_stream; + + DEBUGF(fprintf(stderr, "stream: detach idle stream(%p)=%d, state=%d\n", + stream, stream->stream_id, stream->state)); + + prev_stream = stream->closed_prev; + next_stream = stream->closed_next; + + if (prev_stream) { + prev_stream->closed_next = next_stream; + } else { + session->idle_stream_head = next_stream; + } + + if (next_stream) { + next_stream->closed_prev = prev_stream; + } else { + session->idle_stream_tail = prev_stream; + } + + stream->closed_prev = NULL; + stream->closed_next = NULL; + + --session->num_idle_streams; +} + +int nghttp2_session_adjust_closed_stream(nghttp2_session *session) { + size_t num_stream_max; + int rv; + + if (session->local_settings.max_concurrent_streams == + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS) { + num_stream_max = session->pending_local_max_concurrent_stream; + } else { + num_stream_max = session->local_settings.max_concurrent_streams; + } + + DEBUGF(fprintf(stderr, "stream: adjusting kept closed streams " + "num_closed_streams=%zu, num_incoming_streams=%zu, " + "max_concurrent_streams=%zu\n", + session->num_closed_streams, session->num_incoming_streams, + num_stream_max)); + + while (session->num_closed_streams > 0 && + session->num_closed_streams + session->num_incoming_streams > + num_stream_max) { + nghttp2_stream *head_stream; + nghttp2_stream *next; + + head_stream = session->closed_stream_head; + + assert(head_stream); + + next = head_stream->closed_next; + + rv = nghttp2_session_destroy_stream(session, head_stream); + if (rv != 0) { + return rv; + } + + /* head_stream is now freed */ + + session->closed_stream_head = next; + + if (session->closed_stream_head) { + session->closed_stream_head->closed_prev = NULL; + } else { + session->closed_stream_tail = NULL; + } + + --session->num_closed_streams; + } + + return 0; +} + +int nghttp2_session_adjust_idle_stream(nghttp2_session *session) { + size_t max; + int rv; + + /* Make minimum number of idle streams 16, and maximum 100, which + are arbitrary chosen numbers. */ + max = nghttp2_min( + 100, nghttp2_max( + 16, nghttp2_min(session->local_settings.max_concurrent_streams, + session->pending_local_max_concurrent_stream))); + + DEBUGF(fprintf(stderr, "stream: adjusting kept idle streams " + "num_idle_streams=%zu, max=%zu\n", + session->num_idle_streams, max)); + + while (session->num_idle_streams > max) { + nghttp2_stream *head; + nghttp2_stream *next; + + head = session->idle_stream_head; + assert(head); + + next = head->closed_next; + + rv = nghttp2_session_destroy_stream(session, head); + if (rv != 0) { + return rv; + } + + /* head is now destroyed */ + + session->idle_stream_head = next; + + if (session->idle_stream_head) { + session->idle_stream_head->closed_prev = NULL; + } else { + session->idle_stream_tail = NULL; + } + + --session->num_idle_streams; + } + + return 0; +} + +/* + * Closes stream with stream ID |stream_id| if both transmission and + * reception of the stream were disallowed. The |error_code| indicates + * the reason of the closure. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_INVALID_ARGUMENT + * The stream is not found. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +int nghttp2_session_close_stream_if_shut_rdwr(nghttp2_session *session, + nghttp2_stream *stream) { + if ((stream->shut_flags & NGHTTP2_SHUT_RDWR) == NGHTTP2_SHUT_RDWR) { + return nghttp2_session_close_stream(session, stream->stream_id, + NGHTTP2_NO_ERROR); + } + return 0; +} + +/* + * Returns nonzero if local endpoint allows reception of new stream + * from remote. + */ +static int session_allow_incoming_new_stream(nghttp2_session *session) { + return (session->goaway_flags & + (NGHTTP2_GOAWAY_TERM_ON_SEND | NGHTTP2_GOAWAY_SENT)) == 0; +} + +/* + * This function returns nonzero if session is closing. + */ +static int session_is_closing(nghttp2_session *session) { + return (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) != 0 || + (nghttp2_session_want_read(session) == 0 && + nghttp2_session_want_write(session) == 0); +} + +/* + * Check that we can send a frame to the |stream|. This function + * returns 0 if we can send a frame to the |frame|, or one of the + * following negative error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The stream is half-closed for transmission. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + */ +static int session_predicate_for_stream_send(nghttp2_session *session, + nghttp2_stream *stream) { + if (stream == NULL) { + return NGHTTP2_ERR_STREAM_CLOSED; + } + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + if (stream->shut_flags & NGHTTP2_SHUT_WR) { + return NGHTTP2_ERR_STREAM_SHUT_WR; + } + return 0; +} + +int nghttp2_session_check_request_allowed(nghttp2_session *session) { + return !session->server && session->next_stream_id <= INT32_MAX && + (session->goaway_flags & NGHTTP2_GOAWAY_RECV) == 0 && + !session_is_closing(session); +} + +/* + * This function checks request HEADERS frame, which opens stream, can + * be sent at this time. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_START_STREAM_NOT_ALLOWED + * New stream cannot be created because of GOAWAY: session is + * going down or received last_stream_id is strictly less than + * frame->hd.stream_id. + * NGHTTP2_ERR_STREAM_CLOSING + * request HEADERS was canceled by RST_STREAM while it is in queue. + */ +static int session_predicate_request_headers_send(nghttp2_session *session, + nghttp2_outbound_item *item) { + if (item->aux_data.headers.canceled) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + /* If we are terminating session (NGHTTP2_GOAWAY_TERM_ON_SEND), + GOAWAY was received from peer, or session is about to close, new + request is not allowed. */ + if ((session->goaway_flags & NGHTTP2_GOAWAY_RECV) || + session_is_closing(session)) { + return NGHTTP2_ERR_START_STREAM_NOT_ALLOWED; + } + return 0; +} + +/* + * This function checks HEADERS, which is the first frame from the + * server, with the |stream| can be sent at this time. The |stream| + * can be NULL. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed or does not exist. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The transmission is not allowed for this stream (e.g., a frame + * with END_STREAM flag set has already sent) + * NGHTTP2_ERR_INVALID_STREAM_ID + * The stream ID is invalid. + * NGHTTP2_ERR_STREAM_CLOSING + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_INVALID_STREAM_STATE + * The state of the stream is not valid. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + * NGHTTP2_ERR_PROTO + * Client side attempted to send response. + */ +static int session_predicate_response_headers_send(nghttp2_session *session, + nghttp2_stream *stream) { + int rv; + rv = session_predicate_for_stream_send(session, stream); + if (rv != 0) { + return rv; + } + assert(stream); + if (!session->server) { + return NGHTTP2_ERR_PROTO; + } + if (nghttp2_session_is_my_stream_id(session, stream->stream_id)) { + return NGHTTP2_ERR_INVALID_STREAM_ID; + } + if (stream->state == NGHTTP2_STREAM_OPENING) { + return 0; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + return NGHTTP2_ERR_INVALID_STREAM_STATE; +} + +/* + * This function checks HEADERS for reserved stream can be sent. The + * |stream| must be reserved state and the |session| is server side. + * The |stream| can be NULL. + * + * This function returns 0 if it succeeds, or one of the following + * error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The stream is half-closed for transmission. + * NGHTTP2_ERR_PROTO + * The stream is not reserved state + * NGHTTP2_ERR_STREAM_CLOSED + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + * NGHTTP2_ERR_START_STREAM_NOT_ALLOWED + * New stream cannot be created because GOAWAY is already sent or + * received. + * NGHTTP2_ERR_PROTO + * Client side attempted to send push response. + */ +static int +session_predicate_push_response_headers_send(nghttp2_session *session, + nghttp2_stream *stream) { + int rv; + /* TODO Should disallow HEADERS if GOAWAY has already been issued? */ + rv = session_predicate_for_stream_send(session, stream); + if (rv != 0) { + return rv; + } + assert(stream); + if (!session->server) { + return NGHTTP2_ERR_PROTO; + } + if (stream->state != NGHTTP2_STREAM_RESERVED) { + return NGHTTP2_ERR_PROTO; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + if (session->goaway_flags & NGHTTP2_GOAWAY_RECV) { + return NGHTTP2_ERR_START_STREAM_NOT_ALLOWED; + } + return 0; +} + +/* + * This function checks HEADERS, which is neither stream-opening nor + * first response header, with the |stream| can be sent at this time. + * The |stream| can be NULL. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed or does not exist. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The transmission is not allowed for this stream (e.g., a frame + * with END_STREAM flag set has already sent) + * NGHTTP2_ERR_STREAM_CLOSING + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_INVALID_STREAM_STATE + * The state of the stream is not valid. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + */ +static int session_predicate_headers_send(nghttp2_session *session, + nghttp2_stream *stream) { + int rv; + rv = session_predicate_for_stream_send(session, stream); + if (rv != 0) { + return rv; + } + assert(stream); + if (nghttp2_session_is_my_stream_id(session, stream->stream_id)) { + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + return 0; + } + if (stream->state == NGHTTP2_STREAM_OPENED) { + return 0; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + return NGHTTP2_ERR_INVALID_STREAM_STATE; +} + +/* + * This function checks PUSH_PROMISE frame |frame| with the |stream| + * can be sent at this time. The |stream| can be NULL. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_START_STREAM_NOT_ALLOWED + * New stream cannot be created because GOAWAY is already sent or + * received. + * NGHTTP2_ERR_PROTO + * The client side attempts to send PUSH_PROMISE, or the server + * sends PUSH_PROMISE for the stream not initiated by the client. + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed or does not exist. + * NGHTTP2_ERR_STREAM_CLOSING + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The transmission is not allowed for this stream (e.g., a frame + * with END_STREAM flag set has already sent) + * NGHTTP2_ERR_PUSH_DISABLED + * The remote peer disabled reception of PUSH_PROMISE. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + */ +static int session_predicate_push_promise_send(nghttp2_session *session, + nghttp2_stream *stream) { + int rv; + + if (!session->server) { + return NGHTTP2_ERR_PROTO; + } + + rv = session_predicate_for_stream_send(session, stream); + if (rv != 0) { + return rv; + } + + assert(stream); + + if (session->remote_settings.enable_push == 0) { + return NGHTTP2_ERR_PUSH_DISABLED; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + if (session->goaway_flags & NGHTTP2_GOAWAY_RECV) { + return NGHTTP2_ERR_START_STREAM_NOT_ALLOWED; + } + return 0; +} + +/* + * This function checks WINDOW_UPDATE with the stream ID |stream_id| + * can be sent at this time. Note that END_STREAM flag of the previous + * frame does not affect the transmission of the WINDOW_UPDATE frame. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed or does not exist. + * NGHTTP2_ERR_STREAM_CLOSING + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_INVALID_STREAM_STATE + * The state of the stream is not valid. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + */ +static int session_predicate_window_update_send(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + + if (stream_id == 0) { + /* Connection-level window update */ + return 0; + } + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL) { + return NGHTTP2_ERR_STREAM_CLOSED; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + if (state_reserved_local(session, stream)) { + return NGHTTP2_ERR_INVALID_STREAM_STATE; + } + return 0; +} + +static int session_predicate_altsvc_send(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + + if (stream_id == 0) { + return 0; + } + + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL) { + return NGHTTP2_ERR_STREAM_CLOSED; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + + return 0; +} + +/* Take into account settings max frame size and both connection-level + flow control here */ +static ssize_t +nghttp2_session_enforce_flow_control_limits(nghttp2_session *session, + nghttp2_stream *stream, + ssize_t requested_window_size) { + DEBUGF(fprintf(stderr, "send: remote windowsize connection=%d, " + "remote maxframsize=%u, stream(id %d)=%d\n", + session->remote_window_size, + session->remote_settings.max_frame_size, stream->stream_id, + stream->remote_window_size)); + + return nghttp2_min(nghttp2_min(nghttp2_min(requested_window_size, + stream->remote_window_size), + session->remote_window_size), + (int32_t)session->remote_settings.max_frame_size); +} + +/* + * Returns the maximum length of next data read. If the + * connection-level and/or stream-wise flow control are enabled, the + * return value takes into account those current window sizes. The remote + * settings for max frame size is also taken into account. + */ +static size_t nghttp2_session_next_data_read(nghttp2_session *session, + nghttp2_stream *stream) { + ssize_t window_size; + + window_size = nghttp2_session_enforce_flow_control_limits( + session, stream, NGHTTP2_DATA_PAYLOADLEN); + + DEBUGF(fprintf(stderr, "send: available window=%zd\n", window_size)); + + return window_size > 0 ? (size_t)window_size : 0; +} + +/* + * This function checks DATA with the |stream| can be sent at this + * time. The |stream| can be NULL. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_STREAM_CLOSED + * The stream is already closed or does not exist. + * NGHTTP2_ERR_STREAM_SHUT_WR + * The transmission is not allowed for this stream (e.g., a frame + * with END_STREAM flag set has already sent) + * NGHTTP2_ERR_STREAM_CLOSING + * RST_STREAM was queued for this stream. + * NGHTTP2_ERR_INVALID_STREAM_STATE + * The state of the stream is not valid. + * NGHTTP2_ERR_SESSION_CLOSING + * This session is closing. + */ +static int nghttp2_session_predicate_data_send(nghttp2_session *session, + nghttp2_stream *stream) { + int rv; + rv = session_predicate_for_stream_send(session, stream); + if (rv != 0) { + return rv; + } + assert(stream); + if (nghttp2_session_is_my_stream_id(session, stream->stream_id)) { + /* Request body data */ + /* If stream->state is NGHTTP2_STREAM_CLOSING, RST_STREAM was + queued but not yet sent. In this case, we won't send DATA + frames. */ + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + if (stream->state == NGHTTP2_STREAM_RESERVED) { + return NGHTTP2_ERR_INVALID_STREAM_STATE; + } + return 0; + } + /* Response body data */ + if (stream->state == NGHTTP2_STREAM_OPENED) { + return 0; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_STREAM_CLOSING; + } + return NGHTTP2_ERR_INVALID_STREAM_STATE; +} + +static ssize_t session_call_select_padding(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payloadlen) { + ssize_t rv; + + if (frame->hd.length >= max_payloadlen) { + return (ssize_t)frame->hd.length; + } + + if (session->callbacks.select_padding_callback) { + size_t max_paddedlen; + + max_paddedlen = + nghttp2_min(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen); + + rv = session->callbacks.select_padding_callback( + session, frame, max_paddedlen, session->user_data); + if (rv < (ssize_t)frame->hd.length || rv > (ssize_t)max_paddedlen) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + return rv; + } + return (ssize_t)frame->hd.length; +} + +/* Add padding to HEADERS or PUSH_PROMISE. We use + frame->headers.padlen in this function to use the fact that + frame->push_promise has also padlen in the same position. */ +static int session_headers_add_pad(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + ssize_t padded_payloadlen; + nghttp2_active_outbound_item *aob; + nghttp2_bufs *framebufs; + size_t padlen; + size_t max_payloadlen; + + aob = &session->aob; + framebufs = &aob->framebufs; + + max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN, + frame->hd.length + NGHTTP2_MAX_PADLEN); + + padded_payloadlen = + session_call_select_padding(session, frame, max_payloadlen); + + if (nghttp2_is_fatal((int)padded_payloadlen)) { + return (int)padded_payloadlen; + } + + padlen = (size_t)padded_payloadlen - frame->hd.length; + + DEBUGF(fprintf(stderr, "send: padding selected: payloadlen=%zd, padlen=%zu\n", + padded_payloadlen, padlen)); + + rv = nghttp2_frame_add_pad(framebufs, &frame->hd, padlen, 0); + + if (rv != 0) { + return rv; + } + + frame->headers.padlen = padlen; + + return 0; +} + +static size_t session_estimate_headers_payload(nghttp2_session *session, + const nghttp2_nv *nva, + size_t nvlen, + size_t additional) { + return nghttp2_hd_deflate_bound(&session->hd_deflater, nva, nvlen) + + additional; +} + +static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs, + nghttp2_frame *frame) { + ssize_t rv; + nghttp2_buf *buf; + size_t buflen; + size_t framelen; + + assert(session->callbacks.pack_extension_callback); + + buf = &bufs->head->buf; + buflen = nghttp2_min(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN); + + rv = session->callbacks.pack_extension_callback(session, buf->last, buflen, + frame, session->user_data); + if (rv == NGHTTP2_ERR_CANCEL) { + return (int)rv; + } + + if (rv < 0 || (size_t)rv > buflen) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + framelen = (size_t)rv; + + frame->hd.length = framelen; + + assert(buf->pos == buf->last); + buf->last += framelen; + buf->pos -= NGHTTP2_FRAME_HDLEN; + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + return 0; +} + +/* + * This function serializes frame for transmission. + * + * This function returns 0 if it succeeds, or one of negative error + * codes, including both fatal and non-fatal ones. + */ +static int session_prep_frame(nghttp2_session *session, + nghttp2_outbound_item *item) { + int rv; + nghttp2_frame *frame; + nghttp2_mem *mem; + + mem = &session->mem; + frame = &item->frame; + + if (frame->hd.type != NGHTTP2_DATA) { + switch (frame->hd.type) { + case NGHTTP2_HEADERS: { + nghttp2_headers_aux_data *aux_data; + size_t estimated_payloadlen; + + aux_data = &item->aux_data.headers; + + if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) { + /* initial HEADERS, which opens stream */ + nghttp2_stream *stream; + + stream = nghttp2_session_open_stream( + session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, + &frame->headers.pri_spec, NGHTTP2_STREAM_INITIAL, + aux_data->stream_user_data); + + if (stream == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + /* We don't call nghttp2_session_adjust_closed_stream() here, + since we don't keep closed stream in client side */ + + estimated_payloadlen = session_estimate_headers_payload( + session, frame->headers.nva, frame->headers.nvlen, + NGHTTP2_PRIORITY_SPECLEN); + + if (estimated_payloadlen > session->max_send_header_block_length) { + return NGHTTP2_ERR_FRAME_SIZE_ERROR; + } + + rv = session_predicate_request_headers_send(session, item); + if (rv != 0) { + return rv; + } + + if (session_enforce_http_messaging(session)) { + nghttp2_http_record_request_method(stream, frame); + } + } else { + nghttp2_stream *stream; + + estimated_payloadlen = session_estimate_headers_payload( + session, frame->headers.nva, frame->headers.nvlen, + NGHTTP2_PRIORITY_SPECLEN); + + if (estimated_payloadlen > session->max_send_header_block_length) { + return NGHTTP2_ERR_FRAME_SIZE_ERROR; + } + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + if (stream && stream->state == NGHTTP2_STREAM_RESERVED) { + rv = session_predicate_push_response_headers_send(session, stream); + if (rv == 0) { + frame->headers.cat = NGHTTP2_HCAT_PUSH_RESPONSE; + + if (aux_data->stream_user_data) { + stream->stream_user_data = aux_data->stream_user_data; + } + } + } else if (session_predicate_response_headers_send(session, stream) == + 0) { + frame->headers.cat = NGHTTP2_HCAT_RESPONSE; + rv = 0; + } else { + frame->headers.cat = NGHTTP2_HCAT_HEADERS; + + rv = session_predicate_headers_send(session, stream); + } + + if (rv != 0) { + // If stream was already closed, nghttp2_session_get_stream() + // returns NULL, but item is still attached to the stream. + // Search stream including closed again. + stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); + if (stream && stream->item == item) { + int rv2; + + rv2 = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + } + + return rv; + } + } + + rv = nghttp2_frame_pack_headers(&session->aob.framebufs, &frame->headers, + &session->hd_deflater); + + if (rv != 0) { + return rv; + } + + DEBUGF(fprintf(stderr, + "send: before padding, HEADERS serialized in %zd bytes\n", + nghttp2_bufs_len(&session->aob.framebufs))); + + rv = session_headers_add_pad(session, frame); + + if (rv != 0) { + return rv; + } + + DEBUGF(fprintf(stderr, "send: HEADERS finally serialized in %zd bytes\n", + nghttp2_bufs_len(&session->aob.framebufs))); + + if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) { + assert(session->last_sent_stream_id < frame->hd.stream_id); + session->last_sent_stream_id = frame->hd.stream_id; + } + + break; + } + case NGHTTP2_PRIORITY: { + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + /* PRIORITY frame can be sent at any time and to any stream + ID. */ + nghttp2_frame_pack_priority(&session->aob.framebufs, &frame->priority); + + /* Peer can send PRIORITY frame against idle stream to create + "anchor" in dependency tree. Only client can do this in + nghttp2. In nghttp2, only server retains non-active (closed + or idle) streams in memory, so we don't open stream here. */ + break; + } + case NGHTTP2_RST_STREAM: + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + nghttp2_frame_pack_rst_stream(&session->aob.framebufs, + &frame->rst_stream); + break; + case NGHTTP2_SETTINGS: { + if (frame->hd.flags & NGHTTP2_FLAG_ACK) { + assert(session->obq_flood_counter_ > 0); + --session->obq_flood_counter_; + /* When session is about to close, don't send SETTINGS ACK. + We are required to send SETTINGS without ACK though; for + example, we have to send SETTINGS as a part of connection + preface. */ + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + } + + rv = nghttp2_frame_pack_settings(&session->aob.framebufs, + &frame->settings); + if (rv != 0) { + return rv; + } + break; + } + case NGHTTP2_PUSH_PROMISE: { + nghttp2_stream *stream; + size_t estimated_payloadlen; + + estimated_payloadlen = session_estimate_headers_payload( + session, frame->push_promise.nva, frame->push_promise.nvlen, 0); + + if (estimated_payloadlen > session->max_send_header_block_length) { + return NGHTTP2_ERR_FRAME_SIZE_ERROR; + } + + /* stream could be NULL if associated stream was already + closed. */ + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + /* predicte should fail if stream is NULL. */ + rv = session_predicate_push_promise_send(session, stream); + if (rv != 0) { + return rv; + } + + assert(stream); + + rv = nghttp2_frame_pack_push_promise( + &session->aob.framebufs, &frame->push_promise, &session->hd_deflater); + if (rv != 0) { + return rv; + } + rv = session_headers_add_pad(session, frame); + if (rv != 0) { + return rv; + } + + assert(session->last_sent_stream_id + 2 <= + frame->push_promise.promised_stream_id); + session->last_sent_stream_id = frame->push_promise.promised_stream_id; + + break; + } + case NGHTTP2_PING: + if (frame->hd.flags & NGHTTP2_FLAG_ACK) { + assert(session->obq_flood_counter_ > 0); + --session->obq_flood_counter_; + } + + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + nghttp2_frame_pack_ping(&session->aob.framebufs, &frame->ping); + break; + case NGHTTP2_GOAWAY: + rv = nghttp2_frame_pack_goaway(&session->aob.framebufs, &frame->goaway); + if (rv != 0) { + return rv; + } + session->local_last_stream_id = frame->goaway.last_stream_id; + + break; + case NGHTTP2_WINDOW_UPDATE: + rv = session_predicate_window_update_send(session, frame->hd.stream_id); + if (rv != 0) { + return rv; + } + nghttp2_frame_pack_window_update(&session->aob.framebufs, + &frame->window_update); + break; + case NGHTTP2_CONTINUATION: + /* We never handle CONTINUATION here. */ + assert(0); + break; + default: { + nghttp2_ext_aux_data *aux_data; + + /* extension frame */ + + aux_data = &item->aux_data.ext; + + if (aux_data->builtin == 0) { + if (session_is_closing(session)) { + return NGHTTP2_ERR_SESSION_CLOSING; + } + + rv = session_pack_extension(session, &session->aob.framebufs, frame); + if (rv != 0) { + return rv; + } + + break; + } + + switch (frame->hd.type) { + case NGHTTP2_ALTSVC: + rv = session_predicate_altsvc_send(session, frame->hd.stream_id); + if (rv != 0) { + return rv; + } + + nghttp2_frame_pack_altsvc(&session->aob.framebufs, &frame->ext); + + break; + default: + /* Unreachable here */ + assert(0); + break; + } + + break; + } + } + return 0; + } else { + size_t next_readmax; + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + if (stream) { + assert(stream->item == item); + } + + rv = nghttp2_session_predicate_data_send(session, stream); + if (rv != 0) { + // If stream was already closed, nghttp2_session_get_stream() + // returns NULL, but item is still attached to the stream. + // Search stream including closed again. + stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); + if (stream) { + int rv2; + + rv2 = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + } + + return rv; + } + /* Assuming stream is not NULL */ + assert(stream); + next_readmax = nghttp2_session_next_data_read(session, stream); + + if (next_readmax == 0) { + + /* This must be true since we only pop DATA frame item from + queue when session->remote_window_size > 0 */ + assert(session->remote_window_size > 0); + + rv = nghttp2_stream_defer_item(stream, + NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session->aob.item = NULL; + active_outbound_item_reset(&session->aob, mem); + return NGHTTP2_ERR_DEFERRED; + } + + rv = nghttp2_session_pack_data(session, &session->aob.framebufs, + next_readmax, frame, &item->aux_data.data, + stream); + if (rv == NGHTTP2_ERR_DEFERRED) { + rv = nghttp2_stream_defer_item(stream, NGHTTP2_STREAM_FLAG_DEFERRED_USER); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session->aob.item = NULL; + active_outbound_item_reset(&session->aob, mem); + return NGHTTP2_ERR_DEFERRED; + } + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + rv = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = nghttp2_session_add_rst_stream(session, frame->hd.stream_id, + NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + } + if (rv != 0) { + int rv2; + + rv2 = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + + return rv; + } + return 0; + } +} + +nghttp2_outbound_item * +nghttp2_session_get_next_ob_item(nghttp2_session *session) { + if (nghttp2_outbound_queue_top(&session->ob_urgent)) { + return nghttp2_outbound_queue_top(&session->ob_urgent); + } + + if (nghttp2_outbound_queue_top(&session->ob_reg)) { + return nghttp2_outbound_queue_top(&session->ob_reg); + } + + if (!session_is_outgoing_concurrent_streams_max(session)) { + if (nghttp2_outbound_queue_top(&session->ob_syn)) { + return nghttp2_outbound_queue_top(&session->ob_syn); + } + } + + if (session->remote_window_size > 0) { + return nghttp2_stream_next_outbound_item(&session->root); + } + + return NULL; +} + +nghttp2_outbound_item * +nghttp2_session_pop_next_ob_item(nghttp2_session *session) { + nghttp2_outbound_item *item; + + item = nghttp2_outbound_queue_top(&session->ob_urgent); + if (item) { + nghttp2_outbound_queue_pop(&session->ob_urgent); + item->queued = 0; + return item; + } + + item = nghttp2_outbound_queue_top(&session->ob_reg); + if (item) { + nghttp2_outbound_queue_pop(&session->ob_reg); + item->queued = 0; + return item; + } + + if (!session_is_outgoing_concurrent_streams_max(session)) { + item = nghttp2_outbound_queue_top(&session->ob_syn); + if (item) { + nghttp2_outbound_queue_pop(&session->ob_syn); + item->queued = 0; + return item; + } + } + + if (session->remote_window_size > 0) { + return nghttp2_stream_next_outbound_item(&session->root); + } + + return NULL; +} + +static int session_call_before_frame_send(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + if (session->callbacks.before_frame_send_callback) { + rv = session->callbacks.before_frame_send_callback(session, frame, + session->user_data); + if (rv == NGHTTP2_ERR_CANCEL) { + return rv; + } + + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; +} + +static int session_call_on_frame_send(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + if (session->callbacks.on_frame_send_callback) { + rv = session->callbacks.on_frame_send_callback(session, frame, + session->user_data); + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; +} + +static int find_stream_on_goaway_func(nghttp2_map_entry *entry, void *ptr) { + nghttp2_close_stream_on_goaway_arg *arg; + nghttp2_stream *stream; + + arg = (nghttp2_close_stream_on_goaway_arg *)ptr; + stream = (nghttp2_stream *)entry; + + if (nghttp2_session_is_my_stream_id(arg->session, stream->stream_id)) { + if (arg->incoming) { + return 0; + } + } else if (!arg->incoming) { + return 0; + } + + if (stream->state != NGHTTP2_STREAM_IDLE && + (stream->flags & NGHTTP2_STREAM_FLAG_CLOSED) == 0 && + stream->stream_id > arg->last_stream_id) { + /* We are collecting streams to close because we cannot call + nghttp2_session_close_stream() inside nghttp2_map_each(). + Reuse closed_next member.. bad choice? */ + assert(stream->closed_next == NULL); + assert(stream->closed_prev == NULL); + + if (arg->head) { + stream->closed_next = arg->head; + arg->head = stream; + } else { + arg->head = stream; + } + } + + return 0; +} + +/* Closes non-idle and non-closed streams whose stream ID > + last_stream_id. If incoming is nonzero, we are going to close + incoming streams. Otherwise, close outgoing streams. */ +static int session_close_stream_on_goaway(nghttp2_session *session, + int32_t last_stream_id, + int incoming) { + int rv; + nghttp2_stream *stream, *next_stream; + nghttp2_close_stream_on_goaway_arg arg = {session, NULL, last_stream_id, + incoming}; + uint32_t error_code; + + rv = nghttp2_map_each(&session->streams, find_stream_on_goaway_func, &arg); + assert(rv == 0); + + error_code = + session->server && incoming ? NGHTTP2_REFUSED_STREAM : NGHTTP2_CANCEL; + + stream = arg.head; + while (stream) { + next_stream = stream->closed_next; + stream->closed_next = NULL; + rv = nghttp2_session_close_stream(session, stream->stream_id, error_code); + + /* stream may be deleted here */ + + stream = next_stream; + + if (nghttp2_is_fatal(rv)) { + /* Clean up closed_next member just in case */ + while (stream) { + next_stream = stream->closed_next; + stream->closed_next = NULL; + stream = next_stream; + } + return rv; + } + } + + return 0; +} + +static void reschedule_stream(nghttp2_stream *stream) { + stream->last_writelen = stream->item->frame.hd.length; + + nghttp2_stream_reschedule(stream); +} + +static int session_update_stream_consumed_size(nghttp2_session *session, + nghttp2_stream *stream, + size_t delta_size); + +static int session_update_connection_consumed_size(nghttp2_session *session, + size_t delta_size); + +static int session_update_recv_connection_window_size(nghttp2_session *session, + size_t delta_size); + +static int session_update_recv_stream_window_size(nghttp2_session *session, + nghttp2_stream *stream, + size_t delta_size, + int send_window_update); + +/* + * Called after a frame is sent. This function runs + * on_frame_send_callback and handles stream closure upon END_STREAM + * or RST_STREAM. This function does not reset session->aob. It is a + * responsibility of session_after_frame_sent2. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +static int session_after_frame_sent1(nghttp2_session *session) { + int rv; + nghttp2_active_outbound_item *aob = &session->aob; + nghttp2_outbound_item *item = aob->item; + nghttp2_bufs *framebufs = &aob->framebufs; + nghttp2_frame *frame; + + frame = &item->frame; + + if (frame->hd.type != NGHTTP2_DATA) { + + if (frame->hd.type == NGHTTP2_HEADERS || + frame->hd.type == NGHTTP2_PUSH_PROMISE) { + + if (nghttp2_bufs_next_present(framebufs)) { + DEBUGF(fprintf(stderr, "send: CONTINUATION exists, just return\n")); + return 0; + } + } + rv = session_call_on_frame_send(session, frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + switch (frame->hd.type) { + case NGHTTP2_HEADERS: { + nghttp2_headers_aux_data *aux_data; + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream) { + break; + } + + if (stream->item == item) { + rv = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + switch (frame->headers.cat) { + case NGHTTP2_HCAT_REQUEST: { + stream->state = NGHTTP2_STREAM_OPENING; + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); + } + rv = nghttp2_session_close_stream_if_shut_rdwr(session, stream); + if (nghttp2_is_fatal(rv)) { + return rv; + } + /* We assume aux_data is a pointer to nghttp2_headers_aux_data */ + aux_data = &item->aux_data.headers; + if (aux_data->data_prd.read_callback) { + /* nghttp2_submit_data() makes a copy of aux_data->data_prd */ + rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, + frame->hd.stream_id, &aux_data->data_prd); + if (nghttp2_is_fatal(rv)) { + return rv; + } + /* TODO nghttp2_submit_data() may fail if stream has already + DATA frame item. We might have to handle it here. */ + } + break; + } + case NGHTTP2_HCAT_PUSH_RESPONSE: + stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_PUSH); + ++session->num_outgoing_streams; + /* Fall through */ + case NGHTTP2_HCAT_RESPONSE: + stream->state = NGHTTP2_STREAM_OPENED; + /* Fall through */ + case NGHTTP2_HCAT_HEADERS: + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); + } + rv = nghttp2_session_close_stream_if_shut_rdwr(session, stream); + if (nghttp2_is_fatal(rv)) { + return rv; + } + /* We assume aux_data is a pointer to nghttp2_headers_aux_data */ + aux_data = &item->aux_data.headers; + if (aux_data->data_prd.read_callback) { + rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, + frame->hd.stream_id, &aux_data->data_prd); + if (nghttp2_is_fatal(rv)) { + return rv; + } + /* TODO nghttp2_submit_data() may fail if stream has already + DATA frame item. We might have to handle it here. */ + } + break; + } + break; + } + case NGHTTP2_PRIORITY: { + nghttp2_stream *stream; + + if (session->server) { + break; + } + + stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); + + if (!stream) { + if (!session_detect_idle_stream(session, frame->hd.stream_id)) { + break; + } + + stream = nghttp2_session_open_stream( + session, frame->hd.stream_id, NGHTTP2_FLAG_NONE, + &frame->priority.pri_spec, NGHTTP2_STREAM_IDLE, NULL); + if (!stream) { + return NGHTTP2_ERR_NOMEM; + } + } else { + rv = nghttp2_session_reprioritize_stream(session, stream, + &frame->priority.pri_spec); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + rv = nghttp2_session_adjust_idle_stream(session); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + break; + } + case NGHTTP2_RST_STREAM: + rv = nghttp2_session_close_stream(session, frame->hd.stream_id, + frame->rst_stream.error_code); + if (nghttp2_is_fatal(rv)) { + return rv; + } + break; + case NGHTTP2_GOAWAY: { + nghttp2_goaway_aux_data *aux_data; + + aux_data = &item->aux_data.goaway; + + if ((aux_data->flags & NGHTTP2_GOAWAY_AUX_SHUTDOWN_NOTICE) == 0) { + + if (aux_data->flags & NGHTTP2_GOAWAY_AUX_TERM_ON_SEND) { + session->goaway_flags |= NGHTTP2_GOAWAY_TERM_SENT; + } + + session->goaway_flags |= NGHTTP2_GOAWAY_SENT; + + rv = session_close_stream_on_goaway(session, + frame->goaway.last_stream_id, 1); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + break; + } + case NGHTTP2_WINDOW_UPDATE: + if (frame->hd.stream_id == 0) { + session->window_update_queued = 0; + if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { + rv = session_update_connection_consumed_size(session, 0); + } else { + rv = session_update_recv_connection_window_size(session, 0); + } + } else { + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream) { + break; + } + + stream->window_update_queued = 0; + + /* We don't have to send WINDOW_UPDATE if END_STREAM from peer + is seen. */ + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + break; + } + + if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { + rv = session_update_stream_consumed_size(session, stream, 0); + } else { + rv = session_update_recv_stream_window_size(session, stream, 0, 1); + } + } + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + break; + default: + break; + } + + return 0; + } else { + nghttp2_stream *stream; + nghttp2_data_aux_data *aux_data; + + aux_data = &item->aux_data.data; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + /* We update flow control window after a frame was completely + sent. This is possible because we choose payload length not to + exceed the window */ + session->remote_window_size -= (int32_t)frame->hd.length; + if (stream) { + stream->remote_window_size -= (int32_t)frame->hd.length; + } + + if (stream && aux_data->eof) { + rv = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + /* Call on_frame_send_callback after + nghttp2_stream_detach_item(), so that application can issue + nghttp2_submit_data() in the callback. */ + if (session->callbacks.on_frame_send_callback) { + rv = session_call_on_frame_send(session, frame); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + int stream_closed; + + stream_closed = + (stream->shut_flags & NGHTTP2_SHUT_RDWR) == NGHTTP2_SHUT_RDWR; + + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); + + rv = nghttp2_session_close_stream_if_shut_rdwr(session, stream); + if (nghttp2_is_fatal(rv)) { + return rv; + } + /* stream may be NULL if it was closed */ + if (stream_closed) { + stream = NULL; + } + } + return 0; + } + + if (session->callbacks.on_frame_send_callback) { + rv = session_call_on_frame_send(session, frame); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + return 0; + } + /* Unreachable */ + assert(0); + return 0; +} + +/* + * Called after a frame is sent and session_after_frame_sent1. This + * function is responsible to reset session->aob. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + */ +static int session_after_frame_sent2(nghttp2_session *session) { + int rv; + nghttp2_active_outbound_item *aob = &session->aob; + nghttp2_outbound_item *item = aob->item; + nghttp2_bufs *framebufs = &aob->framebufs; + nghttp2_frame *frame; + nghttp2_mem *mem; + nghttp2_stream *stream; + nghttp2_data_aux_data *aux_data; + + mem = &session->mem; + frame = &item->frame; + + if (frame->hd.type != NGHTTP2_DATA) { + + if (frame->hd.type == NGHTTP2_HEADERS || + frame->hd.type == NGHTTP2_PUSH_PROMISE) { + + if (nghttp2_bufs_next_present(framebufs)) { + framebufs->cur = framebufs->cur->next; + + DEBUGF(fprintf(stderr, "send: next CONTINUATION frame, %zu bytes\n", + nghttp2_buf_len(&framebufs->cur->buf))); + + return 0; + } + } + + active_outbound_item_reset(&session->aob, mem); + + return 0; + } + + /* DATA frame */ + + aux_data = &item->aux_data.data; + + /* On EOF, we have already detached data. Please note that + application may issue nghttp2_submit_data() in + on_frame_send_callback (call from session_after_frame_sent1), + which attach data to stream. We don't want to detach it. */ + if (aux_data->eof) { + active_outbound_item_reset(aob, mem); + + return 0; + } + + /* Reset no_copy here because next write may not use this. */ + aux_data->no_copy = 0; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + /* If session is closed or RST_STREAM was queued, we won't send + further data. */ + if (nghttp2_session_predicate_data_send(session, stream) != 0) { + if (stream) { + rv = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + active_outbound_item_reset(aob, mem); + + return 0; + } + + aob->item = NULL; + active_outbound_item_reset(&session->aob, mem); + + return 0; +} + +static int session_call_send_data(nghttp2_session *session, + nghttp2_outbound_item *item, + nghttp2_bufs *framebufs) { + int rv; + nghttp2_buf *buf; + size_t length; + nghttp2_frame *frame; + nghttp2_data_aux_data *aux_data; + + buf = &framebufs->cur->buf; + frame = &item->frame; + length = frame->hd.length - frame->data.padlen; + aux_data = &item->aux_data.data; + + rv = session->callbacks.send_data_callback(session, frame, buf->pos, length, + &aux_data->data_prd.source, + session->user_data); + + switch (rv) { + case 0: + case NGHTTP2_ERR_WOULDBLOCK: + case NGHTTP2_ERR_PAUSE: + case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE: + return rv; + default: + return NGHTTP2_ERR_CALLBACK_FAILURE; + } +} + +static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, + const uint8_t **data_ptr, + int fast_cb) { + int rv; + nghttp2_active_outbound_item *aob; + nghttp2_bufs *framebufs; + nghttp2_mem *mem; + + mem = &session->mem; + aob = &session->aob; + framebufs = &aob->framebufs; + + /* We may have idle streams more than we expect (e.g., + nghttp2_session_change_stream_priority() or + nghttp2_session_create_idle_stream()). Adjust them here. */ + rv = nghttp2_session_adjust_idle_stream(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + for (;;) { + switch (aob->state) { + case NGHTTP2_OB_POP_ITEM: { + nghttp2_outbound_item *item; + + item = nghttp2_session_pop_next_ob_item(session); + if (item == NULL) { + return 0; + } + + rv = session_prep_frame(session, item); + if (rv == NGHTTP2_ERR_DEFERRED) { + DEBUGF(fprintf(stderr, "send: frame transmission deferred\n")); + break; + } + if (rv < 0) { + int32_t opened_stream_id = 0; + uint32_t error_code = NGHTTP2_INTERNAL_ERROR; + + DEBUGF(fprintf(stderr, "send: frame preparation failed with %s\n", + nghttp2_strerror(rv))); + /* TODO If the error comes from compressor, the connection + must be closed. */ + if (item->frame.hd.type != NGHTTP2_DATA && + session->callbacks.on_frame_not_send_callback && is_non_fatal(rv)) { + nghttp2_frame *frame = &item->frame; + /* The library is responsible for the transmission of + WINDOW_UPDATE frame, so we don't call error callback for + it. */ + if (frame->hd.type != NGHTTP2_WINDOW_UPDATE && + session->callbacks.on_frame_not_send_callback( + session, frame, rv, session->user_data) != 0) { + + nghttp2_outbound_item_free(item, mem); + nghttp2_mem_free(mem, item); + + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + /* We have to close stream opened by failed request HEADERS + or PUSH_PROMISE. */ + switch (item->frame.hd.type) { + case NGHTTP2_HEADERS: + if (item->frame.headers.cat == NGHTTP2_HCAT_REQUEST) { + opened_stream_id = item->frame.hd.stream_id; + if (item->aux_data.headers.canceled) { + error_code = item->aux_data.headers.error_code; + } else { + /* Set error_code to REFUSED_STREAM so that application + can send request again. */ + error_code = NGHTTP2_REFUSED_STREAM; + } + } + break; + case NGHTTP2_PUSH_PROMISE: + opened_stream_id = item->frame.push_promise.promised_stream_id; + break; + } + if (opened_stream_id) { + /* careful not to override rv */ + int rv2; + rv2 = nghttp2_session_close_stream(session, opened_stream_id, + error_code); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + } + + nghttp2_outbound_item_free(item, mem); + nghttp2_mem_free(mem, item); + active_outbound_item_reset(aob, mem); + + if (rv == NGHTTP2_ERR_HEADER_COMP) { + /* If header compression error occurred, should terminiate + connection. */ + rv = nghttp2_session_terminate_session(session, + NGHTTP2_INTERNAL_ERROR); + } + if (nghttp2_is_fatal(rv)) { + return rv; + } + break; + } + + aob->item = item; + + nghttp2_bufs_rewind(framebufs); + + if (item->frame.hd.type != NGHTTP2_DATA) { + nghttp2_frame *frame; + + frame = &item->frame; + + DEBUGF(fprintf(stderr, "send: next frame: payloadlen=%zu, type=%u, " + "flags=0x%02x, stream_id=%d\n", + frame->hd.length, frame->hd.type, frame->hd.flags, + frame->hd.stream_id)); + + rv = session_call_before_frame_send(session, frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (rv == NGHTTP2_ERR_CANCEL) { + int32_t opened_stream_id = 0; + uint32_t error_code = NGHTTP2_INTERNAL_ERROR; + + if (session->callbacks.on_frame_not_send_callback) { + if (session->callbacks.on_frame_not_send_callback( + session, frame, rv, session->user_data) != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + + /* We have to close stream opened by canceled request + HEADERS or PUSH_PROMISE. */ + switch (item->frame.hd.type) { + case NGHTTP2_HEADERS: + if (item->frame.headers.cat == NGHTTP2_HCAT_REQUEST) { + opened_stream_id = item->frame.hd.stream_id; + /* We don't have to check + item->aux_data.headers.canceled since it has already + been checked. */ + /* Set error_code to REFUSED_STREAM so that application + can send request again. */ + error_code = NGHTTP2_REFUSED_STREAM; + } + break; + case NGHTTP2_PUSH_PROMISE: + opened_stream_id = item->frame.push_promise.promised_stream_id; + break; + } + if (opened_stream_id) { + /* careful not to override rv */ + int rv2; + rv2 = nghttp2_session_close_stream(session, opened_stream_id, + error_code); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + } + + active_outbound_item_reset(aob, mem); + + break; + } + } else { + DEBUGF(fprintf(stderr, "send: next frame: DATA\n")); + + if (item->aux_data.data.no_copy) { + aob->state = NGHTTP2_OB_SEND_NO_COPY; + break; + } + } + + DEBUGF(fprintf(stderr, + "send: start transmitting frame type=%u, length=%zd\n", + framebufs->cur->buf.pos[3], + framebufs->cur->buf.last - framebufs->cur->buf.pos)); + + aob->state = NGHTTP2_OB_SEND_DATA; + + break; + } + case NGHTTP2_OB_SEND_DATA: { + size_t datalen; + nghttp2_buf *buf; + + buf = &framebufs->cur->buf; + + if (buf->pos == buf->last) { + DEBUGF(fprintf(stderr, "send: end transmission of a frame\n")); + + /* Frame has completely sent */ + if (fast_cb) { + rv = session_after_frame_sent2(session); + } else { + rv = session_after_frame_sent1(session); + if (rv < 0) { + /* FATAL */ + assert(nghttp2_is_fatal(rv)); + return rv; + } + rv = session_after_frame_sent2(session); + } + if (rv < 0) { + /* FATAL */ + assert(nghttp2_is_fatal(rv)); + return rv; + } + /* We have already adjusted the next state */ + break; + } + + *data_ptr = buf->pos; + datalen = nghttp2_buf_len(buf); + + /* We increment the offset here. If send_callback does not send + everything, we will adjust it. */ + buf->pos += datalen; + + return (ssize_t)datalen; + } + case NGHTTP2_OB_SEND_NO_COPY: { + nghttp2_stream *stream; + nghttp2_frame *frame; + int pause; + + DEBUGF(fprintf(stderr, "send: no copy DATA\n")); + + frame = &aob->item->frame; + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (stream == NULL) { + DEBUGF(fprintf( + stderr, + "send: no copy DATA cancelled because stream was closed\n")); + + active_outbound_item_reset(aob, mem); + + break; + } + + rv = session_call_send_data(session, aob->item, framebufs); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + rv = nghttp2_stream_detach_item(stream); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = nghttp2_session_add_rst_stream(session, frame->hd.stream_id, + NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + active_outbound_item_reset(aob, mem); + + break; + } + + if (rv == NGHTTP2_ERR_WOULDBLOCK) { + return 0; + } + + pause = (rv == NGHTTP2_ERR_PAUSE); + + rv = session_after_frame_sent1(session); + if (rv < 0) { + assert(nghttp2_is_fatal(rv)); + return rv; + } + rv = session_after_frame_sent2(session); + if (rv < 0) { + assert(nghttp2_is_fatal(rv)); + return rv; + } + + /* We have already adjusted the next state */ + + if (pause) { + return 0; + } + + break; + } + case NGHTTP2_OB_SEND_CLIENT_MAGIC: { + size_t datalen; + nghttp2_buf *buf; + + buf = &framebufs->cur->buf; + + if (buf->pos == buf->last) { + DEBUGF(fprintf(stderr, "send: end transmission of client magic\n")); + active_outbound_item_reset(aob, mem); + break; + } + + *data_ptr = buf->pos; + datalen = nghttp2_buf_len(buf); + + buf->pos += datalen; + + return (ssize_t)datalen; + } + } + } +} + +ssize_t nghttp2_session_mem_send(nghttp2_session *session, + const uint8_t **data_ptr) { + int rv; + ssize_t len; + + *data_ptr = NULL; + + len = nghttp2_session_mem_send_internal(session, data_ptr, 1); + if (len <= 0) { + return len; + } + + if (session->aob.item) { + /* We have to call session_after_frame_sent1 here to handle stream + closure upon transmission of frames. Otherwise, END_STREAM may + be reached to client before we call nghttp2_session_mem_send + again and we may get exceeding number of incoming streams. */ + rv = session_after_frame_sent1(session); + if (rv < 0) { + assert(nghttp2_is_fatal(rv)); + return (ssize_t)rv; + } + } + + return len; +} + +int nghttp2_session_send(nghttp2_session *session) { + const uint8_t *data = NULL; + ssize_t datalen; + ssize_t sentlen; + nghttp2_bufs *framebufs; + + framebufs = &session->aob.framebufs; + + for (;;) { + datalen = nghttp2_session_mem_send_internal(session, &data, 0); + if (datalen <= 0) { + return (int)datalen; + } + sentlen = session->callbacks.send_callback(session, data, (size_t)datalen, + 0, session->user_data); + if (sentlen < 0) { + if (sentlen == NGHTTP2_ERR_WOULDBLOCK) { + /* Transmission canceled. Rewind the offset */ + framebufs->cur->buf.pos -= datalen; + + return 0; + } + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + /* Rewind the offset to the amount of unsent bytes */ + framebufs->cur->buf.pos -= datalen - sentlen; + } +} + +static ssize_t session_recv(nghttp2_session *session, uint8_t *buf, + size_t len) { + ssize_t rv; + rv = session->callbacks.recv_callback(session, buf, len, 0, + session->user_data); + if (rv > 0) { + if ((size_t)rv > len) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } else if (rv < 0 && rv != NGHTTP2_ERR_WOULDBLOCK && rv != NGHTTP2_ERR_EOF) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + return rv; +} + +static int session_call_on_begin_frame(nghttp2_session *session, + const nghttp2_frame_hd *hd) { + int rv; + + if (session->callbacks.on_begin_frame_callback) { + + rv = session->callbacks.on_begin_frame_callback(session, hd, + session->user_data); + + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + + return 0; +} + +static int session_call_on_frame_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + if (session->callbacks.on_frame_recv_callback) { + rv = session->callbacks.on_frame_recv_callback(session, frame, + session->user_data); + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; +} + +static int session_call_on_begin_headers(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + DEBUGF(fprintf(stderr, "recv: call on_begin_headers callback stream_id=%d\n", + frame->hd.stream_id)); + if (session->callbacks.on_begin_headers_callback) { + rv = session->callbacks.on_begin_headers_callback(session, frame, + session->user_data); + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + return rv; + } + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; +} + +static int session_call_on_header(nghttp2_session *session, + const nghttp2_frame *frame, + const nghttp2_hd_nv *nv) { + int rv = 0; + if (session->callbacks.on_header_callback2) { + rv = session->callbacks.on_header_callback2( + session, frame, nv->name, nv->value, nv->flags, session->user_data); + } else if (session->callbacks.on_header_callback) { + rv = session->callbacks.on_header_callback( + session, frame, nv->name->base, nv->name->len, nv->value->base, + nv->value->len, nv->flags, session->user_data); + } + + if (rv == NGHTTP2_ERR_PAUSE || rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + return rv; + } + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + return 0; +} + +static int +session_call_on_extension_chunk_recv_callback(nghttp2_session *session, + const uint8_t *data, size_t len) { + int rv; + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + if (session->callbacks.on_extension_chunk_recv_callback) { + rv = session->callbacks.on_extension_chunk_recv_callback( + session, &frame->hd, data, len, session->user_data); + if (rv == NGHTTP2_ERR_CANCEL) { + return rv; + } + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + + return 0; +} + +static int session_call_unpack_extension_callback(nghttp2_session *session) { + int rv; + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + void *payload = NULL; + + rv = session->callbacks.unpack_extension_callback( + session, &payload, &frame->hd, session->user_data); + if (rv == NGHTTP2_ERR_CANCEL) { + return rv; + } + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + frame->ext.payload = payload; + + return 0; +} + +/* + * Handles frame size error. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int session_handle_frame_size_error(nghttp2_session *session, + nghttp2_frame *frame _U_) { + /* TODO Currently no callback is called for this error, because we + call this callback before reading any payload */ + return nghttp2_session_terminate_session(session, NGHTTP2_FRAME_SIZE_ERROR); +} + +static uint32_t get_error_code_from_lib_error_code(int lib_error_code) { + switch (lib_error_code) { + case NGHTTP2_ERR_STREAM_CLOSED: + return NGHTTP2_STREAM_CLOSED; + case NGHTTP2_ERR_HEADER_COMP: + return NGHTTP2_COMPRESSION_ERROR; + case NGHTTP2_ERR_FRAME_SIZE_ERROR: + return NGHTTP2_FRAME_SIZE_ERROR; + case NGHTTP2_ERR_FLOW_CONTROL: + return NGHTTP2_FLOW_CONTROL_ERROR; + case NGHTTP2_ERR_REFUSED_STREAM: + return NGHTTP2_REFUSED_STREAM; + case NGHTTP2_ERR_PROTO: + case NGHTTP2_ERR_HTTP_HEADER: + case NGHTTP2_ERR_HTTP_MESSAGING: + return NGHTTP2_PROTOCOL_ERROR; + default: + return NGHTTP2_INTERNAL_ERROR; + } +} + +static int session_handle_invalid_stream2(nghttp2_session *session, + int32_t stream_id, + nghttp2_frame *frame, + int lib_error_code) { + int rv; + rv = nghttp2_session_add_rst_stream( + session, stream_id, get_error_code_from_lib_error_code(lib_error_code)); + if (rv != 0) { + return rv; + } + if (session->callbacks.on_invalid_frame_recv_callback) { + if (session->callbacks.on_invalid_frame_recv_callback( + session, frame, lib_error_code, session->user_data) != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; +} + +static int session_handle_invalid_stream(nghttp2_session *session, + nghttp2_frame *frame, + int lib_error_code) { + return session_handle_invalid_stream2(session, frame->hd.stream_id, frame, + lib_error_code); +} + +static int session_inflate_handle_invalid_stream(nghttp2_session *session, + nghttp2_frame *frame, + int lib_error_code) { + int rv; + rv = session_handle_invalid_stream(session, frame, lib_error_code); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return NGHTTP2_ERR_IGN_HEADER_BLOCK; +} + +/* + * Handles invalid frame which causes connection error. + */ +static int session_handle_invalid_connection(nghttp2_session *session, + nghttp2_frame *frame, + int lib_error_code, + const char *reason) { + if (session->callbacks.on_invalid_frame_recv_callback) { + if (session->callbacks.on_invalid_frame_recv_callback( + session, frame, lib_error_code, session->user_data) != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return nghttp2_session_terminate_session_with_reason( + session, get_error_code_from_lib_error_code(lib_error_code), reason); +} + +static int session_inflate_handle_invalid_connection(nghttp2_session *session, + nghttp2_frame *frame, + int lib_error_code, + const char *reason) { + int rv; + rv = + session_handle_invalid_connection(session, frame, lib_error_code, reason); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return NGHTTP2_ERR_IGN_HEADER_BLOCK; +} + +/* + * Inflates header block in the memory pointed by |in| with |inlen| + * bytes. If this function returns NGHTTP2_ERR_PAUSE, the caller must + * call this function again, until it returns 0 or one of negative + * error code. If |call_header_cb| is zero, the on_header_callback + * are not invoked and the function never return NGHTTP2_ERR_PAUSE. If + * the given |in| is the last chunk of header block, the |final| must + * be nonzero. If header block is successfully processed (which is + * indicated by the return value 0, NGHTTP2_ERR_PAUSE or + * NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE), the number of processed + * input bytes is assigned to the |*readlen_ptr|. + * + * This function return 0 if it succeeds, or one of the negative error + * codes: + * + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + * NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE + * The callback returns this error code, indicating that this + * stream should be RST_STREAMed. + * NGHTTP2_ERR_NOMEM + * Out of memory. + * NGHTTP2_ERR_PAUSE + * The callback function returned NGHTTP2_ERR_PAUSE + * NGHTTP2_ERR_HEADER_COMP + * Header decompression failed + */ +static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, + size_t *readlen_ptr, uint8_t *in, size_t inlen, + int final, int call_header_cb) { + ssize_t proclen; + int rv; + int inflate_flags; + nghttp2_hd_nv nv; + nghttp2_stream *stream; + nghttp2_stream *subject_stream; + int trailer = 0; + + *readlen_ptr = 0; + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + + if (frame->hd.type == NGHTTP2_PUSH_PROMISE) { + subject_stream = nghttp2_session_get_stream( + session, frame->push_promise.promised_stream_id); + } else { + subject_stream = stream; + trailer = session_trailer_headers(session, stream, frame); + } + + DEBUGF(fprintf(stderr, "recv: decoding header block %zu bytes\n", inlen)); + for (;;) { + inflate_flags = 0; + proclen = nghttp2_hd_inflate_hd_nv(&session->hd_inflater, &nv, + &inflate_flags, in, inlen, final); + if (nghttp2_is_fatal((int)proclen)) { + return (int)proclen; + } + if (proclen < 0) { + if (session->iframe.state == NGHTTP2_IB_READ_HEADER_BLOCK) { + if (subject_stream && subject_stream->state != NGHTTP2_STREAM_CLOSING) { + /* Adding RST_STREAM here is very important. It prevents + from invoking subsequent callbacks for the same stream + ID. */ + rv = nghttp2_session_add_rst_stream( + session, subject_stream->stream_id, NGHTTP2_COMPRESSION_ERROR); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + } + rv = + nghttp2_session_terminate_session(session, NGHTTP2_COMPRESSION_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return NGHTTP2_ERR_HEADER_COMP; + } + in += proclen; + inlen -= (size_t)proclen; + *readlen_ptr += (size_t)proclen; + + DEBUGF(fprintf(stderr, "recv: proclen=%zd\n", proclen)); + + if (call_header_cb && (inflate_flags & NGHTTP2_HD_INFLATE_EMIT)) { + rv = 0; + if (subject_stream && session_enforce_http_messaging(session)) { + rv = nghttp2_http_on_header(session, subject_stream, frame, &nv, + trailer); + if (rv == NGHTTP2_ERR_HTTP_HEADER) { + DEBUGF(fprintf( + stderr, "recv: HTTP error: type=%u, id=%d, header %.*s: %.*s\n", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base)); + + rv = session_call_error_callback( + session, "Invalid HTTP header field was received: frame type: " + "%u, stream: %d, name: [%.*s], value: [%.*s]", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = + session_handle_invalid_stream2(session, subject_stream->stream_id, + frame, NGHTTP2_ERR_HTTP_HEADER); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + } + + if (rv == NGHTTP2_ERR_IGN_HTTP_HEADER) { + /* Don't overwrite rv here */ + int rv2; + /* header is ignored */ + DEBUGF(fprintf( + stderr, "recv: HTTP ignored: type=%u, id=%d, header %.*s: %.*s\n", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base)); + + rv2 = session_call_error_callback( + session, + "Ignoring received invalid HTTP header field: frame type: " + "%u, stream: %d, name: [%.*s], value: [%.*s]", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base); + + if (nghttp2_is_fatal(rv2)) { + return rv2; + } + } + } + if (rv == 0) { + rv = session_call_on_header(session, frame, &nv); + /* This handles NGHTTP2_ERR_PAUSE and + NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE as well */ + if (rv != 0) { + return rv; + } + } + } + if (inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + nghttp2_hd_inflate_end_headers(&session->hd_inflater); + break; + } + if ((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && inlen == 0) { + break; + } + } + return 0; +} + +/* + * Call this function when HEADERS frame was completely received. + * + * This function returns 0 if it succeeds, or one of negative error + * codes: + * + * NGHTTP2_ERR_CALLBACK_FAILURE + * The callback function failed. + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int session_end_stream_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream) { + int rv; + if ((frame->hd.flags & NGHTTP2_FLAG_END_STREAM) == 0) { + return 0; + } + + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); + rv = nghttp2_session_close_stream_if_shut_rdwr(session, stream); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return 0; +} + +static int session_after_header_block_received(nghttp2_session *session) { + int rv = 0; + int call_cb = 1; + nghttp2_frame *frame = &session->iframe.frame; + nghttp2_stream *stream; + + /* We don't call on_frame_recv_callback if stream has been closed + already or being closed. */ + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream || stream->state == NGHTTP2_STREAM_CLOSING) { + return 0; + } + + if (session_enforce_http_messaging(session)) { + if (frame->hd.type == NGHTTP2_PUSH_PROMISE) { + nghttp2_stream *subject_stream; + + subject_stream = nghttp2_session_get_stream( + session, frame->push_promise.promised_stream_id); + if (subject_stream) { + rv = nghttp2_http_on_request_headers(subject_stream, frame); + } + } else { + assert(frame->hd.type == NGHTTP2_HEADERS); + switch (frame->headers.cat) { + case NGHTTP2_HCAT_REQUEST: + rv = nghttp2_http_on_request_headers(stream, frame); + break; + case NGHTTP2_HCAT_RESPONSE: + case NGHTTP2_HCAT_PUSH_RESPONSE: + rv = nghttp2_http_on_response_headers(stream); + break; + case NGHTTP2_HCAT_HEADERS: + if (stream->http_flags & NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE) { + assert(!session->server); + rv = nghttp2_http_on_response_headers(stream); + } else { + rv = nghttp2_http_on_trailer_headers(stream, frame); + } + break; + default: + assert(0); + } + if (rv == 0 && (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) { + rv = nghttp2_http_on_remote_end_stream(stream); + } + } + if (rv != 0) { + int32_t stream_id; + + if (frame->hd.type == NGHTTP2_PUSH_PROMISE) { + stream_id = frame->push_promise.promised_stream_id; + } else { + stream_id = frame->hd.stream_id; + } + + call_cb = 0; + + rv = session_handle_invalid_stream2(session, stream_id, frame, + NGHTTP2_ERR_HTTP_MESSAGING); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + } + + if (call_cb) { + rv = session_call_on_frame_received(session, frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + if (frame->hd.type != NGHTTP2_HEADERS) { + return 0; + } + + return session_end_stream_headers_received(session, frame, stream); +} + +int nghttp2_session_on_request_headers_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv = 0; + nghttp2_stream *stream; + if (frame->hd.stream_id == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: stream_id == 0"); + } + + /* If client recieves idle stream from server, it is invalid + regardless stream ID is even or odd. This is because client is + not expected to receive request from server. */ + if (!session->server) { + if (session_detect_idle_stream(session, frame->hd.stream_id)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: client received request"); + } + + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + assert(session->server); + + if (!session_is_new_peer_stream_id(session, frame->hd.stream_id)) { + if (frame->hd.stream_id == 0 || + nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: invalid stream_id"); + } + + /* RFC 7540 says if an endpoint receives a HEADERS with invalid + * stream ID (e.g, numerically smaller than previous), it MUST + * issue connection error with error code PROTOCOL_ERROR. It is a + * bit hard to detect this, since we cannot remember all streams + * we observed so far. + * + * You might imagine this is really easy. But no. HTTP/2 is + * asynchronous protocol, and usually client and server do not + * share the complete picture of open/closed stream status. For + * example, after server sends RST_STREAM for a stream, client may + * send trailer HEADERS for that stream. If naive server detects + * that, and issued connection error, then it is a bug of server + * implementation since client is not wrong if it did not get + * RST_STREAM when it issued trailer HEADERS. + * + * For server session, we remember closed streams as long as the + * sum of closed streams and opened streams are under current max + * concurrent streams. We can use these closed streams to detect + * the error in some cases. + * + * If the stream cannot be found in either closed or opened + * streams, it is considered to be closed, or it has not exist + * (e.g., peer skipped sending the stream). Actually, it is + * impossible to detect which is which, since that information was + * lost forever. For these cases, we send back GOAWAY with + * PROTOCOL_ERROR. + * + * If the stream is found, and we know that it is in half closed + * (remote), or closed by peer's explicit action (e.g., received + * RST_STREAM from peer, or peer sends HEADERS/DATA frame with + * END_STREAM), getting new frame on that stream is clearly error. + * In this case, we send GOAWAY with error code STREAM_CLOSED. + * + * There is one corner case here. Server can change the max + * concurrent streams. The initial value of max concurrent + * streams is unlimited (NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, + * which is UINT32_MAX). When sending out SETTINGS with + * MAX_CONCURRENT_STREAMS, we save its value as pending max + * concurrent streams, and use it as a cap to remember closed + * stream to save memory. This means that we might not sure that + * stream surely closed or has not exist when it is not found in + * closed or opened stream. To workaround this issue, we ignore + * incoming frame if the current max concurrent streams is + * NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, and pending max + * concurrent streams is less than that. + */ + stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); + + if (!stream) { + if (session->local_settings.max_concurrent_streams == + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS && + session->pending_local_max_concurrent_stream < + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS) { + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "HEADERS: stream does not exist"); + } + + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + } + + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + session->last_recv_stream_id = frame->hd.stream_id; + + if (session_is_incoming_concurrent_streams_max(session)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: max concurrent streams exceeded"); + } + + if (!session_allow_incoming_new_stream(session)) { + /* We just ignore stream after GOAWAY was sent */ + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + if (frame->headers.pri_spec.stream_id == frame->hd.stream_id) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: depend on itself"); + } + + if (session_is_incoming_concurrent_streams_pending_max(session)) { + return session_inflate_handle_invalid_stream(session, frame, + NGHTTP2_ERR_REFUSED_STREAM); + } + + stream = nghttp2_session_open_stream( + session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, + &frame->headers.pri_spec, NGHTTP2_STREAM_OPENING, NULL); + if (!stream) { + return NGHTTP2_ERR_NOMEM; + } + + rv = nghttp2_session_adjust_closed_stream(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session->last_proc_stream_id = session->last_recv_stream_id; + + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; +} + +int nghttp2_session_on_response_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream) { + int rv; + /* This function is only called if stream->state == + NGHTTP2_STREAM_OPENING and stream_id is local side initiated. */ + assert(stream->state == NGHTTP2_STREAM_OPENING && + nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)); + if (frame->hd.stream_id == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "response HEADERS: stream_id == 0"); + } + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + /* half closed (remote): from the spec: + + If an endpoint receives additional frames for a stream that is + in this state it MUST respond with a stream error (Section + 5.4.2) of type STREAM_CLOSED. + + We go further, and make it connection error. + */ + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + } + stream->state = NGHTTP2_STREAM_OPENED; + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; +} + +int nghttp2_session_on_push_response_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream) { + int rv = 0; + assert(stream->state == NGHTTP2_STREAM_RESERVED); + if (frame->hd.stream_id == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "push response HEADERS: stream_id == 0"); + } + + if (session->server) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "HEADERS: no HEADERS allowed from client in reserved state"); + } + + if (session_is_incoming_concurrent_streams_max(session)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "push response HEADERS: max concurrent streams exceeded"); + } + + if (!session_allow_incoming_new_stream(session)) { + /* We don't accept new stream after GOAWAY was sent. */ + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + if (session_is_incoming_concurrent_streams_pending_max(session)) { + return session_inflate_handle_invalid_stream(session, frame, + NGHTTP2_ERR_REFUSED_STREAM); + } + + nghttp2_stream_promise_fulfilled(stream); + if (!nghttp2_session_is_my_stream_id(session, stream->stream_id)) { + --session->num_incoming_reserved_streams; + } + ++session->num_incoming_streams; + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; +} + +int nghttp2_session_on_headers_received(nghttp2_session *session, + nghttp2_frame *frame, + nghttp2_stream *stream) { + int rv = 0; + if (frame->hd.stream_id == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "HEADERS: stream_id == 0"); + } + if ((stream->shut_flags & NGHTTP2_SHUT_RD)) { + /* half closed (remote): from the spec: + + If an endpoint receives additional frames for a stream that is + in this state it MUST respond with a stream error (Section + 5.4.2) of type STREAM_CLOSED. + + we go further, and make it connection error. + */ + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + } + if (nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { + if (stream->state == NGHTTP2_STREAM_OPENED) { + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; + } + + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + /* If this is remote peer initiated stream, it is OK unless it + has sent END_STREAM frame already. But if stream is in + NGHTTP2_STREAM_CLOSING, we discard the frame. This is a race + condition. */ + if (stream->state != NGHTTP2_STREAM_CLOSING) { + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; + } + return NGHTTP2_ERR_IGN_HEADER_BLOCK; +} + +static int session_process_headers_frame(nghttp2_session *session) { + int rv; + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + nghttp2_stream *stream; + + rv = nghttp2_frame_unpack_headers_payload(&frame->headers, iframe->sbuf.pos, + nghttp2_buf_len(&iframe->sbuf)); + + if (rv != 0) { + return nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "HEADERS: could not unpack"); + } + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream) { + frame->headers.cat = NGHTTP2_HCAT_REQUEST; + return nghttp2_session_on_request_headers_received(session, frame); + } + + if (stream->state == NGHTTP2_STREAM_RESERVED) { + frame->headers.cat = NGHTTP2_HCAT_PUSH_RESPONSE; + return nghttp2_session_on_push_response_headers_received(session, frame, + stream); + } + + if (stream->state == NGHTTP2_STREAM_OPENING && + nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { + frame->headers.cat = NGHTTP2_HCAT_RESPONSE; + return nghttp2_session_on_response_headers_received(session, frame, stream); + } + + frame->headers.cat = NGHTTP2_HCAT_HEADERS; + return nghttp2_session_on_headers_received(session, frame, stream); +} + +int nghttp2_session_on_priority_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + nghttp2_stream *stream; + + if (frame->hd.stream_id == 0) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "PRIORITY: stream_id == 0"); + } + + if (frame->priority.pri_spec.stream_id == frame->hd.stream_id) { + return nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "depend on itself"); + } + + if (!session->server) { + /* Re-prioritization works only in server */ + return session_call_on_frame_received(session, frame); + } + + stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); + + if (!stream) { + /* PRIORITY against idle stream can create anchor node in + dependency tree. */ + if (!session_detect_idle_stream(session, frame->hd.stream_id)) { + return 0; + } + + stream = nghttp2_session_open_stream( + session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, + &frame->priority.pri_spec, NGHTTP2_STREAM_IDLE, NULL); + + if (stream == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + rv = nghttp2_session_adjust_idle_stream(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } else { + rv = nghttp2_session_reprioritize_stream(session, stream, + &frame->priority.pri_spec); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = nghttp2_session_adjust_idle_stream(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + return session_call_on_frame_received(session, frame); +} + +static int session_process_priority_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_priority_payload(&frame->priority, iframe->sbuf.pos, + nghttp2_buf_len(&iframe->sbuf)); + + return nghttp2_session_on_priority_received(session, frame); +} + +int nghttp2_session_on_rst_stream_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + nghttp2_stream *stream; + if (frame->hd.stream_id == 0) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "RST_STREAM: stream_id == 0"); + } + + if (session_detect_idle_stream(session, frame->hd.stream_id)) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "RST_STREAM: stream in idle"); + } + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (stream) { + /* We may use stream->shut_flags for strict error checking. */ + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); + } + + rv = session_call_on_frame_received(session, frame); + if (rv != 0) { + return rv; + } + rv = nghttp2_session_close_stream(session, frame->hd.stream_id, + frame->rst_stream.error_code); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return 0; +} + +static int session_process_rst_stream_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_rst_stream_payload(&frame->rst_stream, iframe->sbuf.pos, + nghttp2_buf_len(&iframe->sbuf)); + + return nghttp2_session_on_rst_stream_received(session, frame); +} + +static int update_remote_initial_window_size_func(nghttp2_map_entry *entry, + void *ptr) { + int rv; + nghttp2_update_window_size_arg *arg; + nghttp2_stream *stream; + + arg = (nghttp2_update_window_size_arg *)ptr; + stream = (nghttp2_stream *)entry; + + rv = nghttp2_stream_update_remote_initial_window_size( + stream, arg->new_window_size, arg->old_window_size); + if (rv != 0) { + return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, + NGHTTP2_FLOW_CONTROL_ERROR); + } + + /* If window size gets positive, push deferred DATA frame to + outbound queue. */ + if (stream->remote_window_size > 0 && + nghttp2_stream_check_deferred_by_flow_control(stream)) { + + rv = nghttp2_stream_resume_deferred_item( + stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + return 0; +} + +/* + * Updates the remote initial window size of all active streams. If + * error occurs, all streams may not be updated. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int +session_update_remote_initial_window_size(nghttp2_session *session, + int32_t new_initial_window_size) { + nghttp2_update_window_size_arg arg; + + arg.session = session; + arg.new_window_size = new_initial_window_size; + arg.old_window_size = (int32_t)session->remote_settings.initial_window_size; + + return nghttp2_map_each(&session->streams, + update_remote_initial_window_size_func, &arg); +} + +static int update_local_initial_window_size_func(nghttp2_map_entry *entry, + void *ptr) { + int rv; + nghttp2_update_window_size_arg *arg; + nghttp2_stream *stream; + arg = (nghttp2_update_window_size_arg *)ptr; + stream = (nghttp2_stream *)entry; + rv = nghttp2_stream_update_local_initial_window_size( + stream, arg->new_window_size, arg->old_window_size); + if (rv != 0) { + return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, + NGHTTP2_FLOW_CONTROL_ERROR); + } + if (!(arg->session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) && + stream->window_update_queued == 0 && + nghttp2_should_send_window_update(stream->local_window_size, + stream->recv_window_size)) { + + rv = nghttp2_session_add_window_update(arg->session, NGHTTP2_FLAG_NONE, + stream->stream_id, + stream->recv_window_size); + if (rv != 0) { + return rv; + } + + stream->recv_window_size = 0; + } + return 0; +} + +/* + * Updates the local initial window size of all active streams. If + * error occurs, all streams may not be updated. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int +session_update_local_initial_window_size(nghttp2_session *session, + int32_t new_initial_window_size, + int32_t old_initial_window_size) { + nghttp2_update_window_size_arg arg; + arg.session = session; + arg.new_window_size = new_initial_window_size; + arg.old_window_size = old_initial_window_size; + return nghttp2_map_each(&session->streams, + update_local_initial_window_size_func, &arg); +} + +/* + * Apply SETTINGS values |iv| having |niv| elements to the local + * settings. We assumes that all values in |iv| is correct, since we + * validated them in nghttp2_session_add_settings() already. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_HEADER_COMP + * The header table size is out of range + * NGHTTP2_ERR_NOMEM + * Out of memory + */ +int nghttp2_session_update_local_settings(nghttp2_session *session, + nghttp2_settings_entry *iv, + size_t niv) { + int rv; + size_t i; + int32_t new_initial_window_size = -1; + uint32_t header_table_size = 0; + uint32_t min_header_table_size = UINT32_MAX; + uint8_t header_table_size_seen = 0; + /* For NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, use the value last + seen. For NGHTTP2_SETTINGS_HEADER_TABLE_SIZE, use both minimum + value and last seen value. */ + for (i = 0; i < niv; ++i) { + switch (iv[i].settings_id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + header_table_size_seen = 1; + header_table_size = iv[i].value; + min_header_table_size = nghttp2_min(min_header_table_size, iv[i].value); + break; + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + new_initial_window_size = (int32_t)iv[i].value; + break; + } + } + if (header_table_size_seen) { + if (min_header_table_size < header_table_size) { + rv = nghttp2_hd_inflate_change_table_size(&session->hd_inflater, + min_header_table_size); + if (rv != 0) { + return rv; + } + } + + rv = nghttp2_hd_inflate_change_table_size(&session->hd_inflater, + header_table_size); + if (rv != 0) { + return rv; + } + } + if (new_initial_window_size != -1) { + rv = session_update_local_initial_window_size( + session, new_initial_window_size, + (int32_t)session->local_settings.initial_window_size); + if (rv != 0) { + return rv; + } + } + + for (i = 0; i < niv; ++i) { + switch (iv[i].settings_id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + session->local_settings.header_table_size = iv[i].value; + break; + case NGHTTP2_SETTINGS_ENABLE_PUSH: + session->local_settings.enable_push = iv[i].value; + break; + case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + session->local_settings.max_concurrent_streams = iv[i].value; + break; + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + session->local_settings.initial_window_size = iv[i].value; + break; + case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: + session->local_settings.max_frame_size = iv[i].value; + break; + case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + session->local_settings.max_header_list_size = iv[i].value; + break; + } + } + + return 0; +} + +int nghttp2_session_on_settings_received(nghttp2_session *session, + nghttp2_frame *frame, int noack) { + int rv; + size_t i; + nghttp2_mem *mem; + nghttp2_inflight_settings *settings; + + mem = &session->mem; + + if (frame->hd.stream_id != 0) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: stream_id != 0"); + } + if (frame->hd.flags & NGHTTP2_FLAG_ACK) { + if (frame->settings.niv != 0) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_FRAME_SIZE_ERROR, + "SETTINGS: ACK and payload != 0"); + } + + settings = session->inflight_settings_head; + + if (!settings) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "SETTINGS: unexpected ACK"); + } + + rv = nghttp2_session_update_local_settings(session, settings->iv, + settings->niv); + + session->inflight_settings_head = settings->next; + + inflight_settings_del(settings, mem); + + if (rv != 0) { + if (nghttp2_is_fatal(rv)) { + return rv; + } + return session_handle_invalid_connection(session, frame, rv, NULL); + } + return session_call_on_frame_received(session, frame); + } + + for (i = 0; i < frame->settings.niv; ++i) { + nghttp2_settings_entry *entry = &frame->settings.iv[i]; + + switch (entry->settings_id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + + rv = nghttp2_hd_deflate_change_table_size(&session->hd_deflater, + entry->value); + if (rv != 0) { + if (nghttp2_is_fatal(rv)) { + return rv; + } else { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_HEADER_COMP, NULL); + } + } + + session->remote_settings.header_table_size = entry->value; + + break; + case NGHTTP2_SETTINGS_ENABLE_PUSH: + + if (entry->value != 0 && entry->value != 1) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_ENBLE_PUSH"); + } + + if (!session->server && entry->value != 0) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: server attempted to enable push"); + } + + session->remote_settings.enable_push = entry->value; + + break; + case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + + session->remote_settings.max_concurrent_streams = entry->value; + + break; + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + + /* Update the initial window size of the all active streams */ + /* Check that initial_window_size < (1u << 31) */ + if (entry->value > NGHTTP2_MAX_WINDOW_SIZE) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_FLOW_CONTROL, + "SETTINGS: too large SETTINGS_INITIAL_WINDOW_SIZE"); + } + + rv = session_update_remote_initial_window_size(session, + (int32_t)entry->value); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (rv != 0) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_FLOW_CONTROL, NULL); + } + + session->remote_settings.initial_window_size = entry->value; + + break; + case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: + + if (entry->value < NGHTTP2_MAX_FRAME_SIZE_MIN || + entry->value > NGHTTP2_MAX_FRAME_SIZE_MAX) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_MAX_FRAME_SIZE"); + } + + session->remote_settings.max_frame_size = entry->value; + + break; + case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + + session->remote_settings.max_header_list_size = entry->value; + + break; + } + } + + if (!noack && !session_is_closing(session)) { + rv = nghttp2_session_add_settings(session, NGHTTP2_FLAG_ACK, NULL, 0); + + if (rv != 0) { + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return session_handle_invalid_connection(session, frame, + NGHTTP2_ERR_INTERNAL, NULL); + } + } + + return session_call_on_frame_received(session, frame); +} + +static int session_process_settings_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + size_t i; + nghttp2_settings_entry min_header_size_entry; + + if (iframe->max_niv) { + min_header_size_entry = iframe->iv[iframe->max_niv - 1]; + + if (min_header_size_entry.value < UINT32_MAX) { + /* If we have less value, then we must have + SETTINGS_HEADER_TABLE_SIZE in i < iframe->niv */ + for (i = 0; i < iframe->niv; ++i) { + if (iframe->iv[i].settings_id == NGHTTP2_SETTINGS_HEADER_TABLE_SIZE) { + break; + } + } + + assert(i < iframe->niv); + + if (min_header_size_entry.value != iframe->iv[i].value) { + iframe->iv[iframe->niv++] = iframe->iv[i]; + iframe->iv[i] = min_header_size_entry; + } + } + } + + nghttp2_frame_unpack_settings_payload(&frame->settings, iframe->iv, + iframe->niv); + + iframe->iv = NULL; + iframe->niv = 0; + iframe->max_niv = 0; + + return nghttp2_session_on_settings_received(session, frame, 0 /* ACK */); +} + +int nghttp2_session_on_push_promise_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + nghttp2_stream *stream; + nghttp2_stream *promised_stream; + nghttp2_priority_spec pri_spec; + + if (frame->hd.stream_id == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream_id == 0"); + } + if (session->server || session->local_settings.enable_push == 0) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: push disabled"); + } + + if (!nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: invalid stream_id"); + } + + if (!session_allow_incoming_new_stream(session)) { + /* We just discard PUSH_PROMISE after GOAWAY was sent */ + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + if (!session_is_new_peer_stream_id(session, + frame->push_promise.promised_stream_id)) { + /* The spec says if an endpoint receives a PUSH_PROMISE with + illegal stream ID is subject to a connection error of type + PROTOCOL_ERROR. */ + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "PUSH_PROMISE: invalid promised_stream_id"); + } + + if (session_detect_idle_stream(session, frame->hd.stream_id)) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream in idle"); + } + + session->last_recv_stream_id = frame->push_promise.promised_stream_id; + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream || stream->state == NGHTTP2_STREAM_CLOSING || + !session->pending_enable_push || + session->num_incoming_reserved_streams >= + session->max_incoming_reserved_streams) { + /* Currently, client does not retain closed stream, so we don't + check NGHTTP2_SHUT_RD condition here. */ + + rv = nghttp2_session_add_rst_stream( + session, frame->push_promise.promised_stream_id, NGHTTP2_CANCEL); + if (rv != 0) { + return rv; + } + return NGHTTP2_ERR_IGN_HEADER_BLOCK; + } + + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return session_inflate_handle_invalid_connection( + session, frame, NGHTTP2_ERR_STREAM_CLOSED, + "PUSH_PROMISE: stream closed"); + } + + nghttp2_priority_spec_init(&pri_spec, stream->stream_id, + NGHTTP2_DEFAULT_WEIGHT, 0); + + promised_stream = nghttp2_session_open_stream( + session, frame->push_promise.promised_stream_id, NGHTTP2_STREAM_FLAG_NONE, + &pri_spec, NGHTTP2_STREAM_RESERVED, NULL); + + if (!promised_stream) { + return NGHTTP2_ERR_NOMEM; + } + + /* We don't call nghttp2_session_adjust_closed_stream(), since we + don't keep closed stream in client side */ + + session->last_proc_stream_id = session->last_recv_stream_id; + rv = session_call_on_begin_headers(session, frame); + if (rv != 0) { + return rv; + } + return 0; +} + +static int session_process_push_promise_frame(nghttp2_session *session) { + int rv; + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + rv = nghttp2_frame_unpack_push_promise_payload( + &frame->push_promise, iframe->sbuf.pos, nghttp2_buf_len(&iframe->sbuf)); + + if (rv != 0) { + return nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "PUSH_PROMISE: could not unpack"); + } + + return nghttp2_session_on_push_promise_received(session, frame); +} + +int nghttp2_session_on_ping_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv = 0; + if (frame->hd.stream_id != 0) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "PING: stream_id != 0"); + } + if ((session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_PING_ACK) == 0 && + (frame->hd.flags & NGHTTP2_FLAG_ACK) == 0 && + !session_is_closing(session)) { + /* Peer sent ping, so ping it back */ + rv = nghttp2_session_add_ping(session, NGHTTP2_FLAG_ACK, + frame->ping.opaque_data); + if (rv != 0) { + return rv; + } + } + return session_call_on_frame_received(session, frame); +} + +static int session_process_ping_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_ping_payload(&frame->ping, iframe->sbuf.pos, + nghttp2_buf_len(&iframe->sbuf)); + + return nghttp2_session_on_ping_received(session, frame); +} + +int nghttp2_session_on_goaway_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + + if (frame->hd.stream_id != 0) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "GOAWAY: stream_id != 0"); + } + /* Spec says Endpoints MUST NOT increase the value they send in the + last stream identifier. */ + if ((frame->goaway.last_stream_id > 0 && + !nghttp2_session_is_my_stream_id(session, + frame->goaway.last_stream_id)) || + session->remote_last_stream_id < frame->goaway.last_stream_id) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "GOAWAY: invalid last_stream_id"); + } + + session->goaway_flags |= NGHTTP2_GOAWAY_RECV; + + session->remote_last_stream_id = frame->goaway.last_stream_id; + + rv = session_call_on_frame_received(session, frame); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return session_close_stream_on_goaway(session, frame->goaway.last_stream_id, + 0); +} + +static int session_process_goaway_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_goaway_payload( + &frame->goaway, iframe->sbuf.pos, nghttp2_buf_len(&iframe->sbuf), + iframe->lbuf.pos, nghttp2_buf_len(&iframe->lbuf)); + + nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); + + return nghttp2_session_on_goaway_received(session, frame); +} + +static int +session_on_connection_window_update_received(nghttp2_session *session, + nghttp2_frame *frame) { + /* Handle connection-level flow control */ + if (frame->window_update.window_size_increment == 0) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "WINDOW_UPDATE: window_size_increment == 0"); + } + + if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment < + session->remote_window_size) { + return session_handle_invalid_connection(session, frame, + NGHTTP2_ERR_FLOW_CONTROL, NULL); + } + session->remote_window_size += frame->window_update.window_size_increment; + + return session_call_on_frame_received(session, frame); +} + +static int session_on_stream_window_update_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv; + nghttp2_stream *stream; + + if (session_detect_idle_stream(session, frame->hd.stream_id)) { + return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, + "WINDOW_UPDATE to idle stream"); + } + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream) { + return 0; + } + if (state_reserved_remote(session, stream)) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, "WINDOW_UPADATE to reserved stream"); + } + if (frame->window_update.window_size_increment == 0) { + return session_handle_invalid_connection( + session, frame, NGHTTP2_ERR_PROTO, + "WINDOW_UPDATE: window_size_increment == 0"); + } + if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment < + stream->remote_window_size) { + return session_handle_invalid_stream(session, frame, + NGHTTP2_ERR_FLOW_CONTROL); + } + stream->remote_window_size += frame->window_update.window_size_increment; + + if (stream->remote_window_size > 0 && + nghttp2_stream_check_deferred_by_flow_control(stream)) { + + rv = nghttp2_stream_resume_deferred_item( + stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + return session_call_on_frame_received(session, frame); +} + +int nghttp2_session_on_window_update_received(nghttp2_session *session, + nghttp2_frame *frame) { + if (frame->hd.stream_id == 0) { + return session_on_connection_window_update_received(session, frame); + } else { + return session_on_stream_window_update_received(session, frame); + } +} + +static int session_process_window_update_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_window_update_payload( + &frame->window_update, iframe->sbuf.pos, nghttp2_buf_len(&iframe->sbuf)); + + return nghttp2_session_on_window_update_received(session, frame); +} + +int nghttp2_session_on_altsvc_received(nghttp2_session *session, + nghttp2_frame *frame) { + nghttp2_ext_altsvc *altsvc; + nghttp2_stream *stream; + + altsvc = frame->ext.payload; + + /* session->server case has been excluded */ + + if (frame->hd.stream_id == 0) { + if (altsvc->origin_len == 0) { + return 0; + } + } else { + if (altsvc->origin_len > 0) { + return 0; + } + + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream) { + return 0; + } + + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return 0; + } + } + + return session_call_on_frame_received(session, frame); +} + +static int session_process_altsvc_frame(nghttp2_session *session) { + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + nghttp2_frame_unpack_altsvc_payload( + &frame->ext, nghttp2_get_uint16(iframe->sbuf.pos), iframe->lbuf.pos, + nghttp2_buf_len(&iframe->lbuf)); + + /* nghttp2_frame_unpack_altsvc_payload steals buffer from + iframe->lbuf */ + nghttp2_buf_wrap_init(&iframe->lbuf, NULL, 0); + + return nghttp2_session_on_altsvc_received(session, frame); +} + +static int session_process_extension_frame(nghttp2_session *session) { + int rv; + nghttp2_inbound_frame *iframe = &session->iframe; + nghttp2_frame *frame = &iframe->frame; + + rv = session_call_unpack_extension_callback(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + /* This handles the case where rv == NGHTTP2_ERR_CANCEL as well */ + if (rv != 0) { + return 0; + } + + return session_call_on_frame_received(session, frame); +} + +int nghttp2_session_on_data_received(nghttp2_session *session, + nghttp2_frame *frame) { + int rv = 0; + int call_cb = 1; + nghttp2_stream *stream; + + /* We don't call on_frame_recv_callback if stream has been closed + already or being closed. */ + stream = nghttp2_session_get_stream(session, frame->hd.stream_id); + if (!stream || stream->state == NGHTTP2_STREAM_CLOSING) { + /* This should be treated as stream error, but it results in lots + of RST_STREAM. So just ignore frame against nonexistent stream + for now. */ + return 0; + } + + if (session_enforce_http_messaging(session) && + (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) { + if (nghttp2_http_on_remote_end_stream(stream) != 0) { + call_cb = 0; + rv = nghttp2_session_add_rst_stream(session, stream->stream_id, + NGHTTP2_PROTOCOL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + } + + if (call_cb) { + rv = session_call_on_frame_received(session, frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); + rv = nghttp2_session_close_stream_if_shut_rdwr(session, stream); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + return 0; +} + +/* For errors, this function only returns FATAL error. */ +static int session_process_data_frame(nghttp2_session *session) { + int rv; + nghttp2_frame *public_data_frame = &session->iframe.frame; + rv = nghttp2_session_on_data_received(session, public_data_frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return 0; +} + +/* + * Now we have SETTINGS synchronization, flow control error can be + * detected strictly. If DATA frame is received with length > 0 and + * current received window size + delta length is strictly larger than + * local window size, it is subject to FLOW_CONTROL_ERROR, so return + * -1. Note that local_window_size is calculated after SETTINGS ACK is + * received from peer, so peer must honor this limit. If the resulting + * recv_window_size is strictly larger than NGHTTP2_MAX_WINDOW_SIZE, + * return -1 too. + */ +static int adjust_recv_window_size(int32_t *recv_window_size_ptr, size_t delta, + int32_t local_window_size) { + if (*recv_window_size_ptr > local_window_size - (int32_t)delta || + *recv_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - (int32_t)delta) { + return -1; + } + *recv_window_size_ptr += (int32_t)delta; + return 0; +} + +/* + * Accumulates received bytes |delta_size| for stream-level flow + * control and decides whether to send WINDOW_UPDATE to that stream. + * If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set, WINDOW_UPDATE will not + * be sent. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int session_update_recv_stream_window_size(nghttp2_session *session, + nghttp2_stream *stream, + size_t delta_size, + int send_window_update) { + int rv; + rv = adjust_recv_window_size(&stream->recv_window_size, delta_size, + stream->local_window_size); + if (rv != 0) { + return nghttp2_session_add_rst_stream(session, stream->stream_id, + NGHTTP2_FLOW_CONTROL_ERROR); + } + /* We don't have to send WINDOW_UPDATE if the data received is the + last chunk in the incoming stream. */ + /* We have to use local_settings here because it is the constraint + the remote endpoint should honor. */ + if (send_window_update && + !(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) && + stream->window_update_queued == 0 && + nghttp2_should_send_window_update(stream->local_window_size, + stream->recv_window_size)) { + rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE, + stream->stream_id, + stream->recv_window_size); + if (rv != 0) { + return rv; + } + + stream->recv_window_size = 0; + } + return 0; +} + +/* + * Accumulates received bytes |delta_size| for connection-level flow + * control and decides whether to send WINDOW_UPDATE to the + * connection. If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set, + * WINDOW_UPDATE will not be sent. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int session_update_recv_connection_window_size(nghttp2_session *session, + size_t delta_size) { + int rv; + rv = adjust_recv_window_size(&session->recv_window_size, delta_size, + session->local_window_size); + if (rv != 0) { + return nghttp2_session_terminate_session(session, + NGHTTP2_FLOW_CONTROL_ERROR); + } + if (!(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) && + session->window_update_queued == 0 && + nghttp2_should_send_window_update(session->local_window_size, + session->recv_window_size)) { + /* Use stream ID 0 to update connection-level flow control + window */ + rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE, 0, + session->recv_window_size); + if (rv != 0) { + return rv; + } + + session->recv_window_size = 0; + } + return 0; +} + +static int session_update_consumed_size(nghttp2_session *session, + int32_t *consumed_size_ptr, + int32_t *recv_window_size_ptr, + uint8_t window_update_queued, + int32_t stream_id, size_t delta_size, + int32_t local_window_size) { + int32_t recv_size; + int rv; + + if ((size_t)*consumed_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta_size) { + return nghttp2_session_terminate_session(session, + NGHTTP2_FLOW_CONTROL_ERROR); + } + + *consumed_size_ptr += (int32_t)delta_size; + + if (window_update_queued == 0) { + /* recv_window_size may be smaller than consumed_size, because it + may be decreased by negative value with + nghttp2_submit_window_update(). */ + recv_size = nghttp2_min(*consumed_size_ptr, *recv_window_size_ptr); + + if (nghttp2_should_send_window_update(local_window_size, recv_size)) { + rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE, + stream_id, recv_size); + + if (rv != 0) { + return rv; + } + + *recv_window_size_ptr -= recv_size; + *consumed_size_ptr -= recv_size; + } + } + + return 0; +} + +static int session_update_stream_consumed_size(nghttp2_session *session, + nghttp2_stream *stream, + size_t delta_size) { + return session_update_consumed_size( + session, &stream->consumed_size, &stream->recv_window_size, + stream->window_update_queued, stream->stream_id, delta_size, + stream->local_window_size); +} + +static int session_update_connection_consumed_size(nghttp2_session *session, + size_t delta_size) { + return session_update_consumed_size( + session, &session->consumed_size, &session->recv_window_size, + session->window_update_queued, 0, delta_size, session->local_window_size); +} + +/* + * Checks that we can receive the DATA frame for stream, which is + * indicated by |session->iframe.frame.hd.stream_id|. If it is a + * connection error situation, GOAWAY frame will be issued by this + * function. + * + * If the DATA frame is allowed, returns 0. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * NGHTTP2_ERR_IGN_PAYLOAD + * The reception of DATA frame is connection error; or should be + * ignored. + * NGHTTP2_ERR_NOMEM + * Out of memory. + */ +static int session_on_data_received_fail_fast(nghttp2_session *session) { + int rv; + nghttp2_stream *stream; + nghttp2_inbound_frame *iframe; + int32_t stream_id; + const char *failure_reason; + uint32_t error_code = NGHTTP2_PROTOCOL_ERROR; + + iframe = &session->iframe; + stream_id = iframe->frame.hd.stream_id; + + if (stream_id == 0) { + /* The spec says that if a DATA frame is received whose stream ID + is 0, the recipient MUST respond with a connection error of + type PROTOCOL_ERROR. */ + failure_reason = "DATA: stream_id == 0"; + goto fail; + } + + if (session_detect_idle_stream(session, stream_id)) { + failure_reason = "DATA: stream in idle"; + error_code = NGHTTP2_PROTOCOL_ERROR; + goto fail; + } + + stream = nghttp2_session_get_stream(session, stream_id); + if (!stream) { + stream = nghttp2_session_get_stream_raw(session, stream_id); + + if (!stream) { + if (session->server) { + if (session->local_settings.max_concurrent_streams == + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS && + session->pending_local_max_concurrent_stream < + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS) { + return NGHTTP2_ERR_IGN_PAYLOAD; + } + + failure_reason = "DATA: stream does not exist"; + error_code = NGHTTP2_PROTOCOL_ERROR; + goto fail; + } + + return NGHTTP2_ERR_IGN_PAYLOAD; + } + + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + failure_reason = "DATA: stream closed"; + error_code = NGHTTP2_STREAM_CLOSED; + goto fail; + } + + return NGHTTP2_ERR_IGN_PAYLOAD; + } + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + failure_reason = "DATA: stream in half-closed(remote)"; + error_code = NGHTTP2_STREAM_CLOSED; + goto fail; + } + + if (nghttp2_session_is_my_stream_id(session, stream_id)) { + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_IGN_PAYLOAD; + } + if (stream->state != NGHTTP2_STREAM_OPENED) { + failure_reason = "DATA: stream not opened"; + goto fail; + } + return 0; + } + if (stream->state == NGHTTP2_STREAM_RESERVED) { + failure_reason = "DATA: stream in reserved"; + goto fail; + } + if (stream->state == NGHTTP2_STREAM_CLOSING) { + return NGHTTP2_ERR_IGN_PAYLOAD; + } + return 0; +fail: + rv = nghttp2_session_terminate_session_with_reason(session, error_code, + failure_reason); + if (nghttp2_is_fatal(rv)) { + return rv; + } + return NGHTTP2_ERR_IGN_PAYLOAD; +} + +static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe, + const uint8_t *in, + const uint8_t *last) { + return nghttp2_min((size_t)(last - in), iframe->payloadleft); +} + +/* + * Resets iframe->sbuf and advance its mark pointer by |left| bytes. + */ +static void inbound_frame_set_mark(nghttp2_inbound_frame *iframe, size_t left) { + nghttp2_buf_reset(&iframe->sbuf); + iframe->sbuf.mark += left; +} + +static size_t inbound_frame_buf_read(nghttp2_inbound_frame *iframe, + const uint8_t *in, const uint8_t *last) { + size_t readlen; + + readlen = + nghttp2_min((size_t)(last - in), nghttp2_buf_mark_avail(&iframe->sbuf)); + + iframe->sbuf.last = nghttp2_cpymem(iframe->sbuf.last, in, readlen); + + return readlen; +} + +/* + * Unpacks SETTINGS entry in iframe->sbuf. + */ +static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) { + nghttp2_settings_entry iv; + nghttp2_settings_entry *min_header_table_size_entry; + size_t i; + + nghttp2_frame_unpack_settings_entry(&iv, iframe->sbuf.pos); + + switch (iv.settings_id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + case NGHTTP2_SETTINGS_ENABLE_PUSH: + case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: + case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + break; + default: + DEBUGF( + fprintf(stderr, "recv: unknown settings id=0x%02x\n", iv.settings_id)); + + iframe->iv[iframe->niv++] = iv; + + return; + } + + for (i = 0; i < iframe->niv; ++i) { + if (iframe->iv[i].settings_id == iv.settings_id) { + iframe->iv[i] = iv; + break; + } + } + + if (i == iframe->niv) { + iframe->iv[iframe->niv++] = iv; + } + + if (iv.settings_id == NGHTTP2_SETTINGS_HEADER_TABLE_SIZE) { + /* Keep track of minimum value of SETTINGS_HEADER_TABLE_SIZE */ + min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; + + if (iv.value < min_header_table_size_entry->value) { + min_header_table_size_entry->value = iv.value; + } + } +} + +/* + * Checks PADDED flags and set iframe->sbuf to read them accordingly. + * If padding is set, this function returns 1. If no padding is set, + * this function returns 0. On error, returns -1. + */ +static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe, + nghttp2_frame_hd *hd) { + if (hd->flags & NGHTTP2_FLAG_PADDED) { + if (hd->length < 1) { + return -1; + } + inbound_frame_set_mark(iframe, 1); + return 1; + } + DEBUGF(fprintf(stderr, "recv: no padding in payload\n")); + return 0; +} + +/* + * Computes number of padding based on flags. This function returns + * the calculated length if it succeeds, or -1. + */ +static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { + size_t padlen; + + /* 1 for Pad Length field */ + padlen = (size_t)(iframe->sbuf.pos[0] + 1); + + DEBUGF(fprintf(stderr, "recv: padlen=%zu\n", padlen)); + + /* We cannot use iframe->frame.hd.length because of CONTINUATION */ + if (padlen - 1 > iframe->payloadleft) { + return -1; + } + + iframe->padlen = padlen; + + return (ssize_t)padlen; +} + +/* + * This function returns the effective payload length in the data of + * length |readlen| when the remaning payload is |payloadleft|. The + * |payloadleft| does not include |readlen|. If padding was started + * strictly before this data chunk, this function returns -1. + */ +static ssize_t inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, + size_t payloadleft, + size_t readlen) { + size_t trail_padlen = + nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); + + if (trail_padlen > payloadleft) { + size_t padlen; + padlen = trail_padlen - payloadleft; + if (readlen < padlen) { + return -1; + } + return (ssize_t)(readlen - padlen); + } + return (ssize_t)(readlen); +} + +ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, + size_t inlen) { + const uint8_t *first = in, *last = in + inlen; + nghttp2_inbound_frame *iframe = &session->iframe; + size_t readlen; + ssize_t padlen; + int rv; + int busy = 0; + nghttp2_frame_hd cont_hd; + nghttp2_stream *stream; + size_t pri_fieldlen; + nghttp2_mem *mem; + + DEBUGF(fprintf(stderr, + "recv: connection recv_window_size=%d, local_window=%d\n", + session->recv_window_size, session->local_window_size)); + + mem = &session->mem; + + /* We may have idle streams more than we expect (e.g., + nghttp2_session_change_stream_priority() or + nghttp2_session_create_idle_stream()). Adjust them here. */ + rv = nghttp2_session_adjust_idle_stream(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + for (;;) { + switch (iframe->state) { + case NGHTTP2_IB_READ_CLIENT_MAGIC: + readlen = nghttp2_min(inlen, iframe->payloadleft); + + if (memcmp(NGHTTP2_CLIENT_MAGIC + NGHTTP2_CLIENT_MAGIC_LEN - + iframe->payloadleft, + in, readlen) != 0) { + return NGHTTP2_ERR_BAD_CLIENT_MAGIC; + } + + iframe->payloadleft -= readlen; + in += readlen; + + if (iframe->payloadleft == 0) { + session_inbound_frame_reset(session); + iframe->state = NGHTTP2_IB_READ_FIRST_SETTINGS; + } + + break; + case NGHTTP2_IB_READ_FIRST_SETTINGS: + DEBUGF(fprintf(stderr, "recv: [IB_READ_FIRST_SETTINGS]\n")); + + readlen = inbound_frame_buf_read(iframe, in, last); + in += readlen; + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + return in - first; + } + + if (iframe->sbuf.pos[3] != NGHTTP2_SETTINGS || + (iframe->sbuf.pos[4] & NGHTTP2_FLAG_ACK)) { + + iframe->state = NGHTTP2_IB_IGN_ALL; + + rv = session_call_error_callback( + session, "Remote peer returned unexpected data while we expected " + "SETTINGS frame. Perhaps, peer does not support HTTP/2 " + "properly."); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "SETTINGS expected"); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return (ssize_t)inlen; + } + + iframe->state = NGHTTP2_IB_READ_HEAD; + + /* Fall through */ + case NGHTTP2_IB_READ_HEAD: { + int on_begin_frame_called = 0; + + DEBUGF(fprintf(stderr, "recv: [IB_READ_HEAD]\n")); + + readlen = inbound_frame_buf_read(iframe, in, last); + in += readlen; + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + return in - first; + } + + nghttp2_frame_unpack_frame_hd(&iframe->frame.hd, iframe->sbuf.pos); + iframe->payloadleft = iframe->frame.hd.length; + + DEBUGF(fprintf(stderr, "recv: payloadlen=%zu, type=%u, flags=0x%02x, " + "stream_id=%d\n", + iframe->frame.hd.length, iframe->frame.hd.type, + iframe->frame.hd.flags, iframe->frame.hd.stream_id)); + + if (iframe->frame.hd.length > session->local_settings.max_frame_size) { + DEBUGF(fprintf(stderr, "recv: length is too large %zu > %u\n", + iframe->frame.hd.length, + session->local_settings.max_frame_size)); + + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_FRAME_SIZE_ERROR, "too large frame size"); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + break; + } + + switch (iframe->frame.hd.type) { + case NGHTTP2_DATA: { + DEBUGF(fprintf(stderr, "recv: DATA\n")); + + iframe->frame.hd.flags &= + (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PADDED); + /* Check stream is open. If it is not open or closing, + ignore payload. */ + busy = 1; + + rv = session_on_data_received_fail_fast(session); + if (rv == NGHTTP2_ERR_IGN_PAYLOAD) { + DEBUGF(fprintf(stderr, "recv: DATA not allowed stream_id=%d\n", + iframe->frame.hd.stream_id)); + iframe->state = NGHTTP2_IB_IGN_DATA; + break; + } + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); + if (rv < 0) { + iframe->state = NGHTTP2_IB_IGN_DATA; + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, + "DATA: insufficient padding space"); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + break; + } + + if (rv == 1) { + iframe->state = NGHTTP2_IB_READ_PAD_DATA; + break; + } + + iframe->state = NGHTTP2_IB_READ_DATA; + break; + } + case NGHTTP2_HEADERS: + + DEBUGF(fprintf(stderr, "recv: HEADERS\n")); + + iframe->frame.hd.flags &= + (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS | + NGHTTP2_FLAG_PADDED | NGHTTP2_FLAG_PRIORITY); + + rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); + if (rv < 0) { + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, + "HEADERS: insufficient padding space"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + break; + } + + if (rv == 1) { + iframe->state = NGHTTP2_IB_READ_NBYTE; + break; + } + + pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); + + if (pri_fieldlen > 0) { + if (iframe->payloadleft < pri_fieldlen) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + + inbound_frame_set_mark(iframe, pri_fieldlen); + + break; + } + + /* Call on_begin_frame_callback here because + session_process_headers_frame() may call + on_begin_headers_callback */ + rv = session_call_on_begin_frame(session, &iframe->frame.hd); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + on_begin_frame_called = 1; + + rv = session_process_headers_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + rv = nghttp2_session_add_rst_stream( + session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + if (rv == NGHTTP2_ERR_IGN_HEADER_BLOCK) { + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; + + break; + case NGHTTP2_PRIORITY: + DEBUGF(fprintf(stderr, "recv: PRIORITY\n")); + + iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; + + if (iframe->payloadleft != NGHTTP2_PRIORITY_SPECLEN) { + busy = 1; + + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + + inbound_frame_set_mark(iframe, NGHTTP2_PRIORITY_SPECLEN); + + break; + case NGHTTP2_RST_STREAM: + case NGHTTP2_WINDOW_UPDATE: +#ifdef DEBUGBUILD + switch (iframe->frame.hd.type) { + case NGHTTP2_RST_STREAM: + DEBUGF(fprintf(stderr, "recv: RST_STREAM\n")); + break; + case NGHTTP2_WINDOW_UPDATE: + DEBUGF(fprintf(stderr, "recv: WINDOW_UPDATE\n")); + break; + } +#endif /* DEBUGBUILD */ + + iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; + + if (iframe->payloadleft != 4) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + + inbound_frame_set_mark(iframe, 4); + + break; + case NGHTTP2_SETTINGS: + DEBUGF(fprintf(stderr, "recv: SETTINGS\n")); + + iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; + + if ((iframe->frame.hd.length % NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) || + ((iframe->frame.hd.flags & NGHTTP2_FLAG_ACK) && + iframe->payloadleft > 0)) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_SETTINGS; + + if (iframe->payloadleft) { + nghttp2_settings_entry *min_header_table_size_entry; + + /* We allocate iv with addtional one entry, to store the + minimum header table size. */ + iframe->max_niv = + iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1; + + iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) * + iframe->max_niv); + + if (!iframe->iv) { + return NGHTTP2_ERR_NOMEM; + } + + min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; + min_header_table_size_entry->settings_id = + NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; + min_header_table_size_entry->value = UINT32_MAX; + + inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); + break; + } + + busy = 1; + + inbound_frame_set_mark(iframe, 0); + + break; + case NGHTTP2_PUSH_PROMISE: + DEBUGF(fprintf(stderr, "recv: PUSH_PROMISE\n")); + + iframe->frame.hd.flags &= + (NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PADDED); + + rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); + if (rv < 0) { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, + "PUSH_PROMISE: insufficient padding space"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + break; + } + + if (rv == 1) { + iframe->state = NGHTTP2_IB_READ_NBYTE; + break; + } + + if (iframe->payloadleft < 4) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + + inbound_frame_set_mark(iframe, 4); + + break; + case NGHTTP2_PING: + DEBUGF(fprintf(stderr, "recv: PING\n")); + + iframe->frame.hd.flags &= NGHTTP2_FLAG_ACK; + + if (iframe->payloadleft != 8) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + inbound_frame_set_mark(iframe, 8); + + break; + case NGHTTP2_GOAWAY: + DEBUGF(fprintf(stderr, "recv: GOAWAY\n")); + + iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; + + if (iframe->payloadleft < 8) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + inbound_frame_set_mark(iframe, 8); + + break; + case NGHTTP2_CONTINUATION: + DEBUGF(fprintf(stderr, "recv: unexpected CONTINUATION\n")); + + /* Receiving CONTINUATION in this state are subject to + connection error of type PROTOCOL_ERROR */ + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "CONTINUATION: unexpected"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + default: + DEBUGF(fprintf(stderr, "recv: extension frame\n")); + + if (check_ext_type_set(session->user_recv_ext_types, + iframe->frame.hd.type)) { + if (!session->callbacks.unpack_extension_callback) { + /* Silently ignore unknown frame type. */ + + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + } + + busy = 1; + + iframe->state = NGHTTP2_IB_READ_EXTENSION_PAYLOAD; + + break; + } else { + switch (iframe->frame.hd.type) { + case NGHTTP2_ALTSVC: + if ((session->builtin_recv_ext_types & NGHTTP2_TYPEMASK_ALTSVC) == + 0) { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + break; + } + + DEBUGF(fprintf(stderr, "recv: ALTSVC\n")); + + iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; + iframe->frame.ext.payload = &iframe->ext_frame_payload.altsvc; + + if (session->server) { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + break; + } + + if (iframe->payloadleft < 2) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + busy = 1; + + iframe->state = NGHTTP2_IB_READ_NBYTE; + inbound_frame_set_mark(iframe, 2); + + break; + default: + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + } + } + } + + if (!on_begin_frame_called) { + switch (iframe->state) { + case NGHTTP2_IB_IGN_HEADER_BLOCK: + case NGHTTP2_IB_IGN_PAYLOAD: + case NGHTTP2_IB_FRAME_SIZE_ERROR: + case NGHTTP2_IB_IGN_DATA: + break; + default: + rv = session_call_on_begin_frame(session, &iframe->frame.hd); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + } + + break; + } + case NGHTTP2_IB_READ_NBYTE: + DEBUGF(fprintf(stderr, "recv: [IB_READ_NBYTE]\n")); + + readlen = inbound_frame_buf_read(iframe, in, last); + in += readlen; + iframe->payloadleft -= readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu, left=%zd\n", + readlen, iframe->payloadleft, + nghttp2_buf_mark_avail(&iframe->sbuf))); + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + return in - first; + } + + switch (iframe->frame.hd.type) { + case NGHTTP2_HEADERS: + if (iframe->padlen == 0 && + (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { + padlen = inbound_frame_compute_pad(iframe); + if (padlen < 0) { + busy = 1; + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "HEADERS: invalid padding"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + break; + } + iframe->frame.headers.padlen = (size_t)padlen; + + pri_fieldlen = nghttp2_frame_priority_len(iframe->frame.hd.flags); + + if (pri_fieldlen > 0) { + if (iframe->payloadleft < pri_fieldlen) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + iframe->state = NGHTTP2_IB_READ_NBYTE; + inbound_frame_set_mark(iframe, pri_fieldlen); + break; + } else { + /* Truncate buffers used for padding spec */ + inbound_frame_set_mark(iframe, 0); + } + } + + rv = session_process_headers_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + rv = nghttp2_session_add_rst_stream( + session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + if (rv == NGHTTP2_ERR_IGN_HEADER_BLOCK) { + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; + + break; + case NGHTTP2_PRIORITY: + rv = session_process_priority_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_RST_STREAM: + rv = session_process_rst_stream_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_PUSH_PROMISE: + if (iframe->padlen == 0 && + (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { + padlen = inbound_frame_compute_pad(iframe); + if (padlen < 0) { + busy = 1; + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, + "PUSH_PROMISE: invalid padding"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + break; + } + + iframe->frame.push_promise.padlen = (size_t)padlen; + + if (iframe->payloadleft < 4) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + iframe->state = NGHTTP2_IB_READ_NBYTE; + + inbound_frame_set_mark(iframe, 4); + + break; + } + + rv = session_process_push_promise_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + rv = nghttp2_session_add_rst_stream( + session, iframe->frame.push_promise.promised_stream_id, + NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + if (rv == NGHTTP2_ERR_IGN_HEADER_BLOCK) { + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; + + break; + case NGHTTP2_PING: + rv = session_process_ping_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_GOAWAY: { + size_t debuglen; + + /* 8 is Last-stream-ID + Error Code */ + debuglen = iframe->frame.hd.length - 8; + + if (debuglen > 0) { + iframe->raw_lbuf = nghttp2_mem_malloc(mem, debuglen); + + if (iframe->raw_lbuf == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, debuglen); + } + + busy = 1; + + iframe->state = NGHTTP2_IB_READ_GOAWAY_DEBUG; + + break; + } + case NGHTTP2_WINDOW_UPDATE: + rv = session_process_window_update_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_ALTSVC: { + size_t origin_len; + + origin_len = nghttp2_get_uint16(iframe->sbuf.pos); + + DEBUGF(fprintf(stderr, "recv: origin_len=%zu\n", origin_len)); + + if (2 + origin_len > iframe->payloadleft) { + busy = 1; + iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; + break; + } + + if (iframe->frame.hd.length > 2) { + iframe->raw_lbuf = + nghttp2_mem_malloc(mem, iframe->frame.hd.length - 2); + + if (iframe->raw_lbuf == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_buf_wrap_init(&iframe->lbuf, iframe->raw_lbuf, + iframe->frame.hd.length); + } + + busy = 1; + + iframe->state = NGHTTP2_IB_READ_ALTSVC_PAYLOAD; + + break; + } + default: + /* This is unknown frame */ + session_inbound_frame_reset(session); + + break; + } + break; + case NGHTTP2_IB_READ_HEADER_BLOCK: + case NGHTTP2_IB_IGN_HEADER_BLOCK: { + ssize_t data_readlen; + size_t trail_padlen; + int final; +#ifdef DEBUGBUILD + if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { + fprintf(stderr, "recv: [IB_READ_HEADER_BLOCK]\n"); + } else { + fprintf(stderr, "recv: [IB_IGN_HEADER_BLOCK]\n"); + } +#endif /* DEBUGBUILD */ + + readlen = inbound_frame_payload_readlen(iframe, in, last); + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft - readlen)); + + data_readlen = inbound_frame_effective_readlen( + iframe, iframe->payloadleft - readlen, readlen); + trail_padlen = nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); + + final = (iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) && + iframe->payloadleft - (size_t)data_readlen == trail_padlen; + + if (data_readlen > 0 || (data_readlen == 0 && final)) { + size_t hd_proclen = 0; + + DEBUGF(fprintf(stderr, "recv: block final=%d\n", final)); + + rv = + inflate_header_block(session, &iframe->frame, &hd_proclen, + (uint8_t *)in, (size_t)data_readlen, final, + iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (rv == NGHTTP2_ERR_PAUSE) { + in += hd_proclen; + iframe->payloadleft -= hd_proclen; + + return in - first; + } + + if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + /* The application says no more headers. We decompress the + rest of the header block but not invoke on_header_callback + and on_frame_recv_callback. */ + in += hd_proclen; + iframe->payloadleft -= hd_proclen; + + /* Use promised stream ID for PUSH_PROMISE */ + rv = nghttp2_session_add_rst_stream( + session, iframe->frame.hd.type == NGHTTP2_PUSH_PROMISE + ? iframe->frame.push_promise.promised_stream_id + : iframe->frame.hd.stream_id, + NGHTTP2_INTERNAL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + busy = 1; + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + break; + } + + in += readlen; + iframe->payloadleft -= readlen; + + if (rv == NGHTTP2_ERR_HEADER_COMP) { + /* GOAWAY is already issued */ + if (iframe->payloadleft == 0) { + session_inbound_frame_reset(session); + } else { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + } + break; + } + } else { + in += readlen; + iframe->payloadleft -= readlen; + } + + if (iframe->payloadleft) { + break; + } + + if ((iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) == 0) { + + inbound_frame_set_mark(iframe, NGHTTP2_FRAME_HDLEN); + + iframe->padlen = 0; + + if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { + iframe->state = NGHTTP2_IB_EXPECT_CONTINUATION; + } else { + iframe->state = NGHTTP2_IB_IGN_CONTINUATION; + } + } else { + if (iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK) { + rv = session_after_header_block_received(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + session_inbound_frame_reset(session); + } + break; + } + case NGHTTP2_IB_IGN_PAYLOAD: + DEBUGF(fprintf(stderr, "recv: [IB_IGN_PAYLOAD]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + iframe->payloadleft -= readlen; + in += readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (iframe->payloadleft) { + break; + } + + switch (iframe->frame.hd.type) { + case NGHTTP2_HEADERS: + case NGHTTP2_PUSH_PROMISE: + case NGHTTP2_CONTINUATION: + /* Mark inflater bad so that we won't perform further decoding */ + session->hd_inflater.ctx.bad = 1; + break; + default: + break; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_FRAME_SIZE_ERROR: + DEBUGF(fprintf(stderr, "recv: [IB_FRAME_SIZE_ERROR]\n")); + + rv = session_handle_frame_size_error(session, &iframe->frame); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + case NGHTTP2_IB_READ_SETTINGS: + DEBUGF(fprintf(stderr, "recv: [IB_READ_SETTINGS]\n")); + + readlen = inbound_frame_buf_read(iframe, in, last); + iframe->payloadleft -= readlen; + in += readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + break; + } + + if (readlen > 0) { + inbound_frame_set_settings_entry(iframe); + } + if (iframe->payloadleft) { + inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); + break; + } + + rv = session_process_settings_frame(session); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_READ_GOAWAY_DEBUG: + DEBUGF(fprintf(stderr, "recv: [IB_READ_GOAWAY_DEBUG]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + + if (readlen > 0) { + iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); + + iframe->payloadleft -= readlen; + in += readlen; + } + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (iframe->payloadleft) { + assert(nghttp2_buf_avail(&iframe->lbuf) > 0); + + break; + } + + rv = session_process_goaway_frame(session); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_EXPECT_CONTINUATION: + case NGHTTP2_IB_IGN_CONTINUATION: +#ifdef DEBUGBUILD + if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { + fprintf(stderr, "recv: [IB_EXPECT_CONTINUATION]\n"); + } else { + fprintf(stderr, "recv: [IB_IGN_CONTINUATION]\n"); + } +#endif /* DEBUGBUILD */ + + readlen = inbound_frame_buf_read(iframe, in, last); + in += readlen; + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + return in - first; + } + + nghttp2_frame_unpack_frame_hd(&cont_hd, iframe->sbuf.pos); + iframe->payloadleft = cont_hd.length; + + DEBUGF(fprintf(stderr, "recv: payloadlen=%zu, type=%u, flags=0x%02x, " + "stream_id=%d\n", + cont_hd.length, cont_hd.type, cont_hd.flags, + cont_hd.stream_id)); + + if (cont_hd.type != NGHTTP2_CONTINUATION || + cont_hd.stream_id != iframe->frame.hd.stream_id) { + DEBUGF(fprintf(stderr, "recv: expected stream_id=%d, type=%d, but " + "got stream_id=%d, type=%u\n", + iframe->frame.hd.stream_id, NGHTTP2_CONTINUATION, + cont_hd.stream_id, cont_hd.type)); + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, + "unexpected non-CONTINUATION frame or stream_id is invalid"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + } + + /* CONTINUATION won't bear NGHTTP2_PADDED flag */ + + iframe->frame.hd.flags = (uint8_t)( + iframe->frame.hd.flags | (cont_hd.flags & NGHTTP2_FLAG_END_HEADERS)); + iframe->frame.hd.length += cont_hd.length; + + busy = 1; + + if (iframe->state == NGHTTP2_IB_EXPECT_CONTINUATION) { + iframe->state = NGHTTP2_IB_READ_HEADER_BLOCK; + + rv = session_call_on_begin_frame(session, &cont_hd); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } else { + iframe->state = NGHTTP2_IB_IGN_HEADER_BLOCK; + } + + break; + case NGHTTP2_IB_READ_PAD_DATA: + DEBUGF(fprintf(stderr, "recv: [IB_READ_PAD_DATA]\n")); + + readlen = inbound_frame_buf_read(iframe, in, last); + in += readlen; + iframe->payloadleft -= readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu, left=%zu\n", + readlen, iframe->payloadleft, + nghttp2_buf_mark_avail(&iframe->sbuf))); + + if (nghttp2_buf_mark_avail(&iframe->sbuf)) { + return in - first; + } + + /* Pad Length field is subject to flow control */ + rv = session_update_recv_connection_window_size(session, readlen); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + /* Pad Length field is consumed immediately */ + rv = + nghttp2_session_consume(session, iframe->frame.hd.stream_id, readlen); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); + if (stream) { + rv = session_update_recv_stream_window_size( + session, stream, readlen, + iframe->payloadleft || + (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + busy = 1; + + padlen = inbound_frame_compute_pad(iframe); + if (padlen < 0) { + rv = nghttp2_session_terminate_session_with_reason( + session, NGHTTP2_PROTOCOL_ERROR, "DATA: invalid padding"); + if (nghttp2_is_fatal(rv)) { + return rv; + } + iframe->state = NGHTTP2_IB_IGN_DATA; + break; + } + + iframe->frame.data.padlen = (size_t)padlen; + + iframe->state = NGHTTP2_IB_READ_DATA; + + break; + case NGHTTP2_IB_READ_DATA: + stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); + + if (!stream) { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_DATA; + break; + } + + DEBUGF(fprintf(stderr, "recv: [IB_READ_DATA]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + iframe->payloadleft -= readlen; + in += readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (readlen > 0) { + ssize_t data_readlen; + + rv = session_update_recv_connection_window_size(session, readlen); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + rv = session_update_recv_stream_window_size( + session, stream, readlen, + iframe->payloadleft || + (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + data_readlen = inbound_frame_effective_readlen( + iframe, iframe->payloadleft, readlen); + + if (data_readlen == -1) { + /* everything is padding */ + data_readlen = 0; + } + + padlen = (ssize_t)readlen - data_readlen; + + if (padlen > 0) { + /* Padding is considered as "consumed" immediately */ + rv = nghttp2_session_consume(session, iframe->frame.hd.stream_id, + (size_t)padlen); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + DEBUGF(fprintf(stderr, "recv: data_readlen=%zd\n", data_readlen)); + + if (data_readlen > 0) { + if (session_enforce_http_messaging(session)) { + if (nghttp2_http_on_data_chunk(stream, (size_t)data_readlen) != 0) { + if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { + /* Consume all data for connection immediately here */ + rv = session_update_connection_consumed_size( + session, (size_t)data_readlen); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + + rv = nghttp2_session_add_rst_stream( + session, iframe->frame.hd.stream_id, NGHTTP2_PROTOCOL_ERROR); + if (nghttp2_is_fatal(rv)) { + return rv; + } + busy = 1; + iframe->state = NGHTTP2_IB_IGN_DATA; + break; + } + } + if (session->callbacks.on_data_chunk_recv_callback) { + rv = session->callbacks.on_data_chunk_recv_callback( + session, iframe->frame.hd.flags, iframe->frame.hd.stream_id, + in - readlen, (size_t)data_readlen, session->user_data); + if (rv == NGHTTP2_ERR_PAUSE) { + return in - first; + } + + if (nghttp2_is_fatal(rv)) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + } + } + + if (iframe->payloadleft) { + break; + } + + rv = session_process_data_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_IGN_DATA: + DEBUGF(fprintf(stderr, "recv: [IB_IGN_DATA]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + iframe->payloadleft -= readlen; + in += readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (readlen > 0) { + /* Update connection-level flow control window for ignored + DATA frame too */ + rv = session_update_recv_connection_window_size(session, readlen); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { + + /* Ignored DATA is considered as "consumed" immediately. */ + rv = session_update_connection_consumed_size(session, readlen); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + } + } + + if (iframe->payloadleft) { + break; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_IGN_ALL: + return (ssize_t)inlen; + case NGHTTP2_IB_READ_EXTENSION_PAYLOAD: + DEBUGF(fprintf(stderr, "recv: [IB_READ_EXTENSION_PAYLOAD]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + iframe->payloadleft -= readlen; + in += readlen; + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (readlen > 0) { + rv = session_call_on_extension_chunk_recv_callback( + session, in - readlen, readlen); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + if (rv != 0) { + busy = 1; + + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + + break; + } + } + + if (iframe->payloadleft > 0) { + break; + } + + rv = session_process_extension_frame(session); + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + case NGHTTP2_IB_READ_ALTSVC_PAYLOAD: + DEBUGF(fprintf(stderr, "recv: [IB_READ_ALTSVC_PAYLOAD]\n")); + + readlen = inbound_frame_payload_readlen(iframe, in, last); + + if (readlen > 0) { + iframe->lbuf.last = nghttp2_cpymem(iframe->lbuf.last, in, readlen); + + iframe->payloadleft -= readlen; + in += readlen; + } + + DEBUGF(fprintf(stderr, "recv: readlen=%zu, payloadleft=%zu\n", readlen, + iframe->payloadleft)); + + if (iframe->payloadleft) { + assert(nghttp2_buf_avail(&iframe->lbuf) > 0); + + break; + } + + rv = session_process_altsvc_frame(session); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + session_inbound_frame_reset(session); + + break; + } + + if (!busy && in == last) { + break; + } + + busy = 0; + } + + assert(in == last); + + return in - first; +} + +int nghttp2_session_recv(nghttp2_session *session) { + uint8_t buf[NGHTTP2_INBOUND_BUFFER_LENGTH]; + while (1) { + ssize_t readlen; + readlen = session_recv(session, buf, sizeof(buf)); + if (readlen > 0) { + ssize_t proclen = nghttp2_session_mem_recv(session, buf, (size_t)readlen); + if (proclen < 0) { + return (int)proclen; + } + assert(proclen == readlen); + } else if (readlen == 0 || readlen == NGHTTP2_ERR_WOULDBLOCK) { + return 0; + } else if (readlen == NGHTTP2_ERR_EOF) { + return NGHTTP2_ERR_EOF; + } else if (readlen < 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } +} + +/* + * Returns the number of active streams, which includes streams in + * reserved state. + */ +static size_t session_get_num_active_streams(nghttp2_session *session) { + return nghttp2_map_size(&session->streams) - session->num_closed_streams - + session->num_idle_streams; +} + +int nghttp2_session_want_read(nghttp2_session *session) { + size_t num_active_streams; + + /* If this flag is set, we don't want to read. The application + should drop the connection. */ + if (session->goaway_flags & NGHTTP2_GOAWAY_TERM_SENT) { + return 0; + } + + num_active_streams = session_get_num_active_streams(session); + + /* Unless termination GOAWAY is sent or received, we always want to + read incoming frames. */ + + if (num_active_streams > 0) { + return 1; + } + + /* If there is no active streams and GOAWAY has been sent or + received, we are done with this session. */ + return (session->goaway_flags & + (NGHTTP2_GOAWAY_SENT | NGHTTP2_GOAWAY_RECV)) == 0; +} + +int nghttp2_session_want_write(nghttp2_session *session) { + /* If these flag is set, we don't want to write any data. The + application should drop the connection. */ + if (session->goaway_flags & NGHTTP2_GOAWAY_TERM_SENT) { + return 0; + } + + /* + * Unless termination GOAWAY is sent or received, we want to write + * frames if there is pending ones. If pending frame is request/push + * response HEADERS and concurrent stream limit is reached, we don't + * want to write them. + */ + + if (session->aob.item == NULL && + nghttp2_outbound_queue_top(&session->ob_urgent) == NULL && + nghttp2_outbound_queue_top(&session->ob_reg) == NULL && + (nghttp2_pq_empty(&session->root.obq) || + session->remote_window_size == 0) && + (nghttp2_outbound_queue_top(&session->ob_syn) == NULL || + session_is_outgoing_concurrent_streams_max(session))) { + return 0; + } + + /* If there is no active streams and GOAWAY has been sent or + received, we are done with this session. */ + return (session->goaway_flags & + (NGHTTP2_GOAWAY_SENT | NGHTTP2_GOAWAY_RECV)) == 0; +} + +int nghttp2_session_add_ping(nghttp2_session *session, uint8_t flags, + const uint8_t *opaque_data) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_mem *mem; + + mem = &session->mem; + + if ((flags & NGHTTP2_FLAG_ACK) && + session->obq_flood_counter_ >= NGHTTP2_MAX_OBQ_FLOOD_ITEM) { + return NGHTTP2_ERR_FLOODED; + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + nghttp2_frame_ping_init(&frame->ping, flags, opaque_data); + + rv = nghttp2_session_add_item(session, item); + + if (rv != 0) { + nghttp2_frame_ping_free(&frame->ping); + nghttp2_mem_free(mem, item); + return rv; + } + + if (flags & NGHTTP2_FLAG_ACK) { + ++session->obq_flood_counter_; + } + + return 0; +} + +int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id, + uint32_t error_code, const uint8_t *opaque_data, + size_t opaque_data_len, uint8_t aux_flags) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + uint8_t *opaque_data_copy = NULL; + nghttp2_goaway_aux_data *aux_data; + nghttp2_mem *mem; + + mem = &session->mem; + + if (nghttp2_session_is_my_stream_id(session, last_stream_id)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (opaque_data_len) { + if (opaque_data_len + 8 > NGHTTP2_MAX_PAYLOADLEN) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + opaque_data_copy = nghttp2_mem_malloc(mem, opaque_data_len); + if (opaque_data_copy == NULL) { + return NGHTTP2_ERR_NOMEM; + } + memcpy(opaque_data_copy, opaque_data, opaque_data_len); + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + nghttp2_mem_free(mem, opaque_data_copy); + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + /* last_stream_id must not be increased from the value previously + sent */ + last_stream_id = nghttp2_min(last_stream_id, session->local_last_stream_id); + + nghttp2_frame_goaway_init(&frame->goaway, last_stream_id, error_code, + opaque_data_copy, opaque_data_len); + + aux_data = &item->aux_data.goaway; + aux_data->flags = aux_flags; + + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + nghttp2_frame_goaway_free(&frame->goaway, mem); + nghttp2_mem_free(mem, item); + return rv; + } + return 0; +} + +int nghttp2_session_add_window_update(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + int32_t window_size_increment) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_mem *mem; + + mem = &session->mem; + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + nghttp2_frame_window_update_init(&frame->window_update, flags, stream_id, + window_size_increment); + + rv = nghttp2_session_add_item(session, item); + + if (rv != 0) { + nghttp2_frame_window_update_free(&frame->window_update); + nghttp2_mem_free(mem, item); + return rv; + } + return 0; +} + +static void +session_append_inflight_settings(nghttp2_session *session, + nghttp2_inflight_settings *settings) { + nghttp2_inflight_settings **i; + + for (i = &session->inflight_settings_head; *i; i = &(*i)->next) + ; + + *i = settings; +} + +int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags, + const nghttp2_settings_entry *iv, size_t niv) { + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_settings_entry *iv_copy; + size_t i; + int rv; + nghttp2_mem *mem; + nghttp2_inflight_settings *inflight_settings = NULL; + + mem = &session->mem; + + if (flags & NGHTTP2_FLAG_ACK) { + if (niv != 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (session->obq_flood_counter_ >= NGHTTP2_MAX_OBQ_FLOOD_ITEM) { + return NGHTTP2_ERR_FLOODED; + } + } + + if (!nghttp2_iv_check(iv, niv)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + if (niv > 0) { + iv_copy = nghttp2_frame_iv_copy(iv, niv, mem); + if (iv_copy == NULL) { + nghttp2_mem_free(mem, item); + return NGHTTP2_ERR_NOMEM; + } + } else { + iv_copy = NULL; + } + + if ((flags & NGHTTP2_FLAG_ACK) == 0) { + rv = inflight_settings_new(&inflight_settings, iv, niv, mem); + if (rv != 0) { + assert(nghttp2_is_fatal(rv)); + nghttp2_mem_free(mem, iv_copy); + nghttp2_mem_free(mem, item); + return rv; + } + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + nghttp2_frame_settings_init(&frame->settings, flags, iv_copy, niv); + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + /* The only expected error is fatal one */ + assert(nghttp2_is_fatal(rv)); + + inflight_settings_del(inflight_settings, mem); + + nghttp2_frame_settings_free(&frame->settings, mem); + nghttp2_mem_free(mem, item); + + return rv; + } + + if (flags & NGHTTP2_FLAG_ACK) { + ++session->obq_flood_counter_; + } else { + session_append_inflight_settings(session, inflight_settings); + } + + /* Extract NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS and ENABLE_PUSH + here. We use it to refuse the incoming stream and PUSH_PROMISE + with RST_STREAM. */ + + for (i = niv; i > 0; --i) { + if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS) { + session->pending_local_max_concurrent_stream = iv[i - 1].value; + break; + } + } + + for (i = niv; i > 0; --i) { + if (iv[i - 1].settings_id == NGHTTP2_SETTINGS_ENABLE_PUSH) { + session->pending_enable_push = (uint8_t)iv[i - 1].value; + break; + } + } + + return 0; +} + +int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, + size_t datamax, nghttp2_frame *frame, + nghttp2_data_aux_data *aux_data, + nghttp2_stream *stream) { + int rv; + uint32_t data_flags; + ssize_t payloadlen; + ssize_t padded_payloadlen; + nghttp2_buf *buf; + size_t max_payloadlen; + + assert(bufs->head == bufs->cur); + + buf = &bufs->cur->buf; + + if (session->callbacks.read_length_callback) { + + payloadlen = session->callbacks.read_length_callback( + session, frame->hd.type, stream->stream_id, session->remote_window_size, + stream->remote_window_size, session->remote_settings.max_frame_size, + session->user_data); + + DEBUGF(fprintf(stderr, "send: read_length_callback=%zd\n", payloadlen)); + + payloadlen = nghttp2_session_enforce_flow_control_limits(session, stream, + payloadlen); + + DEBUGF(fprintf(stderr, + "send: read_length_callback after flow control=%zd\n", + payloadlen)); + + if (payloadlen <= 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + if ((size_t)payloadlen > nghttp2_buf_avail(buf)) { + /* Resize the current buffer(s). The reason why we do +1 for + buffer size is for possible padding field. */ + rv = nghttp2_bufs_realloc(&session->aob.framebufs, + (size_t)(NGHTTP2_FRAME_HDLEN + 1 + payloadlen)); + + if (rv != 0) { + DEBUGF(fprintf(stderr, "send: realloc buffer failed rv=%d", rv)); + /* If reallocation failed, old buffers are still in tact. So + use safe limit. */ + payloadlen = (ssize_t)datamax; + + DEBUGF( + fprintf(stderr, "send: use safe limit payloadlen=%zd", payloadlen)); + } else { + assert(&session->aob.framebufs == bufs); + + buf = &bufs->cur->buf; + } + } + datamax = (size_t)payloadlen; + } + + /* Current max DATA length is less then buffer chunk size */ + assert(nghttp2_buf_avail(buf) >= datamax); + + data_flags = NGHTTP2_DATA_FLAG_NONE; + payloadlen = aux_data->data_prd.read_callback( + session, frame->hd.stream_id, buf->pos, datamax, &data_flags, + &aux_data->data_prd.source, session->user_data); + + if (payloadlen == NGHTTP2_ERR_DEFERRED || + payloadlen == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { + DEBUGF(fprintf(stderr, "send: DATA postponed due to %s\n", + nghttp2_strerror((int)payloadlen))); + + return (int)payloadlen; + } + + if (payloadlen < 0 || datamax < (size_t)payloadlen) { + /* This is the error code when callback is failed. */ + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + + buf->last = buf->pos + payloadlen; + buf->pos -= NGHTTP2_FRAME_HDLEN; + + /* Clear flags, because this may contain previous flags of previous + DATA */ + frame->hd.flags = NGHTTP2_FLAG_NONE; + + if (data_flags & NGHTTP2_DATA_FLAG_EOF) { + aux_data->eof = 1; + /* If NGHTTP2_DATA_FLAG_NO_END_STREAM is set, don't set + NGHTTP2_FLAG_END_STREAM */ + if ((aux_data->flags & NGHTTP2_FLAG_END_STREAM) && + (data_flags & NGHTTP2_DATA_FLAG_NO_END_STREAM) == 0) { + frame->hd.flags |= NGHTTP2_FLAG_END_STREAM; + } + } + + if (data_flags & NGHTTP2_DATA_FLAG_NO_COPY) { + if (session->callbacks.send_data_callback == NULL) { + DEBUGF(fprintf( + stderr, + "NGHTTP2_DATA_FLAG_NO_COPY requires send_data_callback set\n")); + + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + aux_data->no_copy = 1; + } + + frame->hd.length = (size_t)payloadlen; + frame->data.padlen = 0; + + max_payloadlen = nghttp2_min(datamax, frame->hd.length + NGHTTP2_MAX_PADLEN); + + padded_payloadlen = + session_call_select_padding(session, frame, max_payloadlen); + + if (nghttp2_is_fatal((int)padded_payloadlen)) { + return (int)padded_payloadlen; + } + + frame->data.padlen = (size_t)(padded_payloadlen - payloadlen); + + nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); + + rv = nghttp2_frame_add_pad(bufs, &frame->hd, frame->data.padlen, + aux_data->no_copy); + if (rv != 0) { + return rv; + } + + reschedule_stream(stream); + + if (frame->hd.length == 0 && (data_flags & NGHTTP2_DATA_FLAG_EOF) && + (data_flags & NGHTTP2_DATA_FLAG_NO_END_STREAM)) { + /* DATA payload length is 0, and DATA frame does not bear + END_STREAM. In this case, there is no point to send 0 length + DATA frame. */ + return NGHTTP2_ERR_CANCEL; + } + + return 0; +} + +void *nghttp2_session_get_stream_user_data(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + stream = nghttp2_session_get_stream(session, stream_id); + if (stream) { + return stream->stream_user_data; + } else { + return NULL; + } +} + +int nghttp2_session_set_stream_user_data(nghttp2_session *session, + int32_t stream_id, + void *stream_user_data) { + nghttp2_stream *stream; + stream = nghttp2_session_get_stream(session, stream_id); + if (!stream) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + stream->stream_user_data = stream_user_data; + return 0; +} + +int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) { + int rv; + nghttp2_stream *stream; + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL || !nghttp2_stream_check_deferred_item(stream)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + rv = nghttp2_stream_resume_deferred_item(stream, + NGHTTP2_STREAM_FLAG_DEFERRED_USER); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return rv; +} + +size_t nghttp2_session_get_outbound_queue_size(nghttp2_session *session) { + return nghttp2_outbound_queue_size(&session->ob_urgent) + + nghttp2_outbound_queue_size(&session->ob_reg) + + nghttp2_outbound_queue_size(&session->ob_syn); + /* TODO account for item attached to stream */ +} + +int32_t +nghttp2_session_get_stream_effective_recv_data_length(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL) { + return -1; + } + return stream->recv_window_size < 0 ? 0 : stream->recv_window_size; +} + +int32_t +nghttp2_session_get_stream_effective_local_window_size(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL) { + return -1; + } + return stream->local_window_size; +} + +int32_t +nghttp2_session_get_effective_recv_data_length(nghttp2_session *session) { + return session->recv_window_size < 0 ? 0 : session->recv_window_size; +} + +int32_t +nghttp2_session_get_effective_local_window_size(nghttp2_session *session) { + return session->local_window_size; +} + +int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, stream_id); + if (stream == NULL) { + return -1; + } + + /* stream->remote_window_size can be negative when + SETTINGS_INITIAL_WINDOW_SIZE is changed. */ + return nghttp2_max(0, stream->remote_window_size); +} + +int32_t nghttp2_session_get_remote_window_size(nghttp2_session *session) { + return session->remote_window_size; +} + +uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session, + nghttp2_settings_id id) { + switch (id) { + case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: + return session->remote_settings.header_table_size; + case NGHTTP2_SETTINGS_ENABLE_PUSH: + return session->remote_settings.enable_push; + case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + return session->remote_settings.max_concurrent_streams; + case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + return session->remote_settings.initial_window_size; + case NGHTTP2_SETTINGS_MAX_FRAME_SIZE: + return session->remote_settings.max_frame_size; + case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + return session->remote_settings.max_header_list_size; + } + + assert(0); +} + +static int nghttp2_session_upgrade_internal(nghttp2_session *session, + const uint8_t *settings_payload, + size_t settings_payloadlen, + void *stream_user_data) { + nghttp2_stream *stream; + nghttp2_frame frame; + nghttp2_settings_entry *iv; + size_t niv; + int rv; + nghttp2_priority_spec pri_spec; + nghttp2_mem *mem; + + mem = &session->mem; + + if ((!session->server && session->next_stream_id != 1) || + (session->server && session->last_recv_stream_id >= 1)) { + return NGHTTP2_ERR_PROTO; + } + if (settings_payloadlen % NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + rv = nghttp2_frame_unpack_settings_payload2(&iv, &niv, settings_payload, + settings_payloadlen, mem); + if (rv != 0) { + return rv; + } + + if (session->server) { + nghttp2_frame_hd_init(&frame.hd, settings_payloadlen, NGHTTP2_SETTINGS, + NGHTTP2_FLAG_NONE, 0); + frame.settings.iv = iv; + frame.settings.niv = niv; + rv = nghttp2_session_on_settings_received(session, &frame, 1 /* No ACK */); + } else { + rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, niv); + } + nghttp2_mem_free(mem, iv); + if (rv != 0) { + return rv; + } + + nghttp2_priority_spec_default_init(&pri_spec); + + stream = nghttp2_session_open_stream( + session, 1, NGHTTP2_STREAM_FLAG_NONE, &pri_spec, NGHTTP2_STREAM_OPENING, + session->server ? NULL : stream_user_data); + if (stream == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + /* We don't call nghttp2_session_adjust_closed_stream(), since this + should be the first stream open. */ + + if (session->server) { + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); + session->last_recv_stream_id = 1; + session->last_proc_stream_id = 1; + } else { + nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); + session->last_sent_stream_id = 1; + session->next_stream_id += 2; + } + return 0; +} + +int nghttp2_session_upgrade(nghttp2_session *session, + const uint8_t *settings_payload, + size_t settings_payloadlen, + void *stream_user_data) { + int rv; + nghttp2_stream *stream; + + rv = nghttp2_session_upgrade_internal(session, settings_payload, + settings_payloadlen, stream_user_data); + if (rv != 0) { + return rv; + } + + stream = nghttp2_session_get_stream(session, 1); + assert(stream); + + /* We have no information about request header fields when Upgrade + was happened. So we don't know the request method here. If + request method is HEAD, we have a trouble because we may have + nonzero content-length header field in response headers, and we + will going to check it against the actual DATA frames, but we may + get mismatch because HEAD response body must be empty. Because + of this reason, nghttp2_session_upgrade() was deprecated in favor + of nghttp2_session_upgrade2(), which has |head_request| parameter + to indicate that request method is HEAD or not. */ + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND; + return 0; +} + +int nghttp2_session_upgrade2(nghttp2_session *session, + const uint8_t *settings_payload, + size_t settings_payloadlen, int head_request, + void *stream_user_data) { + int rv; + nghttp2_stream *stream; + + rv = nghttp2_session_upgrade_internal(session, settings_payload, + settings_payloadlen, stream_user_data); + if (rv != 0) { + return rv; + } + + stream = nghttp2_session_get_stream(session, 1); + assert(stream); + + if (head_request) { + stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_HEAD; + } + + return 0; +} + +int nghttp2_session_get_stream_local_close(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, stream_id); + + if (!stream) { + return -1; + } + + return (stream->shut_flags & NGHTTP2_SHUT_WR) != 0; +} + +int nghttp2_session_get_stream_remote_close(nghttp2_session *session, + int32_t stream_id) { + nghttp2_stream *stream; + + stream = nghttp2_session_get_stream(session, stream_id); + + if (!stream) { + return -1; + } + + return (stream->shut_flags & NGHTTP2_SHUT_RD) != 0; +} + +int nghttp2_session_consume(nghttp2_session *session, int32_t stream_id, + size_t size) { + int rv; + nghttp2_stream *stream; + + if (stream_id == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (!(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE)) { + return NGHTTP2_ERR_INVALID_STATE; + } + + rv = session_update_connection_consumed_size(session, size); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + stream = nghttp2_session_get_stream(session, stream_id); + + if (!stream) { + return 0; + } + + rv = session_update_stream_consumed_size(session, stream, size); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return 0; +} + +int nghttp2_session_consume_connection(nghttp2_session *session, size_t size) { + int rv; + + if (!(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE)) { + return NGHTTP2_ERR_INVALID_STATE; + } + + rv = session_update_connection_consumed_size(session, size); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return 0; +} + +int nghttp2_session_consume_stream(nghttp2_session *session, int32_t stream_id, + size_t size) { + int rv; + nghttp2_stream *stream; + + if (stream_id == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (!(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE)) { + return NGHTTP2_ERR_INVALID_STATE; + } + + stream = nghttp2_session_get_stream(session, stream_id); + + if (!stream) { + return 0; + } + + rv = session_update_stream_consumed_size(session, stream, size); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + return 0; +} + +int nghttp2_session_set_next_stream_id(nghttp2_session *session, + int32_t next_stream_id) { + if (next_stream_id <= 0 || + session->next_stream_id > (uint32_t)next_stream_id) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (session->server) { + if (next_stream_id % 2) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + } else if (next_stream_id % 2 == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + session->next_stream_id = (uint32_t)next_stream_id; + return 0; +} + +uint32_t nghttp2_session_get_next_stream_id(nghttp2_session *session) { + return session->next_stream_id; +} + +int32_t nghttp2_session_get_last_proc_stream_id(nghttp2_session *session) { + return session->last_proc_stream_id; +} + +nghttp2_stream *nghttp2_session_find_stream(nghttp2_session *session, + int32_t stream_id) { + if (stream_id == 0) { + return &session->root; + } + + return nghttp2_session_get_stream_raw(session, stream_id); +} + +nghttp2_stream *nghttp2_session_get_root_stream(nghttp2_session *session) { + return &session->root; +} + +int nghttp2_session_check_server_session(nghttp2_session *session) { + return session->server; +} + +int nghttp2_session_change_stream_priority( + nghttp2_session *session, int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + int rv; + nghttp2_stream *stream; + nghttp2_priority_spec pri_spec_copy; + + if (stream_id == 0 || stream_id == pri_spec->stream_id) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + stream = nghttp2_session_get_stream_raw(session, stream_id); + if (!stream) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + pri_spec_copy = *pri_spec; + nghttp2_priority_spec_normalize_weight(&pri_spec_copy); + + rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec_copy); + + if (nghttp2_is_fatal(rv)) { + return rv; + } + + /* We don't intentionally call nghttp2_session_adjust_idle_stream() + so that idle stream created by this function, and existing ones + are kept for application. We will adjust number of idle stream + in nghttp2_session_mem_send or nghttp2_session_mem_recv is + called. */ + return 0; +} + +int nghttp2_session_create_idle_stream(nghttp2_session *session, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + nghttp2_stream *stream; + nghttp2_priority_spec pri_spec_copy; + + if (stream_id == 0 || stream_id == pri_spec->stream_id || + !session_detect_idle_stream(session, stream_id)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + stream = nghttp2_session_get_stream_raw(session, stream_id); + if (stream) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + pri_spec_copy = *pri_spec; + nghttp2_priority_spec_normalize_weight(&pri_spec_copy); + + stream = + nghttp2_session_open_stream(session, stream_id, NGHTTP2_STREAM_FLAG_NONE, + &pri_spec_copy, NGHTTP2_STREAM_IDLE, NULL); + if (!stream) { + return NGHTTP2_ERR_NOMEM; + } + + /* We don't intentionally call nghttp2_session_adjust_idle_stream() + so that idle stream created by this function, and existing ones + are kept for application. We will adjust number of idle stream + in nghttp2_session_mem_send or nghttp2_session_mem_recv is + called. */ + return 0; +} diff --git a/components/nghttp/library/nghttp2_stream.c b/components/nghttp/library/nghttp2_stream.c new file mode 100644 index 0000000000..3221fbf85c --- /dev/null +++ b/components/nghttp/library/nghttp2_stream.c @@ -0,0 +1,1007 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_stream.h" + +#include +#include + +#include "nghttp2_session.h" +#include "nghttp2_helper.h" + +/* Maximum distance between any two stream's cycle in the same + prirority queue. Imagine stream A's cycle is A, and stream B's + cycle is B, and A < B. The cycle is unsigned 32 bit integer, it + may get overflow. Because of how we calculate the next cycle + value, if B - A is less than or equals to + NGHTTP2_MAX_CYCLE_DISTANCE, A and B are in the same scale, in other + words, B is really greater than or equal to A. Otherwise, A is a + result of overflow, and it is actually A > B if we consider that + fact. */ +#define NGHTTP2_MAX_CYCLE_DISTANCE (16384 * 256 + 255) + +static int stream_less(const void *lhsx, const void *rhsx) { + const nghttp2_stream *lhs, *rhs; + + lhs = nghttp2_struct_of(lhsx, nghttp2_stream, pq_entry); + rhs = nghttp2_struct_of(rhsx, nghttp2_stream, pq_entry); + + if (lhs->cycle == rhs->cycle) { + return lhs->seq < rhs->seq; + } + + if (lhs->cycle < rhs->cycle) { + return rhs->cycle - lhs->cycle <= NGHTTP2_MAX_CYCLE_DISTANCE; + } + + return lhs->cycle - rhs->cycle > NGHTTP2_MAX_CYCLE_DISTANCE; +} + +void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, + uint8_t flags, nghttp2_stream_state initial_state, + int32_t weight, int32_t remote_initial_window_size, + int32_t local_initial_window_size, + void *stream_user_data, nghttp2_mem *mem) { + nghttp2_map_entry_init(&stream->map_entry, (key_type)stream_id); + nghttp2_pq_init(&stream->obq, stream_less, mem); + + stream->stream_id = stream_id; + stream->flags = flags; + stream->state = initial_state; + stream->shut_flags = NGHTTP2_SHUT_NONE; + stream->stream_user_data = stream_user_data; + stream->item = NULL; + stream->remote_window_size = remote_initial_window_size; + stream->local_window_size = local_initial_window_size; + stream->recv_window_size = 0; + stream->consumed_size = 0; + stream->recv_reduction = 0; + stream->window_update_queued = 0; + + stream->dep_prev = NULL; + stream->dep_next = NULL; + stream->sib_prev = NULL; + stream->sib_next = NULL; + + stream->closed_prev = NULL; + stream->closed_next = NULL; + + stream->weight = weight; + stream->sum_dep_weight = 0; + + stream->http_flags = NGHTTP2_HTTP_FLAG_NONE; + stream->content_length = -1; + stream->recv_content_length = 0; + stream->status_code = -1; + + stream->queued = 0; + stream->descendant_last_cycle = 0; + stream->cycle = 0; + stream->pending_penalty = 0; + stream->descendant_next_seq = 0; + stream->seq = 0; + stream->last_writelen = 0; +} + +void nghttp2_stream_free(nghttp2_stream *stream) { + nghttp2_pq_free(&stream->obq); + /* We don't free stream->item. If it is assigned to aob, then + active_outbound_item_reset() will delete it. Otherwise, + nghttp2_stream_close() or session_del() will delete it. */ +} + +void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag) { + stream->shut_flags = (uint8_t)(stream->shut_flags | flag); +} + +/* + * Returns nonzero if |stream| is active. This function does not take + * into account its descendants. + */ +static int stream_active(nghttp2_stream *stream) { + return stream->item && + (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) == 0; +} + +/* + * Returns nonzero if |stream| or one of its descendants is active + */ +static int stream_subtree_active(nghttp2_stream *stream) { + return stream_active(stream) || !nghttp2_pq_empty(&stream->obq); +} + +/* + * Returns next cycle for |stream|. + */ +static void stream_next_cycle(nghttp2_stream *stream, uint32_t last_cycle) { + uint32_t penalty; + + penalty = (uint32_t)stream->last_writelen * NGHTTP2_MAX_WEIGHT + + stream->pending_penalty; + + stream->cycle = last_cycle + penalty / (uint32_t)stream->weight; + stream->pending_penalty = penalty % (uint32_t)stream->weight; +} + +static int stream_obq_push(nghttp2_stream *dep_stream, nghttp2_stream *stream) { + int rv; + + for (; dep_stream && !stream->queued; + stream = dep_stream, dep_stream = dep_stream->dep_prev) { + stream_next_cycle(stream, dep_stream->descendant_last_cycle); + stream->seq = dep_stream->descendant_next_seq++; + + DEBUGF(fprintf(stderr, "stream: stream=%d obq push cycle=%d\n", + stream->stream_id, stream->cycle)); + + DEBUGF(fprintf(stderr, "stream: push stream %d to stream %d\n", + stream->stream_id, dep_stream->stream_id)); + + rv = nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry); + if (rv != 0) { + return rv; + } + stream->queued = 1; + } + + return 0; +} + +/* + * Removes |stream| from parent's obq. If removal of |stream| makes + * parent's obq empty, and parent is not active, then parent is also + * removed. This process is repeated recursively. + */ +static void stream_obq_remove(nghttp2_stream *stream) { + nghttp2_stream *dep_stream; + + dep_stream = stream->dep_prev; + + if (!stream->queued) { + return; + } + + for (; dep_stream; stream = dep_stream, dep_stream = dep_stream->dep_prev) { + DEBUGF(fprintf(stderr, "stream: remove stream %d from stream %d\n", + stream->stream_id, dep_stream->stream_id)); + + nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry); + + assert(stream->queued); + + stream->queued = 0; + stream->cycle = 0; + stream->pending_penalty = 0; + stream->descendant_last_cycle = 0; + stream->last_writelen = 0; + + if (stream_subtree_active(dep_stream)) { + return; + } + } +} + +/* + * Moves |stream| from |src|'s obq to |dest|'s obq. Removal from + * |src|'s obq is just done calling nghttp2_pq_remove(), so it does + * not recursively remove |src| and ancestors, like + * stream_obq_remove(). + */ +static int stream_obq_move(nghttp2_stream *dest, nghttp2_stream *src, + nghttp2_stream *stream) { + if (!stream->queued) { + return 0; + } + + DEBUGF(fprintf(stderr, "stream: remove stream %d from stream %d (move)\n", + stream->stream_id, src->stream_id)); + + nghttp2_pq_remove(&src->obq, &stream->pq_entry); + stream->queued = 0; + + return stream_obq_push(dest, stream); +} + +void nghttp2_stream_reschedule(nghttp2_stream *stream) { + nghttp2_stream *dep_stream; + + assert(stream->queued); + + dep_stream = stream->dep_prev; + + for (; dep_stream; stream = dep_stream, dep_stream = dep_stream->dep_prev) { + nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry); + + stream_next_cycle(stream, dep_stream->descendant_last_cycle); + stream->seq = dep_stream->descendant_next_seq++; + + nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry); + + DEBUGF(fprintf(stderr, "stream: stream=%d obq resched cycle=%d\n", + stream->stream_id, stream->cycle)); + + dep_stream->last_writelen = stream->last_writelen; + } +} + +void nghttp2_stream_change_weight(nghttp2_stream *stream, int32_t weight) { + nghttp2_stream *dep_stream; + uint32_t last_cycle; + int32_t old_weight; + uint32_t wlen_penalty; + + if (stream->weight == weight) { + return; + } + + old_weight = stream->weight; + stream->weight = weight; + + dep_stream = stream->dep_prev; + + if (!dep_stream) { + return; + } + + dep_stream->sum_dep_weight += weight - old_weight; + + if (!stream->queued) { + return; + } + + nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry); + + wlen_penalty = (uint32_t)stream->last_writelen * NGHTTP2_MAX_WEIGHT; + + /* Compute old stream->pending_penalty we used to calculate + stream->cycle */ + stream->pending_penalty = + (uint32_t)((stream->pending_penalty + (uint32_t)old_weight - + (wlen_penalty % (uint32_t)old_weight)) % + (uint32_t)old_weight); + + last_cycle = stream->cycle - + (wlen_penalty + stream->pending_penalty) / (uint32_t)old_weight; + + /* Now we have old stream->pending_penalty and new stream->weight in + place */ + stream_next_cycle(stream, last_cycle); + + if (stream->cycle < dep_stream->descendant_last_cycle && + (dep_stream->descendant_last_cycle - stream->cycle) <= + NGHTTP2_MAX_CYCLE_DISTANCE) { + stream->cycle = dep_stream->descendant_last_cycle; + } + + /* Continue to use same stream->seq */ + + nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry); + + DEBUGF(fprintf(stderr, "stream: stream=%d obq resched cycle=%d\n", + stream->stream_id, stream->cycle)); +} + +static nghttp2_stream *stream_last_sib(nghttp2_stream *stream) { + for (; stream->sib_next; stream = stream->sib_next) + ; + + return stream; +} + +int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream, + int32_t weight) { + weight = stream->weight * weight / stream->sum_dep_weight; + + return nghttp2_max(1, weight); +} + +#ifdef STREAM_DEP_DEBUG + +static void ensure_inactive(nghttp2_stream *stream) { + nghttp2_stream *si; + + if (stream->queued) { + fprintf(stderr, "stream(%p)=%d, stream->queued = 1; want 0\n", stream, + stream->stream_id); + assert(0); + } + + if (stream_active(stream)) { + fprintf(stderr, "stream(%p)=%d, stream_active(stream) = 1; want 0\n", + stream, stream->stream_id); + assert(0); + } + + if (!nghttp2_pq_empty(&stream->obq)) { + fprintf(stderr, "stream(%p)=%d, nghttp2_pq_size() = %zu; want 0\n", stream, + stream->stream_id, nghttp2_pq_size(&stream->obq)); + assert(0); + } + + for (si = stream->dep_next; si; si = si->sib_next) { + ensure_inactive(si); + } +} + +static void check_queued(nghttp2_stream *stream) { + nghttp2_stream *si; + int queued; + + if (stream->queued) { + if (!stream_subtree_active(stream)) { + fprintf(stderr, + "stream(%p)=%d, stream->queued == 1, but " + "stream_active() == %d and nghttp2_pq_size(&stream->obq) = %zu\n", + stream, stream->stream_id, stream_active(stream), + nghttp2_pq_size(&stream->obq)); + assert(0); + } + if (!stream_active(stream)) { + queued = 0; + for (si = stream->dep_next; si; si = si->sib_next) { + if (si->queued) { + ++queued; + } + } + if (queued == 0) { + fprintf(stderr, "stream(%p)=%d, stream->queued == 1, and " + "!stream_active(), but no descendants is queued\n", + stream, stream->stream_id); + assert(0); + } + } + + for (si = stream->dep_next; si; si = si->sib_next) { + check_queued(si); + } + } else { + if (stream_active(stream) || !nghttp2_pq_empty(&stream->obq)) { + fprintf(stderr, "stream(%p) = %d, stream->queued == 0, but " + "stream_active(stream) == %d and " + "nghttp2_pq_size(&stream->obq) = %zu\n", + stream, stream->stream_id, stream_active(stream), + nghttp2_pq_size(&stream->obq)); + assert(0); + } + for (si = stream->dep_next; si; si = si->sib_next) { + ensure_inactive(si); + } + } +} + +static void check_sum_dep(nghttp2_stream *stream) { + nghttp2_stream *si; + int32_t n = 0; + for (si = stream->dep_next; si; si = si->sib_next) { + n += si->weight; + } + if (n != stream->sum_dep_weight) { + fprintf(stderr, "stream(%p)=%d, sum_dep_weight = %d; want %d\n", stream, + stream->stream_id, n, stream->sum_dep_weight); + assert(0); + } + for (si = stream->dep_next; si; si = si->sib_next) { + check_sum_dep(si); + } +} + +static void check_dep_prev(nghttp2_stream *stream) { + nghttp2_stream *si; + for (si = stream->dep_next; si; si = si->sib_next) { + if (si->dep_prev != stream) { + fprintf(stderr, "si->dep_prev = %p; want %p\n", si->dep_prev, stream); + assert(0); + } + check_dep_prev(si); + } +} + +#endif /* STREAM_DEP_DEBUG */ + +#ifdef STREAM_DEP_DEBUG +static void validate_tree(nghttp2_stream *stream) { + nghttp2_stream *si; + + if (!stream) { + return; + } + + for (; stream->dep_prev; stream = stream->dep_prev) + ; + + assert(stream->stream_id == 0); + assert(!stream->queued); + + fprintf(stderr, "checking...\n"); + if (nghttp2_pq_empty(&stream->obq)) { + fprintf(stderr, "root obq empty\n"); + for (si = stream->dep_next; si; si = si->sib_next) { + ensure_inactive(si); + } + } else { + for (si = stream->dep_next; si; si = si->sib_next) { + check_queued(si); + } + } + + check_sum_dep(stream); + check_dep_prev(stream); +} +#else /* !STREAM_DEP_DEBUG */ +static void validate_tree(nghttp2_stream *stream _U_) {} +#endif /* !STREAM_DEP_DEBUG*/ + +static int stream_update_dep_on_attach_item(nghttp2_stream *stream) { + int rv; + + rv = stream_obq_push(stream->dep_prev, stream); + if (rv != 0) { + return rv; + } + + validate_tree(stream); + return 0; +} + +static int stream_update_dep_on_detach_item(nghttp2_stream *stream) { + if (nghttp2_pq_empty(&stream->obq)) { + stream_obq_remove(stream); + } + + validate_tree(stream); + + return 0; +} + +int nghttp2_stream_attach_item(nghttp2_stream *stream, + nghttp2_outbound_item *item) { + int rv; + + assert((stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) == 0); + assert(stream->item == NULL); + + DEBUGF(fprintf(stderr, "stream: stream=%d attach item=%p\n", + stream->stream_id, item)); + + stream->item = item; + + rv = stream_update_dep_on_attach_item(stream); + if (rv != 0) { + /* This may relave stream->queued == 1, but stream->item == NULL. + But only consequence of this error is fatal one, and session + destruction. In that execution path, these inconsistency does + not matter. */ + stream->item = NULL; + return rv; + } + + return 0; +} + +int nghttp2_stream_detach_item(nghttp2_stream *stream) { + DEBUGF(fprintf(stderr, "stream: stream=%d detach item=%p\n", + stream->stream_id, stream->item)); + + stream->item = NULL; + stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_DEFERRED_ALL); + + return stream_update_dep_on_detach_item(stream); +} + +int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags) { + assert(stream->item); + + DEBUGF(fprintf(stderr, "stream: stream=%d defer item=%p cause=%02x\n", + stream->stream_id, stream->item, flags)); + + stream->flags |= flags; + + return stream_update_dep_on_detach_item(stream); +} + +int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags) { + assert(stream->item); + + DEBUGF(fprintf(stderr, "stream: stream=%d resume item=%p flags=%02x\n", + stream->stream_id, stream->item, flags)); + + stream->flags = (uint8_t)(stream->flags & ~flags); + + if (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) { + return 0; + } + + return stream_update_dep_on_attach_item(stream); +} + +int nghttp2_stream_check_deferred_item(nghttp2_stream *stream) { + return stream->item && (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL); +} + +int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream) { + return stream->item && + (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); +} + +static int update_initial_window_size(int32_t *window_size_ptr, + int32_t new_initial_window_size, + int32_t old_initial_window_size) { + int64_t new_window_size = (int64_t)(*window_size_ptr) + + new_initial_window_size - old_initial_window_size; + if (INT32_MIN > new_window_size || + new_window_size > NGHTTP2_MAX_WINDOW_SIZE) { + return -1; + } + *window_size_ptr = (int32_t)new_window_size; + return 0; +} + +int nghttp2_stream_update_remote_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size) { + return update_initial_window_size(&stream->remote_window_size, + new_initial_window_size, + old_initial_window_size); +} + +int nghttp2_stream_update_local_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size) { + return update_initial_window_size(&stream->local_window_size, + new_initial_window_size, + old_initial_window_size); +} + +void nghttp2_stream_promise_fulfilled(nghttp2_stream *stream) { + stream->state = NGHTTP2_STREAM_OPENED; + stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_PUSH); +} + +int nghttp2_stream_dep_find_ancestor(nghttp2_stream *stream, + nghttp2_stream *target) { + for (; stream; stream = stream->dep_prev) { + if (stream == target) { + return 1; + } + } + return 0; +} + +int nghttp2_stream_dep_insert(nghttp2_stream *dep_stream, + nghttp2_stream *stream) { + nghttp2_stream *si; + int rv; + + DEBUGF(fprintf(stderr, + "stream: dep_insert dep_stream(%p)=%d, stream(%p)=%d\n", + dep_stream, dep_stream->stream_id, stream, stream->stream_id)); + + stream->sum_dep_weight = dep_stream->sum_dep_weight; + dep_stream->sum_dep_weight = stream->weight; + + if (dep_stream->dep_next) { + for (si = dep_stream->dep_next; si; si = si->sib_next) { + si->dep_prev = stream; + if (si->queued) { + rv = stream_obq_move(stream, dep_stream, si); + if (rv != 0) { + return rv; + } + } + } + + if (stream_subtree_active(stream)) { + rv = stream_obq_push(dep_stream, stream); + if (rv != 0) { + return rv; + } + } + + stream->dep_next = dep_stream->dep_next; + } + + dep_stream->dep_next = stream; + stream->dep_prev = dep_stream; + + validate_tree(stream); + + return 0; +} + +static void set_dep_prev(nghttp2_stream *stream, nghttp2_stream *dep) { + for (; stream; stream = stream->sib_next) { + stream->dep_prev = dep; + } +} + +static void link_dep(nghttp2_stream *dep_stream, nghttp2_stream *stream) { + dep_stream->dep_next = stream; + if (stream) { + stream->dep_prev = dep_stream; + } +} + +static void link_sib(nghttp2_stream *a, nghttp2_stream *b) { + a->sib_next = b; + if (b) { + b->sib_prev = a; + } +} + +static void insert_link_dep(nghttp2_stream *dep_stream, + nghttp2_stream *stream) { + nghttp2_stream *sib_next; + + assert(stream->sib_prev == NULL); + + sib_next = dep_stream->dep_next; + + link_sib(stream, sib_next); + + link_dep(dep_stream, stream); +} + +static void unlink_sib(nghttp2_stream *stream) { + nghttp2_stream *prev, *next, *dep_next; + + prev = stream->sib_prev; + dep_next = stream->dep_next; + + assert(prev); + + if (dep_next) { + /* + * prev--stream(--sib_next--...) + * | + * dep_next + */ + + link_sib(prev, dep_next); + + set_dep_prev(dep_next, stream->dep_prev); + + if (stream->sib_next) { + link_sib(stream_last_sib(dep_next), stream->sib_next); + } + } else { + /* + * prev--stream(--sib_next--...) + */ + next = stream->sib_next; + + prev->sib_next = next; + + if (next) { + next->sib_prev = prev; + } + } +} + +static void unlink_dep(nghttp2_stream *stream) { + nghttp2_stream *prev, *next, *dep_next; + + prev = stream->dep_prev; + dep_next = stream->dep_next; + + assert(prev); + + if (dep_next) { + /* + * prev + * | + * stream(--sib_next--...) + * | + * dep_next + */ + link_dep(prev, dep_next); + + set_dep_prev(dep_next, stream->dep_prev); + + if (stream->sib_next) { + link_sib(stream_last_sib(dep_next), stream->sib_next); + } + + } else if (stream->sib_next) { + /* + * prev + * | + * stream--sib_next + */ + next = stream->sib_next; + + next->sib_prev = NULL; + + link_dep(prev, next); + } else { + prev->dep_next = NULL; + } +} + +void nghttp2_stream_dep_add(nghttp2_stream *dep_stream, + nghttp2_stream *stream) { + DEBUGF(fprintf(stderr, "stream: dep_add dep_stream(%p)=%d, stream(%p)=%d\n", + dep_stream, dep_stream->stream_id, stream, stream->stream_id)); + + dep_stream->sum_dep_weight += stream->weight; + + if (dep_stream->dep_next == NULL) { + link_dep(dep_stream, stream); + } else { + insert_link_dep(dep_stream, stream); + } + + validate_tree(stream); +} + +int nghttp2_stream_dep_remove(nghttp2_stream *stream) { + nghttp2_stream *dep_prev, *si; + int32_t sum_dep_weight_delta; + int rv; + + DEBUGF(fprintf(stderr, "stream: dep_remove stream(%p)=%d\n", stream, + stream->stream_id)); + + /* Distribute weight of |stream| to direct descendants */ + sum_dep_weight_delta = -stream->weight; + + for (si = stream->dep_next; si; si = si->sib_next) { + si->weight = nghttp2_stream_dep_distributed_weight(stream, si->weight); + + sum_dep_weight_delta += si->weight; + + if (si->queued) { + rv = stream_obq_move(stream->dep_prev, stream, si); + if (rv != 0) { + return rv; + } + } + } + + assert(stream->dep_prev); + + dep_prev = stream->dep_prev; + + dep_prev->sum_dep_weight += sum_dep_weight_delta; + + if (stream->queued) { + stream_obq_remove(stream); + } + + if (stream->sib_prev) { + unlink_sib(stream); + } else { + unlink_dep(stream); + } + + stream->sum_dep_weight = 0; + + stream->dep_prev = NULL; + stream->dep_next = NULL; + stream->sib_prev = NULL; + stream->sib_next = NULL; + + validate_tree(dep_prev); + + return 0; +} + +int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream, + nghttp2_stream *stream) { + nghttp2_stream *last_sib; + nghttp2_stream *dep_next; + nghttp2_stream *si; + int rv; + + DEBUGF(fprintf(stderr, "stream: dep_insert_subtree dep_stream(%p)=%d " + "stream(%p)=%d\n", + dep_stream, dep_stream->stream_id, stream, stream->stream_id)); + + stream->sum_dep_weight += dep_stream->sum_dep_weight; + dep_stream->sum_dep_weight = stream->weight; + + if (dep_stream->dep_next) { + dep_next = dep_stream->dep_next; + + link_dep(dep_stream, stream); + + if (stream->dep_next) { + last_sib = stream_last_sib(stream->dep_next); + + link_sib(last_sib, dep_next); + } else { + link_dep(stream, dep_next); + } + + for (si = dep_next; si; si = si->sib_next) { + si->dep_prev = stream; + if (si->queued) { + rv = stream_obq_move(stream, dep_stream, si); + if (rv != 0) { + return rv; + } + } + } + } else { + link_dep(dep_stream, stream); + } + + if (stream_subtree_active(stream)) { + rv = stream_obq_push(dep_stream, stream); + if (rv != 0) { + return rv; + } + } + + validate_tree(dep_stream); + + return 0; +} + +int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream, + nghttp2_stream *stream) { + int rv; + + DEBUGF(fprintf(stderr, "stream: dep_add_subtree dep_stream(%p)=%d " + "stream(%p)=%d\n", + dep_stream, dep_stream->stream_id, stream, stream->stream_id)); + + dep_stream->sum_dep_weight += stream->weight; + + if (dep_stream->dep_next) { + insert_link_dep(dep_stream, stream); + } else { + link_dep(dep_stream, stream); + } + + if (stream_subtree_active(stream)) { + rv = stream_obq_push(dep_stream, stream); + if (rv != 0) { + return rv; + } + } + + validate_tree(dep_stream); + + return 0; +} + +void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream) { + nghttp2_stream *next, *dep_prev; + + DEBUGF(fprintf(stderr, "stream: dep_remove_subtree stream(%p)=%d\n", stream, + stream->stream_id)); + + assert(stream->dep_prev); + + dep_prev = stream->dep_prev; + + if (stream->sib_prev) { + link_sib(stream->sib_prev, stream->sib_next); + } else { + next = stream->sib_next; + + link_dep(dep_prev, next); + + if (next) { + next->sib_prev = NULL; + } + } + + dep_prev->sum_dep_weight -= stream->weight; + + if (stream->queued) { + stream_obq_remove(stream); + } + + validate_tree(dep_prev); + + stream->sib_prev = NULL; + stream->sib_next = NULL; + stream->dep_prev = NULL; +} + +int nghttp2_stream_in_dep_tree(nghttp2_stream *stream) { + return stream->dep_prev || stream->dep_next || stream->sib_prev || + stream->sib_next; +} + +nghttp2_outbound_item * +nghttp2_stream_next_outbound_item(nghttp2_stream *stream) { + nghttp2_pq_entry *ent; + nghttp2_stream *si; + + for (;;) { + if (stream_active(stream)) { + /* Update ascendant's descendant_last_cycle here, so that we can + assure that new stream is scheduled based on it. */ + for (si = stream; si->dep_prev; si = si->dep_prev) { + si->dep_prev->descendant_last_cycle = si->cycle; + } + return stream->item; + } + ent = nghttp2_pq_top(&stream->obq); + if (!ent) { + return NULL; + } + stream = nghttp2_struct_of(ent, nghttp2_stream, pq_entry); + } +} + +nghttp2_stream_proto_state nghttp2_stream_get_state(nghttp2_stream *stream) { + if (stream->flags & NGHTTP2_STREAM_FLAG_CLOSED) { + return NGHTTP2_STREAM_STATE_CLOSED; + } + + if (stream->flags & NGHTTP2_STREAM_FLAG_PUSH) { + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return NGHTTP2_STREAM_STATE_RESERVED_LOCAL; + } + + if (stream->shut_flags & NGHTTP2_SHUT_WR) { + return NGHTTP2_STREAM_STATE_RESERVED_REMOTE; + } + } + + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE; + } + + if (stream->shut_flags & NGHTTP2_SHUT_WR) { + return NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL; + } + + if (stream->state == NGHTTP2_STREAM_IDLE) { + return NGHTTP2_STREAM_STATE_IDLE; + } + + return NGHTTP2_STREAM_STATE_OPEN; +} + +nghttp2_stream *nghttp2_stream_get_parent(nghttp2_stream *stream) { + return stream->dep_prev; +} + +nghttp2_stream *nghttp2_stream_get_next_sibling(nghttp2_stream *stream) { + return stream->sib_next; +} + +nghttp2_stream *nghttp2_stream_get_previous_sibling(nghttp2_stream *stream) { + return stream->sib_prev; +} + +nghttp2_stream *nghttp2_stream_get_first_child(nghttp2_stream *stream) { + return stream->dep_next; +} + +int32_t nghttp2_stream_get_weight(nghttp2_stream *stream) { + return stream->weight; +} + +int32_t nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream) { + return stream->sum_dep_weight; +} + +int32_t nghttp2_stream_get_stream_id(nghttp2_stream *stream) { + return stream->stream_id; +} diff --git a/components/nghttp/library/nghttp2_submit.c b/components/nghttp/library/nghttp2_submit.c new file mode 100644 index 0000000000..cf9a7c0c21 --- /dev/null +++ b/components/nghttp/library/nghttp2_submit.c @@ -0,0 +1,723 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_submit.h" + +#include +#include + +#include "nghttp2_session.h" +#include "nghttp2_frame.h" +#include "nghttp2_helper.h" +#include "nghttp2_priority_spec.h" + +/* + * Detects the dependency error, that is stream attempted to depend on + * itself. If |stream_id| is -1, we use session->next_stream_id as + * stream ID. + * + * This function returns 0 if it succeeds, or one of the following + * error codes: + * + * NGHTTP2_ERR_INVALID_ARGUMENT + * Stream attempted to depend on itself. + */ +static int detect_self_dependency(nghttp2_session *session, int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + assert(pri_spec); + + if (stream_id == -1) { + if ((int32_t)session->next_stream_id == pri_spec->stream_id) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + return 0; + } + + if (stream_id == pri_spec->stream_id) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + return 0; +} + +/* This function takes ownership of |nva_copy|. Regardless of the + return value, the caller must not free |nva_copy| after this + function returns. */ +static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec, + nghttp2_nv *nva_copy, size_t nvlen, + const nghttp2_data_provider *data_prd, + void *stream_user_data) { + int rv; + uint8_t flags_copy; + nghttp2_outbound_item *item = NULL; + nghttp2_frame *frame = NULL; + nghttp2_headers_category hcat; + nghttp2_mem *mem; + + mem = &session->mem; + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + rv = NGHTTP2_ERR_NOMEM; + goto fail; + } + + nghttp2_outbound_item_init(item); + + if (data_prd != NULL && data_prd->read_callback != NULL) { + item->aux_data.headers.data_prd = *data_prd; + } + + item->aux_data.headers.stream_user_data = stream_user_data; + + flags_copy = + (uint8_t)((flags & (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PRIORITY)) | + NGHTTP2_FLAG_END_HEADERS); + + if (stream_id == -1) { + if (session->next_stream_id > INT32_MAX) { + rv = NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE; + goto fail; + } + + stream_id = (int32_t)session->next_stream_id; + session->next_stream_id += 2; + + hcat = NGHTTP2_HCAT_REQUEST; + } else { + /* More specific categorization will be done later. */ + hcat = NGHTTP2_HCAT_HEADERS; + } + + frame = &item->frame; + + nghttp2_frame_headers_init(&frame->headers, flags_copy, stream_id, hcat, + pri_spec, nva_copy, nvlen); + + rv = nghttp2_session_add_item(session, item); + + if (rv != 0) { + nghttp2_frame_headers_free(&frame->headers, mem); + goto fail2; + } + + if (hcat == NGHTTP2_HCAT_REQUEST) { + return stream_id; + } + + return 0; + +fail: + /* nghttp2_frame_headers_init() takes ownership of nva_copy. */ + nghttp2_nv_array_del(nva_copy, mem); +fail2: + nghttp2_mem_free(mem, item); + + return rv; +} + +static int32_t submit_headers_shared_nva(nghttp2_session *session, + uint8_t flags, int32_t stream_id, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd, + void *stream_user_data) { + int rv; + nghttp2_nv *nva_copy; + nghttp2_priority_spec copy_pri_spec; + nghttp2_mem *mem; + + mem = &session->mem; + + if (pri_spec) { + copy_pri_spec = *pri_spec; + nghttp2_priority_spec_normalize_weight(©_pri_spec); + } else { + nghttp2_priority_spec_default_init(©_pri_spec); + } + + rv = nghttp2_nv_array_copy(&nva_copy, nva, nvlen, mem); + if (rv < 0) { + return rv; + } + + return submit_headers_shared(session, flags, stream_id, ©_pri_spec, + nva_copy, nvlen, data_prd, stream_user_data); +} + +int nghttp2_submit_trailer(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen) { + if (stream_id <= 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + return (int)submit_headers_shared_nva(session, NGHTTP2_FLAG_END_STREAM, + stream_id, NULL, nva, nvlen, NULL, + NULL); +} + +int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + void *stream_user_data) { + int rv; + + if (stream_id == -1) { + if (session->server) { + return NGHTTP2_ERR_PROTO; + } + } else if (stream_id <= 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + flags &= NGHTTP2_FLAG_END_STREAM; + + if (pri_spec && !nghttp2_priority_spec_check_default(pri_spec)) { + rv = detect_self_dependency(session, stream_id, pri_spec); + if (rv != 0) { + return rv; + } + + flags |= NGHTTP2_FLAG_PRIORITY; + } else { + pri_spec = NULL; + } + + return submit_headers_shared_nva(session, flags, stream_id, pri_spec, nva, + nvlen, NULL, stream_user_data); +} + +int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, + const uint8_t *opaque_data) { + flags &= NGHTTP2_FLAG_ACK; + return nghttp2_session_add_ping(session, flags, opaque_data); +} + +int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags _U_, + int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_priority_spec copy_pri_spec; + nghttp2_mem *mem; + + mem = &session->mem; + + if (stream_id == 0 || pri_spec == NULL) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (stream_id == pri_spec->stream_id) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + copy_pri_spec = *pri_spec; + + nghttp2_priority_spec_normalize_weight(©_pri_spec); + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + + nghttp2_frame_priority_init(&frame->priority, stream_id, ©_pri_spec); + + rv = nghttp2_session_add_item(session, item); + + if (rv != 0) { + nghttp2_frame_priority_free(&frame->priority); + nghttp2_mem_free(mem, item); + + return rv; + } + + return 0; +} + +int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags _U_, + int32_t stream_id, uint32_t error_code) { + if (stream_id == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + return nghttp2_session_add_rst_stream(session, stream_id, error_code); +} + +int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags _U_, + int32_t last_stream_id, uint32_t error_code, + const uint8_t *opaque_data, size_t opaque_data_len) { + if (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND) { + return 0; + } + return nghttp2_session_add_goaway(session, last_stream_id, error_code, + opaque_data, opaque_data_len, + NGHTTP2_GOAWAY_AUX_NONE); +} + +int nghttp2_submit_shutdown_notice(nghttp2_session *session) { + if (!session->server) { + return NGHTTP2_ERR_INVALID_STATE; + } + if (session->goaway_flags) { + return 0; + } + return nghttp2_session_add_goaway(session, (1u << 31) - 1, NGHTTP2_NO_ERROR, + NULL, 0, + NGHTTP2_GOAWAY_AUX_SHUTDOWN_NOTICE); +} + +int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags _U_, + const nghttp2_settings_entry *iv, size_t niv) { + return nghttp2_session_add_settings(session, NGHTTP2_FLAG_NONE, iv, niv); +} + +int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags _U_, + int32_t stream_id, const nghttp2_nv *nva, + size_t nvlen, + void *promised_stream_user_data) { + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_nv *nva_copy; + uint8_t flags_copy; + int32_t promised_stream_id; + int rv; + nghttp2_mem *mem; + + mem = &session->mem; + + if (stream_id <= 0 || nghttp2_session_is_my_stream_id(session, stream_id)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (!session->server) { + return NGHTTP2_ERR_PROTO; + } + + /* All 32bit signed stream IDs are spent. */ + if (session->next_stream_id > INT32_MAX) { + return NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE; + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + item->aux_data.headers.stream_user_data = promised_stream_user_data; + + frame = &item->frame; + + rv = nghttp2_nv_array_copy(&nva_copy, nva, nvlen, mem); + if (rv < 0) { + nghttp2_mem_free(mem, item); + return rv; + } + + flags_copy = NGHTTP2_FLAG_END_HEADERS; + + promised_stream_id = (int32_t)session->next_stream_id; + session->next_stream_id += 2; + + nghttp2_frame_push_promise_init(&frame->push_promise, flags_copy, stream_id, + promised_stream_id, nva_copy, nvlen); + + rv = nghttp2_session_add_item(session, item); + + if (rv != 0) { + nghttp2_frame_push_promise_free(&frame->push_promise, mem); + nghttp2_mem_free(mem, item); + + return rv; + } + + return promised_stream_id; +} + +int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + int32_t window_size_increment) { + int rv; + nghttp2_stream *stream = 0; + if (window_size_increment == 0) { + return 0; + } + flags = 0; + if (stream_id == 0) { + rv = nghttp2_adjust_local_window_size( + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); + if (rv != 0) { + return rv; + } + } else { + stream = nghttp2_session_get_stream(session, stream_id); + if (!stream) { + return 0; + } + + rv = nghttp2_adjust_local_window_size( + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); + if (rv != 0) { + return rv; + } + } + + if (window_size_increment > 0) { + if (stream_id == 0) { + session->consumed_size = + nghttp2_max(0, session->consumed_size - window_size_increment); + } else { + stream->consumed_size = + nghttp2_max(0, stream->consumed_size - window_size_increment); + } + + return nghttp2_session_add_window_update(session, flags, stream_id, + window_size_increment); + } + return 0; +} + +int nghttp2_session_set_local_window_size(nghttp2_session *session, + uint8_t flags, int32_t stream_id, + int32_t window_size) { + int32_t window_size_increment; + nghttp2_stream *stream; + int rv; + + if (window_size < 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + flags = 0; + + if (stream_id == 0) { + window_size_increment = window_size - session->local_window_size; + + if (window_size_increment == 0) { + return 0; + } + + if (window_size_increment < 0) { + return nghttp2_adjust_local_window_size( + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); + } + + rv = nghttp2_increase_local_window_size( + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); + + if (rv != 0) { + return rv; + } + } else { + stream = nghttp2_session_get_stream(session, stream_id); + + if (stream == NULL) { + return 0; + } + + window_size_increment = window_size - stream->local_window_size; + + if (window_size_increment == 0) { + return 0; + } + + if (window_size_increment < 0) { + return nghttp2_adjust_local_window_size( + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); + } + + rv = nghttp2_increase_local_window_size( + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); + + if (rv != 0) { + return rv; + } + } + + if (window_size_increment > 0) { + return nghttp2_session_add_window_update(session, flags, stream_id, + window_size_increment); + } + + return 0; +} + +int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_, + int32_t stream_id, const uint8_t *origin, + size_t origin_len, const uint8_t *field_value, + size_t field_value_len) { + nghttp2_mem *mem; + uint8_t *buf, *p; + uint8_t *origin_copy; + uint8_t *field_value_copy; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_ext_altsvc *altsvc; + int rv; + + mem = &session->mem; + + if (!session->server) { + return NGHTTP2_ERR_INVALID_STATE; + } + + if (2 + origin_len + field_value_len > NGHTTP2_MAX_PAYLOADLEN) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (stream_id == 0) { + if (origin_len == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + } else if (origin_len != 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + buf = nghttp2_mem_malloc(mem, origin_len + field_value_len + 2); + if (buf == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + p = buf; + + origin_copy = p; + if (origin_len) { + p = nghttp2_cpymem(p, origin, origin_len); + } + *p++ = '\0'; + + field_value_copy = p; + if (field_value_len) { + p = nghttp2_cpymem(p, field_value, field_value_len); + } + *p++ = '\0'; + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + rv = NGHTTP2_ERR_NOMEM; + goto fail_item_malloc; + } + + nghttp2_outbound_item_init(item); + + item->aux_data.ext.builtin = 1; + + altsvc = &item->ext_frame_payload.altsvc; + + frame = &item->frame; + frame->ext.payload = altsvc; + + nghttp2_frame_altsvc_init(&frame->ext, stream_id, origin_copy, origin_len, + field_value_copy, field_value_len); + + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + nghttp2_frame_altsvc_free(&frame->ext, mem); + nghttp2_mem_free(mem, item); + + return rv; + } + + return 0; + +fail_item_malloc: + free(buf); + + return rv; +} + +static uint8_t set_request_flags(const nghttp2_priority_spec *pri_spec, + const nghttp2_data_provider *data_prd) { + uint8_t flags = NGHTTP2_FLAG_NONE; + if (data_prd == NULL || data_prd->read_callback == NULL) { + flags |= NGHTTP2_FLAG_END_STREAM; + } + + if (pri_spec) { + flags |= NGHTTP2_FLAG_PRIORITY; + } + + return flags; +} + +int32_t nghttp2_submit_request(nghttp2_session *session, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd, + void *stream_user_data) { + uint8_t flags; + int rv; + + if (session->server) { + return NGHTTP2_ERR_PROTO; + } + + if (pri_spec && !nghttp2_priority_spec_check_default(pri_spec)) { + rv = detect_self_dependency(session, -1, pri_spec); + if (rv != 0) { + return rv; + } + } else { + pri_spec = NULL; + } + + flags = set_request_flags(pri_spec, data_prd); + + return submit_headers_shared_nva(session, flags, -1, pri_spec, nva, nvlen, + data_prd, stream_user_data); +} + +static uint8_t set_response_flags(const nghttp2_data_provider *data_prd) { + uint8_t flags = NGHTTP2_FLAG_NONE; + if (data_prd == NULL || data_prd->read_callback == NULL) { + flags |= NGHTTP2_FLAG_END_STREAM; + } + return flags; +} + +int nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd) { + uint8_t flags; + + if (stream_id <= 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (!session->server) { + return NGHTTP2_ERR_PROTO; + } + + flags = set_response_flags(data_prd); + return submit_headers_shared_nva(session, flags, stream_id, NULL, nva, nvlen, + data_prd, NULL); +} + +int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider *data_prd) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_data_aux_data *aux_data; + uint8_t nflags = flags & NGHTTP2_FLAG_END_STREAM; + nghttp2_mem *mem; + + mem = &session->mem; + + if (stream_id == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + aux_data = &item->aux_data.data; + aux_data->data_prd = *data_prd; + aux_data->eof = 0; + aux_data->flags = nflags; + + /* flags are sent on transmission */ + nghttp2_frame_data_init(&frame->data, NGHTTP2_FLAG_NONE, stream_id); + + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + nghttp2_frame_data_free(&frame->data); + nghttp2_mem_free(mem, item); + return rv; + } + return 0; +} + +ssize_t nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen, + const nghttp2_settings_entry *iv, + size_t niv) { + if (!nghttp2_iv_check(iv, niv)) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (buflen < (niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH)) { + return NGHTTP2_ERR_INSUFF_BUFSIZE; + } + + return (ssize_t)nghttp2_frame_pack_settings_payload(buf, iv, niv); +} + +int nghttp2_submit_extension(nghttp2_session *session, uint8_t type, + uint8_t flags, int32_t stream_id, void *payload) { + int rv; + nghttp2_outbound_item *item; + nghttp2_frame *frame; + nghttp2_mem *mem; + + mem = &session->mem; + + if (type <= NGHTTP2_CONTINUATION) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (!session->callbacks.pack_extension_callback) { + return NGHTTP2_ERR_INVALID_STATE; + } + + item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); + if (item == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + nghttp2_outbound_item_init(item); + + frame = &item->frame; + nghttp2_frame_extension_init(&frame->ext, type, flags, stream_id, payload); + + rv = nghttp2_session_add_item(session, item); + if (rv != 0) { + nghttp2_frame_extension_free(&frame->ext); + nghttp2_mem_free(mem, item); + return rv; + } + + return 0; +} diff --git a/components/nghttp/library/nghttp2_version.c b/components/nghttp/library/nghttp2_version.c new file mode 100644 index 0000000000..8c5710d419 --- /dev/null +++ b/components/nghttp/library/nghttp2_version.c @@ -0,0 +1,38 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include + +static nghttp2_info version = {NGHTTP2_VERSION_AGE, NGHTTP2_VERSION_NUM, + NGHTTP2_VERSION, NGHTTP2_PROTO_VERSION_ID}; + +nghttp2_info *nghttp2_version(int least_version) { + if (least_version > NGHTTP2_VERSION_NUM) + return NULL; + return &version; +} diff --git a/components/nghttp/port/http_parser.c b/components/nghttp/port/http_parser.c new file mode 100644 index 0000000000..3c896ffadc --- /dev/null +++ b/components/nghttp/port/http_parser.c @@ -0,0 +1,2469 @@ +/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev + * + * Additional changes are licensed under the same terms as NGINX and + * copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include "http_parser.h" +#include +#include +#include +#include +#include +#include + +#ifndef ULLONG_MAX +# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */ +#endif + +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#ifndef BIT_AT +# define BIT_AT(a, i) \ + (!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \ + (1 << ((unsigned int) (i) & 7)))) +#endif + +#ifndef ELEM_AT +# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v)) +#endif + +#define SET_ERRNO(e) \ +do { \ + parser->http_errno = (e); \ +} while(0) + +#define CURRENT_STATE() p_state +#define UPDATE_STATE(V) p_state = (enum state) (V); +#define RETURN(V) \ +do { \ + parser->state = CURRENT_STATE(); \ + return (V); \ +} while (0); +#define REEXECUTE() \ + goto reexecute; \ + + +#ifdef __GNUC__ +# define LIKELY(X) __builtin_expect(!!(X), 1) +# define UNLIKELY(X) __builtin_expect(!!(X), 0) +#else +# define LIKELY(X) (X) +# define UNLIKELY(X) (X) +#endif + + +/* Run the notify callback FOR, returning ER if it fails */ +#define CALLBACK_NOTIFY_(FOR, ER) \ +do { \ + assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ + \ + if (LIKELY(settings->on_##FOR)) { \ + parser->state = CURRENT_STATE(); \ + if (UNLIKELY(0 != settings->on_##FOR(parser))) { \ + SET_ERRNO(HPE_CB_##FOR); \ + } \ + UPDATE_STATE(parser->state); \ + \ + /* We either errored above or got paused; get out */ \ + if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \ + return (ER); \ + } \ + } \ +} while (0) + +/* Run the notify callback FOR and consume the current byte */ +#define CALLBACK_NOTIFY(FOR) CALLBACK_NOTIFY_(FOR, p - data + 1) + +/* Run the notify callback FOR and don't consume the current byte */ +#define CALLBACK_NOTIFY_NOADVANCE(FOR) CALLBACK_NOTIFY_(FOR, p - data) + +/* Run data callback FOR with LEN bytes, returning ER if it fails */ +#define CALLBACK_DATA_(FOR, LEN, ER) \ +do { \ + assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ + \ + if (FOR##_mark) { \ + if (LIKELY(settings->on_##FOR)) { \ + parser->state = CURRENT_STATE(); \ + if (UNLIKELY(0 != \ + settings->on_##FOR(parser, FOR##_mark, (LEN)))) { \ + SET_ERRNO(HPE_CB_##FOR); \ + } \ + UPDATE_STATE(parser->state); \ + \ + /* We either errored above or got paused; get out */ \ + if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \ + return (ER); \ + } \ + } \ + FOR##_mark = NULL; \ + } \ +} while (0) + +/* Run the data callback FOR and consume the current byte */ +#define CALLBACK_DATA(FOR) \ + CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1) + +/* Run the data callback FOR and don't consume the current byte */ +#define CALLBACK_DATA_NOADVANCE(FOR) \ + CALLBACK_DATA_(FOR, p - FOR##_mark, p - data) + +/* Set the mark FOR; non-destructive if mark is already set */ +#define MARK(FOR) \ +do { \ + if (!FOR##_mark) { \ + FOR##_mark = p; \ + } \ +} while (0) + +/* Don't allow the total size of the HTTP headers (including the status + * line) to exceed HTTP_MAX_HEADER_SIZE. This check is here to protect + * embedders against denial-of-service attacks where the attacker feeds + * us a never-ending header that the embedder keeps buffering. + * + * This check is arguably the responsibility of embedders but we're doing + * it on the embedder's behalf because most won't bother and this way we + * make the web a little safer. HTTP_MAX_HEADER_SIZE is still far bigger + * than any reasonable request or response so this should never affect + * day-to-day operation. + */ +#define COUNT_HEADER_SIZE(V) \ +do { \ + parser->nread += (V); \ + if (UNLIKELY(parser->nread > (HTTP_MAX_HEADER_SIZE))) { \ + SET_ERRNO(HPE_HEADER_OVERFLOW); \ + goto error; \ + } \ +} while (0) + + +#define PROXY_CONNECTION "proxy-connection" +#define CONNECTION "connection" +#define CONTENT_LENGTH "content-length" +#define TRANSFER_ENCODING "transfer-encoding" +#define UPGRADE "upgrade" +#define CHUNKED "chunked" +#define KEEP_ALIVE "keep-alive" +#define CLOSE "close" + + +static const char *method_strings[] = + { +#define XX(num, name, string) #string, + HTTP_METHOD_MAP(XX) +#undef XX + }; + + +/* Tokens as defined by rfc 2616. Also lowercases them. + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + */ +static const char tokens[256] = { +/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ + 0, '!', 0, '#', '$', '%', '&', '\'', +/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ + 0, 0, '*', '+', 0, '-', '.', 0, +/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ + '0', '1', '2', '3', '4', '5', '6', '7', +/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ + '8', '9', 0, 0, 0, 0, 0, 0, +/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ + 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', +/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', +/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', +/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ + 'x', 'y', 'z', 0, 0, 0, '^', '_', +/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', +/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', +/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', +/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ + 'x', 'y', 'z', 0, '|', 0, '~', 0 }; + + +static const int8_t unhex[256] = + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1 + ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + }; + + +#if HTTP_PARSER_STRICT +# define T(v) 0 +#else +# define T(v) v +#endif + + +static const uint8_t normal_url_char[32] = { +/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ + 0 | T(2) | 0 | 0 | T(16) | 0 | 0 | 0, +/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ + 0 | 2 | 4 | 0 | 16 | 32 | 64 | 128, +/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, +/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, }; + +#undef T + +enum state + { s_dead = 1 /* important that this is > 0 */ + + , s_start_req_or_res + , s_res_or_resp_H + , s_start_res + , s_res_H + , s_res_HT + , s_res_HTT + , s_res_HTTP + , s_res_first_http_major + , s_res_http_major + , s_res_first_http_minor + , s_res_http_minor + , s_res_first_status_code + , s_res_status_code + , s_res_status_start + , s_res_status + , s_res_line_almost_done + + , s_start_req + + , s_req_method + , s_req_spaces_before_url + , s_req_schema + , s_req_schema_slash + , s_req_schema_slash_slash + , s_req_server_start + , s_req_server + , s_req_server_with_at + , s_req_path + , s_req_query_string_start + , s_req_query_string + , s_req_fragment_start + , s_req_fragment + , s_req_http_start + , s_req_http_H + , s_req_http_HT + , s_req_http_HTT + , s_req_http_HTTP + , s_req_first_http_major + , s_req_http_major + , s_req_first_http_minor + , s_req_http_minor + , s_req_line_almost_done + + , s_header_field_start + , s_header_field + , s_header_value_discard_ws + , s_header_value_discard_ws_almost_done + , s_header_value_discard_lws + , s_header_value_start + , s_header_value + , s_header_value_lws + + , s_header_almost_done + + , s_chunk_size_start + , s_chunk_size + , s_chunk_parameters + , s_chunk_size_almost_done + + , s_headers_almost_done + , s_headers_done + + /* Important: 's_headers_done' must be the last 'header' state. All + * states beyond this must be 'body' states. It is used for overflow + * checking. See the PARSING_HEADER() macro. + */ + + , s_chunk_data + , s_chunk_data_almost_done + , s_chunk_data_done + + , s_body_identity + , s_body_identity_eof + + , s_message_done + }; + + +#define PARSING_HEADER(state) (state <= s_headers_done) + + +enum header_states + { h_general = 0 + , h_C + , h_CO + , h_CON + + , h_matching_connection + , h_matching_proxy_connection + , h_matching_content_length + , h_matching_transfer_encoding + , h_matching_upgrade + + , h_connection + , h_content_length + , h_transfer_encoding + , h_upgrade + + , h_matching_transfer_encoding_chunked + , h_matching_connection_token_start + , h_matching_connection_keep_alive + , h_matching_connection_close + , h_matching_connection_upgrade + , h_matching_connection_token + + , h_transfer_encoding_chunked + , h_connection_keep_alive + , h_connection_close + , h_connection_upgrade + }; + +enum http_host_state + { + s_http_host_dead = 1 + , s_http_userinfo_start + , s_http_userinfo + , s_http_host_start + , s_http_host_v6_start + , s_http_host + , s_http_host_v6 + , s_http_host_v6_end + , s_http_host_v6_zone_start + , s_http_host_v6_zone + , s_http_host_port_start + , s_http_host_port +}; + +/* Macros for character classes; depends on strict-mode */ +#define CR '\r' +#define LF '\n' +#define LOWER(c) (unsigned char)(c | 0x20) +#define IS_ALPHA(c) (LOWER(c) >= 'a' && LOWER(c) <= 'z') +#define IS_NUM(c) ((c) >= '0' && (c) <= '9') +#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_NUM(c)) +#define IS_HEX(c) (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f')) +#define IS_MARK(c) ((c) == '-' || (c) == '_' || (c) == '.' || \ + (c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \ + (c) == ')') +#define IS_USERINFO_CHAR(c) (IS_ALPHANUM(c) || IS_MARK(c) || (c) == '%' || \ + (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \ + (c) == '$' || (c) == ',') + +#define STRICT_TOKEN(c) (tokens[(unsigned char)c]) + +#if HTTP_PARSER_STRICT +#define TOKEN(c) (tokens[(unsigned char)c]) +#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c)) +#define IS_HOST_CHAR(c) (IS_ALPHANUM(c) || (c) == '.' || (c) == '-') +#else +#define TOKEN(c) ((c == ' ') ? ' ' : tokens[(unsigned char)c]) +#define IS_URL_CHAR(c) \ + (BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80)) +#define IS_HOST_CHAR(c) \ + (IS_ALPHANUM(c) || (c) == '.' || (c) == '-' || (c) == '_') +#endif + +/** + * Verify that a char is a valid visible (printable) US-ASCII + * character or %x80-FF + **/ +#define IS_HEADER_CHAR(ch) \ + (ch == CR || ch == LF || ch == 9 || ((unsigned char)ch > 31 && ch != 127)) + +#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res) + + +#if HTTP_PARSER_STRICT +# define STRICT_CHECK(cond) \ +do { \ + if (cond) { \ + SET_ERRNO(HPE_STRICT); \ + goto error; \ + } \ +} while (0) +# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead) +#else +# define STRICT_CHECK(cond) +# define NEW_MESSAGE() start_state +#endif + + +/* Map errno values to strings for human-readable output */ +#define HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s }, +static struct { + const char *name; + const char *description; +} http_strerror_tab[] = { + HTTP_ERRNO_MAP(HTTP_STRERROR_GEN) +}; +#undef HTTP_STRERROR_GEN + +int http_message_needs_eof(const http_parser *parser); + +/* Our URL parser. + * + * This is designed to be shared by http_parser_execute() for URL validation, + * hence it has a state transition + byte-for-byte interface. In addition, it + * is meant to be embedded in http_parser_parse_url(), which does the dirty + * work of turning state transitions URL components for its API. + * + * This function should only be invoked with non-space characters. It is + * assumed that the caller cares about (and can detect) the transition between + * URL and non-URL states by looking for these. + */ +static enum state +parse_url_char(enum state s, const char ch) +{ + if (ch == ' ' || ch == '\r' || ch == '\n') { + return s_dead; + } + +#if HTTP_PARSER_STRICT + if (ch == '\t' || ch == '\f') { + return s_dead; + } +#endif + + switch (s) { + case s_req_spaces_before_url: + /* Proxied requests are followed by scheme of an absolute URI (alpha). + * All methods except CONNECT are followed by '/' or '*'. + */ + + if (ch == '/' || ch == '*') { + return s_req_path; + } + + if (IS_ALPHA(ch)) { + return s_req_schema; + } + + break; + + case s_req_schema: + if (IS_ALPHA(ch)) { + return s; + } + + if (ch == ':') { + return s_req_schema_slash; + } + + break; + + case s_req_schema_slash: + if (ch == '/') { + return s_req_schema_slash_slash; + } + + break; + + case s_req_schema_slash_slash: + if (ch == '/') { + return s_req_server_start; + } + + break; + + case s_req_server_with_at: + if (ch == '@') { + return s_dead; + } + + /* FALLTHROUGH */ + case s_req_server_start: + case s_req_server: + if (ch == '/') { + return s_req_path; + } + + if (ch == '?') { + return s_req_query_string_start; + } + + if (ch == '@') { + return s_req_server_with_at; + } + + if (IS_USERINFO_CHAR(ch) || ch == '[' || ch == ']') { + return s_req_server; + } + + break; + + case s_req_path: + if (IS_URL_CHAR(ch)) { + return s; + } + + switch (ch) { + case '?': + return s_req_query_string_start; + + case '#': + return s_req_fragment_start; + } + + break; + + case s_req_query_string_start: + case s_req_query_string: + if (IS_URL_CHAR(ch)) { + return s_req_query_string; + } + + switch (ch) { + case '?': + /* allow extra '?' in query string */ + return s_req_query_string; + + case '#': + return s_req_fragment_start; + } + + break; + + case s_req_fragment_start: + if (IS_URL_CHAR(ch)) { + return s_req_fragment; + } + + switch (ch) { + case '?': + return s_req_fragment; + + case '#': + return s; + } + + break; + + case s_req_fragment: + if (IS_URL_CHAR(ch)) { + return s; + } + + switch (ch) { + case '?': + case '#': + return s; + } + + break; + + default: + break; + } + + /* We should never fall out of the switch above unless there's an error */ + return s_dead; +} + +size_t http_parser_execute (http_parser *parser, + const http_parser_settings *settings, + const char *data, + size_t len) +{ + char c, ch; + int8_t unhex_val; + const char *p = data; + const char *header_field_mark = 0; + const char *header_value_mark = 0; + const char *url_mark = 0; + const char *body_mark = 0; + const char *status_mark = 0; + enum state p_state = (enum state) parser->state; + const unsigned int lenient = parser->lenient_http_headers; + + /* We're in an error state. Don't bother doing anything. */ + if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { + return 0; + } + + if (len == 0) { + switch (CURRENT_STATE()) { + case s_body_identity_eof: + /* Use of CALLBACK_NOTIFY() here would erroneously return 1 byte read if + * we got paused. + */ + CALLBACK_NOTIFY_NOADVANCE(message_complete); + return 0; + + case s_dead: + case s_start_req_or_res: + case s_start_res: + case s_start_req: + return 0; + + default: + SET_ERRNO(HPE_INVALID_EOF_STATE); + return 1; + } + } + + + if (CURRENT_STATE() == s_header_field) + header_field_mark = data; + if (CURRENT_STATE() == s_header_value) + header_value_mark = data; + switch (CURRENT_STATE()) { + case s_req_path: + case s_req_schema: + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + case s_req_server: + case s_req_server_with_at: + case s_req_query_string_start: + case s_req_query_string: + case s_req_fragment_start: + case s_req_fragment: + url_mark = data; + break; + case s_res_status: + status_mark = data; + break; + default: + break; + } + + for (p=data; p != data + len; p++) { + ch = *p; + + if (PARSING_HEADER(CURRENT_STATE())) + COUNT_HEADER_SIZE(1); + +reexecute: + switch (CURRENT_STATE()) { + + case s_dead: + /* this state is used after a 'Connection: close' message + * the parser will error out if it reads another message + */ + if (LIKELY(ch == CR || ch == LF)) + break; + + SET_ERRNO(HPE_CLOSED_CONNECTION); + goto error; + + case s_start_req_or_res: + { + if (ch == CR || ch == LF) + break; + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + if (ch == 'H') { + UPDATE_STATE(s_res_or_resp_H); + + CALLBACK_NOTIFY(message_begin); + } else { + parser->type = HTTP_REQUEST; + UPDATE_STATE(s_start_req); + REEXECUTE(); + } + + break; + } + + case s_res_or_resp_H: + if (ch == 'T') { + parser->type = HTTP_RESPONSE; + UPDATE_STATE(s_res_HT); + } else { + if (UNLIKELY(ch != 'E')) { + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + + parser->type = HTTP_REQUEST; + parser->method = HTTP_HEAD; + parser->index = 2; + UPDATE_STATE(s_req_method); + } + break; + + case s_start_res: + { + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + switch (ch) { + case 'H': + UPDATE_STATE(s_res_H); + break; + + case CR: + case LF: + break; + + default: + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + + CALLBACK_NOTIFY(message_begin); + break; + } + + case s_res_H: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_res_HT); + break; + + case s_res_HT: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_res_HTT); + break; + + case s_res_HTT: + STRICT_CHECK(ch != 'P'); + UPDATE_STATE(s_res_HTTP); + break; + + case s_res_HTTP: + STRICT_CHECK(ch != '/'); + UPDATE_STATE(s_res_first_http_major); + break; + + case s_res_first_http_major: + if (UNLIKELY(ch < '0' || ch > '9')) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major = ch - '0'; + UPDATE_STATE(s_res_http_major); + break; + + /* major HTTP version or dot */ + case s_res_http_major: + { + if (ch == '.') { + UPDATE_STATE(s_res_first_http_minor); + break; + } + + if (!IS_NUM(ch)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major *= 10; + parser->http_major += ch - '0'; + + if (UNLIKELY(parser->http_major > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* first digit of minor HTTP version */ + case s_res_first_http_minor: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor = ch - '0'; + UPDATE_STATE(s_res_http_minor); + break; + + /* minor HTTP version or end of request line */ + case s_res_http_minor: + { + if (ch == ' ') { + UPDATE_STATE(s_res_first_status_code); + break; + } + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor *= 10; + parser->http_minor += ch - '0'; + + if (UNLIKELY(parser->http_minor > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + case s_res_first_status_code: + { + if (!IS_NUM(ch)) { + if (ch == ' ') { + break; + } + + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + parser->status_code = ch - '0'; + UPDATE_STATE(s_res_status_code); + break; + } + + case s_res_status_code: + { + if (!IS_NUM(ch)) { + switch (ch) { + case ' ': + UPDATE_STATE(s_res_status_start); + break; + case CR: + UPDATE_STATE(s_res_line_almost_done); + break; + case LF: + UPDATE_STATE(s_header_field_start); + break; + default: + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + break; + } + + parser->status_code *= 10; + parser->status_code += ch - '0'; + + if (UNLIKELY(parser->status_code > 999)) { + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + + break; + } + + case s_res_status_start: + { + if (ch == CR) { + UPDATE_STATE(s_res_line_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + break; + } + + MARK(status); + UPDATE_STATE(s_res_status); + parser->index = 0; + break; + } + + case s_res_status: + if (ch == CR) { + UPDATE_STATE(s_res_line_almost_done); + CALLBACK_DATA(status); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + CALLBACK_DATA(status); + break; + } + + break; + + case s_res_line_almost_done: + STRICT_CHECK(ch != LF); + UPDATE_STATE(s_header_field_start); + break; + + case s_start_req: + { + if (ch == CR || ch == LF) + break; + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + if (UNLIKELY(!IS_ALPHA(ch))) { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + parser->method = (enum http_method) 0; + parser->index = 1; + switch (ch) { + case 'A': parser->method = HTTP_ACL; break; + case 'B': parser->method = HTTP_BIND; break; + case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break; + case 'D': parser->method = HTTP_DELETE; break; + case 'G': parser->method = HTTP_GET; break; + case 'H': parser->method = HTTP_HEAD; break; + case 'L': parser->method = HTTP_LOCK; /* or LINK */ break; + case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH, MKCALENDAR */ break; + case 'N': parser->method = HTTP_NOTIFY; break; + case 'O': parser->method = HTTP_OPTIONS; break; + case 'P': parser->method = HTTP_POST; + /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */ + break; + case 'R': parser->method = HTTP_REPORT; /* or REBIND */ break; + case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break; + case 'T': parser->method = HTTP_TRACE; break; + case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE, UNBIND, UNLINK */ break; + default: + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + UPDATE_STATE(s_req_method); + + CALLBACK_NOTIFY(message_begin); + + break; + } + + case s_req_method: + { + const char *matcher; + if (UNLIKELY(ch == '\0')) { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + matcher = method_strings[parser->method]; + if (ch == ' ' && matcher[parser->index] == '\0') { + UPDATE_STATE(s_req_spaces_before_url); + } else if (ch == matcher[parser->index]) { + ; /* nada */ + } else if (IS_ALPHA(ch)) { + + switch (parser->method << 16 | parser->index << 8 | ch) { +#define XX(meth, pos, ch, new_meth) \ + case (HTTP_##meth << 16 | pos << 8 | ch): \ + parser->method = HTTP_##new_meth; break; + + XX(POST, 1, 'U', PUT) + XX(POST, 1, 'A', PATCH) + XX(CONNECT, 1, 'H', CHECKOUT) + XX(CONNECT, 2, 'P', COPY) + XX(MKCOL, 1, 'O', MOVE) + XX(MKCOL, 1, 'E', MERGE) + XX(MKCOL, 2, 'A', MKACTIVITY) + XX(MKCOL, 3, 'A', MKCALENDAR) + XX(SUBSCRIBE, 1, 'E', SEARCH) + XX(REPORT, 2, 'B', REBIND) + XX(POST, 1, 'R', PROPFIND) + XX(PROPFIND, 4, 'P', PROPPATCH) + XX(PUT, 2, 'R', PURGE) + XX(LOCK, 1, 'I', LINK) + XX(UNLOCK, 2, 'S', UNSUBSCRIBE) + XX(UNLOCK, 2, 'B', UNBIND) + XX(UNLOCK, 3, 'I', UNLINK) +#undef XX + + default: + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (ch == '-' && + parser->index == 1 && + parser->method == HTTP_MKCOL) { + parser->method = HTTP_MSEARCH; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + ++parser->index; + break; + } + + case s_req_spaces_before_url: + { + if (ch == ' ') break; + + MARK(url); + if (parser->method == HTTP_CONNECT) { + UPDATE_STATE(s_req_server_start); + } + + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + + break; + } + + case s_req_schema: + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + { + switch (ch) { + /* No whitespace allowed here */ + case ' ': + case CR: + case LF: + SET_ERRNO(HPE_INVALID_URL); + goto error; + default: + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + } + + break; + } + + case s_req_server: + case s_req_server_with_at: + case s_req_path: + case s_req_query_string_start: + case s_req_query_string: + case s_req_fragment_start: + case s_req_fragment: + { + switch (ch) { + case ' ': + UPDATE_STATE(s_req_http_start); + CALLBACK_DATA(url); + break; + case CR: + case LF: + parser->http_major = 0; + parser->http_minor = 9; + UPDATE_STATE((ch == CR) ? + s_req_line_almost_done : + s_header_field_start); + CALLBACK_DATA(url); + break; + default: + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + } + break; + } + + case s_req_http_start: + switch (ch) { + case 'H': + UPDATE_STATE(s_req_http_H); + break; + case ' ': + break; + default: + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + break; + + case s_req_http_H: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_req_http_HT); + break; + + case s_req_http_HT: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_req_http_HTT); + break; + + case s_req_http_HTT: + STRICT_CHECK(ch != 'P'); + UPDATE_STATE(s_req_http_HTTP); + break; + + case s_req_http_HTTP: + STRICT_CHECK(ch != '/'); + UPDATE_STATE(s_req_first_http_major); + break; + + /* first digit of major HTTP version */ + case s_req_first_http_major: + if (UNLIKELY(ch < '1' || ch > '9')) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major = ch - '0'; + UPDATE_STATE(s_req_http_major); + break; + + /* major HTTP version or dot */ + case s_req_http_major: + { + if (ch == '.') { + UPDATE_STATE(s_req_first_http_minor); + break; + } + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major *= 10; + parser->http_major += ch - '0'; + + if (UNLIKELY(parser->http_major > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* first digit of minor HTTP version */ + case s_req_first_http_minor: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor = ch - '0'; + UPDATE_STATE(s_req_http_minor); + break; + + /* minor HTTP version or end of request line */ + case s_req_http_minor: + { + if (ch == CR) { + UPDATE_STATE(s_req_line_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + break; + } + + /* XXX allow spaces after digit? */ + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor *= 10; + parser->http_minor += ch - '0'; + + if (UNLIKELY(parser->http_minor > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* end of request line */ + case s_req_line_almost_done: + { + if (UNLIKELY(ch != LF)) { + SET_ERRNO(HPE_LF_EXPECTED); + goto error; + } + + UPDATE_STATE(s_header_field_start); + break; + } + + case s_header_field_start: + { + if (ch == CR) { + UPDATE_STATE(s_headers_almost_done); + break; + } + + if (ch == LF) { + /* they might be just sending \n instead of \r\n so this would be + * the second \n to denote the end of headers*/ + UPDATE_STATE(s_headers_almost_done); + REEXECUTE(); + } + + c = TOKEN(ch); + + if (UNLIKELY(!c)) { + SET_ERRNO(HPE_INVALID_HEADER_TOKEN); + goto error; + } + + MARK(header_field); + + parser->index = 0; + UPDATE_STATE(s_header_field); + + switch (c) { + case 'c': + parser->header_state = h_C; + break; + + case 'p': + parser->header_state = h_matching_proxy_connection; + break; + + case 't': + parser->header_state = h_matching_transfer_encoding; + break; + + case 'u': + parser->header_state = h_matching_upgrade; + break; + + default: + parser->header_state = h_general; + break; + } + break; + } + + case s_header_field: + { + const char* start = p; + for (; p != data + len; p++) { + ch = *p; + c = TOKEN(ch); + + if (!c) + break; + + switch (parser->header_state) { + case h_general: + break; + + case h_C: + parser->index++; + parser->header_state = (c == 'o' ? h_CO : h_general); + break; + + case h_CO: + parser->index++; + parser->header_state = (c == 'n' ? h_CON : h_general); + break; + + case h_CON: + parser->index++; + switch (c) { + case 'n': + parser->header_state = h_matching_connection; + break; + case 't': + parser->header_state = h_matching_content_length; + break; + default: + parser->header_state = h_general; + break; + } + break; + + /* connection */ + + case h_matching_connection: + parser->index++; + if (parser->index > sizeof(CONNECTION)-1 + || c != CONNECTION[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(CONNECTION)-2) { + parser->header_state = h_connection; + } + break; + + /* proxy-connection */ + + case h_matching_proxy_connection: + parser->index++; + if (parser->index > sizeof(PROXY_CONNECTION)-1 + || c != PROXY_CONNECTION[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(PROXY_CONNECTION)-2) { + parser->header_state = h_connection; + } + break; + + /* content-length */ + + case h_matching_content_length: + parser->index++; + if (parser->index > sizeof(CONTENT_LENGTH)-1 + || c != CONTENT_LENGTH[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(CONTENT_LENGTH)-2) { + if (parser->flags & F_CONTENTLENGTH) { + SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH); + goto error; + } + parser->header_state = h_content_length; + parser->flags |= F_CONTENTLENGTH; + } + break; + + /* transfer-encoding */ + + case h_matching_transfer_encoding: + parser->index++; + if (parser->index > sizeof(TRANSFER_ENCODING)-1 + || c != TRANSFER_ENCODING[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) { + parser->header_state = h_transfer_encoding; + } + break; + + /* upgrade */ + + case h_matching_upgrade: + parser->index++; + if (parser->index > sizeof(UPGRADE)-1 + || c != UPGRADE[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(UPGRADE)-2) { + parser->header_state = h_upgrade; + } + break; + + case h_connection: + case h_content_length: + case h_transfer_encoding: + case h_upgrade: + if (ch != ' ') parser->header_state = h_general; + break; + + default: + assert(0 && "Unknown header_state"); + break; + } + } + + COUNT_HEADER_SIZE(p - start); + + if (p == data + len) { + --p; + break; + } + + if (ch == ':') { + UPDATE_STATE(s_header_value_discard_ws); + CALLBACK_DATA(header_field); + break; + } + + SET_ERRNO(HPE_INVALID_HEADER_TOKEN); + goto error; + } + + case s_header_value_discard_ws: + if (ch == ' ' || ch == '\t') break; + + if (ch == CR) { + UPDATE_STATE(s_header_value_discard_ws_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_value_discard_lws); + break; + } + + /* FALLTHROUGH */ + + case s_header_value_start: + { + MARK(header_value); + + UPDATE_STATE(s_header_value); + parser->index = 0; + + c = LOWER(ch); + + switch (parser->header_state) { + case h_upgrade: + parser->flags |= F_UPGRADE; + parser->header_state = h_general; + break; + + case h_transfer_encoding: + /* looking for 'Transfer-Encoding: chunked' */ + if ('c' == c) { + parser->header_state = h_matching_transfer_encoding_chunked; + } else { + parser->header_state = h_general; + } + break; + + case h_content_length: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + goto error; + } + + parser->content_length = ch - '0'; + break; + + case h_connection: + /* looking for 'Connection: keep-alive' */ + if (c == 'k') { + parser->header_state = h_matching_connection_keep_alive; + /* looking for 'Connection: close' */ + } else if (c == 'c') { + parser->header_state = h_matching_connection_close; + } else if (c == 'u') { + parser->header_state = h_matching_connection_upgrade; + } else { + parser->header_state = h_matching_connection_token; + } + break; + + /* Multi-value `Connection` header */ + case h_matching_connection_token_start: + break; + + default: + parser->header_state = h_general; + break; + } + break; + } + + case s_header_value: + { + const char* start = p; + enum header_states h_state = (enum header_states) parser->header_state; + for (; p != data + len; p++) { + ch = *p; + if (ch == CR) { + UPDATE_STATE(s_header_almost_done); + parser->header_state = h_state; + CALLBACK_DATA(header_value); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_almost_done); + COUNT_HEADER_SIZE(p - start); + parser->header_state = h_state; + CALLBACK_DATA_NOADVANCE(header_value); + REEXECUTE(); + } + + if (!lenient && !IS_HEADER_CHAR(ch)) { + SET_ERRNO(HPE_INVALID_HEADER_TOKEN); + goto error; + } + + c = LOWER(ch); + + switch (h_state) { + case h_general: + { + const char* p_cr; + const char* p_lf; + size_t limit = data + len - p; + + limit = MIN(limit, HTTP_MAX_HEADER_SIZE); + + p_cr = (const char*) memchr(p, CR, limit); + p_lf = (const char*) memchr(p, LF, limit); + if (p_cr != NULL) { + if (p_lf != NULL && p_cr >= p_lf) + p = p_lf; + else + p = p_cr; + } else if (UNLIKELY(p_lf != NULL)) { + p = p_lf; + } else { + p = data + len; + } + --p; + + break; + } + + case h_connection: + case h_transfer_encoding: + assert(0 && "Shouldn't get here."); + break; + + case h_content_length: + { + uint64_t t; + + if (ch == ' ') break; + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + parser->header_state = h_state; + goto error; + } + + t = parser->content_length; + t *= 10; + t += ch - '0'; + + /* Overflow? Test against a conservative limit for simplicity. */ + if (UNLIKELY((ULLONG_MAX - 10) / 10 < parser->content_length)) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + parser->header_state = h_state; + goto error; + } + + parser->content_length = t; + break; + } + + /* Transfer-Encoding: chunked */ + case h_matching_transfer_encoding_chunked: + parser->index++; + if (parser->index > sizeof(CHUNKED)-1 + || c != CHUNKED[parser->index]) { + h_state = h_general; + } else if (parser->index == sizeof(CHUNKED)-2) { + h_state = h_transfer_encoding_chunked; + } + break; + + case h_matching_connection_token_start: + /* looking for 'Connection: keep-alive' */ + if (c == 'k') { + h_state = h_matching_connection_keep_alive; + /* looking for 'Connection: close' */ + } else if (c == 'c') { + h_state = h_matching_connection_close; + } else if (c == 'u') { + h_state = h_matching_connection_upgrade; + } else if (STRICT_TOKEN(c)) { + h_state = h_matching_connection_token; + } else if (c == ' ' || c == '\t') { + /* Skip lws */ + } else { + h_state = h_general; + } + break; + + /* looking for 'Connection: keep-alive' */ + case h_matching_connection_keep_alive: + parser->index++; + if (parser->index > sizeof(KEEP_ALIVE)-1 + || c != KEEP_ALIVE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(KEEP_ALIVE)-2) { + h_state = h_connection_keep_alive; + } + break; + + /* looking for 'Connection: close' */ + case h_matching_connection_close: + parser->index++; + if (parser->index > sizeof(CLOSE)-1 || c != CLOSE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(CLOSE)-2) { + h_state = h_connection_close; + } + break; + + /* looking for 'Connection: upgrade' */ + case h_matching_connection_upgrade: + parser->index++; + if (parser->index > sizeof(UPGRADE) - 1 || + c != UPGRADE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(UPGRADE)-2) { + h_state = h_connection_upgrade; + } + break; + + case h_matching_connection_token: + if (ch == ',') { + h_state = h_matching_connection_token_start; + parser->index = 0; + } + break; + + case h_transfer_encoding_chunked: + if (ch != ' ') h_state = h_general; + break; + + case h_connection_keep_alive: + case h_connection_close: + case h_connection_upgrade: + if (ch == ',') { + if (h_state == h_connection_keep_alive) { + parser->flags |= F_CONNECTION_KEEP_ALIVE; + } else if (h_state == h_connection_close) { + parser->flags |= F_CONNECTION_CLOSE; + } else if (h_state == h_connection_upgrade) { + parser->flags |= F_CONNECTION_UPGRADE; + } + h_state = h_matching_connection_token_start; + parser->index = 0; + } else if (ch != ' ') { + h_state = h_matching_connection_token; + } + break; + + default: + UPDATE_STATE(s_header_value); + h_state = h_general; + break; + } + } + parser->header_state = h_state; + + COUNT_HEADER_SIZE(p - start); + + if (p == data + len) + --p; + break; + } + + case s_header_almost_done: + { + if (UNLIKELY(ch != LF)) { + SET_ERRNO(HPE_LF_EXPECTED); + goto error; + } + + UPDATE_STATE(s_header_value_lws); + break; + } + + case s_header_value_lws: + { + if (ch == ' ' || ch == '\t') { + UPDATE_STATE(s_header_value_start); + REEXECUTE(); + } + + /* finished the header */ + switch (parser->header_state) { + case h_connection_keep_alive: + parser->flags |= F_CONNECTION_KEEP_ALIVE; + break; + case h_connection_close: + parser->flags |= F_CONNECTION_CLOSE; + break; + case h_transfer_encoding_chunked: + parser->flags |= F_CHUNKED; + break; + case h_connection_upgrade: + parser->flags |= F_CONNECTION_UPGRADE; + break; + default: + break; + } + + UPDATE_STATE(s_header_field_start); + REEXECUTE(); + } + + case s_header_value_discard_ws_almost_done: + { + STRICT_CHECK(ch != LF); + UPDATE_STATE(s_header_value_discard_lws); + break; + } + + case s_header_value_discard_lws: + { + if (ch == ' ' || ch == '\t') { + UPDATE_STATE(s_header_value_discard_ws); + break; + } else { + switch (parser->header_state) { + case h_connection_keep_alive: + parser->flags |= F_CONNECTION_KEEP_ALIVE; + break; + case h_connection_close: + parser->flags |= F_CONNECTION_CLOSE; + break; + case h_connection_upgrade: + parser->flags |= F_CONNECTION_UPGRADE; + break; + case h_transfer_encoding_chunked: + parser->flags |= F_CHUNKED; + break; + default: + break; + } + + /* header value was empty */ + MARK(header_value); + UPDATE_STATE(s_header_field_start); + CALLBACK_DATA_NOADVANCE(header_value); + REEXECUTE(); + } + } + + case s_headers_almost_done: + { + STRICT_CHECK(ch != LF); + + if (parser->flags & F_TRAILING) { + /* End of a chunked request */ + UPDATE_STATE(s_message_done); + CALLBACK_NOTIFY_NOADVANCE(chunk_complete); + REEXECUTE(); + } + + /* Cannot use chunked encoding and a content-length header together + per the HTTP specification. */ + if ((parser->flags & F_CHUNKED) && + (parser->flags & F_CONTENTLENGTH)) { + SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH); + goto error; + } + + UPDATE_STATE(s_headers_done); + + /* Set this here so that on_headers_complete() callbacks can see it */ + parser->upgrade = + ((parser->flags & (F_UPGRADE | F_CONNECTION_UPGRADE)) == + (F_UPGRADE | F_CONNECTION_UPGRADE) || + parser->method == HTTP_CONNECT); + + /* Here we call the headers_complete callback. This is somewhat + * different than other callbacks because if the user returns 1, we + * will interpret that as saying that this message has no body. This + * is needed for the annoying case of recieving a response to a HEAD + * request. + * + * We'd like to use CALLBACK_NOTIFY_NOADVANCE() here but we cannot, so + * we have to simulate it by handling a change in errno below. + */ + if (settings->on_headers_complete) { + switch (settings->on_headers_complete(parser)) { + case 0: + break; + + case 2: + parser->upgrade = 1; + + case 1: + parser->flags |= F_SKIPBODY; + break; + + default: + SET_ERRNO(HPE_CB_headers_complete); + RETURN(p - data); /* Error */ + } + } + + if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { + RETURN(p - data); + } + + REEXECUTE(); + } + + case s_headers_done: + { + int hasBody; + STRICT_CHECK(ch != LF); + + parser->nread = 0; + + hasBody = parser->flags & F_CHUNKED || + (parser->content_length > 0 && parser->content_length != ULLONG_MAX); + if (parser->upgrade && (parser->method == HTTP_CONNECT || + (parser->flags & F_SKIPBODY) || !hasBody)) { + /* Exit, the rest of the message is in a different protocol. */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + RETURN((p - data) + 1); + } + + if (parser->flags & F_SKIPBODY) { + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else if (parser->flags & F_CHUNKED) { + /* chunked encoding - ignore Content-Length header */ + UPDATE_STATE(s_chunk_size_start); + } else { + if (parser->content_length == 0) { + /* Content-Length header given but zero: Content-Length: 0\r\n */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else if (parser->content_length != ULLONG_MAX) { + /* Content-Length header given and non-zero */ + UPDATE_STATE(s_body_identity); + } else { + if (!http_message_needs_eof(parser)) { + /* Assume content-length 0 - read the next */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else { + /* Read body until EOF */ + UPDATE_STATE(s_body_identity_eof); + } + } + } + + break; + } + + case s_body_identity: + { + uint64_t to_read = MIN(parser->content_length, + (uint64_t) ((data + len) - p)); + + assert(parser->content_length != 0 + && parser->content_length != ULLONG_MAX); + + /* The difference between advancing content_length and p is because + * the latter will automaticaly advance on the next loop iteration. + * Further, if content_length ends up at 0, we want to see the last + * byte again for our message complete callback. + */ + MARK(body); + parser->content_length -= to_read; + p += to_read - 1; + + if (parser->content_length == 0) { + UPDATE_STATE(s_message_done); + + /* Mimic CALLBACK_DATA_NOADVANCE() but with one extra byte. + * + * The alternative to doing this is to wait for the next byte to + * trigger the data callback, just as in every other case. The + * problem with this is that this makes it difficult for the test + * harness to distinguish between complete-on-EOF and + * complete-on-length. It's not clear that this distinction is + * important for applications, but let's keep it for now. + */ + CALLBACK_DATA_(body, p - body_mark + 1, p - data); + REEXECUTE(); + } + + break; + } + + /* read until EOF */ + case s_body_identity_eof: + MARK(body); + p = data + len - 1; + + break; + + case s_message_done: + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + if (parser->upgrade) { + /* Exit, the rest of the message is in a different protocol. */ + RETURN((p - data) + 1); + } + break; + + case s_chunk_size_start: + { + assert(parser->nread == 1); + assert(parser->flags & F_CHUNKED); + + unhex_val = unhex[(unsigned char)ch]; + if (UNLIKELY(unhex_val == -1)) { + SET_ERRNO(HPE_INVALID_CHUNK_SIZE); + goto error; + } + + parser->content_length = unhex_val; + UPDATE_STATE(s_chunk_size); + break; + } + + case s_chunk_size: + { + uint64_t t; + + assert(parser->flags & F_CHUNKED); + + if (ch == CR) { + UPDATE_STATE(s_chunk_size_almost_done); + break; + } + + unhex_val = unhex[(unsigned char)ch]; + + if (unhex_val == -1) { + if (ch == ';' || ch == ' ') { + UPDATE_STATE(s_chunk_parameters); + break; + } + + SET_ERRNO(HPE_INVALID_CHUNK_SIZE); + goto error; + } + + t = parser->content_length; + t *= 16; + t += unhex_val; + + /* Overflow? Test against a conservative limit for simplicity. */ + if (UNLIKELY((ULLONG_MAX - 16) / 16 < parser->content_length)) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + goto error; + } + + parser->content_length = t; + break; + } + + case s_chunk_parameters: + { + assert(parser->flags & F_CHUNKED); + /* just ignore this shit. TODO check for overflow */ + if (ch == CR) { + UPDATE_STATE(s_chunk_size_almost_done); + break; + } + break; + } + + case s_chunk_size_almost_done: + { + assert(parser->flags & F_CHUNKED); + STRICT_CHECK(ch != LF); + + parser->nread = 0; + + if (parser->content_length == 0) { + parser->flags |= F_TRAILING; + UPDATE_STATE(s_header_field_start); + } else { + UPDATE_STATE(s_chunk_data); + } + CALLBACK_NOTIFY(chunk_header); + break; + } + + case s_chunk_data: + { + uint64_t to_read = MIN(parser->content_length, + (uint64_t) ((data + len) - p)); + + assert(parser->flags & F_CHUNKED); + assert(parser->content_length != 0 + && parser->content_length != ULLONG_MAX); + + /* See the explanation in s_body_identity for why the content + * length and data pointers are managed this way. + */ + MARK(body); + parser->content_length -= to_read; + p += to_read - 1; + + if (parser->content_length == 0) { + UPDATE_STATE(s_chunk_data_almost_done); + } + + break; + } + + case s_chunk_data_almost_done: + assert(parser->flags & F_CHUNKED); + assert(parser->content_length == 0); + STRICT_CHECK(ch != CR); + UPDATE_STATE(s_chunk_data_done); + CALLBACK_DATA(body); + break; + + case s_chunk_data_done: + assert(parser->flags & F_CHUNKED); + STRICT_CHECK(ch != LF); + parser->nread = 0; + UPDATE_STATE(s_chunk_size_start); + CALLBACK_NOTIFY(chunk_complete); + break; + + default: + assert(0 && "unhandled state"); + SET_ERRNO(HPE_INVALID_INTERNAL_STATE); + goto error; + } + } + + /* Run callbacks for any marks that we have leftover after we ran our of + * bytes. There should be at most one of these set, so it's OK to invoke + * them in series (unset marks will not result in callbacks). + * + * We use the NOADVANCE() variety of callbacks here because 'p' has already + * overflowed 'data' and this allows us to correct for the off-by-one that + * we'd otherwise have (since CALLBACK_DATA() is meant to be run with a 'p' + * value that's in-bounds). + */ + + assert(((header_field_mark ? 1 : 0) + + (header_value_mark ? 1 : 0) + + (url_mark ? 1 : 0) + + (body_mark ? 1 : 0) + + (status_mark ? 1 : 0)) <= 1); + + CALLBACK_DATA_NOADVANCE(header_field); + CALLBACK_DATA_NOADVANCE(header_value); + CALLBACK_DATA_NOADVANCE(url); + CALLBACK_DATA_NOADVANCE(body); + CALLBACK_DATA_NOADVANCE(status); + + RETURN(len); + +error: + if (HTTP_PARSER_ERRNO(parser) == HPE_OK) { + SET_ERRNO(HPE_UNKNOWN); + } + + RETURN(p - data); +} + + +/* Does the parser need to see an EOF to find the end of the message? */ +int +http_message_needs_eof (const http_parser *parser) +{ + if (parser->type == HTTP_REQUEST) { + return 0; + } + + /* See RFC 2616 section 4.4 */ + if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */ + parser->status_code == 204 || /* No Content */ + parser->status_code == 304 || /* Not Modified */ + parser->flags & F_SKIPBODY) { /* response to a HEAD request */ + return 0; + } + + if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) { + return 0; + } + + return 1; +} + + +int +http_should_keep_alive (const http_parser *parser) +{ + if (parser->http_major > 0 && parser->http_minor > 0) { + /* HTTP/1.1 */ + if (parser->flags & F_CONNECTION_CLOSE) { + return 0; + } + } else { + /* HTTP/1.0 or earlier */ + if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) { + return 0; + } + } + + return !http_message_needs_eof(parser); +} + + +const char * +http_method_str (enum http_method m) +{ + return ELEM_AT(method_strings, m, ""); +} + + +void +http_parser_init (http_parser *parser, enum http_parser_type t) +{ + void *data = parser->data; /* preserve application data */ + memset(parser, 0, sizeof(*parser)); + parser->data = data; + parser->type = t; + parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res)); + parser->http_errno = HPE_OK; +} + +void +http_parser_settings_init(http_parser_settings *settings) +{ + memset(settings, 0, sizeof(*settings)); +} + +const char * +http_errno_name(enum http_errno err) { + assert(((size_t) err) < ARRAY_SIZE(http_strerror_tab)); + return http_strerror_tab[err].name; +} + +const char * +http_errno_description(enum http_errno err) { + assert(((size_t) err) < ARRAY_SIZE(http_strerror_tab)); + return http_strerror_tab[err].description; +} + +static enum http_host_state +http_parse_host_char(enum http_host_state s, const char ch) { + switch(s) { + case s_http_userinfo: + case s_http_userinfo_start: + if (ch == '@') { + return s_http_host_start; + } + + if (IS_USERINFO_CHAR(ch)) { + return s_http_userinfo; + } + break; + + case s_http_host_start: + if (ch == '[') { + return s_http_host_v6_start; + } + + if (IS_HOST_CHAR(ch)) { + return s_http_host; + } + + break; + + case s_http_host: + if (IS_HOST_CHAR(ch)) { + return s_http_host; + } + + /* FALLTHROUGH */ + case s_http_host_v6_end: + if (ch == ':') { + return s_http_host_port_start; + } + + break; + + case s_http_host_v6: + if (ch == ']') { + return s_http_host_v6_end; + } + + /* FALLTHROUGH */ + case s_http_host_v6_start: + if (IS_HEX(ch) || ch == ':' || ch == '.') { + return s_http_host_v6; + } + + if (s == s_http_host_v6 && ch == '%') { + return s_http_host_v6_zone_start; + } + break; + + case s_http_host_v6_zone: + if (ch == ']') { + return s_http_host_v6_end; + } + + /* FALLTHROUGH */ + case s_http_host_v6_zone_start: + /* RFC 6874 Zone ID consists of 1*( unreserved / pct-encoded) */ + if (IS_ALPHANUM(ch) || ch == '%' || ch == '.' || ch == '-' || ch == '_' || + ch == '~') { + return s_http_host_v6_zone; + } + break; + + case s_http_host_port: + case s_http_host_port_start: + if (IS_NUM(ch)) { + return s_http_host_port; + } + + break; + + default: + break; + } + return s_http_host_dead; +} + +static int +http_parse_host(const char * buf, struct http_parser_url *u, int found_at) { + enum http_host_state s; + + const char *p; + size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len; + + assert(u->field_set & (1 << UF_HOST)); + + u->field_data[UF_HOST].len = 0; + + s = found_at ? s_http_userinfo_start : s_http_host_start; + + for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) { + enum http_host_state new_s = http_parse_host_char(s, *p); + + if (new_s == s_http_host_dead) { + return 1; + } + + switch(new_s) { + case s_http_host: + if (s != s_http_host) { + u->field_data[UF_HOST].off = p - buf; + } + u->field_data[UF_HOST].len++; + break; + + case s_http_host_v6: + if (s != s_http_host_v6) { + u->field_data[UF_HOST].off = p - buf; + } + u->field_data[UF_HOST].len++; + break; + + case s_http_host_v6_zone_start: + case s_http_host_v6_zone: + u->field_data[UF_HOST].len++; + break; + + case s_http_host_port: + if (s != s_http_host_port) { + u->field_data[UF_PORT].off = p - buf; + u->field_data[UF_PORT].len = 0; + u->field_set |= (1 << UF_PORT); + } + u->field_data[UF_PORT].len++; + break; + + case s_http_userinfo: + if (s != s_http_userinfo) { + u->field_data[UF_USERINFO].off = p - buf ; + u->field_data[UF_USERINFO].len = 0; + u->field_set |= (1 << UF_USERINFO); + } + u->field_data[UF_USERINFO].len++; + break; + + default: + break; + } + s = new_s; + } + + /* Make sure we don't end somewhere unexpected */ + switch (s) { + case s_http_host_start: + case s_http_host_v6_start: + case s_http_host_v6: + case s_http_host_v6_zone_start: + case s_http_host_v6_zone: + case s_http_host_port_start: + case s_http_userinfo: + case s_http_userinfo_start: + return 1; + default: + break; + } + + return 0; +} + +void +http_parser_url_init(struct http_parser_url *u) { + memset(u, 0, sizeof(*u)); +} + +int +http_parser_parse_url(const char *buf, size_t buflen, int is_connect, + struct http_parser_url *u) +{ + enum state s; + const char *p; + enum http_parser_url_fields uf, old_uf; + int found_at = 0; + + u->port = u->field_set = 0; + s = is_connect ? s_req_server_start : s_req_spaces_before_url; + old_uf = UF_MAX; + + for (p = buf; p < buf + buflen; p++) { + s = parse_url_char(s, *p); + + /* Figure out the next field that we're operating on */ + switch (s) { + case s_dead: + return 1; + + /* Skip delimeters */ + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + case s_req_query_string_start: + case s_req_fragment_start: + continue; + + case s_req_schema: + uf = UF_SCHEMA; + break; + + case s_req_server_with_at: + found_at = 1; + + /* FALLTROUGH */ + case s_req_server: + uf = UF_HOST; + break; + + case s_req_path: + uf = UF_PATH; + break; + + case s_req_query_string: + uf = UF_QUERY; + break; + + case s_req_fragment: + uf = UF_FRAGMENT; + break; + + default: + assert(!"Unexpected state"); + return 1; + } + + /* Nothing's changed; soldier on */ + if (uf == old_uf) { + u->field_data[uf].len++; + continue; + } + + u->field_data[uf].off = p - buf; + u->field_data[uf].len = 1; + + u->field_set |= (1 << uf); + old_uf = uf; + } + + /* host must be present if there is a schema */ + /* parsing http:///toto will fail */ + if ((u->field_set & (1 << UF_SCHEMA)) && + (u->field_set & (1 << UF_HOST)) == 0) { + return 1; + } + + if (u->field_set & (1 << UF_HOST)) { + if (http_parse_host(buf, u, found_at) != 0) { + return 1; + } + } + + /* CONNECT requests can only contain "hostname:port" */ + if (is_connect && u->field_set != ((1 << UF_HOST)|(1 << UF_PORT))) { + return 1; + } + + if (u->field_set & (1 << UF_PORT)) { + /* Don't bother with endp; we've already validated the string */ + unsigned long v = strtoul(buf + u->field_data[UF_PORT].off, NULL, 10); + + /* Ports have a max value of 2^16 */ + if (v > 0xffff) { + return 1; + } + + u->port = (uint16_t) v; + } + + return 0; +} + +void +http_parser_pause(http_parser *parser, int paused) { + /* Users should only be pausing/unpausing a parser that is not in an error + * state. In non-debug builds, there's not much that we can do about this + * other than ignore it. + */ + if (HTTP_PARSER_ERRNO(parser) == HPE_OK || + HTTP_PARSER_ERRNO(parser) == HPE_PAUSED) { + SET_ERRNO((paused) ? HPE_PAUSED : HPE_OK); + } else { + assert(0 && "Attempting to pause parser in error state"); + } +} + +int +http_body_is_final(const struct http_parser *parser) { + return parser->state == s_message_done; +} + +unsigned long +http_parser_version(void) { + return HTTP_PARSER_VERSION_MAJOR * 0x10000 | + HTTP_PARSER_VERSION_MINOR * 0x00100 | + HTTP_PARSER_VERSION_PATCH * 0x00001; +} diff --git a/components/nghttp/port/include/config.h b/components/nghttp/port/include/config.h new file mode 100644 index 0000000000..f193b0afca --- /dev/null +++ b/components/nghttp/port/include/config.h @@ -0,0 +1,36 @@ +#ifndef __HAVE_CONFIG_H_ +#define __HAVE_CONFIG_H_ + +#define _U_ + +#define SIZEOF_INT_P 2 + +//#define DEBUGBUILD +#include "stdio.h" +#include "stdlib.h" +#include "string.h" + +#if (!defined(nghttp_unlikely)) +#define nghttp_unlikely(Expression) !!(Expression) +#endif + +#define nghttp_ASSERT(Expression) do{if (!(Expression)) printf("%d\n", __LINE__);}while(0) + +#define CU_ASSERT(a) nghttp_ASSERT(a) +#define CU_ASSERT_FATAL(a) nghttp_ASSERT(a) + +#if 1 +#define NGHTTP2_DEBUG_INFO() printf("%s %d\n", __FILE__, __LINE__) +#else +#define NGHTTP2_DEBUG_INFO() +#endif + +#define NGHTTP_PLATFORM_HTONS(_n) ((uint16_t)((((_n) & 0xff) << 8) | (((_n) >> 8) & 0xff))) +#define NGHTTP_PLATFORM_HTONL(_n) ((uint32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) )) + +#define htons(x) NGHTTP_PLATFORM_HTONS(x) +#define ntohs(x) NGHTTP_PLATFORM_HTONS(x) +#define htonl(x) NGHTTP_PLATFORM_HTONL(x) +#define ntohl(x) NGHTTP_PLATFORM_HTONL(x) + +#endif diff --git a/components/nghttp/port/include/http_parser.h b/components/nghttp/port/include/http_parser.h new file mode 100644 index 0000000000..105ae510a8 --- /dev/null +++ b/components/nghttp/port/include/http_parser.h @@ -0,0 +1,362 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#ifndef http_parser_h +#define http_parser_h +#ifdef __cplusplus +extern "C" { +#endif + +/* Also update SONAME in the Makefile whenever you change these. */ +#define HTTP_PARSER_VERSION_MAJOR 2 +#define HTTP_PARSER_VERSION_MINOR 7 +#define HTTP_PARSER_VERSION_PATCH 0 + +#include +#if defined(_WIN32) && !defined(__MINGW32__) && \ + (!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__) +#include +#include +typedef __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include +#endif + +/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run + * faster + */ +#ifndef HTTP_PARSER_STRICT +# define HTTP_PARSER_STRICT 1 +#endif + +/* Maximium header size allowed. If the macro is not defined + * before including this header then the default is used. To + * change the maximum header size, define the macro in the build + * environment (e.g. -DHTTP_MAX_HEADER_SIZE=). To remove + * the effective limit on the size of the header, define the macro + * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff) + */ +#ifndef HTTP_MAX_HEADER_SIZE +# define HTTP_MAX_HEADER_SIZE (80*1024) +#endif + +typedef struct http_parser http_parser; +typedef struct http_parser_settings http_parser_settings; + + +/* Callbacks should return non-zero to indicate an error. The parser will + * then halt execution. + * + * The one exception is on_headers_complete. In a HTTP_RESPONSE parser + * returning '1' from on_headers_complete will tell the parser that it + * should not expect a body. This is used when receiving a response to a + * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: + * chunked' headers that indicate the presence of a body. + * + * Returning `2` from on_headers_complete will tell parser that it should not + * expect neither a body nor any futher responses on this connection. This is + * useful for handling responses to a CONNECT request which may not contain + * `Upgrade` or `Connection: upgrade` headers. + * + * http_data_cb does not return data chunks. It will be called arbitrarily + * many times for each string. E.G. you might get 10 callbacks for "on_url" + * each providing just a few characters more data. + */ +typedef int (*http_data_cb) (http_parser*, const char *at, size_t length); +typedef int (*http_cb) (http_parser*); + + +/* Request Methods */ +#define HTTP_METHOD_MAP(XX) \ + XX(0, DELETE, DELETE) \ + XX(1, GET, GET) \ + XX(2, HEAD, HEAD) \ + XX(3, POST, POST) \ + XX(4, PUT, PUT) \ + /* pathological */ \ + XX(5, CONNECT, CONNECT) \ + XX(6, OPTIONS, OPTIONS) \ + XX(7, TRACE, TRACE) \ + /* WebDAV */ \ + XX(8, COPY, COPY) \ + XX(9, LOCK, LOCK) \ + XX(10, MKCOL, MKCOL) \ + XX(11, MOVE, MOVE) \ + XX(12, PROPFIND, PROPFIND) \ + XX(13, PROPPATCH, PROPPATCH) \ + XX(14, SEARCH, SEARCH) \ + XX(15, UNLOCK, UNLOCK) \ + XX(16, BIND, BIND) \ + XX(17, REBIND, REBIND) \ + XX(18, UNBIND, UNBIND) \ + XX(19, ACL, ACL) \ + /* subversion */ \ + XX(20, REPORT, REPORT) \ + XX(21, MKACTIVITY, MKACTIVITY) \ + XX(22, CHECKOUT, CHECKOUT) \ + XX(23, MERGE, MERGE) \ + /* upnp */ \ + XX(24, MSEARCH, M-SEARCH) \ + XX(25, NOTIFY, NOTIFY) \ + XX(26, SUBSCRIBE, SUBSCRIBE) \ + XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ + /* RFC-5789 */ \ + XX(28, PATCH, PATCH) \ + XX(29, PURGE, PURGE) \ + /* CalDAV */ \ + XX(30, MKCALENDAR, MKCALENDAR) \ + /* RFC-2068, section 19.6.1.2 */ \ + XX(31, LINK, LINK) \ + XX(32, UNLINK, UNLINK) \ + +enum http_method + { +#define XX(num, name, string) HTTP_##name = num, + HTTP_METHOD_MAP(XX) +#undef XX + }; + + +enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; + + +/* Flag values for http_parser.flags field */ +enum flags + { F_CHUNKED = 1 << 0 + , F_CONNECTION_KEEP_ALIVE = 1 << 1 + , F_CONNECTION_CLOSE = 1 << 2 + , F_CONNECTION_UPGRADE = 1 << 3 + , F_TRAILING = 1 << 4 + , F_UPGRADE = 1 << 5 + , F_SKIPBODY = 1 << 6 + , F_CONTENTLENGTH = 1 << 7 + }; + + +/* Map for errno-related constants + * + * The provided argument should be a macro that takes 2 arguments. + */ +#define HTTP_ERRNO_MAP(XX) \ + /* No error */ \ + XX(OK, "success") \ + \ + /* Callback-related errors */ \ + XX(CB_message_begin, "the on_message_begin callback failed") \ + XX(CB_url, "the on_url callback failed") \ + XX(CB_header_field, "the on_header_field callback failed") \ + XX(CB_header_value, "the on_header_value callback failed") \ + XX(CB_headers_complete, "the on_headers_complete callback failed") \ + XX(CB_body, "the on_body callback failed") \ + XX(CB_message_complete, "the on_message_complete callback failed") \ + XX(CB_status, "the on_status callback failed") \ + XX(CB_chunk_header, "the on_chunk_header callback failed") \ + XX(CB_chunk_complete, "the on_chunk_complete callback failed") \ + \ + /* Parsing-related errors */ \ + XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \ + XX(HEADER_OVERFLOW, \ + "too many header bytes seen; overflow detected") \ + XX(CLOSED_CONNECTION, \ + "data received after completed connection: close message") \ + XX(INVALID_VERSION, "invalid HTTP version") \ + XX(INVALID_STATUS, "invalid HTTP status code") \ + XX(INVALID_METHOD, "invalid HTTP method") \ + XX(INVALID_URL, "invalid URL") \ + XX(INVALID_HOST, "invalid host") \ + XX(INVALID_PORT, "invalid port") \ + XX(INVALID_PATH, "invalid path") \ + XX(INVALID_QUERY_STRING, "invalid query string") \ + XX(INVALID_FRAGMENT, "invalid fragment") \ + XX(LF_EXPECTED, "LF character expected") \ + XX(INVALID_HEADER_TOKEN, "invalid character in header") \ + XX(INVALID_CONTENT_LENGTH, \ + "invalid character in content-length header") \ + XX(UNEXPECTED_CONTENT_LENGTH, \ + "unexpected content-length header") \ + XX(INVALID_CHUNK_SIZE, \ + "invalid character in chunk size header") \ + XX(INVALID_CONSTANT, "invalid constant string") \ + XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ + XX(STRICT, "strict mode assertion failed") \ + XX(PAUSED, "parser is paused") \ + XX(UNKNOWN, "an unknown error occurred") + + +/* Define HPE_* values for each errno value above */ +#define HTTP_ERRNO_GEN(n, s) HPE_##n, +enum http_errno { + HTTP_ERRNO_MAP(HTTP_ERRNO_GEN) +}; +#undef HTTP_ERRNO_GEN + + +/* Get an http_errno value from an http_parser */ +#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) + + +struct http_parser { + /** PRIVATE **/ + unsigned int type : 2; /* enum http_parser_type */ + unsigned int flags : 8; /* F_* values from 'flags' enum; semi-public */ + unsigned int state : 7; /* enum state from http_parser.c */ + unsigned int header_state : 7; /* enum header_state from http_parser.c */ + unsigned int index : 7; /* index into current matcher */ + unsigned int lenient_http_headers : 1; + + uint32_t nread; /* # bytes read in various scenarios */ + uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */ + + /** READ-ONLY **/ + unsigned short http_major; + unsigned short http_minor; + unsigned int status_code : 16; /* responses only */ + unsigned int method : 8; /* requests only */ + unsigned int http_errno : 7; + + /* 1 = Upgrade header was present and the parser has exited because of that. + * 0 = No upgrade header present. + * Should be checked when http_parser_execute() returns in addition to + * error checking. + */ + unsigned int upgrade : 1; + + /** PUBLIC **/ + void *data; /* A pointer to get hook to the "connection" or "socket" object */ +}; + + +struct http_parser_settings { + http_cb on_message_begin; + http_data_cb on_url; + http_data_cb on_status; + http_data_cb on_header_field; + http_data_cb on_header_value; + http_cb on_headers_complete; + http_data_cb on_body; + http_cb on_message_complete; + /* When on_chunk_header is called, the current chunk length is stored + * in parser->content_length. + */ + http_cb on_chunk_header; + http_cb on_chunk_complete; +}; + + +enum http_parser_url_fields + { UF_SCHEMA = 0 + , UF_HOST = 1 + , UF_PORT = 2 + , UF_PATH = 3 + , UF_QUERY = 4 + , UF_FRAGMENT = 5 + , UF_USERINFO = 6 + , UF_MAX = 7 + }; + + +/* Result structure for http_parser_parse_url(). + * + * Callers should index into field_data[] with UF_* values iff field_set + * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and + * because we probably have padding left over), we convert any port to + * a uint16_t. + */ +struct http_parser_url { + uint16_t field_set; /* Bitmask of (1 << UF_*) values */ + uint16_t port; /* Converted UF_PORT string */ + + struct { + uint16_t off; /* Offset into buffer in which field starts */ + uint16_t len; /* Length of run in buffer */ + } field_data[UF_MAX]; +}; + + +/* Returns the library version. Bits 16-23 contain the major version number, + * bits 8-15 the minor version number and bits 0-7 the patch level. + * Usage example: + * + * unsigned long version = http_parser_version(); + * unsigned major = (version >> 16) & 255; + * unsigned minor = (version >> 8) & 255; + * unsigned patch = version & 255; + * printf("http_parser v%u.%u.%u\n", major, minor, patch); + */ +unsigned long http_parser_version(void); + +void http_parser_init(http_parser *parser, enum http_parser_type type); + + +/* Initialize http_parser_settings members to 0 + */ +void http_parser_settings_init(http_parser_settings *settings); + + +/* Executes the parser. Returns number of parsed bytes. Sets + * `parser->http_errno` on error. */ +size_t http_parser_execute(http_parser *parser, + const http_parser_settings *settings, + const char *data, + size_t len); + + +/* If http_should_keep_alive() in the on_headers_complete or + * on_message_complete callback returns 0, then this should be + * the last message on the connection. + * If you are the server, respond with the "Connection: close" header. + * If you are the client, close the connection. + */ +int http_should_keep_alive(const http_parser *parser); + +/* Returns a string version of the HTTP method. */ +const char *http_method_str(enum http_method m); + +/* Return a string name of the given error */ +const char *http_errno_name(enum http_errno err); + +/* Return a string description of the given error */ +const char *http_errno_description(enum http_errno err); + +/* Initialize all http_parser_url members to 0 */ +void http_parser_url_init(struct http_parser_url *u); + +/* Parse a URL; return nonzero on failure */ +int http_parser_parse_url(const char *buf, size_t buflen, + int is_connect, + struct http_parser_url *u); + +/* Pause or un-pause the parser; a nonzero value pauses */ +void http_parser_pause(http_parser *parser, int paused); + +/* Checks if this is the final chunk of the body. */ +int http_body_is_final(const http_parser *parser); + +#ifdef __cplusplus +} +#endif +#endif From 96e0afd30fbf29b6c317c430dafa5486920d1ece Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Mon, 26 Sep 2016 19:21:55 +0800 Subject: [PATCH 090/179] components/nghttp: rename Makefile to component.mk --- components/nghttp/Makefile.projbuild | 4 ++++ components/nghttp/component.mk | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 components/nghttp/Makefile.projbuild create mode 100644 components/nghttp/component.mk diff --git a/components/nghttp/Makefile.projbuild b/components/nghttp/Makefile.projbuild new file mode 100644 index 0000000000..a93010ade9 --- /dev/null +++ b/components/nghttp/Makefile.projbuild @@ -0,0 +1,4 @@ +# Anyone compiling mbedTLS code needs the name of the +# alternative config file + +CFLAGS += -DHAVE_CONFIG_H diff --git a/components/nghttp/component.mk b/components/nghttp/component.mk new file mode 100644 index 0000000000..a4dca5cf70 --- /dev/null +++ b/components/nghttp/component.mk @@ -0,0 +1,9 @@ +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := port/include include + +COMPONENT_SRCDIRS := library port + +include $(IDF_PATH)/make/component_common.mk \ No newline at end of file From bd2e55def3bb7f98a8bcdd7a71564cda93f80471 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 19:45:36 +0800 Subject: [PATCH 091/179] component/esp32: adjust some APIs 1. Modify wifi_init_config_t to: typedef struct { wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; 2. Modify argument of esp_wifi_set/get_promiscuous from uint8_t/uint8_t* to bool/bool* --- components/esp32/include/esp_wifi.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 32d5cd0f67..b128e373cf 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -138,23 +138,11 @@ typedef enum { } wifi_second_chan_t; +typedef esp_err_t (*wifi_event_handler_t)(void *event); typedef struct { - QueueHandle_t event_queue; /**< WiFi event queue handle */ - uint8_t rx_ba_win; /**< TBC */ - uint8_t tx_ba_win; /**< TBC */ - uint8_t rx_buf_cnt; /**< TBC */ - uint8_t tx_buf_cnt; /**< TBC */ + wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; - -#define WIFI_INIT_CONFIG_DEFAULT(event_queue_) { \ - .event_queue = event_queue_, \ - .rx_ba_win = 0, \ - .tx_ba_win = 0, \ - .rx_buf_cnt = 0, \ - .tx_buf_cnt = 0 \ -}; - /** * @brief Init WiFi * Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, @@ -165,7 +153,6 @@ typedef struct { * to this queue when event happens, such as, when station connects to WiFi, WiFi driver * will post station connected event to this queue. If the queue is not initialized, WiFi * will not post any events - * @attention 3. For other parameters, currently it's not ready, just ignore it. * * @param wifi_init_config_t *config : provide WiFi init configuration * @@ -531,22 +518,22 @@ esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); /** * @brief Enable the promiscuous mode. * - * @param uint8 promiscuous : 0 - disable / 1 - enable + * @param bool promiscuous : false - disable / true - enable * * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_set_promiscuous(uint8_t enable); +esp_err_t esp_wifi_set_promiscuous(bool enable); /** * @brief Get the promiscuous mode. * - * @param uint8 *enable : store the current status of promiscuous mode + * @param bool *enable : store the current status of promiscuous mode * * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_get_promiscuous(uint8_t *enable); +esp_err_t esp_wifi_get_promiscuous(bool *enable); typedef struct { char ssid[32]; /**< SSID of ESP32 soft-AP */ From 0aace445a6032d6acaf1c20b4e8f62371f25fcc0 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 20:15:16 +0800 Subject: [PATCH 092/179] component/esp32: modify bool argument name from enable to en 1. Modify WIFI_INIT_CONFIG_DEFAULT 2. Modify bool argument name from enable to en --- components/esp32/include/esp_wifi.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index b128e373cf..463d1281a7 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -143,6 +143,11 @@ typedef struct { wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; + +#define WIFI_INIT_CONFIG_DEFAULT(event_handler_) { \ + .event_handler = (wifi_event_handler_t)event_handler_, \ +}; + /** * @brief Init WiFi * Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, @@ -523,7 +528,7 @@ esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_set_promiscuous(bool enable); +esp_err_t esp_wifi_set_promiscuous(bool en); /** * @brief Get the promiscuous mode. @@ -533,7 +538,7 @@ esp_err_t esp_wifi_set_promiscuous(bool enable); * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_get_promiscuous(bool *enable); +esp_err_t esp_wifi_get_promiscuous(bool *en); typedef struct { char ssid[32]; /**< SSID of ESP32 soft-AP */ From 62dbce1e81ae68553c86c8e3e73fb0e33199b81f Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 20:43:19 +0800 Subject: [PATCH 093/179] component/esp32: udpate wifi lib 1. 1a01e34f - adjust esp_wifi_set/get_promiscuous' arguments from uint8/uint8* to bool/bool* 2. 3611e699 - register event handler instead of event Q in esp_wifi_init --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index f6d558367a..a6967f4c1b 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit f6d558367a08b6c9b18c2de515bd0a6740d2c45c +Subproject commit a6967f4c1bac9269eb6651e84f2cebf81eb5f982 From d4b8a916a435cbd079572e385c75935dc54e43aa Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 14:57:02 +1000 Subject: [PATCH 094/179] examples: HTTP request example --- examples/02_http_request/Makefile | 9 + examples/02_http_request/README.md | 5 + .../02_http_request/main/Kconfig.projbuild | 17 ++ examples/02_http_request/main/component.mk | 10 ++ .../02_http_request/main/http_request_main.c | 159 ++++++++++++++++++ 5 files changed, 200 insertions(+) create mode 100644 examples/02_http_request/Makefile create mode 100644 examples/02_http_request/README.md create mode 100644 examples/02_http_request/main/Kconfig.projbuild create mode 100644 examples/02_http_request/main/component.mk create mode 100644 examples/02_http_request/main/http_request_main.c diff --git a/examples/02_http_request/Makefile b/examples/02_http_request/Makefile new file mode 100644 index 0000000000..2625075074 --- /dev/null +++ b/examples/02_http_request/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := http-request + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/02_http_request/README.md b/examples/02_http_request/README.md new file mode 100644 index 0000000000..1e1bd3d26a --- /dev/null +++ b/examples/02_http_request/README.md @@ -0,0 +1,5 @@ +# HTTP Request Example + +Uses a POSIX socket to make a very simple HTTP request. + +See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/examples/02_http_request/main/Kconfig.projbuild b/examples/02_http_request/main/Kconfig.projbuild new file mode 100644 index 0000000000..c5d5523a9f --- /dev/null +++ b/examples/02_http_request/main/Kconfig.projbuild @@ -0,0 +1,17 @@ +menu "Example Configuration" + +config WIFI_SSID + string "WiFi SSID" + default "myssid" + help + SSID (network name) for the example to connect to. + +config WIFI_PASSWORD + string "WiFi Password" + default "myssid" + help + WiFi password (WPA or WPA2) for the example to use. + + Can be left blank if the network has no security set. + +endmenu \ No newline at end of file diff --git a/examples/02_http_request/main/component.mk b/examples/02_http_request/main/component.mk new file mode 100644 index 0000000000..24356f23ed --- /dev/null +++ b/examples/02_http_request/main/component.mk @@ -0,0 +1,10 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/02_http_request/main/http_request_main.c b/examples/02_http_request/main/http_request_main.c new file mode 100644 index 0000000000..8360c9e51e --- /dev/null +++ b/examples/02_http_request/main/http_request_main.c @@ -0,0 +1,159 @@ +/* HTTP GET Example using plain POSIX sockets + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "esp_log.h" + +#include "lwip/err.h" +#include "lwip/sockets.h" +#include "lwip/sys.h" +#include "lwip/netdb.h" +#include "lwip/dns.h" + +/* The examples use simple WiFi configuration that you can set via + 'make menuconfig'. + + If you'd rather not, just change the below entries to strings with + the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid" +*/ +#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID +#define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD + +/* Flag for when we are connected & ready to make a request */ +static volatile bool ready; + +/* Constants that aren't configurable in menuconfig */ +#define WEB_SERVER "example.com" +#define WEB_PORT 80 +#define WEB_URL "http://example.com/" + +static const char *TAG = "example"; + +static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" + "Host: "WEB_SERVER"\n" + "User-Agent: esp-idf/1.0 esp32\n" + "\n"; + +static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) +{ + switch(event->event_id) { + case SYSTEM_EVENT_STA_GOT_IP: + ready = true; + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + ready = false; + break; + default: + break; + } + return ESP_OK; +} + +static void set_wifi_configuration(void) +{ + wifi_config_t wifi_config = { + .sta = { + .ssid = EXAMPLE_WIFI_SSID, + .password = EXAMPLE_WIFI_PASS, + }, + }; + ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); + esp_wifi_set_mode(WIFI_MODE_STA); + esp_wifi_set_config(WIFI_IF_STA, &wifi_config); +} + +static void http_get_task(void *pvParameters) +{ + const struct addrinfo hints = { + .ai_family = AF_INET, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *res; + struct in_addr *addr; + int s, r; + char recv_buf[64]; + + while(1) { + esp_wifi_connect(); + /* Wait for the event callback to tell us we are connected */ + while (!ready) { + vTaskDelay(1); + } + ESP_LOGI(TAG, "Connected to AP"); + + int err = getaddrinfo(WEB_SERVER, "80", &hints, &res); + + if(err != 0 || res == NULL) { + ESP_LOGE(TAG, "DNS lookup failed err=%d res=%p", err, res); + vTaskDelay(1000 / portTICK_RATE_MS); + continue; + } + + /* Code to print the resolved IP. + + Note: inet_ntoa is non-reentrant, look at ipaddr_ntoa_r for "real" code */ + addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr; + ESP_LOGI(TAG, "DNS lookup succeeded. IP=%s", inet_ntoa(*addr)); + + s = socket(res->ai_family, res->ai_socktype, 0); + if(s < 0) { + ESP_LOGE(TAG, "... Failed to allocate socket."); + freeaddrinfo(res); + vTaskDelay(1000 / portTICK_RATE_MS); + continue; + } + ESP_LOGI(TAG, "... allocated socket\r\n"); + + if(connect(s, res->ai_addr, res->ai_addrlen) != 0) { + ESP_LOGE(TAG, "... socket connect failed errno=%d", errno); + close(s); + freeaddrinfo(res); + vTaskDelay(4000 / portTICK_RATE_MS); + continue; + } + + ESP_LOGI(TAG, "... connected"); + freeaddrinfo(res); + + if (write(s, REQUEST, strlen(REQUEST)) < 0) { + ESP_LOGE(TAG, "... socket send failed"); + close(s); + vTaskDelay(4000 / portTICK_RATE_MS); + continue; + } + ESP_LOGI(TAG, "... socket send success"); + + /* Read HTTP response */ + do { + bzero(recv_buf, sizeof(recv_buf)); + r = read(s, recv_buf, sizeof(recv_buf)-1); + for(int i = 0; i < r; i++) { + putchar(recv_buf[i]); + } + } while(r > 0); + + ESP_LOGI(TAG, "... done reading from socket. Last read return=%d errno=%d\r\n", r, errno); + close(s); + for(int countdown = 10; countdown >= 0; countdown--) { + ESP_LOGI(TAG, "%d... ", countdown); + vTaskDelay(1000 / portTICK_RATE_MS); + } + ESP_LOGI(TAG, "Starting again!"); + } +} + +void app_main() +{ + esp_event_set_cb(wifi_event_cb, NULL); + set_wifi_configuration(); + xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL); +} From aa75a719171362c545b53d643c1e0dca1d1a9261 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 16:36:30 +1000 Subject: [PATCH 095/179] mbedtls: Add some initial menuconfig options --- components/mbedtls/Kconfig | 37 +++++++++++++++++++ .../mbedtls/port/include/mbedtls/esp_config.h | 6 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 components/mbedtls/Kconfig diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig new file mode 100644 index 0000000000..b9c92bd7cc --- /dev/null +++ b/components/mbedtls/Kconfig @@ -0,0 +1,37 @@ +menu "mbedTLS" + +config MBEDTLS_SSL_MAX_CONTENT_LEN + int "TLS maximum message content length" + default 16384 + range 512 16384 + help + Maximum TLS message length (in bytes) supported by mbedTLS. + + 16384 is the default and this value is required to comply + fully with TLS standards. + + However you can set a lower value in order to save RAM. This + is safe if the other end of the connection supports Maximum + Fragment Length Negotiation Extension (max_fragment_length, + see RFC6066) or you know for certain that it will never send a + message longer than a certain number of bytes. + + If the value is set too low, symptoms are a failed TLS + handshake or a return value of MBEDTLS_ERR_SSL_INVALID_RECORD + (-0x7200). + +config MBEDTLS_DEBUG + bool "Enable mbedTLS debugging" + default "no" + help + Enable mbedTLS debugging functions. + + If this option is enabled, use the mbedtls_debug_set_threshold() + and mbedtls_ssl_conf_dbg() functions to obtain debugging output + from mbedTLS. + + Note thatm mbedTLS debugging is not related to the ESP logging + functionality. See the "https_request_main" example for a + sample function which connects the two together. + +endmenu diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index 68be319c35..5a69ff78e4 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -27,6 +27,8 @@ #ifndef MBEDTLS_CONFIG_H #define MBEDTLS_CONFIG_H +#include "sdkconfig.h" + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) #define _CRT_SECURE_NO_DEPRECATE 1 #endif @@ -1659,7 +1661,9 @@ * * This module provides debugging functions. */ +#if CONFIG_MBEDTLS_DEBUG #define MBEDTLS_DEBUG_C +#endif /** * \def MBEDTLS_DES_C @@ -2481,7 +2485,7 @@ /* SSL options */ -#define MBEDTLS_SSL_MAX_CONTENT_LEN 5120 /**< Maxium fragment length in bytes, determines the size of each of the two internal I/O buffers */ +#define MBEDTLS_SSL_MAX_CONTENT_LEN CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN /**< Maxium fragment length in bytes, determines the size of each of the two internal I/O buffers */ //#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */ //#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ //#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ From af0a5d8d7ee2edc345ba21022a3f8c49a0187f3f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 16:44:27 +1000 Subject: [PATCH 096/179] examples: Add https_request example --- examples/03_https_request/Makefile | 9 + examples/03_https_request/README.md | 5 + .../03_https_request/main/Kconfig.projbuild | 17 + examples/03_https_request/main/cert.c | 44 +++ examples/03_https_request/main/component.mk | 10 + .../main/https_request_main.c | 349 ++++++++++++++++++ 6 files changed, 434 insertions(+) create mode 100644 examples/03_https_request/Makefile create mode 100644 examples/03_https_request/README.md create mode 100644 examples/03_https_request/main/Kconfig.projbuild create mode 100644 examples/03_https_request/main/cert.c create mode 100644 examples/03_https_request/main/component.mk create mode 100644 examples/03_https_request/main/https_request_main.c diff --git a/examples/03_https_request/Makefile b/examples/03_https_request/Makefile new file mode 100644 index 0000000000..e9382bd03d --- /dev/null +++ b/examples/03_https_request/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := https-request + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/03_https_request/README.md b/examples/03_https_request/README.md new file mode 100644 index 0000000000..fb7c6df95c --- /dev/null +++ b/examples/03_https_request/README.md @@ -0,0 +1,5 @@ +# HTTPS Request Example + +Uses an mbedTLS socket to make a very simple HTTPS request over a secure connection, including verifying the server TLS certificate. + +See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/examples/03_https_request/main/Kconfig.projbuild b/examples/03_https_request/main/Kconfig.projbuild new file mode 100644 index 0000000000..c5d5523a9f --- /dev/null +++ b/examples/03_https_request/main/Kconfig.projbuild @@ -0,0 +1,17 @@ +menu "Example Configuration" + +config WIFI_SSID + string "WiFi SSID" + default "myssid" + help + SSID (network name) for the example to connect to. + +config WIFI_PASSWORD + string "WiFi Password" + default "myssid" + help + WiFi password (WPA or WPA2) for the example to use. + + Can be left blank if the network has no security set. + +endmenu \ No newline at end of file diff --git a/examples/03_https_request/main/cert.c b/examples/03_https_request/main/cert.c new file mode 100644 index 0000000000..7acc438ef3 --- /dev/null +++ b/examples/03_https_request/main/cert.c @@ -0,0 +1,44 @@ +/* This is the CA certificate for the CA trust chain of + www.howsmyssl.com in PEM format, as dumped via: + + openssl s_client -showcerts -connect www.howsmyssl.com:443 +#include +#include + +/* + 1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3 + i:/O=Digital Signature Trust Co./CN=DST Root CA X3 + */ +const char *server_root_cert = "-----BEGIN CERTIFICATE-----\r\n" +"MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\r\n" +"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\r\n" +"DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\r\n" +"SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\r\n" +"GkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\r\n" +"AQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\r\n" +"q6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\r\n" +"SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\r\n" +"Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWA\r\n" +"a6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj\r\n" +"/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0T\r\n" +"AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIG\r\n" +"CCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNv\r\n" +"bTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9k\r\n" +"c3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAw\r\n" +"VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC\r\n" +"ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz\r\n" +"MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu\r\n" +"Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF\r\n" +"AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo\r\n" +"uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/\r\n" +"wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu\r\n" +"X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG\r\n" +"PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6\r\n" +"KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\r\n" +"-----END CERTIFICATE-----\r\n"; + + diff --git a/examples/03_https_request/main/component.mk b/examples/03_https_request/main/component.mk new file mode 100644 index 0000000000..24356f23ed --- /dev/null +++ b/examples/03_https_request/main/component.mk @@ -0,0 +1,10 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/03_https_request/main/https_request_main.c b/examples/03_https_request/main/https_request_main.c new file mode 100644 index 0000000000..852cde898f --- /dev/null +++ b/examples/03_https_request/main/https_request_main.c @@ -0,0 +1,349 @@ +/* HTTPS GET Example using plain mbedTLS sockets + * + * Contacts the howsmyssl.com API via TLS v1.2 and reads a JSON + * response. + * + * Adapted from the ssl_client1 example in mbedtls. + * + * Original Copyright (C) 2006-2016, ARM Limited, All Rights Reserved, Apache 2.0 License. + * Additions Copyright (C) Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD, Apache 2.0 License. + * + * + * Licensed 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. + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "esp_log.h" +#include "esp_system.h" + +#include "lwip/err.h" +#include "lwip/sockets.h" +#include "lwip/sys.h" +#include "lwip/netdb.h" +#include "lwip/dns.h" + +#include "mbedtls/net.h" +#include "mbedtls/debug.h" +#include "mbedtls/ssl.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ctr_drbg.h" +#include "mbedtls/error.h" +#include "mbedtls/certs.h" + +/* The examples use simple WiFi configuration that you can set via + 'make menuconfig'. + + If you'd rather not, just change the below entries to strings with + the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid" +*/ +#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID +#define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD + +/* Flag for when we are connected & ready to make a request */ +static volatile bool ready; + +/* Constants that aren't configurable in menuconfig */ +#define WEB_SERVER "www.howsmyssl.com" +#define WEB_PORT "443" +#define WEB_URL "https://www.howsmyssl.com/a/check" + +static const char *TAG = "example"; + +static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" + "Host: "WEB_SERVER"\n" + "User-Agent: esp-idf/1.0 esp32\n" + "\n"; + +/* Root cert for howsmyssl.com, found in cert.c */ +extern const char *server_root_cert; + +#ifdef MBEDTLS_DEBUG_C + +#define MBEDTLS_DEBUG_LEVEL 4 + +/* mbedtls debug function that translates mbedTLS debug output + to ESP_LOGx debug output. + + MBEDTLS_DEBUG_LEVEL 4 means all mbedTLS debug output gets sent here, + and then filtered to the +*/ +static void mbedtls_debug(void *ctx, int level, + const char *file, int line, + const char *str) +{ + const char *MBTAG = "mbedtls"; + char *file_sep; + + /* Shorten 'file' from the whole file path to just the filename + + This is a bit wasteful because the macros are compiled in with + the full _FILE_ path in each case. + */ + file_sep = rindex(file, '/'); + if(file_sep) + file = file_sep+1; + + switch(level) { + case 1: + ESP_LOGI(MBTAG, "%s:%d %s", file, line, str); + break; + case 2: + case 3: + ESP_LOGD(MBTAG, "%s:%d %s", file, line, str); + case 4: + ESP_LOGV(MBTAG, "%s:%d %s", file, line, str); + break; + default: + ESP_LOGE(MBTAG, "Unexpected log level %d: %s", level, str); + break; + } +} + +#endif + +static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) +{ + switch(event->event_id) { + case SYSTEM_EVENT_STA_GOT_IP: + ready = true; + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + ready = false; + break; + default: + break; + } + return ESP_OK; +} + +static void set_wifi_configuration(void) +{ + wifi_config_t wifi_config = { + .sta = { + .ssid = EXAMPLE_WIFI_SSID, + .password = EXAMPLE_WIFI_PASS, + }, + }; + ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); + esp_wifi_set_mode(WIFI_MODE_STA); + esp_wifi_set_config(WIFI_IF_STA, &wifi_config); +} + +static void https_get_task(void *pvParameters) +{ + char buf[512]; + int ret, flags, len; + + mbedtls_entropy_context entropy; + mbedtls_ctr_drbg_context ctr_drbg; + mbedtls_ssl_context ssl; + mbedtls_x509_crt cacert; + mbedtls_ssl_config conf; + mbedtls_net_context server_fd; + + esp_wifi_connect(); + + mbedtls_ssl_init(&ssl); + mbedtls_x509_crt_init(&cacert); + mbedtls_ctr_drbg_init(&ctr_drbg); + ESP_LOGI(TAG, "Seeding the random number generator"); + + mbedtls_ssl_config_init(&conf); + + mbedtls_entropy_init(&entropy); + if((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, + NULL, 0)) != 0) + { + ESP_LOGE(TAG, "mbedtls_ctr_drbg_seed returned %d", ret); + abort(); + } + + ESP_LOGI(TAG, "Loading the CA root certificate..."); + + ret = mbedtls_x509_crt_parse(&cacert, (uint8_t*)server_root_cert, strlen(server_root_cert)+1); + if(ret < 0) + { + ESP_LOGE(TAG, "mbedtls_x509_crt_parse returned -0x%x\n\n", -ret); + abort(); + } + + ESP_LOGI(TAG, "Setting hostname for TLS session..."); + + /* Hostname set here should match CN in server certificate */ + if((ret = mbedtls_ssl_set_hostname(&ssl, WEB_SERVER)) != 0) + { + ESP_LOGE(TAG, "mbedtls_ssl_set_hostname returned -0x%x", -ret); + abort(); + } + + ESP_LOGI(TAG, "Setting up the SSL/TLS structure..."); + + if((ret = mbedtls_ssl_config_defaults(&conf, + MBEDTLS_SSL_IS_CLIENT, + MBEDTLS_SSL_TRANSPORT_STREAM, + MBEDTLS_SSL_PRESET_DEFAULT)) != 0) + { + ESP_LOGE(TAG, "mbedtls_ssl_config_defaults returned %d", ret); + goto exit; + } + + /* MBEDTLS_SSL_VERIFY_OPTIONAL is bad for security, in this example it will print + a warning if CA verification fails but it will continue to connect. + + You should consider using MBEDTLS_SSL_VERIFY_REQUIRED in your own code. + */ + mbedtls_ssl_conf_authmode(&conf, MBEDTLS_SSL_VERIFY_OPTIONAL); + mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL); + mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg); +#ifdef MBEDTLS_DEBUG_C + mbedtls_debug_set_threshold(MBEDTLS_DEBUG_LEVEL); + mbedtls_ssl_conf_dbg(&conf, mbedtls_debug, NULL); +#endif + + ESP_LOGI(TAG, "%d free...", system_get_free_heap_size()); + + char *x = malloc(8192); + memset(x, 'a', 8192); + + ESP_LOGI(TAG, "%d free now...", system_get_free_heap_size()); + + if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) + { + ESP_LOGE(TAG, "mbedtls_ssl_setup returned -0x%x\n\n", -ret); + goto exit; + } + + ESP_LOGI(TAG, "Waiting for WiFi online..."); + while (!ready) { + vTaskDelay(1); + } + ESP_LOGI(TAG, "WiFi is online"); + + while(1) { + ESP_LOGI(TAG, "Connecting to %s:%s...", WEB_SERVER, WEB_PORT); + mbedtls_net_init(&server_fd); + + if ((ret = mbedtls_net_connect(&server_fd, WEB_SERVER, + WEB_PORT, MBEDTLS_NET_PROTO_TCP)) != 0) + { + ESP_LOGE(TAG, "mbedtls_net_connect returned -%x", -ret); + goto exit; + } + + ESP_LOGI(TAG, "Connected."); + + mbedtls_ssl_set_bio(&ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL); + + ESP_LOGI(TAG, "Performing the SSL/TLS handshake..."); + + while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) + { + if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) + { + ESP_LOGE(TAG, "mbedtls_ssl_handshake returned -0x%x", -ret); + goto exit; + } + } + + ESP_LOGI(TAG, "Verifying peer X.509 certificate..."); + + if ((flags = mbedtls_ssl_get_verify_result(&ssl)) != 0) + { + /* In real life, we probably want to close connection if ret != 0 */ + ESP_LOGW(TAG, "Failed to verify peer certificate!"); + bzero(buf, sizeof(buf)); + mbedtls_x509_crt_verify_info(buf, sizeof(buf), " ! ", flags); + ESP_LOGW(TAG, "verification info: %s", buf); + } + else { + ESP_LOGI(TAG, "Certificate verified."); + } + + ESP_LOGI(TAG, "Writing HTTP request..."); + + while((ret = mbedtls_ssl_write(&ssl, (const unsigned char *)REQUEST, strlen(REQUEST))) <= 0) + { + if(ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) + { + ESP_LOGE(TAG, "mbedtls_ssl_write returned -0x%x", -ret); + goto exit; + } + } + + len = ret; + ESP_LOGI(TAG, "%d bytes written", len); + ESP_LOGI(TAG, "Reading HTTP response..."); + + do + { + len = sizeof(buf) - 1; + bzero(buf, sizeof(buf)); + ret = mbedtls_ssl_read(&ssl, (unsigned char *)buf, len); + + if(ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) + continue; + + if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) { + ret = 0; + break; + } + + if(ret < 0) + { + ESP_LOGE(TAG, "mbedtls_ssl_read returned -0x%x", -ret); + break; + } + + if(ret == 0) + { + ESP_LOGI(TAG, "connection closed"); + break; + } + + len = ret; + ESP_LOGI(TAG, "%d bytes read", len); + /* Print response directly to stdout as it is read */ + for(int i = 0; i < len; i++) { + putchar(buf[i]); + } + } while(1); + + mbedtls_ssl_close_notify(&ssl); + + exit: + mbedtls_ssl_session_reset(&ssl); + mbedtls_net_free(&server_fd); + + if(ret != 0) + { + mbedtls_strerror(ret, buf, 100); + ESP_LOGE(TAG, "Last error was: -0x%x - %s", -ret, buf); + } + + for(int countdown = 10; countdown >= 0; countdown--) { + ESP_LOGI(TAG, "%d...", countdown); + vTaskDelay(1000 / portTICK_RATE_MS); + } + ESP_LOGI(TAG, "Starting again!"); + } +} + +void app_main() +{ + esp_event_set_cb(wifi_event_cb, NULL); + set_wifi_configuration(); + xTaskCreate(&https_get_task, "https_get_task", 8192, NULL, 5, NULL); +} From 79c21895d0fc6555dddbc4eb532af78d2ea49a84 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 16:46:39 +1000 Subject: [PATCH 097/179] Update gitignore for examples --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index 48230f5690..85027773b6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,18 @@ GTAGS GRTAGS GPATH +# emacs +.dir-locals.el + # emacs temp file suffixes *~ .#* \#*# +# Example project files +examples/*/sdkconfig +examples/*/sdkconfig.old +examples/*/build + +# Bootloader files +components/bootloader/src/sdkconfig.old \ No newline at end of file From 22e99694e3c7711a1e3a758d358147f07c1c848e Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 17:25:36 +1000 Subject: [PATCH 098/179] Documentation: Add contributor guide, expand README & add an examples README --- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ README.md | 18 ++++++++++++++++-- examples/README.md | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 examples/README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..824ec6ff31 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributions Guide + +We welcome contributions to the esp-idf project! + +## How to Contribute + +Contributions to esp-idf - fixing bugs, adding features, adding documentation - are welcome. We accept contributions via the [Github Pull Request](https://help.github.com/articles/about-pull-requests/) feature. + +## Before Contributing + +Before sending us a Pull Request, please consider this list of points: + +* Is the contribution entirely your own work, or already licensed under an Apache License 2.0 compatible Open Source License? If not then we cannot accept it. + +* Does any new code conform to the esp-idf Style Guide? (Style Guide currently pending). + +* Is the code adequately commented for people to understand how it is structured? + +* Is there documentation or examples that go with code contributions? [There are additional suggestions for writing good examples in the examples README](examples/README.md). + +* Are comments and documentation written in clear English, with no spelling or grammar errors? + +* If the contribution contains multiple commits, are they grouped together into logical changes (one major change per pull request)? Are any commits with names like "fixed typo" squashed into previous commits? + +* If you're unsure about any of these points, please open the Pull Request anyhow and then ask us for feedback. + +## Pull Request Process + +After you open the Pull Request, there will probably be some discussion in the comments field of the request itself. + +Once the Pull Request is ready to merge, it will first be merged into our internal git system for in-house automated testing. + +If this process passes, it will be merged onto the public github repository. + +## Legal Part + +Before a contribution is accepted, you will need to sign our Contributor Agreement. You will be prompted for this automatically as part of the Pull Request process. diff --git a/README.md b/README.md index 10fd72a3c3..ff645c3392 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ # Using Espressif IoT Development Framework with the ESP32 -# Prerequisites +# Setting Up ESP-IDF + +In the [docs](docs) directory you will find per-platform setup guides: + +* [Windows Setup Guide](docs/windows-setup.rst) +* [Mac OS Setup Guide](docs/macos-setup.rst) +* [Linux Setup Guide](docs/linux-setup.rst) + +# Finding A Project + +As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in the setup guide, esp-idf comes with some example projects in the [examples](examples) directory. + +Once you've found the project you want to work with, change to its directory and you can configure and build it: # Configuring your project @@ -52,8 +64,10 @@ For more details about partition tables and how to create custom variations, vie # Resources -* The [docs directory of the esp-idf repository](https://github.com/espressif/esp-idf/tree/master/docs) contains esp-idf documentation. +* The [docs directory of the esp-idf repository](docs) contains esp-idf documentation. * The [esp32.com forum](http://esp32.com/) is a place to ask questions and find community resources. * [Check the Issues section on github](https://github.com/espressif/esp-idf/issues) if you find a bug or have a feature request. Please check existing Issues before opening a new one. + +* If you're interested in contributing to esp-idf, please check the [CONTRIBUTING.md](CONTRIBUTING.md) file. diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000000..2cf66b9d07 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,35 @@ +# Examples + +This directory contains a growing number of simple example projects for esp-idf. These are intended to show basic esp-idf functionality, and to provide you can use for your own projects. + +# Using Examples + +Building examples is the same as building any other project: + +* Follow the setup instructions in the top-level esp-idf README. + +* Set `IDF_PATH` environment variable to point to the path to the esp-idf top-level directory. +* Change into the directory of the example you'd like to build. +* `make menuconfig` to configure the example. Most examples require a simple WiFi SSID & password via this configuration. +* `make` to build the example. +* Follow the printed instructions to flash, or run `make flash`. + +# Copying Examples + +Each example is a standalone project. The examples *do not have to be inside the esp-idf directory*. You can copy an example directory to anywhere on your computer in order to make a copy that you can modify and work with. + +The `IDF_PATH` environment variable is the only thing that connects the example to the rest of the `esp-idf` system. + +If you're looking for a more bare-bones project to start from, try [esp-idf-template](https://github.com/espressif/esp-idf-template). + +# Contributing Examples + +If you have a new example you think we'd like, please consider sending it to us as a Pull Request. + +Please read the esp-idf CONTRIBUTING.md file which lays out general contribution rules. + +In addition, here are some tips for creating good examples: + +* A good example is documented and the basic options can be configured. +* A good example does not contain a lot of code. If there is a lot of generic code in the example, consider refactoring that code into a standalone component and then use the component's API in your example. +* Examples must be licensed under the Apache License 2.0 or (preferably for examples) if possible you can declare the example to be Public Domain / Creative Commons Zero. From 7058b01983add1a2375e07c4db5c694090ef78bc Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 26 Sep 2016 15:59:39 +1000 Subject: [PATCH 099/179] BT: Relink component on new BT library, auto-initialise submodule if missing --- components/bt/component.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/bt/component.mk b/components/bt/component.mk index 8290f9f4a4..a9233cc74a 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -16,8 +16,10 @@ COMPONENT_ADD_LDFLAGS := -lbt -L$(abspath lib) \ $(addprefix -l,$(LIBS)) \ $(LINKER_SCRIPTS) +include $(IDF_PATH)/make/component_common.mk ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) -include $(IDF_PATH)/make/component_common.mk +# automatically trigger a git submodule update if BT library is missing +$(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) From db183e653c9b54875c1205a2d9f69cfbf0fe4059 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 26 Sep 2016 16:00:00 +1000 Subject: [PATCH 100/179] BT example: Enable BT stack in config by default --- examples/04_ble_adv/Makefile | 6 ++++++ examples/04_ble_adv/sdkconfig.defaults | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 examples/04_ble_adv/sdkconfig.defaults diff --git a/examples/04_ble_adv/Makefile b/examples/04_ble_adv/Makefile index cea72c6f02..9f91869a8b 100644 --- a/examples/04_ble_adv/Makefile +++ b/examples/04_ble_adv/Makefile @@ -7,3 +7,9 @@ PROJECT_NAME := ble_adv include $(IDF_PATH)/make/project.mk +# Copy some defaults into the sdkconfig by default +# so BT stack is enabled +sdkconfig: sdkconfig.defaults + $(Q) cp $< $@ + +menuconfig: sdkconfig diff --git a/examples/04_ble_adv/sdkconfig.defaults b/examples/04_ble_adv/sdkconfig.defaults new file mode 100644 index 0000000000..e435f383c8 --- /dev/null +++ b/examples/04_ble_adv/sdkconfig.defaults @@ -0,0 +1,14 @@ +# Override some defaults so BT stack is enabled +# in this example + +# +# BT config +# +CONFIG_BT_ENABLED=y + +# +# ESP32-specific config +# +CONFIG_ESP32_ENABLE_STACK_BT=y +# CONFIG_ESP32_ENABLE_STACK_NONE is not set +CONFIG_MEMMAP_BT=y From 8016e862e0e81c91b1c2de80bcbb7ecfab37af2d Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 26 Sep 2016 15:48:36 +1000 Subject: [PATCH 101/179] Examples: Use event groups for waiting until WiFi is associated & ESP has IP --- .../02_http_request/main/http_request_main.c | 31 ++++++++---- .../main/https_request_main.c | 48 +++++++++++-------- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/examples/02_http_request/main/http_request_main.c b/examples/02_http_request/main/http_request_main.c index 8360c9e51e..6096cb4c3a 100644 --- a/examples/02_http_request/main/http_request_main.c +++ b/examples/02_http_request/main/http_request_main.c @@ -9,6 +9,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "freertos/event_groups.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" @@ -28,8 +29,13 @@ #define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID #define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD -/* Flag for when we are connected & ready to make a request */ -static volatile bool ready; +/* FreeRTOS event group to signal when we are connected & ready to make a request */ +static EventGroupHandle_t wifi_event_group; + +/* The event group allows multiple bits for each event, + but we only care about one event - are we connected + to the AP with an IP? */ +const int CONNECTED_BIT = BIT0; /* Constants that aren't configurable in menuconfig */ #define WEB_SERVER "example.com" @@ -46,11 +52,17 @@ static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) { switch(event->event_id) { + case SYSTEM_EVENT_STA_START: + esp_wifi_connect(); + break; case SYSTEM_EVENT_STA_GOT_IP: - ready = true; + xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; case SYSTEM_EVENT_STA_DISCONNECTED: - ready = false; + /* This is a workaround as ESP32 WiFi libs don't currently + auto-reassociate. */ + esp_wifi_connect(); + xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); break; default: break; @@ -83,11 +95,11 @@ static void http_get_task(void *pvParameters) char recv_buf[64]; while(1) { - esp_wifi_connect(); - /* Wait for the event callback to tell us we are connected */ - while (!ready) { - vTaskDelay(1); - } + /* Wait for the callback to set the CONNECTED_BIT in the + event group. + */ + xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, + false, true, portMAX_DELAY); ESP_LOGI(TAG, "Connected to AP"); int err = getaddrinfo(WEB_SERVER, "80", &hints, &res); @@ -153,6 +165,7 @@ static void http_get_task(void *pvParameters) void app_main() { + wifi_event_group = xEventGroupCreate(); esp_event_set_cb(wifi_event_cb, NULL); set_wifi_configuration(); xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL); diff --git a/examples/03_https_request/main/https_request_main.c b/examples/03_https_request/main/https_request_main.c index 852cde898f..e816e4e363 100644 --- a/examples/03_https_request/main/https_request_main.c +++ b/examples/03_https_request/main/https_request_main.c @@ -24,6 +24,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "freertos/event_groups.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" @@ -52,8 +53,13 @@ #define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID #define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD -/* Flag for when we are connected & ready to make a request */ -static volatile bool ready; +/* FreeRTOS event group to signal when we are connected & ready to make a request */ +static EventGroupHandle_t wifi_event_group; + +/* The event group allows multiple bits for each event, + but we only care about one event - are we connected + to the AP with an IP? */ +const int CONNECTED_BIT = BIT0; /* Constants that aren't configurable in menuconfig */ #define WEB_SERVER "www.howsmyssl.com" @@ -78,7 +84,7 @@ extern const char *server_root_cert; to ESP_LOGx debug output. MBEDTLS_DEBUG_LEVEL 4 means all mbedTLS debug output gets sent here, - and then filtered to the + and then filtered to the ESP logging mechanism. */ static void mbedtls_debug(void *ctx, int level, const char *file, int line, @@ -117,11 +123,17 @@ static void mbedtls_debug(void *ctx, int level, static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) { switch(event->event_id) { + case SYSTEM_EVENT_STA_START: + esp_wifi_connect(); + break; case SYSTEM_EVENT_STA_GOT_IP: - ready = true; + xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; case SYSTEM_EVENT_STA_DISCONNECTED: - ready = false; + /* This is a workaround as ESP32 WiFi libs don't currently + auto-reassociate. */ + esp_wifi_connect(); + xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); break; default: break; @@ -154,8 +166,6 @@ static void https_get_task(void *pvParameters) mbedtls_ssl_config conf; mbedtls_net_context server_fd; - esp_wifi_connect(); - mbedtls_ssl_init(&ssl); mbedtls_x509_crt_init(&cacert); mbedtls_ctr_drbg_init(&ctr_drbg); @@ -213,29 +223,24 @@ static void https_get_task(void *pvParameters) mbedtls_ssl_conf_dbg(&conf, mbedtls_debug, NULL); #endif - ESP_LOGI(TAG, "%d free...", system_get_free_heap_size()); - - char *x = malloc(8192); - memset(x, 'a', 8192); - - ESP_LOGI(TAG, "%d free now...", system_get_free_heap_size()); - if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { ESP_LOGE(TAG, "mbedtls_ssl_setup returned -0x%x\n\n", -ret); goto exit; } - ESP_LOGI(TAG, "Waiting for WiFi online..."); - while (!ready) { - vTaskDelay(1); - } - ESP_LOGI(TAG, "WiFi is online"); - while(1) { - ESP_LOGI(TAG, "Connecting to %s:%s...", WEB_SERVER, WEB_PORT); + /* Wait for the callback to set the CONNECTED_BIT in the + event group. + */ + xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, + false, true, portMAX_DELAY); + ESP_LOGI(TAG, "Connected to AP"); + mbedtls_net_init(&server_fd); + ESP_LOGI(TAG, "Connecting to %s:%s...", WEB_SERVER, WEB_PORT); + if ((ret = mbedtls_net_connect(&server_fd, WEB_SERVER, WEB_PORT, MBEDTLS_NET_PROTO_TCP)) != 0) { @@ -343,6 +348,7 @@ static void https_get_task(void *pvParameters) void app_main() { + wifi_event_group = xEventGroupCreate(); esp_event_set_cb(wifi_event_cb, NULL); set_wifi_configuration(); xTaskCreate(&https_get_task, "https_get_task", 8192, NULL, 5, NULL); From de7654622792724be7f34bb45bef946f77a4be7a Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 26 Sep 2016 17:13:32 +1000 Subject: [PATCH 102/179] Build examples out-of-tree as part of CI process --- .gitlab-ci.yml | 17 +++++++++++++++++ examples/04_ble_adv/Makefile | 1 + make/build_examples.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100755 make/build_examples.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42f24cd033..6d788a65ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,6 +69,23 @@ build_ssc: - chmod +x gen_misc_ng.sh - ./gen_misc_ng.sh +build_examples: + <<: *build_template + artifacts: + paths: + - build_examples/*/*/build/*.bin + - build_examples/*/*/build/*.elf + - build_examples/*/*/build/*.map + - build_examples/*/*/build/bootloader/*.bin + expire_in: 6 mos + + script: + # it's not possible to build 100% out-of-tree and have the "artifacts" + # mechanism work, but this is the next best thing + - mkdir build_examples + - cd build_examples + - ${IDF_PATH}/make/build_examples.sh + test_nvs_on_host: stage: test image: espressif/esp32-ci-env diff --git a/examples/04_ble_adv/Makefile b/examples/04_ble_adv/Makefile index 9f91869a8b..3a913b817b 100644 --- a/examples/04_ble_adv/Makefile +++ b/examples/04_ble_adv/Makefile @@ -13,3 +13,4 @@ sdkconfig: sdkconfig.defaults $(Q) cp $< $@ menuconfig: sdkconfig +defconfig: sdkconfig diff --git a/make/build_examples.sh b/make/build_examples.sh new file mode 100755 index 0000000000..d264862874 --- /dev/null +++ b/make/build_examples.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Build all examples from the examples directory, out of tree to +# ensure they can run when copied to a new directory. +# +# Runs as part of CI process. +# +# Assumes CWD is an out-of-tree build directory, and will copy examples to individual subdirectories, one by one. +# +[ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1 + +EXAMPLE_NUM=1 +RESULT=0 + +set -e + +for example in ${IDF_PATH}/examples/*; do + [ -f ${example}/Makefile ] || continue + echo "Building ${example} as ${EXAMPLE_NUM}..." + mkdir ${EXAMPLE_NUM} + cp -r ${example} ${EXAMPLE_NUM} + pushd ${EXAMPLE_NUM}/`basename ${example}` + # can't do "make defconfig all" as this will trip menuconfig + # sometimes + make defconfig && make || RESULT=$? + popd + EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) +done + +exit $RESULT + From 6850751ee808acb9d2620259a4519b3d0dd501ba Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 27 Sep 2016 10:30:07 +1000 Subject: [PATCH 103/179] Add very simple "hello world" & "blink" examples --- examples/01_hello_world/Makefile | 9 ++++ examples/01_hello_world/README.md | 5 ++ .../main/component.mk | 0 .../01_hello_world/main/hello_world_main.c | 32 +++++++++++++ examples/02_blink/Makefile | 9 ++++ examples/02_blink/README.md | 5 ++ examples/02_blink/main/Kconfig.projbuild | 14 ++++++ examples/02_blink/main/blink.c | 48 +++++++++++++++++++ .../main/component.mk | 0 .../Makefile | 0 .../README.md | 0 .../main/Kconfig.projbuild | 0 .../main/component.mk | 0 .../main/http_request_main.c | 0 .../Makefile | 0 .../README.md | 0 .../main/Kconfig.projbuild | 0 .../main/cert.c | 0 examples/04_https_request/main/component.mk | 10 ++++ .../main/https_request_main.c | 0 examples/{04_ble_adv => 05_ble_adv}/Makefile | 0 .../{04_ble_adv => 05_ble_adv}/README.rst | 0 .../{04_ble_adv => 05_ble_adv}/main/app_bt.c | 0 examples/05_ble_adv/main/component.mk | 10 ++++ .../sdkconfig.defaults | 0 25 files changed, 142 insertions(+) create mode 100644 examples/01_hello_world/Makefile create mode 100644 examples/01_hello_world/README.md rename examples/{02_http_request => 01_hello_world}/main/component.mk (100%) create mode 100644 examples/01_hello_world/main/hello_world_main.c create mode 100644 examples/02_blink/Makefile create mode 100644 examples/02_blink/README.md create mode 100644 examples/02_blink/main/Kconfig.projbuild create mode 100644 examples/02_blink/main/blink.c rename examples/{03_https_request => 02_blink}/main/component.mk (100%) rename examples/{02_http_request => 03_http_request}/Makefile (100%) rename examples/{02_http_request => 03_http_request}/README.md (100%) rename examples/{02_http_request => 03_http_request}/main/Kconfig.projbuild (100%) rename examples/{04_ble_adv => 03_http_request}/main/component.mk (100%) rename examples/{02_http_request => 03_http_request}/main/http_request_main.c (100%) rename examples/{03_https_request => 04_https_request}/Makefile (100%) rename examples/{03_https_request => 04_https_request}/README.md (100%) rename examples/{03_https_request => 04_https_request}/main/Kconfig.projbuild (100%) rename examples/{03_https_request => 04_https_request}/main/cert.c (100%) create mode 100644 examples/04_https_request/main/component.mk rename examples/{03_https_request => 04_https_request}/main/https_request_main.c (100%) rename examples/{04_ble_adv => 05_ble_adv}/Makefile (100%) rename examples/{04_ble_adv => 05_ble_adv}/README.rst (100%) rename examples/{04_ble_adv => 05_ble_adv}/main/app_bt.c (100%) create mode 100644 examples/05_ble_adv/main/component.mk rename examples/{04_ble_adv => 05_ble_adv}/sdkconfig.defaults (100%) diff --git a/examples/01_hello_world/Makefile b/examples/01_hello_world/Makefile new file mode 100644 index 0000000000..0d1f5e687d --- /dev/null +++ b/examples/01_hello_world/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := hello-world + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/01_hello_world/README.md b/examples/01_hello_world/README.md new file mode 100644 index 0000000000..4fb3c40c13 --- /dev/null +++ b/examples/01_hello_world/README.md @@ -0,0 +1,5 @@ +# Hello World Example + +Starts a FreeRTOS task to print "Hello World" + +See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/examples/02_http_request/main/component.mk b/examples/01_hello_world/main/component.mk similarity index 100% rename from examples/02_http_request/main/component.mk rename to examples/01_hello_world/main/component.mk diff --git a/examples/01_hello_world/main/hello_world_main.c b/examples/01_hello_world/main/hello_world_main.c new file mode 100644 index 0000000000..73c048cbe8 --- /dev/null +++ b/examples/01_hello_world/main/hello_world_main.c @@ -0,0 +1,32 @@ +/* Hello World Example + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_system.h" +#include "nvs_flash.h" + +void hello_task(void *pvParameter) +{ + printf("Hello world!\n"); + for (int i = 10; i >= 0; i--) { + printf("Restarting in %d seconds...\n", i); + vTaskDelay(1000 / portTICK_RATE_MS); + } + printf("Restarting now.\n"); + fflush(stdout); + system_restart(); +} + +void app_main() +{ + nvs_flash_init(6, 3); + system_init(); + xTaskCreate(&hello_task, "hello_task", 2048, NULL, 5, NULL); +} diff --git a/examples/02_blink/Makefile b/examples/02_blink/Makefile new file mode 100644 index 0000000000..6f8b9fabe8 --- /dev/null +++ b/examples/02_blink/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := blink + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/02_blink/README.md b/examples/02_blink/README.md new file mode 100644 index 0000000000..10590f623e --- /dev/null +++ b/examples/02_blink/README.md @@ -0,0 +1,5 @@ +# Blink Example + +Starts a FreeRTOS task to blink an LED + +See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/examples/02_blink/main/Kconfig.projbuild b/examples/02_blink/main/Kconfig.projbuild new file mode 100644 index 0000000000..f44a3df7c3 --- /dev/null +++ b/examples/02_blink/main/Kconfig.projbuild @@ -0,0 +1,14 @@ +menu "Example Configuration" + +config BLINK_GPIO + int "Blink GPIO number" + range 0 34 + default 5 + help + GPIO number (IOxx) to blink on and off. + + Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. + + GPIOs 35-39 are input-only so cannot be used as outputs. + +endmenu diff --git a/examples/02_blink/main/blink.c b/examples/02_blink/main/blink.c new file mode 100644 index 0000000000..3f12d92671 --- /dev/null +++ b/examples/02_blink/main/blink.c @@ -0,0 +1,48 @@ +/* Blink Example + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_system.h" +#include "nvs_flash.h" +#include "driver/gpio.h" +#include "sdkconfig.h" + +/* Can run 'make menuconfig' to choose the GPIO to blink, + or you can edit the following line and set a number here. +*/ +#define BLINK_GPIO CONFIG_BLINK_GPIO + +void blink_task(void *pvParameter) +{ + /* Configure the IOMUX register for pad BLINK_GPIO (some pads are + muxed to GPIO on reset already, but some default to other + functions and need to be switched to GPIO. Consult the + Technical Reference for a list of pads and their default + functions.) + */ + gpio_pad_select_gpio(BLINK_GPIO); + /* Set the GPIO as a push/pull output */ + gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT); + while(1) { + /* Blink off (output low) */ + gpio_set_level(BLINK_GPIO, 0); + vTaskDelay(1000 / portTICK_RATE_MS); + /* Blink on (output high) */ + gpio_set_level(BLINK_GPIO, 1); + vTaskDelay(1000 / portTICK_RATE_MS); + } +} + +void app_main() +{ + nvs_flash_init(6, 3); + system_init(); + xTaskCreate(&blink_task, "blink_task", 512, NULL, 5, NULL); +} diff --git a/examples/03_https_request/main/component.mk b/examples/02_blink/main/component.mk similarity index 100% rename from examples/03_https_request/main/component.mk rename to examples/02_blink/main/component.mk diff --git a/examples/02_http_request/Makefile b/examples/03_http_request/Makefile similarity index 100% rename from examples/02_http_request/Makefile rename to examples/03_http_request/Makefile diff --git a/examples/02_http_request/README.md b/examples/03_http_request/README.md similarity index 100% rename from examples/02_http_request/README.md rename to examples/03_http_request/README.md diff --git a/examples/02_http_request/main/Kconfig.projbuild b/examples/03_http_request/main/Kconfig.projbuild similarity index 100% rename from examples/02_http_request/main/Kconfig.projbuild rename to examples/03_http_request/main/Kconfig.projbuild diff --git a/examples/04_ble_adv/main/component.mk b/examples/03_http_request/main/component.mk similarity index 100% rename from examples/04_ble_adv/main/component.mk rename to examples/03_http_request/main/component.mk diff --git a/examples/02_http_request/main/http_request_main.c b/examples/03_http_request/main/http_request_main.c similarity index 100% rename from examples/02_http_request/main/http_request_main.c rename to examples/03_http_request/main/http_request_main.c diff --git a/examples/03_https_request/Makefile b/examples/04_https_request/Makefile similarity index 100% rename from examples/03_https_request/Makefile rename to examples/04_https_request/Makefile diff --git a/examples/03_https_request/README.md b/examples/04_https_request/README.md similarity index 100% rename from examples/03_https_request/README.md rename to examples/04_https_request/README.md diff --git a/examples/03_https_request/main/Kconfig.projbuild b/examples/04_https_request/main/Kconfig.projbuild similarity index 100% rename from examples/03_https_request/main/Kconfig.projbuild rename to examples/04_https_request/main/Kconfig.projbuild diff --git a/examples/03_https_request/main/cert.c b/examples/04_https_request/main/cert.c similarity index 100% rename from examples/03_https_request/main/cert.c rename to examples/04_https_request/main/cert.c diff --git a/examples/04_https_request/main/component.mk b/examples/04_https_request/main/component.mk new file mode 100644 index 0000000000..24356f23ed --- /dev/null +++ b/examples/04_https_request/main/component.mk @@ -0,0 +1,10 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/03_https_request/main/https_request_main.c b/examples/04_https_request/main/https_request_main.c similarity index 100% rename from examples/03_https_request/main/https_request_main.c rename to examples/04_https_request/main/https_request_main.c diff --git a/examples/04_ble_adv/Makefile b/examples/05_ble_adv/Makefile similarity index 100% rename from examples/04_ble_adv/Makefile rename to examples/05_ble_adv/Makefile diff --git a/examples/04_ble_adv/README.rst b/examples/05_ble_adv/README.rst similarity index 100% rename from examples/04_ble_adv/README.rst rename to examples/05_ble_adv/README.rst diff --git a/examples/04_ble_adv/main/app_bt.c b/examples/05_ble_adv/main/app_bt.c similarity index 100% rename from examples/04_ble_adv/main/app_bt.c rename to examples/05_ble_adv/main/app_bt.c diff --git a/examples/05_ble_adv/main/component.mk b/examples/05_ble_adv/main/component.mk new file mode 100644 index 0000000000..24356f23ed --- /dev/null +++ b/examples/05_ble_adv/main/component.mk @@ -0,0 +1,10 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/04_ble_adv/sdkconfig.defaults b/examples/05_ble_adv/sdkconfig.defaults similarity index 100% rename from examples/04_ble_adv/sdkconfig.defaults rename to examples/05_ble_adv/sdkconfig.defaults From c3f418aa903b89d6819b05ab6f7e4917d585dd65 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 27 Sep 2016 11:16:40 +1000 Subject: [PATCH 104/179] Update http_request & https_request examples for new startup flow --- .../03_http_request/main/http_request_main.c | 25 +++++++++++++------ .../main/https_request_main.c | 24 ++++++++++++------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/examples/03_http_request/main/http_request_main.c b/examples/03_http_request/main/http_request_main.c index 6096cb4c3a..d26c13fe78 100644 --- a/examples/03_http_request/main/http_request_main.c +++ b/examples/03_http_request/main/http_request_main.c @@ -10,9 +10,11 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/event_groups.h" +#include "esp_system.h" #include "esp_wifi.h" -#include "esp_event.h" +#include "esp_event_loop.h" #include "esp_log.h" +#include "nvs_flash.h" #include "lwip/err.h" #include "lwip/sockets.h" @@ -49,7 +51,7 @@ static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" "User-Agent: esp-idf/1.0 esp32\n" "\n"; -static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) +static esp_err_t event_handler(void *ctx, system_event_t *event) { switch(event->event_id) { case SYSTEM_EVENT_STA_START: @@ -70,8 +72,14 @@ static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) return ESP_OK; } -static void set_wifi_configuration(void) +static void initialise_wifi(void) { + tcpip_adapter_init(); + wifi_event_group = xEventGroupCreate(); + ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(esp_event_loop_get_queue() ); + ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); + ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); wifi_config_t wifi_config = { .sta = { .ssid = EXAMPLE_WIFI_SSID, @@ -79,8 +87,9 @@ static void set_wifi_configuration(void) }, }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); - esp_wifi_set_mode(WIFI_MODE_STA); - esp_wifi_set_config(WIFI_IF_STA, &wifi_config); + ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_start() ); } static void http_get_task(void *pvParameters) @@ -165,8 +174,8 @@ static void http_get_task(void *pvParameters) void app_main() { - wifi_event_group = xEventGroupCreate(); - esp_event_set_cb(wifi_event_cb, NULL); - set_wifi_configuration(); + nvs_flash_init(6, 3); + system_init(); + initialise_wifi(); xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL); } diff --git a/examples/04_https_request/main/https_request_main.c b/examples/04_https_request/main/https_request_main.c index e816e4e363..a3151aee87 100644 --- a/examples/04_https_request/main/https_request_main.c +++ b/examples/04_https_request/main/https_request_main.c @@ -26,9 +26,10 @@ #include "freertos/task.h" #include "freertos/event_groups.h" #include "esp_wifi.h" -#include "esp_event.h" +#include "esp_event_loop.h" #include "esp_log.h" #include "esp_system.h" +#include "nvs_flash.h" #include "lwip/err.h" #include "lwip/sockets.h" @@ -120,7 +121,7 @@ static void mbedtls_debug(void *ctx, int level, #endif -static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) +static esp_err_t event_handler(void *ctx, system_event_t *event) { switch(event->event_id) { case SYSTEM_EVENT_STA_START: @@ -141,8 +142,14 @@ static esp_err_t wifi_event_cb(void *ctx, system_event_t *event) return ESP_OK; } -static void set_wifi_configuration(void) +static void initialise_wifi(void) { + tcpip_adapter_init(); + wifi_event_group = xEventGroupCreate(); + ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(esp_event_loop_get_queue() ); + ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); + ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); wifi_config_t wifi_config = { .sta = { .ssid = EXAMPLE_WIFI_SSID, @@ -150,8 +157,9 @@ static void set_wifi_configuration(void) }, }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); - esp_wifi_set_mode(WIFI_MODE_STA); - esp_wifi_set_config(WIFI_IF_STA, &wifi_config); + ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_start() ); } static void https_get_task(void *pvParameters) @@ -348,8 +356,8 @@ static void https_get_task(void *pvParameters) void app_main() { - wifi_event_group = xEventGroupCreate(); - esp_event_set_cb(wifi_event_cb, NULL); - set_wifi_configuration(); + nvs_flash_init(6, 3); + system_init(); + initialise_wifi(); xTaskCreate(&https_get_task, "https_get_task", 8192, NULL, 5, NULL); } From 12b09344c824fbe8013c2faabd464c83ae75a68f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 27 Sep 2016 12:03:08 +1000 Subject: [PATCH 105/179] Add contributor agreement, update CONTRIBUTING file --- CONTRIBUTING.md | 8 +- docs/contributor-agreement.rst | 196 +++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 docs/contributor-agreement.rst diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 824ec6ff31..b0af761d53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,13 +4,13 @@ We welcome contributions to the esp-idf project! ## How to Contribute -Contributions to esp-idf - fixing bugs, adding features, adding documentation - are welcome. We accept contributions via the [Github Pull Request](https://help.github.com/articles/about-pull-requests/) feature. +Contributions to esp-idf - fixing bugs, adding features, adding documentation - are welcome. We accept contributions via [Github Pull Requests](https://help.github.com/articles/about-pull-requests/). ## Before Contributing Before sending us a Pull Request, please consider this list of points: -* Is the contribution entirely your own work, or already licensed under an Apache License 2.0 compatible Open Source License? If not then we cannot accept it. +* Is the contribution entirely your own work, or already licensed under an Apache License 2.0 compatible Open Source License? If not then we unfortunately cannot accept it. * Does any new code conform to the esp-idf Style Guide? (Style Guide currently pending). @@ -20,7 +20,7 @@ Before sending us a Pull Request, please consider this list of points: * Are comments and documentation written in clear English, with no spelling or grammar errors? -* If the contribution contains multiple commits, are they grouped together into logical changes (one major change per pull request)? Are any commits with names like "fixed typo" squashed into previous commits? +* If the contribution contains multiple commits, are they grouped together into logical changes (one major change per pull request)? Are any commits with names like "fixed typo" [squashed into previous commits](http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit/)? * If you're unsure about any of these points, please open the Pull Request anyhow and then ask us for feedback. @@ -34,4 +34,4 @@ If this process passes, it will be merged onto the public github repository. ## Legal Part -Before a contribution is accepted, you will need to sign our Contributor Agreement. You will be prompted for this automatically as part of the Pull Request process. +Before a contribution can be accepted, you will need to sign our [Contributor Agreement](docs/contributor-agreement.rst). You will be prompted for this automatically as part of the Pull Request process. diff --git a/docs/contributor-agreement.rst b/docs/contributor-agreement.rst new file mode 100644 index 0000000000..7c194e7728 --- /dev/null +++ b/docs/contributor-agreement.rst @@ -0,0 +1,196 @@ +Contributor Agreement +--------------------- + +Individual Contributor Non-Exclusive License Agreement +------------------------------------------------------ + +including the Traditional Patent License OPTION +----------------------------------------------- + +Thank you for your interest in contributing to Espressif IoT Development +Framework (esp-idf) ("We" or "Us"). + +The purpose of this contributor agreement ("Agreement") is to clarify +and document the rights granted by contributors to Us. To make this +document effective, please follow the instructions at +https://github.com/espressif/esp-idf/blob/master/CONTRIBUTING.md. + +1. DEFINITIONS +~~~~~~~~~~~~~~ + +**"You"** means the Individual Copyright owner who submits a +Contribution to Us. If You are an employee and submit the Contribution +as part of your employment, You have had Your employer approve this +Agreement or sign the Entity version of this document. + +**"Contribution"** means any original work of authorship (software +and/or documentation) including any modifications or additions to an +existing work, Submitted by You to Us, in which You own the Copyright. +If You do not own the Copyright in the entire work of authorship, please +contact Us at angus@espressif.com. + +**"Copyright"** means all rights protecting works of authorship owned or +controlled by You, including copyright, moral and neighboring rights, as +appropriate, for the full term of their existence including any +extensions by You. + +**"Material"** means the software or documentation made available by Us +to third parties. When this Agreement covers more than one software +project, the Material means the software or documentation to which the +Contribution was Submitted. After You Submit the Contribution, it may be +included in the Material. + +**"Submit"** means any form of physical, electronic, or written +communication sent to Us, including but not limited to electronic +mailing lists, source code control systems, and issue tracking systems +that are managed by, or on behalf of, Us, but excluding communication +that is conspicuously marked or otherwise designated in writing by You +as "Not a Contribution." + +**"Submission Date"** means the date You Submit a Contribution to Us. + +**"Documentation"** means any non-software portion of a Contribution. + +2. LICENSE GRANT +~~~~~~~~~~~~~~~~ + +2.1 Copyright License to Us + +Subject to the terms and conditions of this Agreement, You hereby grant +to Us a worldwide, royalty-free, NON-exclusive, perpetual and +irrevocable license, with the right to transfer an unlimited number of +non-exclusive licenses or to grant sublicenses to third parties, under +the Copyright covering the Contribution to use the Contribution by all +means, including, but not limited to: + +- to publish the Contribution, +- to modify the Contribution, to prepare derivative works based upon or + containing the Contribution and to combine the Contribution with + other software code, +- to reproduce the Contribution in original or modified form, +- to distribute, to make the Contribution available to the public, + display and publicly perform the Contribution in original or modified + form. + +2.2 Moral Rights remain unaffected to the extent they are recognized and +not waivable by applicable law. Notwithstanding, You may add your name +in the header of the source code files of Your Contribution and We will +respect this attribution when using Your Contribution. + +3. PATENTS +~~~~~~~~~~ + +3.1 Patent License + +Subject to the terms and conditions of this Agreement You hereby grant +to us a worldwide, royalty-free, non-exclusive, perpetual and +irrevocable (except as stated in Section 3.2) patent license, with the +right to transfer an unlimited number of non-exclusive licenses or to +grant sublicenses to third parties, to make, have made, use, sell, offer +for sale, import and otherwise transfer the Contribution and the +Contribution in combination with the Material (and portions of such +combination). This license applies to all patents owned or controlled by +You, whether already acquired or hereafter acquired, that would be +infringed by making, having made, using, selling, offering for sale, +importing or otherwise transferring of Your Contribution(s) alone or by +combination of Your Contribution(s) with the Material. + +3.2 Revocation of Patent License + +You reserve the right to revoke the patent license stated in section 3.1 +if we make any infringement claim that is targeted at your Contribution +and not asserted for a Defensive Purpose. An assertion of claims of the +Patents shall be considered for a "Defensive Purpose" if the claims are +asserted against an entity that has filed, maintained, threatened, or +voluntarily participated in a patent infringement lawsuit against Us or +any of Our licensees. + + +4. DISCLAIMER +~~~~~~~~~~~~~ + +THE CONTRIBUTION IS PROVIDED "AS IS". MORE PARTICULARLY, ALL EXPRESS OR +IMPLIED WARRANTIES INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US AND BY US TO YOU. +TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED, SUCH +WARRANTY IS LIMITED IN DURATION TO THE MINIMUM PERIOD PERMITTED BY LAW. + +5. Consequential Damage Waiver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL YOU +OR US BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF ANTICIPATED SAVINGS, +LOSS OF DATA, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL AND EXEMPLARY +DAMAGES ARISING OUT OF THIS AGREEMENT REGARDLESS OF THE LEGAL OR +EQUITABLE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS +BASED. + +6. Approximation of Disclaimer and Damage Waiver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +IF THE DISCLAIMER AND DAMAGE WAIVER MENTIONED IN SECTION 4 AND SECTION 5 +CANNOT BE GIVEN LEGAL EFFECT UNDER APPLICABLE LOCAL LAW, REVIEWING +COURTS SHALL APPLY LOCAL LAW THAT MOST CLOSELY APPROXIMATES AN ABSOLUTE +WAIVER OF ALL CIVIL LIABILITY IN CONNECTION WITH THE CONTRIBUTION. + +7. Term +~~~~~~~ + +7.1 This Agreement shall come into effect upon Your acceptance of the +terms and conditions. + +7.2 In the event of a termination of this Agreement Sections 4, 5, 6, 7 +and 8 shall survive such termination and shall remain in full force +thereafter. For the avoidance of doubt, Contributions that are already +licensed under a free and open source license at the date of the +termination shall remain in full force after the termination of this +Agreement. + +8. Miscellaneous +~~~~~~~~~~~~~~~~ + +8.1 This Agreement and all disputes, claims, actions, suits or other +proceedings arising out of this agreement or relating in any way to it +shall be governed by the laws of People's Republic of China excluding +its private international law provisions. + +8.2 This Agreement sets out the entire agreement between You and Us for +Your Contributions to Us and overrides all other agreements or +understandings. + +8.3 If any provision of this Agreement is found void and unenforceable, +such provision will be replaced to the extent possible with a provision +that comes closest to the meaning of the original provision and that is +enforceable. The terms and conditions set forth in this Agreement shall +apply notwithstanding any failure of essential purpose of this Agreement +or any limited remedy to the maximum extent possible under law. + +8.4 You agree to notify Us of any facts or circumstances of which you +become aware that would make this Agreement inaccurate in any respect. + +.. rubric:: You + :name: you + ++------------+----+ +| Date: | | ++------------+----+ +| Name: | | ++------------+----+ +| Title: | | ++------------+----+ +| Address: | | ++------------+----+ + +.. rubric:: Us + :name: us + ++------------+----+ +| Date: | | ++------------+----+ +| Name: | | ++------------+----+ +| Title: | | ++------------+----+ +| Address: | | ++------------+----+ From a98ab8d80186f61abc2c79c185f2f6b3d7255baa Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 27 Sep 2016 12:45:06 +1000 Subject: [PATCH 106/179] nvs: Remove flash layout arguments from nvs_init() Add notes that current NVS layout defaults are a Work In Progress and not yet integrated with the partition table. --- components/nvs_flash/include/nvs_flash.h | 19 ++++++++++++++++++- components/nvs_flash/src/nvs_api.cpp | 8 +++++++- components/nvs_flash/test/test_nvs.cpp | 14 +++++++------- docs/partition-tables.rst | 10 ++++++++++ .../01_hello_world/main/hello_world_main.c | 2 +- examples/02_blink/main/blink.c | 2 +- .../03_http_request/main/http_request_main.c | 2 +- .../main/https_request_main.c | 2 +- 8 files changed, 46 insertions(+), 13 deletions(-) diff --git a/components/nvs_flash/include/nvs_flash.h b/components/nvs_flash/include/nvs_flash.h index 5d9dc7359b..ce98f39407 100644 --- a/components/nvs_flash/include/nvs_flash.h +++ b/components/nvs_flash/include/nvs_flash.h @@ -18,7 +18,24 @@ extern "C" { #endif -esp_err_t nvs_flash_init(uint32_t baseSector, uint32_t sectorCount); +/** Initialise NVS flash storage with default flash sector layout + + Temporarily, this region is hardcoded as a 12KB (0x3000 byte) + region starting at 24KB (0x6000 byte) offset in flash. +*/ +esp_err_t nvs_flash_init(void); + +/** Initialise NVS flash storage with custom flash sector layout + + @param baseSector Flash sector (units of 4096 bytes) offset to start NVS. + @param sectorCount Length (in flash sectors) of NVS region. + + @return ESP_OK if flash was successfully initialised. + + @note Use this parameter if you're not using the options in menuconfig for + configuring flash layout & partition table. +*/ +esp_err_t nvs_flash_init_custom(uint32_t baseSector, uint32_t sectorCount); #ifdef __cplusplus diff --git a/components/nvs_flash/src/nvs_api.cpp b/components/nvs_flash/src/nvs_api.cpp index 00a279d2b5..0a56925c0c 100644 --- a/components/nvs_flash/src/nvs_api.cpp +++ b/components/nvs_flash/src/nvs_api.cpp @@ -16,6 +16,7 @@ #include "nvs_storage.hpp" #include "intrusive_list.h" #include "nvs_platform.hpp" +#include "sdkconfig.h" #ifdef ESP_PLATFORM // Uncomment this line to force output from this module @@ -60,7 +61,12 @@ extern "C" void nvs_dump() s_nvs_storage.debugDump(); } -extern "C" esp_err_t nvs_flash_init(uint32_t baseSector, uint32_t sectorCount) +extern "C" esp_err_t nvs_flash_init(void) +{ + return nvs_flash_init_custom(6, 3); +} + +extern "C" esp_err_t nvs_flash_init_custom(uint32_t baseSector, uint32_t sectorCount) { Lock::init(); Lock lock; diff --git a/components/nvs_flash/test/test_nvs.cpp b/components/nvs_flash/test/test_nvs.cpp index 540d977b4c..3db9b45aeb 100644 --- a/components/nvs_flash/test/test_nvs.cpp +++ b/components/nvs_flash/test/test_nvs.cpp @@ -425,7 +425,7 @@ TEST_CASE("nvs api tests", "[nvs]") for (uint16_t i = NVS_FLASH_SECTOR; i Date: Tue, 27 Sep 2016 11:33:19 +0800 Subject: [PATCH 107/179] wifi: use default esp_event_send handler in WIFI_INIT_CONFIG_DEFAULT --- components/esp32/include/esp_wifi.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 463d1281a7..a6ad8dd30a 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -61,8 +61,9 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/queue.h" -#include "esp_err.h" #include "rom/queue.h" +#include "esp_err.h" +#include "esp_event.h" #ifdef __cplusplus extern "C" { @@ -144,8 +145,8 @@ typedef struct { } wifi_init_config_t; -#define WIFI_INIT_CONFIG_DEFAULT(event_handler_) { \ - .event_handler = (wifi_event_handler_t)event_handler_, \ +#define WIFI_INIT_CONFIG_DEFAULT() { \ + .event_handler = &esp_event_send, \ }; /** From fc53bb6ed5c72120ee967c4dc088f82cbef6371f Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Tue, 27 Sep 2016 11:36:30 +0800 Subject: [PATCH 108/179] Add UNTESTED_FUNCTION() call to untested functions, make Kconfig option to enable that to map to assert() --- components/freertos/Kconfig | 8 ++++++ components/freertos/croutine.c | 1 + .../include/freertos/FreeRTOSConfig.h | 8 ++++++ components/freertos/queue.c | 6 +++-- components/freertos/tasks.c | 27 +++++++++++++------ 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index d7c306c246..af7142bb1f 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -44,6 +44,14 @@ config FREERTOS_HZ help Select the tick rate at which FreeRTOS does pre-emptive context switching. +config FREERTOS_ASSERT_ON_UNTESTED_FUNCTION + bool "Halt when an SMP-untested function is called" + default y + help + Some functions in FreeRTOS have not been thoroughly tested yet when moving to + the SMP implementation of FreeRTOS. When this option is enabled, these fuctions + will throw an assert(). + choice FREERTOS_CHECK_STACKOVERFLOW prompt "Check for stack overflow" default FREERTOS_CHECK_STACKOVERFLOW_QUICK diff --git a/components/freertos/croutine.c b/components/freertos/croutine.c index 6a36da9033..cd596ad45c 100644 --- a/components/freertos/croutine.c +++ b/components/freertos/croutine.c @@ -143,6 +143,7 @@ BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPri BaseType_t xReturn; CRCB_t *pxCoRoutine; + UNTESTED_FUNCTION(); //Actually, coroutines are entirely unsupported /* Allocate the memory that will store the co-routine control block. */ pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) ); if( pxCoRoutine ) diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 089d799dda..466c6404c7 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -263,5 +263,13 @@ #define configXT_SIMULATOR 0 +#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION +#include "rom/ets_sys.h" +#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0) +#else +#define UNTESTED_FUNCTION() +#endif + + #endif /* FREERTOS_CONFIG_H */ diff --git a/components/freertos/queue.c b/components/freertos/queue.c index 1fb0552d49..bf4866569b 100644 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@ -888,7 +888,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; configASSERT( pxQueue ); configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); - ets_printf("Not Supported: %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); for( ;; ) { taskENTER_CRITICAL(); @@ -1902,6 +1902,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; BaseType_t xReturn; Queue_t * const pxQueue = ( Queue_t * ) xQueue; + UNTESTED_FUNCTION(); /* If the queue is already full we may have to block. A critical section is required to prevent an interrupt removing something from the queue between the check to see if the queue is full and blocking on the queue. */ @@ -2175,7 +2176,8 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { UBaseType_t ux; - + + UNTESTED_FUNCTION(); /* See if there is an empty space in the registry. A NULL name denotes a free slot. */ for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index b9035bda0f..806a047f41 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -129,6 +129,9 @@ functions but without including stdio.h here. */ } while(0) #endif + + + /* Value that can be assigned to the eNotifyState member of the TCB. */ typedef enum { @@ -584,7 +587,6 @@ BaseType_t xReturn; TCB_t * pxNewTCB; StackType_t *pxTopOfStack; BaseType_t i; - configASSERT( pxTaskCode ); configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) ); configASSERT( (xCoreID>=0 && xCoreID 0U ) ); configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 ); @@ -1029,7 +1031,7 @@ BaseType_t i; List_t *pxStateList; const TCB_t * const pxTCB = ( TCB_t * ) xTask; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); configASSERT( pxTCB ); if( pxTCB == pxCurrentTCB[ xPortGetCoreID() ] ) @@ -1099,7 +1101,7 @@ BaseType_t i; TCB_t *pxTCB; UBaseType_t uxReturn; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); taskENTER_CRITICAL(&xTaskQueueMutex); { /* If null is passed in here then we are changing the @@ -1307,7 +1309,7 @@ BaseType_t i; { TCB_t *pxTCB; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); taskENTER_CRITICAL(&xTaskQueueMutex); { /* If null is passed in here then it is the running task that is @@ -1448,7 +1450,7 @@ BaseType_t i; { TCB_t * const pxTCB = ( TCB_t * ) xTaskToResume; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); /* It does not make sense to resume the calling task. */ configASSERT( xTaskToResume ); @@ -1850,7 +1852,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) { UBaseType_t uxTask = 0, uxQueue = configMAX_PRIORITIES; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); vTaskSuspendAll(); //WARNING: This only suspends one CPU. ToDo: suspend others as well. Mux using taskQueueMutex maybe? { /* Is there a space in the array for each task in the system? */ @@ -3136,7 +3138,7 @@ UBaseType_t x; { TCB_t *pxTCB; - ets_printf("ToDo %s\n", __FUNCTION__); + UNTESTED_FUNCTION(); /* If null is passed in here then we are deleting ourselves. */ pxTCB = prvGetTCBFromHandle( xTaskToModify ); @@ -3344,6 +3346,7 @@ TCB_t *pxNewTCB; volatile TCB_t *pxNextTCB, *pxFirstTCB; UBaseType_t uxTask = 0; + UNTESTED_FUNCTION(); if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 ) { listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); @@ -3450,6 +3453,7 @@ TCB_t *pxNewTCB; uint8_t *pucEndOfStack; UBaseType_t uxReturn; + UNTESTED_FUNCTION(); pxTCB = prvGetTCBFromHandle( xTask ); #if portSTACK_GROWTH < 0 @@ -3881,6 +3885,7 @@ scheduler will re-enable the interrupts instead. */ TaskStatus_t *pxTaskStatusArray; volatile UBaseType_t uxArraySize, x; char cStatus; + UNTESTED_FUNCTION(); /* * PLEASE NOTE: @@ -3974,6 +3979,7 @@ scheduler will re-enable the interrupts instead. */ volatile UBaseType_t uxArraySize, x; uint32_t ulTotalTime, ulStatsAsPercentage; + UNTESTED_FUNCTION(); #if( configUSE_TRACE_FACILITY != 1 ) { #error configUSE_TRACE_FACILITY must also be set to 1 in FreeRTOSConfig.h to use vTaskGetRunTimeStats(). @@ -4131,6 +4137,7 @@ TickType_t uxReturn; TickType_t xTimeToWake; uint32_t ulReturn; + UNTESTED_FUNCTION(); taskENTER_CRITICAL(&xTaskQueueMutex); { /* Only block if the notification count is not already non-zero. */ @@ -4241,6 +4248,7 @@ TickType_t uxReturn; TickType_t xTimeToWake; BaseType_t xReturn; + UNTESTED_FUNCTION(); taskENTER_CRITICAL(&xTaskQueueMutex); { /* Only block if a notification is not already pending. */ @@ -4363,6 +4371,7 @@ TickType_t uxReturn; eNotifyValue eOriginalNotifyState; BaseType_t xReturn = pdPASS; + UNTESTED_FUNCTION(); configASSERT( xTaskToNotify ); pxTCB = ( TCB_t * ) xTaskToNotify; @@ -4447,6 +4456,7 @@ TickType_t uxReturn; eNotifyValue eOriginalNotifyState; BaseType_t xReturn = pdPASS; + UNTESTED_FUNCTION(); configASSERT( xTaskToNotify ); pxTCB = ( TCB_t * ) xTaskToNotify; @@ -4540,6 +4550,7 @@ TickType_t uxReturn; TCB_t * pxTCB; eNotifyValue eOriginalNotifyState; + UNTESTED_FUNCTION(); configASSERT( xTaskToNotify ); From 952df01a10d2d755bc304bed0a9f50c85901a6cb Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 27 Sep 2016 11:47:47 +0800 Subject: [PATCH 109/179] wifi: move type definitions into separate header file While this may reduce esp_wifi.h file readability for people who don't have a "go to definition" function in their editors, this is needed to decouple esp_wifi and esp_event headers, and possibly other headers which may use wifi types in the future. --- components/esp32/include/esp_event.h | 5 +- components/esp32/include/esp_wifi.h | 160 +-------------- components/esp32/include/esp_wifi_types.h | 190 ++++++++++++++++++ .../tcpip_adapter/include/tcpip_adapter.h | 2 +- 4 files changed, 196 insertions(+), 161 deletions(-) create mode 100644 components/esp32/include/esp_wifi_types.h diff --git a/components/esp32/include/esp_event.h b/components/esp32/include/esp_event.h index 86afab2c40..0ca4ca90ba 100644 --- a/components/esp32/include/esp_event.h +++ b/components/esp32/include/esp_event.h @@ -19,8 +19,7 @@ #include #include "esp_err.h" -#include "esp_wifi.h" - +#include "esp_wifi_types.h" #include "tcpip_adapter.h" #ifdef __cplusplus @@ -105,6 +104,8 @@ typedef struct { system_event_info_t event_info; /**< event information */ } system_event_t; +typedef esp_err_t (*system_event_handler_t)(system_event_t *event); + /** * @brief Send a event to event task * diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index a6ad8dd30a..12378f3346 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -63,85 +63,15 @@ #include "freertos/queue.h" #include "rom/queue.h" #include "esp_err.h" +#include "esp_wifi_types.h" #include "esp_event.h" #ifdef __cplusplus extern "C" { #endif -typedef enum { - WIFI_MODE_NULL = 0, /**< null mode */ - WIFI_MODE_STA, /**< WiFi station mode */ - WIFI_MODE_AP, /**< WiFi soft-AP mode */ - WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */ - WIFI_MODE_MAX -} wifi_mode_t; - -typedef enum { - WIFI_IF_STA = 0, /**< ESP32 station interface */ - WIFI_IF_AP, /**< ESP32 soft-AP interface */ - WIFI_IF_MAX -} wifi_interface_t; - -typedef enum { - WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */ - WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */ - WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */ - WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */ - WIFI_COUNTRY_MAX -} wifi_country_t; - -typedef enum { - WIFI_AUTH_OPEN = 0, /**< authenticate mode : open */ - WIFI_AUTH_WEP, /**< authenticate mode : WEP */ - WIFI_AUTH_WPA_PSK, /**< authenticate mode : WPA_PSK */ - WIFI_AUTH_WPA2_PSK, /**< authenticate mode : WPA2_PSK */ - WIFI_AUTH_WPA_WPA2_PSK, /**< authenticate mode : WPA_WPA2_PSK */ - WIFI_AUTH_MAX -} wifi_auth_mode_t; - -enum { - WIFI_REASON_UNSPECIFIED = 1, - WIFI_REASON_AUTH_EXPIRE = 2, - WIFI_REASON_AUTH_LEAVE = 3, - WIFI_REASON_ASSOC_EXPIRE = 4, - WIFI_REASON_ASSOC_TOOMANY = 5, - WIFI_REASON_NOT_AUTHED = 6, - WIFI_REASON_NOT_ASSOCED = 7, - WIFI_REASON_ASSOC_LEAVE = 8, - WIFI_REASON_ASSOC_NOT_AUTHED = 9, - WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, - WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, - WIFI_REASON_IE_INVALID = 13, - WIFI_REASON_MIC_FAILURE = 14, - WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, - WIFI_REASON_IE_IN_4WAY_DIFFERS = 17, - WIFI_REASON_GROUP_CIPHER_INVALID = 18, - WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19, - WIFI_REASON_AKMP_INVALID = 20, - WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21, - WIFI_REASON_INVALID_RSN_IE_CAP = 22, - WIFI_REASON_802_1X_AUTH_FAILED = 23, - WIFI_REASON_CIPHER_SUITE_REJECTED = 24, - - WIFI_REASON_BEACON_TIMEOUT = 200, - WIFI_REASON_NO_AP_FOUND = 201, - WIFI_REASON_AUTH_FAIL = 202, - WIFI_REASON_ASSOC_FAIL = 203, - WIFI_REASON_HANDSHAKE_TIMEOUT = 204, -}; - -typedef enum { - WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */ - WIFI_SECOND_CHAN_ABOVE, /**< the channel width is HT40 and the second channel is above the primary channel */ - WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ -} wifi_second_chan_t; - - -typedef esp_err_t (*wifi_event_handler_t)(void *event); typedef struct { - wifi_event_handler_t event_handler; /**< WiFi event handler */ + system_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; @@ -270,13 +200,6 @@ esp_err_t esp_wifi_clear_fast_connect(void); */ esp_err_t esp_wifi_kick_station(uint16_t aid); -typedef struct { - char *ssid; /**< SSID of AP */ - uint8_t *bssid; /**< MAC address of AP */ - uint8_t channel; /**< channel, scan the specific channel */ - bool show_hidden; /**< enable to scan AP whose SSID is hidden */ -} wifi_scan_config_t; - /** * @brief Scan all available APs. * @@ -314,15 +237,6 @@ esp_err_t esp_wifi_scan_stop(void); */ esp_err_t esp_wifi_get_ap_num(uint16_t *number); -typedef struct { - uint8_t bssid[6]; /**< MAC address of AP */ - uint8_t ssid[32]; /**< SSID of AP */ - uint8_t primary; /**< channel of AP */ - wifi_second_chan_t second; /**< second channel of AP */ - int8_t rssi; /**< signal strength of AP */ - wifi_auth_mode_t authmode; /**< authmode of AP */ -} wifi_ap_list_t; - /** * @brief Get AP list found in last scan * @@ -335,13 +249,6 @@ typedef struct { */ esp_err_t esp_wifi_get_ap_list(uint16_t *number, wifi_ap_list_t *ap_list); -typedef enum { - WIFI_PS_NONE, /**< No power save */ - WIFI_PS_MODEM, /**< Modem power save */ - WIFI_PS_LIGHT, /**< Light power save */ - WIFI_PS_MAC, /**< MAC power save */ -} wifi_ps_type_t; - /** * @brief Set current power save type * @@ -362,10 +269,6 @@ esp_err_t esp_wifi_set_ps(wifi_ps_type_t type); */ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type); -#define WIFI_PROTOCOL_11B 1 -#define WIFI_PROTOCOL_11G 2 -#define WIFI_PROTOCOL_11N 4 - /** * @brief Set protocol type of specified interface * The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) @@ -391,11 +294,6 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); */ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -typedef enum { - WIFI_BW_HT20 = 0, /* Bandwidth is HT20 */ - WIFI_BW_HT40, /* Bandwidth is HT40 */ -} wifi_bandwidth_t; - /** * @brief Set the bandwidth of ESP32 specified interface * @@ -541,29 +439,6 @@ esp_err_t esp_wifi_set_promiscuous(bool en); */ esp_err_t esp_wifi_get_promiscuous(bool *en); -typedef struct { - char ssid[32]; /**< SSID of ESP32 soft-AP */ - char password[64]; /**< Password of ESP32 soft-AP */ - uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */ - uint8_t channel; /**< Channel of ESP32 soft-AP */ - wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ - uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ - uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ - uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ -} wifi_ap_config_t; - -typedef struct { - char ssid[32]; /**< SSID of target AP*/ - char password[64]; /**< password of target AP*/ - bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/ - uint8_t bssid[6]; /**< MAC address of target AP*/ -} wifi_sta_config_t; - -typedef union { - wifi_ap_config_t ap; /**< configuration of AP */ - wifi_sta_config_t sta; /**< configuration of STA */ -} wifi_config_t; - /** * @brief Set the configuration of the ESP32 STA or AP * @@ -591,11 +466,6 @@ esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf); */ esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf); -struct station_info { - STAILQ_ENTRY(station_info) next; - uint8_t bssid[6]; -}; - /** * @brief Get STAs associated with soft-AP * @@ -610,11 +480,6 @@ esp_err_t esp_wifi_get_station_list(struct station_info **station); esp_err_t esp_wifi_free_station_list(void); -typedef enum { - WIFI_STORAGE_FLASH, /**< all configuration will strore in both memory and flash */ - WIFI_STORAGE_RAM, /**< all configuration will only store in the memory */ -} wifi_storage_t; - /** * @brief Set the WiFi API configuration storage type * @@ -671,27 +536,6 @@ esp_err_t esp_wifi_set_auto_connect(bool en); */ esp_err_t esp_wifi_get_auto_connect(bool *en); -/** - * @brief Vendor IE type - * - */ -typedef enum { - WIFI_VND_IE_TYPE_BEACON, - WIFI_VND_IE_TYPE_PROBE_REQ, - WIFI_VND_IE_TYPE_PROBE_RESP, - WIFI_VND_IE_TYPE_ASSOC_REQ, - WIFI_VND_IE_TYPE_ASSOC_RESP, -} wifi_vendor_ie_type_t; - -/** - * @brief Vendor IE index - * - */ -typedef enum { - WIFI_VND_IE_ID_0, - WIFI_VND_IE_ID_1, -} wifi_vendor_ie_id_t; - /** * @brief Set vendor specific element * diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h new file mode 100644 index 0000000000..b3474769e8 --- /dev/null +++ b/components/esp32/include/esp_wifi_types.h @@ -0,0 +1,190 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __ESP_WIFI_TYPES_H__ +#define __ESP_WIFI_TYPES_H__ + +#include +#include +#include "rom/queue.h" +#include "esp_err.h" +#include "esp_wifi_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + WIFI_MODE_NULL = 0, /**< null mode */ + WIFI_MODE_STA, /**< WiFi station mode */ + WIFI_MODE_AP, /**< WiFi soft-AP mode */ + WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */ + WIFI_MODE_MAX +} wifi_mode_t; + +typedef enum { + WIFI_IF_STA = 0, /**< ESP32 station interface */ + WIFI_IF_AP, /**< ESP32 soft-AP interface */ + WIFI_IF_MAX +} wifi_interface_t; + +typedef enum { + WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */ + WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */ + WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */ + WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */ + WIFI_COUNTRY_MAX +} wifi_country_t; + +typedef enum { + WIFI_AUTH_OPEN = 0, /**< authenticate mode : open */ + WIFI_AUTH_WEP, /**< authenticate mode : WEP */ + WIFI_AUTH_WPA_PSK, /**< authenticate mode : WPA_PSK */ + WIFI_AUTH_WPA2_PSK, /**< authenticate mode : WPA2_PSK */ + WIFI_AUTH_WPA_WPA2_PSK, /**< authenticate mode : WPA_WPA2_PSK */ + WIFI_AUTH_MAX +} wifi_auth_mode_t; + +enum { + WIFI_REASON_UNSPECIFIED = 1, + WIFI_REASON_AUTH_EXPIRE = 2, + WIFI_REASON_AUTH_LEAVE = 3, + WIFI_REASON_ASSOC_EXPIRE = 4, + WIFI_REASON_ASSOC_TOOMANY = 5, + WIFI_REASON_NOT_AUTHED = 6, + WIFI_REASON_NOT_ASSOCED = 7, + WIFI_REASON_ASSOC_LEAVE = 8, + WIFI_REASON_ASSOC_NOT_AUTHED = 9, + WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, + WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, + WIFI_REASON_IE_INVALID = 13, + WIFI_REASON_MIC_FAILURE = 14, + WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, + WIFI_REASON_IE_IN_4WAY_DIFFERS = 17, + WIFI_REASON_GROUP_CIPHER_INVALID = 18, + WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19, + WIFI_REASON_AKMP_INVALID = 20, + WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21, + WIFI_REASON_INVALID_RSN_IE_CAP = 22, + WIFI_REASON_802_1X_AUTH_FAILED = 23, + WIFI_REASON_CIPHER_SUITE_REJECTED = 24, + + WIFI_REASON_BEACON_TIMEOUT = 200, + WIFI_REASON_NO_AP_FOUND = 201, + WIFI_REASON_AUTH_FAIL = 202, + WIFI_REASON_ASSOC_FAIL = 203, + WIFI_REASON_HANDSHAKE_TIMEOUT = 204, +}; + +typedef enum { + WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */ + WIFI_SECOND_CHAN_ABOVE, /**< the channel width is HT40 and the second channel is above the primary channel */ + WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ +} wifi_second_chan_t; + +typedef struct { + char *ssid; /**< SSID of AP */ + uint8_t *bssid; /**< MAC address of AP */ + uint8_t channel; /**< channel, scan the specific channel */ + bool show_hidden; /**< enable to scan AP whose SSID is hidden */ +} wifi_scan_config_t; + +typedef struct { + uint8_t bssid[6]; /**< MAC address of AP */ + uint8_t ssid[32]; /**< SSID of AP */ + uint8_t primary; /**< channel of AP */ + wifi_second_chan_t second; /**< second channel of AP */ + int8_t rssi; /**< signal strength of AP */ + wifi_auth_mode_t authmode; /**< authmode of AP */ +} wifi_ap_list_t; + +typedef enum { + WIFI_PS_NONE, /**< No power save */ + WIFI_PS_MODEM, /**< Modem power save */ + WIFI_PS_LIGHT, /**< Light power save */ + WIFI_PS_MAC, /**< MAC power save */ +} wifi_ps_type_t; + +#define WIFI_PROTOCOL_11B 1 +#define WIFI_PROTOCOL_11G 2 +#define WIFI_PROTOCOL_11N 4 + +typedef enum { + WIFI_BW_HT20 = 0, /* Bandwidth is HT20 */ + WIFI_BW_HT40, /* Bandwidth is HT40 */ +} wifi_bandwidth_t; + +typedef struct { + char ssid[32]; /**< SSID of ESP32 soft-AP */ + char password[64]; /**< Password of ESP32 soft-AP */ + uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */ + uint8_t channel; /**< Channel of ESP32 soft-AP */ + wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ + uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ + uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ + uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ +} wifi_ap_config_t; + +typedef struct { + char ssid[32]; /**< SSID of target AP*/ + char password[64]; /**< password of target AP*/ + bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/ + uint8_t bssid[6]; /**< MAC address of target AP*/ +} wifi_sta_config_t; + +typedef union { + wifi_ap_config_t ap; /**< configuration of AP */ + wifi_sta_config_t sta; /**< configuration of STA */ +} wifi_config_t; + +struct station_info { + STAILQ_ENTRY(station_info) next; + uint8_t bssid[6]; +}; + +typedef enum { + WIFI_STORAGE_FLASH, /**< all configuration will strore in both memory and flash */ + WIFI_STORAGE_RAM, /**< all configuration will only store in the memory */ +} wifi_storage_t; + +/** + * @brief Vendor IE type + * + */ +typedef enum { + WIFI_VND_IE_TYPE_BEACON, + WIFI_VND_IE_TYPE_PROBE_REQ, + WIFI_VND_IE_TYPE_PROBE_RESP, + WIFI_VND_IE_TYPE_ASSOC_REQ, + WIFI_VND_IE_TYPE_ASSOC_RESP, +} wifi_vendor_ie_type_t; + +/** + * @brief Vendor IE index + * + */ +typedef enum { + WIFI_VND_IE_ID_0, + WIFI_VND_IE_ID_1, +} wifi_vendor_ie_id_t; + + +#ifdef __cplusplus +} +#endif + + +#endif /* __ESP_WIFI_TYPES_H__ */ diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 51fb233d81..ae33892094 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -17,7 +17,7 @@ #include #include "rom/queue.h" -#include "esp_wifi.h" +#include "esp_wifi_types.h" #define CONFIG_TCPIP_LWIP 1 #define CONFIG_DHCP_STA_LIST 1 From 8db85d71b2cf112465396f0605d2d60794461b17 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Tue, 27 Sep 2016 11:50:46 +0800 Subject: [PATCH 110/179] Fix UNTESTED_FUNCTION includes, remove unnecessary mux initialization in event groups --- components/freertos/event_groups.c | 7 ------- .../freertos/include/freertos/FreeRTOSConfig.h | 16 ++++++++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/components/freertos/event_groups.c b/components/freertos/event_groups.c index 0eafab10a5..902a4ad72a 100644 --- a/components/freertos/event_groups.c +++ b/components/freertos/event_groups.c @@ -124,7 +124,6 @@ typedef struct xEventGroupDefinition /* Again: one mux for all events. Maybe this can be made more granular. ToDo: look into that. -JD */ static portMUX_TYPE xEventGroupMux = portMUX_INITIALIZER_UNLOCKED; -static BaseType_t xMuxInitialized = pdFALSE; /*-----------------------------------------------------------*/ @@ -145,12 +144,6 @@ EventGroupHandle_t xEventGroupCreate( void ) { EventGroup_t *pxEventBits; - //Initialize mux, if needed - if ( xMuxInitialized == pdFALSE ) { - vPortCPUInitializeMutex( & xEventGroupMux ); - xMuxInitialized = pdTRUE; - } - pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) ); if( pxEventBits != NULL ) { diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 466c6404c7..d1958e7701 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -124,6 +124,16 @@ abort(); \ } #endif + +#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION +#include +#include "rom/ets_sys.h" +#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0) +#else +#define UNTESTED_FUNCTION() +#endif + + #endif /* def __ASSEMBLER__ */ @@ -263,12 +273,6 @@ #define configXT_SIMULATOR 0 -#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION -#include "rom/ets_sys.h" -#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0) -#else -#define UNTESTED_FUNCTION() -#endif #endif /* FREERTOS_CONFIG_H */ From e6479ef3143ea5058098874181a13749e8945ed9 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 27 Sep 2016 19:30:43 +1000 Subject: [PATCH 111/179] app_main: Return type to void Result is not checked --- components/esp32/cpu_start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index fd46eec282..7b2ccdc609 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -55,7 +55,7 @@ static bool app_cpu_started = false; static void do_global_ctors(void); static void main_task(void* args); extern void ets_setup_syscalls(void); -extern int app_main(void); +extern void app_main(void); extern int _bss_start; extern int _bss_end; From 7c494055e38aefee6b488bee52ba660f2c245696 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 12 Sep 2016 17:23:15 +1000 Subject: [PATCH 112/179] esp32: Bootloader wake deep sleep stub App can contain a stub program resident in RTC fast memory. Bootloader will load the stub on initial boot. If the device wakes from deep sleep, the stub is run immediately (before any other data is loaded, etc.) To implement a custom wake stub, implement a function in your program: ``` void RTC_IRAM_ATTR esp_wake_deep_sleep(void) { esp_default_wake_deep_sleep(); // other wake logic } ``` ... and it will replace the default implementation. --- .../bootloader/src/main/bootloader_config.h | 4 + .../bootloader/src/main/bootloader_start.c | 26 +++- components/esp32/cpu_start.c | 1 + components/esp32/deepsleep.c | 45 ++++++ components/esp32/include/esp_attr.h | 16 +- components/esp32/include/esp_deepsleep.h | 137 ++++++++++++++++++ components/esp32/include/esp_system.h | 15 -- components/esp32/include/rom/rtc.h | 20 +-- components/esp32/ld/esp32.bt.ld | 6 + components/esp32/ld/esp32.bt.trace.ld | 6 + components/esp32/ld/esp32.common.ld | 16 +- components/esp32/ld/esp32.ld | 6 + 12 files changed, 264 insertions(+), 34 deletions(-) create mode 100644 components/esp32/deepsleep.c create mode 100644 components/esp32/include/esp_deepsleep.h diff --git a/components/bootloader/src/main/bootloader_config.h b/components/bootloader/src/main/bootloader_config.h index 7ad97af674..709ff41b16 100644 --- a/components/bootloader/src/main/bootloader_config.h +++ b/components/bootloader/src/main/bootloader_config.h @@ -30,6 +30,10 @@ extern "C" #define IROM_HIGH 0x40400000 #define DROM_LOW 0x3F400000 #define DROM_HIGH 0x3F800000 +#define RTC_IRAM_LOW 0x400C0000 +#define RTC_IRAM_HIGH 0x400C2000 +#define RTC_DATA_LOW 0x50000000 +#define RTC_DATA_HIGH 0x50002000 /*spi mode,saved in third byte in flash */ enum { diff --git a/components/bootloader/src/main/bootloader_start.c b/components/bootloader/src/main/bootloader_start.c index 6b3298c29c..e0ab7f9e2a 100644 --- a/components/bootloader/src/main/bootloader_start.c +++ b/components/bootloader/src/main/bootloader_start.c @@ -22,6 +22,7 @@ #include "rom/ets_sys.h" #include "rom/spi_flash.h" #include "rom/crc.h" +#include "rom/rtc.h" #include "soc/soc.h" #include "soc/cpu.h" @@ -362,11 +363,15 @@ void unpack_load_app(const partition_pos_t* partition) uint32_t irom_load_addr = 0; uint32_t irom_size = 0; + /* Reload the RTC memory sections whenever a non-deepsleep reset + is occuring */ + bool load_rtc_memory = rtc_get_reset_reason(0) != DEEPSLEEP_RESET; + ESP_LOGD(TAG, "bin_header: %u %u %u %u %08x", image_header.magic, - image_header.blocks, - image_header.spi_mode, - image_header.spi_size, - (unsigned)image_header.entry_addr); + image_header.blocks, + image_header.spi_mode, + image_header.spi_size, + (unsigned)image_header.entry_addr); for (uint32_t section_index = 0; section_index < image_header.blocks; @@ -406,7 +411,18 @@ void unpack_load_app(const partition_pos_t* partition) map = true; } - ESP_LOGI(TAG, "section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); + if(!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) { + ESP_LOGD(TAG, "Skipping RTC code section at %08x\n", pos); + load = false; + } + + if(!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) { + ESP_LOGD(TAG, "Skipping RTC data section at %08x\n", pos); + load = false; + } + + ESP_LOGI(TAG, "section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, + section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); if (!load) { pos += section_header.data_len; diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 7b2ccdc609..fb97cce47e 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -42,6 +42,7 @@ #include "esp_spi_flash.h" #include "esp_ipc.h" #include "esp_log.h" +#include "esp_deepsleep.h" void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))); void start_cpu0_default(void) IRAM_ATTR; diff --git a/components/esp32/deepsleep.c b/components/esp32/deepsleep.c new file mode 100644 index 0000000000..ee188c25dd --- /dev/null +++ b/components/esp32/deepsleep.c @@ -0,0 +1,45 @@ +/* Wake from deep sleep stub + + See esp_deepsleep.h esp_wake_deep_sleep() comments for details. +*/ +#include +#include +#include "rom/cache.h" +#include "rom/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "esp_attr.h" +#include "esp_deepsleep.h" + +/* Updating RTC_MEMORY_CRC_REG register via set_rtc_memory_crc() + is not thread-safe. */ +static _lock_t lock_rtc_memory_crc; + +esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void) +{ + _lock_acquire(&lock_rtc_memory_crc); + uint32_t stored_crc = REG_READ(RTC_MEMORY_CRC_REG); + set_rtc_memory_crc(); + uint32_t calc_crc = REG_READ(RTC_MEMORY_CRC_REG); + REG_WRITE(RTC_MEMORY_CRC_REG, stored_crc); + _lock_release(&lock_rtc_memory_crc); + + if(stored_crc == calc_crc) { + return (esp_deep_sleep_wake_stub_fn_t)REG_READ(RTC_ENTRY_ADDR_REG); + } else { + return NULL; + } +} + +void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) +{ + _lock_acquire(&lock_rtc_memory_crc); + REG_WRITE(RTC_ENTRY_ADDR_REG, (uint32_t)new_stub); + set_rtc_memory_crc(); + _lock_release(&lock_rtc_memory_crc); +} + +void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) { + mmu_init(0); +} + +void __attribute__((weak, alias("esp_default_wake_deep_sleep"))) esp_wake_deep_sleep(void); diff --git a/components/esp32/include/esp_attr.h b/components/esp32/include/esp_attr.h index 18a611489b..156d2957f9 100644 --- a/components/esp32/include/esp_attr.h +++ b/components/esp32/include/esp_attr.h @@ -17,8 +17,8 @@ #define ROMFN_ATTR //Normally, the linker script will put all code and rodata in flash, -//and all variables in shared RAM. This can be redirected to IRAM if -//needed using these macros. +//and all variables in shared RAM. These macros can be used to redirect +//particular functions/variables to other memory regions. // Forces code into IRAM instead of flash #define IRAM_ATTR __attribute__((section(".iram1"))) @@ -26,4 +26,16 @@ // Forces data into DRAM instead of flash #define DRAM_ATTR __attribute__((section(".dram1"))) +// Forces code into RTC fast memory +#define RTC_IRAM_ATTR __attribute__((section(".rtc.text"))) + +// Forces data into RTC slow memory +// Any variable marked with this attribute will keep its value +// during a deep sleep / wake cycle. +#define RTC_DATA_ATTR __attribute__((section(".rtc.data"))) + +// Forces read-only data into RTC slow memory +// Makes constant data available to RTC wake stubs (see esp_deepsleep.h) +#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata"))) + #endif /* __ESP_ATTR_H__ */ diff --git a/components/esp32/include/esp_deepsleep.h b/components/esp32/include/esp_deepsleep.h new file mode 100644 index 0000000000..3683a8eeab --- /dev/null +++ b/components/esp32/include/esp_deepsleep.h @@ -0,0 +1,137 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __ESP_DEEPSLEEP_H__ +#define __ESP_DEEPSLEEP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup Deep_Sleep_API Deep Sleep API + * @brief API for putting device into deep sleep + */ + +/** @addtogroup Deep_Sleep_API + * @{ + */ + +/** + * @brief Set the chip to deep-sleep mode. + * + * The device will automatically wake up after the deep-sleep time set + * by the users. Upon waking up, the device boots up from user_init. + * + * @attention The parameter time_in_us to be "uint64" is for further development. + * Only the low 32 bits of parameter time_in_us are avalable now. + * + * @param uint64 time_in_us : deep-sleep time, only the low 32bits are avalable now. unit: microsecond + * + * @return null + */ +void system_deep_sleep(uint64_t time_in_us); + +/** + * @brief Default stub to run on wake from deep sleep. + * + * Allows for executing code immediately on wake from sleep, before + * the software bootloader or esp-idf app has started up. + * + * This function is weak-linked, so you can implement your own version + * to run code immediately when the chip wakes from + * sleep. + * + * For example: + * @code + * void RTC_IRAM_ATTR esp_wake_deep_sleep(void) { + * esp_default_wake_deep_sleep(); + * // Add additional functionality here + * } + * + * (Implementing this function is not required for normal operation, + * in the usual case your app will start normally when waking from + * deep sleep.) + * + * esp_wake_deep_sleep() functionality is limited: + * + * - Runs immediately on wake, so most of the SoC is freshly reset - + * flash is unmapped and hardware is otherwise uninitialised. + * + * - Can only call functions implemented in ROM, or marked RTC_IRAM_ATTR. + * + * - Static variables marked RTC_DATA_ATTR will have initial values on + * cold boot, and maintain these values between sleep/wake cycles. + * + * - Read-only data should be marked RTC_RODATA_ATTR. Strings must be + * declared as variables also using RTC_RODATA_ATTR, like this: + * RTC_RODATA_ATTR const char message[] = "Hello from very early boot!\n"; + * + * - Any other static memory will not be initialised (either to zero, + * or to any predefined value). + * + * + * - If you implement your own stub, the first call the stub makes + should be to esp_default_wake_deep_sleep(). + */ +void esp_wake_deep_sleep(void); + +/** + * @brief Function type for stub to run on wake from sleep. + * + */ +typedef void (*esp_deep_sleep_wake_stub_fn_t)(void); + +/** + * @brief Install a new stub at runtime to run on wake from deep sleep + * + * If implementing esp_wake_deep_sleep() then it is not necessary to + * call this function. + * + * However, it is possible to call this function to substitute a + * different deep sleep stub. Any function used as a deep sleep stub + * must be marked RTC_IRAM_ATTR, and must obey the same rules given + * for esp_wake_deep_sleep(). + */ +void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub); + +/** + * @brief Return current wake from deep sleep stub, or NULL if + * no stub is installed. + */ +esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void); + +/* The default esp-idf-provided esp_wake_deep_sleep() stub. + + If you replace esp_wake_deep_sleep() in your program, or use + esp_set_deep_sleep_wake_stub(), then it is recommended you call + esp_default_wake_deep_sleep() as the first function in your stub. +*/ +void esp_default_wake_deep_sleep(void); + +/** + * @} + */ + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_SYSTEM_H__ */ diff --git a/components/esp32/include/esp_system.h b/components/esp32/include/esp_system.h index 3a479060b6..0a77044cfc 100644 --- a/components/esp32/include/esp_system.h +++ b/components/esp32/include/esp_system.h @@ -62,21 +62,6 @@ void system_restore(void); */ void system_restart(void); -/** - * @brief Set the chip to deep-sleep mode. - * - * The device will automatically wake up after the deep-sleep time set - * by the users. Upon waking up, the device boots up from user_init. - * - * @attention The parameter time_in_us to be "uint64" is for further development. - * Only the low 32 bits of parameter time_in_us are avalable now. - * - * @param uint64 time_in_us : deep-sleep time, only the low 32bits are avalable now. unit: microsecond - * - * @return null - */ -void system_deep_sleep(uint64_t time_in_us); - /** * @brief Get system time, unit: microsecond. * diff --git a/components/esp32/include/rom/rtc.h b/components/esp32/include/rom/rtc.h index d8c0c789a3..665b97c8ea 100644 --- a/components/esp32/include/rom/rtc.h +++ b/components/esp32/include/rom/rtc.h @@ -51,18 +51,18 @@ extern "C" { * ************************************************************************************* * Rtc store registers usage - * RTC_STORE0 - * RTC_STORE1 - * RTC_STORE2 - * RTC_STORE3 - * RTC_STORE4 Reserved - * RTC_STORE5 External Xtal Frequency - * RTC_STORE6 FAST_RTC_MEMORY_ENTRY - * RTC_STORE7 FAST_RTC_MEMORY_CRC + * RTC_CNTL_STORE0_REG + * RTC_CNTL_STORE1_REG + * RTC_CNTL_STORE2_REG + * RTC_CNTL_STORE3_REG + * RTC_CNTL_STORE4_REG Reserved + * RTC_CNTL_STORE5_REG External Xtal Frequency + * RTC_CNTL_STORE6_REG FAST_RTC_MEMORY_ENTRY + * RTC_CNTL_STORE7_REG FAST_RTC_MEMORY_CRC ************************************************************************************* */ -#define RTC_ENTRY_ADDR RTC_STORE6 -#define RTC_MEMORY_CRC RTC_STORE7 +#define RTC_ENTRY_ADDR_REG RTC_CNTL_STORE6_REG +#define RTC_MEMORY_CRC_REG RTC_CNTL_STORE7_REG typedef enum { diff --git a/components/esp32/ld/esp32.bt.ld b/components/esp32/ld/esp32.bt.ld index 90d0f491bc..ccf0821ae1 100644 --- a/components/esp32/ld/esp32.bt.ld +++ b/components/esp32/ld/esp32.bt.ld @@ -9,6 +9,12 @@ MEMORY iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ dram0_0_seg (RW) : org = 0x3FFC0000, len = 0x40000 /* Shared RAM, minus rom bss/data/stack.*/ drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 + + /* RTC fast memory (executable). Persists over deep sleep. + */ + rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 + /* RTC slow memory (data accessible). Persists over deep sleep. */ + rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 } _heap_end = 0x40000000; diff --git a/components/esp32/ld/esp32.bt.trace.ld b/components/esp32/ld/esp32.bt.trace.ld index d4d7069eb0..78cedeb290 100644 --- a/components/esp32/ld/esp32.bt.trace.ld +++ b/components/esp32/ld/esp32.bt.trace.ld @@ -9,6 +9,12 @@ MEMORY iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ dram0_0_seg (RW) : org = 0x3FFC0000, len = 0x38000 /* Shared RAM, minus rom bss/data/stack.*/ drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 + + /* RTC fast memory (executable). Persists over deep sleep. + */ + rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 + /* RTC slow memory (data accessible). Persists over deep sleep. */ + rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 } _heap_end = 0x3FFF8000; diff --git a/components/esp32/ld/esp32.common.ld b/components/esp32/ld/esp32.common.ld index 3fb4ca761c..a3c6367840 100644 --- a/components/esp32/ld/esp32.common.ld +++ b/components/esp32/ld/esp32.common.ld @@ -102,7 +102,7 @@ SECTIONS _rodata_start = ABSOLUTE(.); *(.rodata) *(.rodata.*) - *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ *(.gnu.linkonce.r.*) *(.rodata1) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); @@ -132,7 +132,7 @@ SECTIONS *(.dynamic) *(.gnu.version_d) _rodata_end = ABSOLUTE(.); - /* Literals are also RO data. */ + /* Literals are also RO data. */ _lit4_start = ABSOLUTE(.); *(*.lit4) *(.lit4.*) @@ -153,4 +153,16 @@ SECTIONS _text_end = ABSOLUTE(.); _etext = .; } >iram0_2_seg + + .rtc.text : + { + . = ALIGN(4); + *(.rtc.literal .rtc.text) + } >rtc_iram_seg + + .rtc.data : + { + *(.rtc.data) + *(.rtc.rodata) + } > rtc_slow_seg } diff --git a/components/esp32/ld/esp32.ld b/components/esp32/ld/esp32.ld index becbc6baac..6c67c7d79d 100644 --- a/components/esp32/ld/esp32.ld +++ b/components/esp32/ld/esp32.ld @@ -9,6 +9,12 @@ MEMORY iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ dram0_0_seg (RW) : org = 0x3FFB0000, len = 0x50000 /* Shared RAM, minus rom bss/data/stack.*/ drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 + + /* RTC fast memory (executable). Persists over deep sleep. + */ + rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 + /* RTC slow memory (data accessible). Persists over deep sleep. */ + rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 } _heap_end = 0x40000000; From 5f45cbc16acf0f617c964de7d896398ac77927a1 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 14 Sep 2016 10:58:38 +1000 Subject: [PATCH 113/179] esp32: Add esp_deepsleep.h to esp_system.h to keep backwards compatibility with system_deep_sleep() --- components/esp32/include/esp_system.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/esp32/include/esp_system.h b/components/esp32/include/esp_system.h index 0a77044cfc..84133366d7 100644 --- a/components/esp32/include/esp_system.h +++ b/components/esp32/include/esp_system.h @@ -18,6 +18,7 @@ #include #include "esp_err.h" +#include "esp_deepsleep.h" #ifdef __cplusplus extern "C" { From 2c6ab8579a2415eb31ee2be65fc887ca0c1b75aa Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 11:04:16 +1000 Subject: [PATCH 114/179] esp32: Pass memory layout linker script through C preprocessor C preprocessor is a bit icky, but with ULP we will have 3 possible variables influencing the memory layout and 9 linker scripts is too many! --- components/bt/Kconfig | 6 ++++ components/esp32/component.mk | 27 ++++++++--------- components/esp32/ld/esp32.bt.ld | 20 ------------- components/esp32/ld/esp32.bt.trace.ld | 20 ------------- components/esp32/ld/esp32.ld | 43 +++++++++++++++++++++++---- components/esp32/ld/esp32.trace.ld | 14 --------- 6 files changed, 55 insertions(+), 75 deletions(-) delete mode 100644 components/esp32/ld/esp32.bt.ld delete mode 100644 components/esp32/ld/esp32.bt.trace.ld delete mode 100644 components/esp32/ld/esp32.trace.ld diff --git a/components/bt/Kconfig b/components/bt/Kconfig index ab163efc61..e397214d22 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -21,3 +21,9 @@ config BT_ENABLED # This enables classic BT support endmenu + +# Memory reserved at start of DRAM for Bluetooth stack +config BT_RESERVE_DRAM + hex + default 0x10000 if MEMMAP_BT + default 0 diff --git a/components/esp32/component.mk b/components/esp32/component.mk index d275898db3..223c955d51 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -12,21 +12,7 @@ COMPONENT_SRCDIRS := . hwcrypto LIBS := crypto core net80211 phy rtc pp wpa wps -ifeq ($(CONFIG_MEMMAP_BT),y) - ifeq ($(CONFIG_MEMMAP_TRACEMEM),y) - LINKER_SCRIPTS = -T esp32.bt.trace.ld - else - LINKER_SCRIPTS = -T esp32.bt.ld - endif -else - ifeq ($(CONFIG_MEMMAP_TRACEMEM),y) - LINKER_SCRIPTS = -T esp32.trace.ld - else - LINKER_SCRIPTS = -T esp32.ld - endif -endif - -LINKER_SCRIPTS += -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld +LINKER_SCRIPTS += -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld COMPONENT_ADD_LDFLAGS := -lesp32 \ $(abspath libhal.a) \ @@ -51,3 +37,14 @@ $(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) # It would be better for components to be able to expose any of these # non-standard dependencies via get_variable, but this will do for now. $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) + +# Preprocess esp32.ld linker script into esp32_out.ld +# +# The library doesn't really depend on esp32_out.ld, but it +# saves us from having to add the target to a Makefile.projbuild +$(COMPONENT_LIBRARY): esp32_out.ld + +esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h + $(CC) -I ../include -C -P -x c -E $< -o $@ + +COMPONENT_EXTRA_CLEAN := esp32_out.ld diff --git a/components/esp32/ld/esp32.bt.ld b/components/esp32/ld/esp32.bt.ld deleted file mode 100644 index ccf0821ae1..0000000000 --- a/components/esp32/ld/esp32.bt.ld +++ /dev/null @@ -1,20 +0,0 @@ -/* THESE ARE THE VIRTUAL RUNTIME ADDRESSES */ -/* The load addresses are defined later using the AT statements. */ -MEMORY -{ - /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length - of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but - are connected to the data port of the CPU and eg allow bytewise access. */ - iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */ - iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ - dram0_0_seg (RW) : org = 0x3FFC0000, len = 0x40000 /* Shared RAM, minus rom bss/data/stack.*/ - drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 - - /* RTC fast memory (executable). Persists over deep sleep. - */ - rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 - /* RTC slow memory (data accessible). Persists over deep sleep. */ - rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 -} - -_heap_end = 0x40000000; diff --git a/components/esp32/ld/esp32.bt.trace.ld b/components/esp32/ld/esp32.bt.trace.ld deleted file mode 100644 index 78cedeb290..0000000000 --- a/components/esp32/ld/esp32.bt.trace.ld +++ /dev/null @@ -1,20 +0,0 @@ -/* THESE ARE THE VIRTUAL RUNTIME ADDRESSES */ -/* The load addresses are defined later using the AT statements. */ -MEMORY -{ - /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length - of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but - are connected to the data port of the CPU and eg allow bytewise access. */ - iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */ - iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ - dram0_0_seg (RW) : org = 0x3FFC0000, len = 0x38000 /* Shared RAM, minus rom bss/data/stack.*/ - drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 - - /* RTC fast memory (executable). Persists over deep sleep. - */ - rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 - /* RTC slow memory (data accessible). Persists over deep sleep. */ - rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 -} - -_heap_end = 0x3FFF8000; diff --git a/components/esp32/ld/esp32.ld b/components/esp32/ld/esp32.ld index 6c67c7d79d..c44b2e42a3 100644 --- a/components/esp32/ld/esp32.ld +++ b/components/esp32/ld/esp32.ld @@ -1,20 +1,51 @@ -/* THESE ARE THE VIRTUAL RUNTIME ADDRESSES */ -/* The load addresses are defined later using the AT statements. */ +/* ESP32 Linker Script Memory Layout + + This file describes the memory layout (memory blocks) as virtual + memory addresses. + + esp32.common.ld contains output sections to link compiler output + into these memory blocks. + + *** + + This linker script is passed through the C preprocessor to include + configuration options. + + Please use preprocessor features sparingly! Restrict + to simple macros with numeric values, and/or #if/#endif blocks. +*/ +#include "sdkconfig.h" + MEMORY { /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but are connected to the data port of the CPU and eg allow bytewise access. */ - iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */ - iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ - dram0_0_seg (RW) : org = 0x3FFB0000, len = 0x50000 /* Shared RAM, minus rom bss/data/stack.*/ + + /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */ + iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 + + /* Even though the segment name is iram, it is actually mapped to flash */ + iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 + + /* Shared data RAM, excluding memory reserved for ROM bss/data/stack. + + Enabling Bluetooth & Trace Memory features in menuconfig will decrease + the amount of RAM available. + */ + dram0_0_seg (RW) : org = 0x3FFB0000 + CONFIG_BT_RESERVE_DRAM, + len = 0x50000 - CONFIG_TRACEMEM_RESERVE_DRAM - CONFIG_BT_RESERVE_DRAM + + /* Flash mapped constant data */ drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 /* RTC fast memory (executable). Persists over deep sleep. */ rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 + /* RTC slow memory (data accessible). Persists over deep sleep. */ rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 } -_heap_end = 0x40000000; +/* Heap ends at top of dram0_0_seg */ +_heap_end = 0x40000000 - CONFIG_TRACEMEM_RESERVE_DRAM; diff --git a/components/esp32/ld/esp32.trace.ld b/components/esp32/ld/esp32.trace.ld deleted file mode 100644 index f619f8d984..0000000000 --- a/components/esp32/ld/esp32.trace.ld +++ /dev/null @@ -1,14 +0,0 @@ -/* THESE ARE THE VIRTUAL RUNTIME ADDRESSES */ -/* The load addresses are defined later using the AT statements. */ -MEMORY -{ - /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length - of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but - are connected to the data port of the CPU and eg allow bytewise access. */ - iram0_0_seg (RX) : org = 0x40080000, len = 0x20000 /* IRAM for PRO cpu. Not sure if happy with this, this is MMU area... */ - iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000 /* Even though the segment name is iram, it is actually mapped to flash */ - dram0_0_seg (RW) : org = 0x3FFB0000, len = 0x48000 /* Shared RAM, minus rom bss/data/stack.*/ - drom0_0_seg (R) : org = 0x3F400010, len = 0x800000 -} - -_heap_end = 0x3FFF8000; From 103a2a0079f222b98eb2636e84a8b33de8344993 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Sep 2016 11:24:02 +1000 Subject: [PATCH 115/179] esp32: Allow RTC slow memory to be reserved for ULP coprocessor --- components/esp32/Kconfig | 24 ++++++++++++++++++++++++ components/esp32/ld/esp32.ld | 8 ++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index a43d16d2c6..3770966a08 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -110,4 +110,28 @@ config NEWLIB_STDOUT_ADDCR is usually done by an added CR character. Enabling this will make the standard output code automatically add a CR character before a LF. +config ULP_COPROC_ENABLED + bool "Enable Ultra Low Power (ULP) Coprocessor" + default "n" + help + Set to 'y' if you plan to load a firmware for the coprocessor. + + If this option is enabled, further coprocessor configuration will appear in the Components menu. + +config ULP_COPROC_RESERVE_MEM + int "RTC slow memory reserved for coprocessor" + default 512 + range 32 8192 + depends on ULP_COPROC_ENABLED + help + Bytes of memory to reserve for ULP coprocessor firmware & data. + + Data is reserved at the beginning of RTC slow memory. + +# Set CONFIG_ULP_COPROC_RESERVE_MEM to 0 if ULP is disabled +config ULP_COPROC_RESERVE_MEM + int + default 0 + depends on !ULP_COPROC_ENABLED + endmenu diff --git a/components/esp32/ld/esp32.ld b/components/esp32/ld/esp32.ld index c44b2e42a3..7ecfd19e54 100644 --- a/components/esp32/ld/esp32.ld +++ b/components/esp32/ld/esp32.ld @@ -43,8 +43,12 @@ MEMORY */ rtc_iram_seg(RWX) : org = 0x400C0000, len = 0x2000 - /* RTC slow memory (data accessible). Persists over deep sleep. */ - rtc_slow_seg(RW) : org = 0x50000000, len = 0x2000 + /* RTC slow memory (data accessible). Persists over deep sleep. + + Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled. + */ + rtc_slow_seg(RW) : org = 0x50000000 + CONFIG_ULP_COPROC_RESERVE_MEM, + len = 0x2000 - CONFIG_ULP_COPROC_RESERVE_MEM } /* Heap ends at top of dram0_0_seg */ From ec03c31ec443a523b0023b17471c64d502f6e57c Mon Sep 17 00:00:00 2001 From: xiaxiaotian Date: Wed, 28 Sep 2016 11:52:39 +0800 Subject: [PATCH 116/179] 1. Change the deep sleep stub code to fix wake bug. --- components/esp32/cpu_start.c | 1 - components/esp32/deepsleep.c | 6 +++++- components/esp32/include/rom/rtc.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index fb97cce47e..7b2ccdc609 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -42,7 +42,6 @@ #include "esp_spi_flash.h" #include "esp_ipc.h" #include "esp_log.h" -#include "esp_deepsleep.h" void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))); void start_cpu0_default(void) IRAM_ATTR; diff --git a/components/esp32/deepsleep.c b/components/esp32/deepsleep.c index ee188c25dd..61268bce6b 100644 --- a/components/esp32/deepsleep.c +++ b/components/esp32/deepsleep.c @@ -7,6 +7,7 @@ #include "rom/cache.h" #include "rom/rtc.h" #include "soc/rtc_cntl_reg.h" +#include "soc/dport_reg.h" #include "esp_attr.h" #include "esp_deepsleep.h" @@ -39,7 +40,10 @@ void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) } void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) { - mmu_init(0); + // + //mmu_init(0); + REG_SET_BIT(DPORT_PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MMU_IA_CLR); + REG_CLR_BIT(DPORT_PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MMU_IA_CLR); } void __attribute__((weak, alias("esp_default_wake_deep_sleep"))) esp_wake_deep_sleep(void); diff --git a/components/esp32/include/rom/rtc.h b/components/esp32/include/rom/rtc.h index 665b97c8ea..9577119f5c 100644 --- a/components/esp32/include/rom/rtc.h +++ b/components/esp32/include/rom/rtc.h @@ -161,7 +161,7 @@ WAKEUP_REASON rtc_get_wakeup_cause(void); * * @param uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory. * - * @param uint32_t crc_len : 0 - 0x7ff, 0 for 1 byte, 0x7ff for 0x800 byte. + * @param uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte. * * @return uint32_t : CRC32 result */ From 516ab36bbebc4f2f64a56d10490b0e5d5e2eb41b Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Wed, 28 Sep 2016 12:04:15 +0800 Subject: [PATCH 117/179] Minor modification 1. add new line between typedefs 2. for param check functions, return bool if they are true/false --- components/driver/include/driver/ledc.h | 6 ++++++ components/driver/ledc.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 2dffce8c9c..3e3d3740df 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -34,24 +34,29 @@ typedef enum { //LEDC_LOW_SPEED_MODE, /*LEDC low speed speed_mode */ LEDC_SPEED_MODE_MAX, } ledc_mode_t; + typedef enum { LEDC_INTR_DISABLE = 0, /*Disable LEDC interrupt */ LEDC_INTR_FADE_END, /*Enable LEDC interrupt */ } ledc_intr_type_t; + typedef enum { LEDC_DUTY_DIR_DECREASE = 0, /*LEDC duty decrease direction */ LEDC_DUTY_DIR_INCREASE = 1, /*LEDC duty increase direction */ } ledc_duty_direction_t; + typedef enum { LEDC_REF_TICK = 0, /*LEDC timer clock divided from reference tick(1Mhz) */ LEDC_APB_CLK, /*LEDC timer clock divided from APB clock(80Mhz)*/ } ledc_clk_src_t; + typedef enum { LEDC_TIMER0 = 0, /*LEDC source timer TIMER0 */ LEDC_TIMER1, /*LEDC source timer TIMER1 */ LEDC_TIMER2, /*LEDC source timer TIMER2 */ LEDC_TIMER3, /*LEDC source timer TIMER3 */ } ledc_timer_t; + typedef enum { LEDC_CHANNEL_0 = 0, /*LEDC channel 0 */ LEDC_CHANNEL_1, /*LEDC channel 1 */ @@ -62,6 +67,7 @@ typedef enum { LEDC_CHANNEL_6, /*LEDC channel 6 */ LEDC_CHANNEL_7, /*LEDC channel 7 */ } ledc_channel_t; + typedef enum { LEDC_TIMER_10_BIT = 10, /*LEDC PWM depth 10Bit */ LEDC_TIMER_11_BIT = 11, /*LEDC PWM depth 11Bit */ diff --git a/components/driver/ledc.c b/components/driver/ledc.c index a5bf92f6f9..3fd0f27afb 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -20,7 +20,7 @@ #include "soc/gpio_sig_map.h" #include "driver/ledc.h" -//TODO: Move these debug options to menuconfig +//TODO: to use APIs in esp_log.h. #define LEDC_DBG_WARING_ENABLE (0) #define LEDC_DBG_ERROR_ENABLE (0) #define LEDC_INFO_ENABLE (0) @@ -64,31 +64,31 @@ static portMUX_TYPE ledc_spinlock = portMUX_INITIALIZER_UNLOCKED; -static int ledc_is_valid_channel(uint32_t channel) +static bool ledc_is_valid_channel(uint32_t channel) { if(channel > LEDC_CHANNEL_7) { LEDC_ERROR("LEDC CHANNEL ERR: %d\n",channel); - return 0; + return false; } - return 1; + return true; } -static int ledc_is_valid_mode(uint32_t mode) +static bool ledc_is_valid_mode(uint32_t mode) { if(mode >= LEDC_SPEED_MODE_MAX) { LEDC_ERROR("LEDC MODE ERR: %d\n",mode); - return 0; + return false; } - return 1; + return true; } -static int ledc_is_valid_timer(int timer) +static bool ledc_is_valid_timer(int timer) { if(timer > LEDC_TIMER3) { LEDC_ERROR("LEDC TIMER ERR: %d\n", timer); - return 0; + return false; } - return 1; + return true; } esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src) From 70e1131b4b0012a2bc3f99450622eb0ca09d80e1 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 28 Sep 2016 12:27:25 +0800 Subject: [PATCH 118/179] esp32: add TRACEMEM_RESERVE_DRAM config this configaration is missed when rebase --- components/esp32/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 3770966a08..b5754deed5 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -63,6 +63,12 @@ config MEMMAP_TRACEMEM of memory that can't be used for general purposes anymore. Disable this if you do not know what this is. +# Memory to reverse for trace, used in linker script +config TRACEMEM_RESERVE_DRAM + hex + default 0x8000 if MEMMAP_TRACEMEM + default 0x0 + config MEMMAP_SPISRAM bool "Use external SPI SRAM chip as main memory" default "n" From 910172db498ad58a7edc4a68ecd8a9ed93272ef8 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Wed, 28 Sep 2016 12:30:44 +0800 Subject: [PATCH 119/179] component/bt: update libbtdm_app.a 1. update the lib to version 010102 because the branch feature/btdm_controller missed the lib --- components/bt/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/lib b/components/bt/lib index 6c9a6de656..bcbc35215c 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 6c9a6de656262113a0aab63907d6871a64e00fae +Subproject commit bcbc35215c6d87279da4b87a74d3360c537d6724 From a9502dffd3ec908599206e6864121215efe7824f Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Wed, 28 Sep 2016 12:43:35 +0800 Subject: [PATCH 120/179] Add ringbuf.c. This works like a FreeRTOS queue, but allows for variable-length items which in some cases is more memory efficient than a queue. --- .../freertos/include/freertos/ringbuf.h | 206 ++++++++ components/freertos/ringbuf.c | 474 ++++++++++++++++++ 2 files changed, 680 insertions(+) create mode 100644 components/freertos/include/freertos/ringbuf.h create mode 100644 components/freertos/ringbuf.c diff --git a/components/freertos/include/freertos/ringbuf.h b/components/freertos/include/freertos/ringbuf.h new file mode 100644 index 0000000000..7884e9856e --- /dev/null +++ b/components/freertos/include/freertos/ringbuf.h @@ -0,0 +1,206 @@ +#ifndef FREERTOS_RINGBUF_H +#define FREERTOS_RINGBUF_H + +/* +Header definitions for a FreeRTOS ringbuffer object + +A ringbuffer instantiated by these functions essentially acts like a FreeRTOS queue, with the +difference that it's strictly FIFO and with the main advantage that you can put in randomly-sized +items. The capacity, accordingly, isn't measured in the amount of items, but the amount of memory +that is used for storing the items. Dependent on the size of the items, more or less of them will +fit in the ring buffer. + +This ringbuffer tries to be efficient with memory: when inserting an item, the item data will +be copied to the ringbuffer memory. When retrieving an item, however, a reference to ringbuffer +memory will be returned. The returned memory is guaranteed to be 32-bit aligned and contiguous. +The application can use this memory, but as long as it does, ringbuffer writes that would write +to this bit of memory will block. + +The requirement for items to be contiguous is slightly problematic when the only way to place +the next item would involve a wraparound from the end to the beginning of the ringbuffer. This can +be solved in two ways: +- allow_split_items = pdTRUE: The insertion code will split the item in two items; one which fits +in the space left at the end of the ringbuffer, one that contains the remaining data which is placed +in the beginning. Two xRingbufferReceive calls will be needed to retrieve the data. +- allow_split_items = pdFALSE: The insertion code will leave the room at the end of the ringbuffer +unused and instead will put the entire item at the start of the ringbuffer, as soon as there is +enough free space. + +The maximum size of an item will be affected by this decision. When split items are allowed, it's +acceptable to push items of (buffer_size)-16 bytes into the buffer. When it's not allowed, the +maximum size is (buffer_size/2)-8 bytes. +*/ + +//An opaque handle for a ringbuff object. +typedef void * RingbufHandle_t; + + +/** + * @brief Create a ring buffer + * + * @param buf_length : Length of circular buffer, in bytes. Each entry will take up its own length, plus a header + * that at the moment is equal to sizeof(size_t). + * @param allow_split_items : pdTRUE if it is acceptable that item data is inserted as two + * items instead of one. + * + * @return A RingbufHandle_t handle to the created ringbuffer, or NULL in case of error. + */ +RingbufHandle_t xRingbufferCreate(size_t buf_length, BaseType_t allow_split_items); + + +/** + * @brief Delete a ring buffer + * + * @param ringbuf - Ring buffer to delete + * + * @return void + */ +void vRingbufferDelete(RingbufHandle_t ringbuf); + + +/** + * @brief Get maximum size of an item that can be placed in the ring buffer + * + * @param ringbuf - Ring buffer to query + * + * @return Maximum size, in bytes, of an item that can be placed in a ring buffer. + */ +size_t xRingbufferGetMaxItemSize(RingbufHandle_t ringbuf); + + +/** + * @brief Insert an item into the ring buffer + * + * @param ringbuf - Ring buffer to insert the item into + * @param data - Pointer to data to insert. NULL is allowed if data_size is 0. + * @param data_size - Size of data to insert. A value of 0 is allowed. + * @param xTicksToWait - Ticks to wait for room in the ringbuffer. + * + * @return pdTRUE if succeeded, pdFALSE on time-out or when the buffer is larger + * than indicated by xRingbufferGetMaxItemSize(ringbuf). + */ +BaseType_t xRingbufferSend(RingbufHandle_t ringbuf, void *data, size_t data_size, TickType_t ticks_to_wait); + + +/** + * @brief Insert an item into the ring buffer from an ISR + * + * @param ringbuf - Ring buffer to insert the item into + * @param data - Pointer to data to insert. NULL is allowed if data_size is 0. + * @param data_size - Size of data to insert. A value of 0 is allowed. + * @param higher_prio_task_awoken - Value pointed to will be set to pdTRUE if the push woke up a higher + * priority task. + * + * @return pdTRUE if succeeded, pdFALSE when the ring buffer does not have space. + */ +BaseType_t xRingbufferSendFromISR(RingbufHandle_t ringbuf, void *data, size_t data_size, BaseType_t *higher_prio_task_awoken); + +/** + * @brief Retrieve an item from the ring buffer + * + * @param ringbuf - Ring buffer to retrieve the item from + * @param item_size - Pointer to a variable to which the size of the retrieved item will be written. + * @param xTicksToWait - Ticks to wait for items in the ringbuffer. + * + * @return Pointer to the retrieved item on success; *item_size filled with the length of the + * item. NULL on timeout, *item_size is untouched in that case. + */ +void *xRingbufferReceive(RingbufHandle_t ringbuf, size_t *item_size, TickType_t ticks_to_wait); + + +/** + * @brief Retrieve an item from the ring buffer from an ISR + * + * @param ringbuf - Ring buffer to retrieve the item from + * @param item_size - Pointer to a variable to which the size of the retrieved item will be written. + * + * @return Pointer to the retrieved item on success; *item_size filled with the length of the + * item. NULL when the ringbuffer is empty, *item_size is untouched in that case. + */ +void *xRingbufferReceiveFromISR(RingbufHandle_t ringbuf, size_t *item_size); + + +/** + * @brief Return a previously-retrieved item to the ringbuffer + * + * @param ringbuf - Ring buffer the item was retrieved from + * @param item - Item that was received earlier + * + * @return void + */ +void vRingbufferReturnItem(RingbufHandle_t ringbuf, void *item); + + + +/** + * @brief Return a previously-retrieved item to the ringbuffer from an ISR + * + * @param ringbuf - Ring buffer the item was retrieved from + * @param item - Item that was received earlier + * @param higher_prio_task_awoken - Value pointed to will be set to pdTRUE if the push woke up a higher + * priority task. + * + * @return void + */ +void vRingbufferReturnItemFromISR(RingbufHandle_t ringbuf, void *item, BaseType_t *higher_prio_task_awoken); + + +/** + * @brief Add the ringbuffer to a queue set. This specifically adds the semaphore that indicates + * more space has become available in the ringbuffer. + * + * @param ringbuf - Ring buffer to add to the queue set + * @param xQueueSet - Queue set to add the ringbuffer to + * + * @return pdTRUE on success, pdFALSE otherwise + */ +BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet); + + +/** + * @brief Add the ringbuffer to a queue set. This specifically adds the semaphore that indicates + * something has been written into the ringbuffer. + * + * @param ringbuf - Ring buffer to add to the queue set + * @param xQueueSet - Queue set to add the ringbuffer to + * + * @return pdTRUE on success, pdFALSE otherwise + */ +BaseType_t xRingbufferAddToQueueSetWrite(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet); + + +/** + * @brief Remove the ringbuffer from a queue set. This specifically removes the semaphore that indicates + * more space has become available in the ringbuffer. + * + * @param ringbuf - Ring buffer to remove from the queue set + * @param xQueueSet - Queue set to remove the ringbuffer from + * + * @return pdTRUE on success, pdFALSE otherwise + */ +BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet); + + +/** + * @brief Remove the ringbuffer from a queue set. This specifically removes the semaphore that indicates + * something has been written to the ringbuffer. + * + * @param ringbuf - Ring buffer to remove from the queue set + * @param xQueueSet - Queue set to remove the ringbuffer from + * + * @return pdTRUE on success, pdFALSE otherwise + */ +BaseType_t xRingbufferRemoveFromQueueSetWrite(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet); + + +/** + * @brief Debugging function to print the internal pointers in the ring buffer + * + * @param ringbuf - Ring buffer to show + * + * @return void + */ +void xRingbufferPrintInfo(RingbufHandle_t ringbuf); + + +#endif diff --git a/components/freertos/ringbuf.c b/components/freertos/ringbuf.c new file mode 100644 index 0000000000..6045c5a695 --- /dev/null +++ b/components/freertos/ringbuf.c @@ -0,0 +1,474 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "freertos/queue.h" +#include "freertos/xtensa_api.h" +#include "freertos/ringbuf.h" +#include +#include +#include +#include + +typedef enum { + flag_allowsplit = 1, +} rbflag_t; + +typedef enum { + iflag_free = 1, //Buffer is not read and given back by application, free to overwrite + iflag_dummydata = 2, //Data from here to end of ringbuffer is dummy. Restart reading at start of ringbuffer. +} itemflag_t; + + +//The ringbuffer structure +typedef struct { + SemaphoreHandle_t free_space_sem; //Binary semaphore, wakes up writing threads when there's more free space + SemaphoreHandle_t items_buffered_sem; //Binary semaphore, indicates there are new packets in the circular buffer. See remark. + size_t size; //Size of the data storage + uint8_t *write_ptr; //Pointer where the next item is written + uint8_t *read_ptr; //Pointer from where the next item is read + uint8_t *free_ptr; //Pointer to the last block that hasn't been given back to the ringbuffer yet + uint8_t *data; //Data storage + portMUX_TYPE mux; //Spinlock for actual data/ptr/struct modification + rbflag_t flags; +} ringbuf_t; + + + +/* +Remark: A counting semaphore for items_buffered_sem would be more logical, but counting semaphores in +FreeRTOS need a maximum count, and allocate more memory the larger the maximum count is. Here, we +would need to set the maximum to the maximum amount of times a null-byte unit firs in the buffer, +which is quite high and so would waste a fair amount of memory. +*/ + + +//The header prepended to each ringbuffer entry. Size is assumed to be a multiple of 32bits. +typedef struct { + size_t len; + itemflag_t flags; +} buf_entry_hdr_t; + + +//Calculate space free in the buffer +static int ringbufferFreeMem(ringbuf_t *rb) +{ + int free_size = rb->free_ptr-rb->write_ptr; + if (free_size <= 0) free_size += rb->size; + //Reserve one byte. If we do not do this and the entire buffer is filled, we get a situation + //where read_ptr == free_ptr, messing up the next calculation. + return free_size-1; +} + +//Copies a single item to the ring buffer. Assumes there is space in the ringbuffer and +//the ringbuffer is locked. Increases write_ptr to the next item. Returns pdTRUE on +//success, pdFALSE if it can't make the item fit and the calling routine needs to retry +//later or fail. +//This function by itself is not threadsafe, always call from within a muxed section. +static BaseType_t copyItemToRingbuf(ringbuf_t *rb, uint8_t *buffer, size_t buffer_size) +{ + size_t rbuffer_size=(buffer_size+3)&~3; //Payload length, rounded to next 32-bit value + configASSERT(((int)rb->write_ptr&3)==0); //write_ptr needs to be 32-bit aligned + configASSERT(rb->write_ptr-(rb->data+rb->size) >= sizeof(buf_entry_hdr_t)); //need to have at least the size + //of a header to the end of the ringbuff + size_t rem_len=(rb->data + rb->size) - rb->write_ptr; //length remaining until end of ringbuffer + + //See if we have enough contiguous space to write the buffer. + if (rem_len < rbuffer_size + sizeof(buf_entry_hdr_t)) { + //The buffer can't be contiguously written to the ringbuffer, but needs special handling. Do + //that depending on how the ringbuffer is configured. + //The code here is also expected to check if the buffer, mangled in whatever way is implemented, + //will still fit, and return pdFALSE if that is not the case. + if (rb->flags & flag_allowsplit) { + //Buffer plus header is not going to fit in the room from wr_pos to the end of the + //ringbuffer... we need to split the write in two. + //First, see if this will fit at all. + if (ringbufferFreeMem(rb) < (sizeof(buf_entry_hdr_t)*2)+rbuffer_size) { + //Will not fit. + return pdFALSE; + } + //Because the code at the end of the function makes sure we always have + //room for a header, this should never assert. + configASSERT(rem_len>=sizeof(buf_entry_hdr_t)); + //Okay, it should fit. Write everything. + //First, place bit of buffer that does fit. Write header first... + buf_entry_hdr_t *hdr=(buf_entry_hdr_t *)rb->write_ptr; + hdr->flags=0; + hdr->len=rem_len-sizeof(buf_entry_hdr_t); + rb->write_ptr+=sizeof(buf_entry_hdr_t); + rem_len-=sizeof(buf_entry_hdr_t); + if (rem_len!=0) { + //..then write the data bit that fits. + memcpy(rb->write_ptr, buffer, rem_len); + //Update vars so the code later on will write the rest of the data. + buffer+=rem_len; + rbuffer_size-=rem_len; + buffer_size-=rem_len; + } else { + //Huh, only the header fit. Mark as dummy so the receive function doesn't receive + //an useless zero-byte packet. + hdr->flags|=iflag_dummydata; + } + rb->write_ptr=rb->data; + } else { + //Buffer plus header is not going to fit in the room from wr_pos to the end of the + //ringbuffer... but we're not allowed to split the buffer. We need to fill the + //rest of the ringbuffer with a dummy item so we can place the data at the _start_ of + //the ringbuffer.. + //First, find out if we actually have enough space at the start of the ringbuffer to + //make this work (Again, we need 4 bytes extra because otherwise read_ptr==free_ptr) + if (rb->free_ptr-rb->data < rbuffer_size+sizeof(buf_entry_hdr_t)+4) { + //Will not fit. + return pdFALSE; + } + //If the read buffer hasn't wrapped around yet, there's no way this will work either. + if (rb->free_ptr > rb->write_ptr) { + //No luck. + return pdFALSE; + } + + //Okay, it will fit. Mark the rest of the ringbuffer space with a dummy packet. + buf_entry_hdr_t *hdr=(buf_entry_hdr_t *)rb->write_ptr; + hdr->flags=iflag_dummydata; + //Reset the write pointer to the start of the ringbuffer so the code later on can + //happily write the data. + rb->write_ptr=rb->data; + } + } else { + //No special handling needed. Checking if it's gonna fit probably still is a good idea. + if (ringbufferFreeMem(rb) < sizeof(buf_entry_hdr_t)+rbuffer_size) { + //Buffer is not going to fit, period. + return pdFALSE; + } + } + + //If we are here, the buffer is guaranteed to fit in the space starting at the write pointer. + buf_entry_hdr_t *hdr=(buf_entry_hdr_t *)rb->write_ptr; + hdr->len=buffer_size; + hdr->flags=0; + rb->write_ptr+=sizeof(buf_entry_hdr_t); + memcpy(rb->write_ptr, buffer, buffer_size); + rb->write_ptr+=rbuffer_size; + + //The buffer will wrap around if we don't have room for a header anymore. + if ((rb->data+rb->size)-rb->write_ptr < sizeof(buf_entry_hdr_t)) { + //'Forward' the write buffer until we are at the start of the ringbuffer. + //The read pointer will always be at the start of a full header, which cannot + //exist at the point of the current write pointer, so there's no chance of overtaking + //that. + rb->write_ptr=rb->data; + } + return pdTRUE; +} + +//Retrieves a pointer to the data of the next item, or NULL if this is not possible. +//This function by itself is not threadsafe, always call from within a muxed section. +static uint8_t *getItemFromRingbuf(ringbuf_t *rb, size_t *length) +{ + uint8_t *ret; + configASSERT(((int)rb->read_ptr&3)==0); + if (rb->read_ptr == rb->write_ptr) { + //No data available. + return NULL; + } + //The item written at the point of the read pointer may be a dummy item. + //We need to skip past it first, if that's the case. + buf_entry_hdr_t *hdr=(buf_entry_hdr_t *)rb->read_ptr; + configASSERT((hdr->len < rb->size) || (hdr->flags & iflag_dummydata)); + if (hdr->flags & iflag_dummydata) { + //Hdr is dummy data. Reset to start of ringbuffer. + rb->read_ptr=rb->data; + //Get real header + hdr=(buf_entry_hdr_t *)rb->read_ptr; + configASSERT(hdr->len < rb->size); + //No need to re-check if the ringbuffer is empty: the write routine will + //always write a dummy item plus the real data item in one go, so now we must + //be at the real data item by definition. + } + //Okay, pass the data back. + ret=rb->read_ptr+sizeof(buf_entry_hdr_t); + *length=hdr->len; + //...and move the read pointer past the data. + rb->read_ptr+=sizeof(buf_entry_hdr_t)+((hdr->len+3)&~3); + //The buffer will wrap around if we don't have room for a header anymore. + if ((rb->data + rb->size) - rb->read_ptr < sizeof(buf_entry_hdr_t)) { + rb->read_ptr=rb->data; + } + return ret; +} + +//Returns an item to the ringbuffer. Will mark the item as free, and will see if the free pointer +//can be increase. +//This function by itself is not threadsafe, always call from within a muxed section. +static void returnItemToRingbuf(ringbuf_t *rb, void *item) { + uint8_t *data=(uint8_t*)item; + configASSERT(((int)rb->free_ptr&3)==0); + configASSERT(data >= rb->data); + configASSERT(data < rb->data+rb->size); + //Grab the buffer entry that preceeds the buffer + buf_entry_hdr_t *hdr=(buf_entry_hdr_t*)(data-sizeof(buf_entry_hdr_t)); + configASSERT(hdr->len < rb->size); + configASSERT((hdr->flags & iflag_dummydata)==0); + configASSERT((hdr->flags & iflag_free)==0); + //Mark the buffer as free. + hdr->flags|=iflag_free; + + //Do a cleanup pass. + hdr=(buf_entry_hdr_t *)rb->free_ptr; + //basically forward free_ptr until we run into either a block that is still in use or the write pointer. + while (((hdr->flags & iflag_free) || (hdr->flags & iflag_dummydata)) && rb->free_ptr != rb->write_ptr) { + if (hdr->flags & iflag_dummydata) { + //Rest is dummy data. Reset to start of ringbuffer. + rb->free_ptr=rb->data; + } else { + //Skip past item + size_t len=(hdr->len+3)&~3; + rb->free_ptr+=len+sizeof(buf_entry_hdr_t); + configASSERT(rb->free_ptr<=rb->data+rb->size); + } + //The buffer will wrap around if we don't have room for a header anymore. + if ((rb->data+rb->size)-rb->free_ptr < sizeof(buf_entry_hdr_t)) { + rb->free_ptr=rb->data; + } + //Next header + hdr=(buf_entry_hdr_t *)rb->free_ptr; + } +} + + +void xRingbufferPrintInfo(RingbufHandle_t ringbuf) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + ets_printf("Rb size %d free %d rptr %d freeptr %d wptr %d\n", + rb->size, ringbufferFreeMem(rb), rb->read_ptr-rb->data, rb->free_ptr-rb->data, rb->write_ptr-rb->data); +} + + + +RingbufHandle_t xRingbufferCreate(size_t buf_length, BaseType_t allow_split_items) +{ + ringbuf_t *rb = malloc(sizeof(ringbuf_t)); + if (rb==NULL) goto err; + memset(rb, 0, sizeof(ringbuf_t)); + rb->data = malloc(buf_length); + if (rb->data == NULL) goto err; + rb->size = buf_length; + rb->free_ptr = rb->data; + rb->read_ptr = rb->data; + rb->write_ptr = rb->data; + rb->free_space_sem = xSemaphoreCreateBinary(); + rb->items_buffered_sem = xSemaphoreCreateBinary(); + rb->flags=0; + if (allow_split_items) rb->flags|=flag_allowsplit; + if (rb->free_space_sem == NULL || rb->items_buffered_sem == NULL) goto err; + vPortCPUInitializeMutex(&rb->mux); + return (RingbufHandle_t)rb; + +err: + //Some error has happened. Free/destroy all allocated things and return NULL. + if (rb) { + free(rb->data); + if (rb->free_space_sem) vSemaphoreDelete(rb->free_space_sem); + if (rb->items_buffered_sem) vSemaphoreDelete(rb->items_buffered_sem); + } + free(rb); + return NULL; +} + +void vRingbufferDelete(RingbufHandle_t ringbuf) { + ringbuf_t *rb=(ringbuf_t *)ringbuf; + if (rb) { + free(rb->data); + if (rb->free_space_sem) vSemaphoreDelete(rb->free_space_sem); + if (rb->items_buffered_sem) vSemaphoreDelete(rb->items_buffered_sem); + } + free(rb); +} + +size_t xRingbufferGetMaxItemSize(RingbufHandle_t ringbuf) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + //In both cases, we return 4 bytes less than what we actually can have. If the ringbuffer is + //indeed entirely filled, read_ptr==free_ptr, which throws off the free space calculation. + if (rb->flags & flag_allowsplit) { + //Worst case, we need to split an item into two, which means two headers of overhead. + return rb->size-(sizeof(buf_entry_hdr_t)*2)-4; + } else { + //Worst case, we have the write ptr in such a position that we are lacking four bytes of free + //memory to put an item into the rest of the memory. If this happens, we have to dummy-fill + //(item_data-4) bytes of buffer, then we only have (size-(item_data-4) bytes left to fill + //with the real item. (item size being header+data) + return (rb->size/2)-sizeof(buf_entry_hdr_t)-4; + } +} + +BaseType_t xRingbufferSend(RingbufHandle_t ringbuf, void *data, size_t dataSize, TickType_t ticks_to_wait) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + size_t needed_size=dataSize+sizeof(buf_entry_hdr_t); + BaseType_t done=pdFALSE; + portTickType ticks_end=xTaskGetTickCount() + ticks_to_wait; + + configASSERT(rb); + + if (dataSize > xRingbufferGetMaxItemSize(ringbuf)) { + //Data will never ever fit in the queue. + return pdFALSE; + } + + while (!done) { + //Check if there is enough room in the buffer. If not, wait until there is. + do { + if (ringbufferFreeMem(rb) < needed_size) { + //Data does not fit yet. Wait until the free_space_sem is given, then re-evaluate. + + BaseType_t r = xSemaphoreTake(rb->free_space_sem, ticks_to_wait); + if (r == pdFALSE) { + //Timeout. + return pdFALSE; + } + //Adjust ticks_to_wait; we may have waited less than that and in the case the free memory still is not enough, + //we will need to wait some more. + ticks_to_wait = ticks_end - xTaskGetTickCount(); + } + } while (ringbufferFreeMem(rb) < needed_size && ticks_to_wait>=0); + + //Lock the mux in order to make sure no one else is messing with the ringbuffer and do the copy. + portENTER_CRITICAL(&rb->mux); + //Another thread may have been able to sneak its write first. Check again now we locked the ringbuff, and retry + //everything if this is the case. Otherwise, we can write and are done. + done=copyItemToRingbuf(rb, data, dataSize); + portEXIT_CRITICAL(&rb->mux); + } + xSemaphoreGive(rb->items_buffered_sem); + return pdTRUE; +} + + +BaseType_t xRingbufferSendFromISR(RingbufHandle_t ringbuf, void *data, size_t dataSize, BaseType_t *higher_prio_task_awoken) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + BaseType_t write_succeeded; + configASSERT(rb); + size_t needed_size=dataSize+sizeof(buf_entry_hdr_t); + portENTER_CRITICAL_ISR(&rb->mux); + if (needed_size>ringbufferFreeMem(rb)) { + //Does not fit in the remaining space in the ringbuffer. + write_succeeded=pdFALSE; + } else { + copyItemToRingbuf(rb, data, dataSize); + write_succeeded=pdTRUE; + } + portEXIT_CRITICAL_ISR(&rb->mux); + if (write_succeeded) { + xSemaphoreGiveFromISR(rb->items_buffered_sem, higher_prio_task_awoken); + } + return write_succeeded; +} + + +void *xRingbufferReceive(RingbufHandle_t ringbuf, size_t *item_size, TickType_t ticks_to_wait) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + uint8_t *itemData; + BaseType_t done=pdFALSE; + configASSERT(rb); + while(!done) { + //See if there's any data available. If not, wait until there is. + while (rb->read_ptr == rb->write_ptr) { + BaseType_t r=xSemaphoreTake(rb->items_buffered_sem, ticks_to_wait); + if (r == pdFALSE) { + //Timeout. + return NULL; + } + } + //Okay, we seem to have data in the buffer. Grab the mux and copy it out if it's still there. + portENTER_CRITICAL(&rb->mux); + itemData=getItemFromRingbuf(rb, item_size); + portEXIT_CRITICAL(&rb->mux); + if (itemData) { + //We managed to get an item. + done=pdTRUE; + } + } + return (void*)itemData; +} + + +void *xRingbufferReceiveFromISR(RingbufHandle_t ringbuf, size_t *item_size) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + uint8_t *itemData; + configASSERT(rb); + portENTER_CRITICAL_ISR(&rb->mux); + itemData=getItemFromRingbuf(rb, item_size); + portEXIT_CRITICAL_ISR(&rb->mux); + return (void*)itemData; +} + + +void vRingbufferReturnItem(RingbufHandle_t ringbuf, void *item) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + portENTER_CRITICAL_ISR(&rb->mux); + returnItemToRingbuf(rb, item); + portEXIT_CRITICAL_ISR(&rb->mux); + xSemaphoreGive(rb->free_space_sem); +} + + +void vRingbufferReturnItemFromISR(RingbufHandle_t ringbuf, void *item, BaseType_t *higher_prio_task_awoken) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + portENTER_CRITICAL_ISR(&rb->mux); + returnItemToRingbuf(rb, item); + portEXIT_CRITICAL_ISR(&rb->mux); + xSemaphoreGiveFromISR(rb->free_space_sem, higher_prio_task_awoken); +} + + +BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + return xQueueAddToSet(rb->items_buffered_sem, xQueueSet); +} + + +BaseType_t xRingbufferAddToQueueSetWrite(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + return xQueueAddToSet(rb->free_space_sem, xQueueSet); +} + + +BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + return xQueueRemoveFromSet(rb->items_buffered_sem, xQueueSet); +} + +BaseType_t xRingbufferRemoveFromQueueSetWrite(RingbufHandle_t ringbuf, QueueSetHandle_t xQueueSet) +{ + ringbuf_t *rb=(ringbuf_t *)ringbuf; + configASSERT(rb); + return xQueueRemoveFromSet(rb->free_space_sem, xQueueSet); +} + From ed0a85ab4d283803cfe49e814952f9ca04df057a Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 28 Sep 2016 13:24:58 +0800 Subject: [PATCH 121/179] Kconfig: use 4 spaces to instead 1 tab In some Kconfig file, both 4 spaces and 1 tab are used mix, let's just use 4 space, it will be clean in some editor. --- Kconfig | 18 +-- components/bt/Kconfig | 28 ++-- components/esp32/Kconfig | 42 +++--- components/freertos/Kconfig | 250 +++++++++++++++++------------------ components/log/Kconfig | 14 +- components/lwip/Kconfig | 34 ++--- components/mbedtls/Kconfig | 2 +- components/spi_flash/Kconfig | 18 +-- 8 files changed, 203 insertions(+), 203 deletions(-) diff --git a/Kconfig b/Kconfig index 73770a79a6..11ea099de2 100644 --- a/Kconfig +++ b/Kconfig @@ -7,18 +7,18 @@ mainmenu "Espressif IoT Development Framework Configuration" menu "SDK tool configuration" config TOOLPREFIX - string "Compiler toolchain path/prefix" - default "xtensa-esp32-elf-" - help - The prefix/path that is used to call the toolchain. The default setting assumes - a crosstool-ng gcc setup that is in your PATH. + string "Compiler toolchain path/prefix" + default "xtensa-esp32-elf-" + help + The prefix/path that is used to call the toolchain. The default setting assumes + a crosstool-ng gcc setup that is in your PATH. config PYTHON string "Python 2 interpreter" - default "python" - help - The executable name/path that is used to run python. On some systems Python 2.x - may need to be invoked as python2. + default "python" + help + The executable name/path that is used to run python. On some systems Python 2.x + may need to be invoked as python2. endmenu source "$COMPONENT_KCONFIGS_PROJBUILD" diff --git a/components/bt/Kconfig b/components/bt/Kconfig index e397214d22..e43ff864de 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -3,27 +3,27 @@ visible if MEMMAP_BT config BT_ENABLED - bool - depends on ESP32_ENABLE_STACK_BT - help - This compiles in the low-level BT stack. + bool + depends on ESP32_ENABLE_STACK_BT + help + This compiles in the low-level BT stack. #config BT_BTLE -# bool "Enable BTLE" -# depends on BT_ENABLED -# help -# This compiles BTLE support +# bool "Enable BTLE" +# depends on BT_ENABLED +# help +# This compiles BTLE support # #config BT_BT -# bool "Enable classic BT" -# depends on BT_ENABLED -# help -# This enables classic BT support +# bool "Enable classic BT" +# depends on BT_ENABLED +# help +# This enables classic BT support endmenu # Memory reserved at start of DRAM for Bluetooth stack config BT_RESERVE_DRAM hex - default 0x10000 if MEMMAP_BT - default 0 + default 0x10000 if MEMMAP_BT + default 0 diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index b5754deed5..535df23eb5 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -84,7 +84,7 @@ config WIFI_ENABLED help This compiles in the low-level WiFi stack. - Temporarily, this option is not compatible with BT stack. + Temporarily, this option is not compatible with BT stack. config SYSTEM_EVENT_QUEUE_SIZE int "System event queue size" @@ -107,37 +107,37 @@ config MAIN_TASK_STACK_SIZE config NEWLIB_STDOUT_ADDCR - bool "Standard-out output adds carriage return before newline" - default y - help - Most people are used to end their printf strings with a newline. If this - is sent as is to the serial port, most terminal programs will only move the - cursor one line down, not also move it to the beginning of the line. This - is usually done by an added CR character. Enabling this will make the - standard output code automatically add a CR character before a LF. + bool "Standard-out output adds carriage return before newline" + default y + help + Most people are used to end their printf strings with a newline. If this + is sent as is to the serial port, most terminal programs will only move the + cursor one line down, not also move it to the beginning of the line. This + is usually done by an added CR character. Enabling this will make the + standard output code automatically add a CR character before a LF. config ULP_COPROC_ENABLED bool "Enable Ultra Low Power (ULP) Coprocessor" default "n" help - Set to 'y' if you plan to load a firmware for the coprocessor. + Set to 'y' if you plan to load a firmware for the coprocessor. - If this option is enabled, further coprocessor configuration will appear in the Components menu. + If this option is enabled, further coprocessor configuration will appear in the Components menu. config ULP_COPROC_RESERVE_MEM - int "RTC slow memory reserved for coprocessor" - default 512 - range 32 8192 - depends on ULP_COPROC_ENABLED - help - Bytes of memory to reserve for ULP coprocessor firmware & data. + int "RTC slow memory reserved for coprocessor" + default 512 + range 32 8192 + depends on ULP_COPROC_ENABLED + help + Bytes of memory to reserve for ULP coprocessor firmware & data. - Data is reserved at the beginning of RTC slow memory. + Data is reserved at the beginning of RTC slow memory. # Set CONFIG_ULP_COPROC_RESERVE_MEM to 0 if ULP is disabled config ULP_COPROC_RESERVE_MEM - int - default 0 - depends on !ULP_COPROC_ENABLED + int + default 0 + depends on !ULP_COPROC_ENABLED endmenu diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index d7c306c246..e350e347f3 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -2,192 +2,192 @@ menu "FreeRTOS" # This is actually also handled in the ESP32 startup code, not only in FreeRTOS. config FREERTOS_UNICORE - bool "Run FreeRTOS only on first core" - default n - help - This version of FreeRTOS normally takes control of all cores of - the CPU. Select this if you only want to start it on the first core. - This is needed when e.g. another process needs complete control - over the second core. + bool "Run FreeRTOS only on first core" + default n + help + This version of FreeRTOS normally takes control of all cores of + the CPU. Select this if you only want to start it on the first core. + This is needed when e.g. another process needs complete control + over the second core. choice FREERTOS_CORETIMER - prompt "Xtensa timer to use as the FreeRTOS tick source" - default CONFIG_FREERTOS_CORETIMER_0 - help - FreeRTOS needs a timer with an associated interrupt to use as - the main tick source to increase counters, run timers and do - pre-emptive multitasking with. There are multiple timers available - to do this, with different interrupt priorities. Check + prompt "Xtensa timer to use as the FreeRTOS tick source" + default CONFIG_FREERTOS_CORETIMER_0 + help + FreeRTOS needs a timer with an associated interrupt to use as + the main tick source to increase counters, run timers and do + pre-emptive multitasking with. There are multiple timers available + to do this, with different interrupt priorities. Check config FREERTOS_CORETIMER_0 - bool "Timer 0 (int 6, level 1)" - help - Select this to use timer 0 + bool "Timer 0 (int 6, level 1)" + help + Select this to use timer 0 config FREERTOS_CORETIMER_1 - bool "Timer 1 (int 15, level 3)" - help - Select this to use timer 1 + bool "Timer 1 (int 15, level 3)" + help + Select this to use timer 1 config FREERTOS_CORETIMER_2 - bool "Timer 2 (int 16, level 5)" - help - Select this to use timer 2 + bool "Timer 2 (int 16, level 5)" + help + Select this to use timer 2 endchoice config FREERTOS_HZ - int "Tick rate (Hz)" - range 1 10000 - default 100 - help - Select the tick rate at which FreeRTOS does pre-emptive context switching. + int "Tick rate (Hz)" + range 1 10000 + default 100 + help + Select the tick rate at which FreeRTOS does pre-emptive context switching. choice FREERTOS_CHECK_STACKOVERFLOW - prompt "Check for stack overflow" - default FREERTOS_CHECK_STACKOVERFLOW_QUICK - help - FreeRTOS can check for stack overflows in threads and trigger an user function - called vApplicationStackOverflowHook when this happens. + prompt "Check for stack overflow" + default FREERTOS_CHECK_STACKOVERFLOW_QUICK + help + FreeRTOS can check for stack overflows in threads and trigger an user function + called vApplicationStackOverflowHook when this happens. config FREERTOS_CHECK_STACKOVERFLOW_NONE - bool "No checking" - help - Do not check for stack overflows (configCHECK_FOR_STACK_OVERFLOW=0) + bool "No checking" + help + Do not check for stack overflows (configCHECK_FOR_STACK_OVERFLOW=0) config FREERTOS_CHECK_STACKOVERFLOW_PTRVAL - bool "Check by stack pointer value" - help - Check for stack overflows on each context switch by checking if - the stack pointer is in a valid range. Quick but does not detect - stack overflows that happened between context switches - (configCHECK_FOR_STACK_OVERFLOW=1) + bool "Check by stack pointer value" + help + Check for stack overflows on each context switch by checking if + the stack pointer is in a valid range. Quick but does not detect + stack overflows that happened between context switches + (configCHECK_FOR_STACK_OVERFLOW=1) config FREERTOS_CHECK_STACKOVERFLOW_CANARY - bool "Check using canary bytes" - help - Places some magic bytes at the end of the stack area and on each - context switch, check if these bytes are still intact. More thorough - than just checking the pointer, but also slightly slower. - (configCHECK_FOR_STACK_OVERFLOW=2) + bool "Check using canary bytes" + help + Places some magic bytes at the end of the stack area and on each + context switch, check if these bytes are still intact. More thorough + than just checking the pointer, but also slightly slower. + (configCHECK_FOR_STACK_OVERFLOW=2) endchoice config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS - int "Amount of thread local storage pointers" - range 0 256 if !WIFI_ENABLED - range 1 256 if WIFI_ENABLED - default 1 - help - FreeRTOS has the ability to store per-thread pointers in the task - control block. This controls the amount of pointers available; - 0 turns off this functionality. + int "Amount of thread local storage pointers" + range 0 256 if !WIFI_ENABLED + range 1 256 if WIFI_ENABLED + default 1 + help + FreeRTOS has the ability to store per-thread pointers in the task + control block. This controls the amount of pointers available; + 0 turns off this functionality. - If using the WiFi stack, this value must be at least 1. + If using the WiFi stack, this value must be at least 1. #This still needs to be implemented. choice FREERTOS_PANIC - prompt "Panic handler behaviour" - default FREERTOS_PANIC_PRINT_REBOOT - help - If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is - invoked. Configure the panic handlers action here. + prompt "Panic handler behaviour" + default FREERTOS_PANIC_PRINT_REBOOT + help + If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is + invoked. Configure the panic handlers action here. config FREERTOS_PANIC_PRINT_HALT - bool "Print registers and halt" - help - Outputs the relevant registers over the serial port and halt the - processor. Needs a manual reset to restart. + bool "Print registers and halt" + help + Outputs the relevant registers over the serial port and halt the + processor. Needs a manual reset to restart. config FREERTOS_PANIC_PRINT_REBOOT - bool "Print registers and reboot" - help - Outputs the relevant registers over the serial port and immediately - reset the processor. + bool "Print registers and reboot" + help + Outputs the relevant registers over the serial port and immediately + reset the processor. config FREERTOS_PANIC_SILENT_REBOOT - bool "Silent reboot" - help - Just resets the processor without outputting anything + bool "Silent reboot" + help + Just resets the processor without outputting anything config FREERTOS_PANIC_GDBSTUB - bool "Invoke GDBStub" - help - Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem - of the crash. + bool "Invoke GDBStub" + help + Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem + of the crash. endchoice config FREERTOS_DEBUG_OCDAWARE - bool "Make exception and panic handlers JTAG/OCD aware" - default y - help - The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and - instead of panicking, have the debugger stop on the offending instruction. + bool "Make exception and panic handlers JTAG/OCD aware" + default y + help + The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and + instead of panicking, have the debugger stop on the offending instruction. choice FREERTOS_ASSERT - prompt "FreeRTOS assertions" - default FREERTOS_ASSERT_FAIL_ABORT - help - Failed FreeRTOS configASSERT() assertions can be configured to - behave in different ways. + prompt "FreeRTOS assertions" + default FREERTOS_ASSERT_FAIL_ABORT + help + Failed FreeRTOS configASSERT() assertions can be configured to + behave in different ways. config FREERTOS_ASSERT_FAIL_ABORT - bool "abort() on failed assertions" - help - If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and - halt execution. The panic handler can be configured to handle - the outcome of an abort() in different ways. + bool "abort() on failed assertions" + help + If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and + halt execution. The panic handler can be configured to handle + the outcome of an abort() in different ways. config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE - bool "Print and continue failed assertions" - help - If a FreeRTOS assertion fails, print it out and continue. + bool "Print and continue failed assertions" + help + If a FreeRTOS assertion fails, print it out and continue. config FREERTOS_ASSERT_DISABLE - bool "Disable FreeRTOS assertions" - help - FreeRTOS configASSERT() will not be compiled into the binary. + bool "Disable FreeRTOS assertions" + help + FreeRTOS configASSERT() will not be compiled into the binary. endchoice config FREERTOS_BREAK_ON_SCHEDULER_START_JTAG - bool "Stop program on scheduler start when JTAG/OCD is detected" - depends on FREERTOS_DEBUG_OCDAWARE - default y - help - If JTAG/OCD is connected, stop execution when the scheduler is started and the first - task is executed. + bool "Stop program on scheduler start when JTAG/OCD is detected" + depends on FREERTOS_DEBUG_OCDAWARE + default y + help + If JTAG/OCD is connected, stop execution when the scheduler is started and the first + task is executed. menuconfig ENABLE_MEMORY_DEBUG - bool "Enable heap memory debug" - default n - help - Enable this option to show malloc heap block and memory crash detect + bool "Enable heap memory debug" + default n + help + Enable this option to show malloc heap block and memory crash detect menuconfig FREERTOS_DEBUG_INTERNALS - bool "Debug FreeRTOS internals" - default n - help - Enable this option to show the menu with internal FreeRTOS debugging features. - This option does not change any code by itself, it just shows/hides some options. + bool "Debug FreeRTOS internals" + default n + help + Enable this option to show the menu with internal FreeRTOS debugging features. + This option does not change any code by itself, it just shows/hides some options. if FREERTOS_DEBUG_INTERNALS config FREERTOS_PORTMUX_DEBUG - bool "Debug portMUX portENTER_CRITICAL/portEXIT_CRITICAL" - depends on FREERTOS_DEBUG_INTERNALS - default n - help - If enabled, debug information (including integrity checks) will be printed - to UART for the port-specific MUX implementation. + bool "Debug portMUX portENTER_CRITICAL/portEXIT_CRITICAL" + depends on FREERTOS_DEBUG_INTERNALS + default n + help + If enabled, debug information (including integrity checks) will be printed + to UART for the port-specific MUX implementation. config FREERTOS_PORTMUX_DEBUG_RECURSIVE - bool "Debug portMUX Recursion" - depends on FREERTOS_PORTMUX_DEBUG - default n - help - If enabled, additional debug information will be printed for recursive - portMUX usage. + bool "Debug portMUX Recursion" + depends on FREERTOS_PORTMUX_DEBUG + default n + help + If enabled, additional debug information will be printed for recursive + portMUX usage. endif # FREERTOS_DEBUG_INTERNALS diff --git a/components/log/Kconfig b/components/log/Kconfig index 1627ea1830..43e3a523ff 100644 --- a/components/log/Kconfig +++ b/components/log/Kconfig @@ -28,13 +28,13 @@ config LOG_DEFAULT_LEVEL_VERBOSE endchoice config LOG_DEFAULT_LEVEL - int - default 0 if LOG_DEFAULT_LEVEL_NONE - default 1 if LOG_DEFAULT_LEVEL_ERROR - default 2 if LOG_DEFAULT_LEVEL_WARN - default 3 if LOG_DEFAULT_LEVEL_INFO - default 4 if LOG_DEFAULT_LEVEL_DEBUG - default 5 if LOG_DEFAULT_LEVEL_VERBOSE + int + default 0 if LOG_DEFAULT_LEVEL_NONE + default 1 if LOG_DEFAULT_LEVEL_ERROR + default 2 if LOG_DEFAULT_LEVEL_WARN + default 3 if LOG_DEFAULT_LEVEL_INFO + default 4 if LOG_DEFAULT_LEVEL_DEBUG + default 5 if LOG_DEFAULT_LEVEL_VERBOSE config LOG_COLORS bool "Use ANSI terminal colors in log output" diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index ceb1453f9a..715d7dd467 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -1,27 +1,27 @@ menu "LWIP" config LWIP_MAX_SOCKETS - int "Max number of open sockets" - range 1 16 - default 4 - help - Sockets take up a certain amount of memory, and allowing fewer - sockets to be open at the same time conserves memory. Specify - the maximum amount of sockets here. + int "Max number of open sockets" + range 1 16 + default 4 + help + Sockets take up a certain amount of memory, and allowing fewer + sockets to be open at the same time conserves memory. Specify + the maximum amount of sockets here. config LWIP_THREAD_LOCAL_STORAGE_INDEX - int "Index for thread-local-storage pointer for lwip" - default 0 - help - Specify the thread-local-storage-pointer index for lwip - use. + int "Index for thread-local-storage pointer for lwip" + default 0 + help + Specify the thread-local-storage-pointer index for lwip + use. config LWIP_SO_REUSE - bool "Enable SO_REUSEADDR option" - default 0 - help - Enabling this option allows binding to a port which remains in - TIME_WAIT. + bool "Enable SO_REUSEADDR option" + default 0 + help + Enabling this option allows binding to a port which remains in + TIME_WAIT. endmenu diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index b9c92bd7cc..60facc7d27 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -2,7 +2,7 @@ menu "mbedTLS" config MBEDTLS_SSL_MAX_CONTENT_LEN int "TLS maximum message content length" - default 16384 + default 16384 range 512 16384 help Maximum TLS message length (in bytes) supported by mbedTLS. diff --git a/components/spi_flash/Kconfig b/components/spi_flash/Kconfig index c344a6b748..154dc7c30f 100644 --- a/components/spi_flash/Kconfig +++ b/components/spi_flash/Kconfig @@ -1,15 +1,15 @@ menu "SPI Flash driver" config SPI_FLASH_ENABLE_COUNTERS - bool "Enable operation counters" - default 0 - help - This option enables the following APIs: - spi_flash_reset_counters - spi_flash_dump_counters - spi_flash_get_counters - These APIs may be used to collect performance data for spi_flash APIs - and to help understand behaviour of libraries which use SPI flash. + bool "Enable operation counters" + default 0 + help + This option enables the following APIs: + spi_flash_reset_counters + spi_flash_dump_counters + spi_flash_get_counters + These APIs may be used to collect performance data for spi_flash APIs + and to help understand behaviour of libraries which use SPI flash. endmenu From 8fcb0827aea62feee12d21675c509a2d4ea5a0a6 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 28 Sep 2016 16:21:24 +0800 Subject: [PATCH 122/179] components/tcpip_adapter: add comments for tcpip_adapter --- .../tcpip_adapter/include/tcpip_adapter.h | 259 +++++++++++++++++- 1 file changed, 248 insertions(+), 11 deletions(-) diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index ae33892094..5737ab7a02 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -15,6 +15,15 @@ #ifndef _TCPIP_ADAPTER_H_ #define _TCPIP_ADAPTER_H_ +/** + * @brief TCPIP adapter library + * + * The aim of this adapter is to provide an abstract layer upon TCPIP stack. + * With this layer, switch to other TCPIP stack is possible and easy in esp-idf. + * + * TODO: ipv6 support will be added. + */ + #include #include "rom/queue.h" #include "esp_wifi_types.h" @@ -55,7 +64,7 @@ struct station_list { #endif -#define ESP_ERR_TCPIP_ADAPTER_BASE 0x5000 // base should be moved to esp_err.h +#define ESP_ERR_TCPIP_ADAPTER_BASE 0x5000 // TODO: move base address to esp_err.h #define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS ESP_ERR_TCPIP_ADAPTER_BASE + 0x00 #define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY ESP_ERR_TCPIP_ADAPTER_BASE + 0x01 @@ -65,46 +74,125 @@ struct station_list { #define ESP_ERR_TCPIP_ADAPTER_NO_MEM ESP_ERR_TCPIP_ADAPTER_BASE + 0x05 #define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x06 -/* will add ethernet interface */ +/* TODO: add Ethernet interface */ typedef enum { TCPIP_ADAPTER_IF_STA = 0, /**< ESP32 station interface */ TCPIP_ADAPTER_IF_AP, /**< ESP32 soft-AP interface */ TCPIP_ADAPTER_IF_MAX } tcpip_adapter_if_t; +/* status of DHCP client or DHCP server */ typedef enum { - TCPIP_ADAPTER_DHCP_INIT = 0, - TCPIP_ADAPTER_DHCP_STARTED, - TCPIP_ADAPTER_DHCP_STOPPED, + TCPIP_ADAPTER_DHCP_INIT = 0, /**< DHCP client/server in initial state */ + TCPIP_ADAPTER_DHCP_STARTED, /**< DHCP client/server already been started */ + TCPIP_ADAPTER_DHCP_STOPPED, /**< DHCP client/server already been stopped */ TCPIP_ADAPTER_DHCP_STATUS_MAX } tcpip_adapter_dhcp_status_t; +/* set the option mode for DHCP client or DHCP server */ typedef enum{ TCPIP_ADAPTER_OP_START = 0, - TCPIP_ADAPTER_OP_SET, - TCPIP_ADAPTER_OP_GET, + TCPIP_ADAPTER_OP_SET, /**< set option mode */ + TCPIP_ADAPTER_OP_GET, /**< get option mode */ TCPIP_ADAPTER_OP_MAX } tcpip_adapter_option_mode_t; typedef enum{ - TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS = 32, - TCPIP_ADAPTER_REQUESTED_IP_ADDRESS = 50, - TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME = 51, - TCPIP_ADAPTER_IP_REQUEST_RETRY_TIME = 52, + TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS = 32, /**< solicitation router address */ + TCPIP_ADAPTER_REQUESTED_IP_ADDRESS = 50, /**< request IP address pool */ + TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME = 51, /**< request IP address lease time */ + TCPIP_ADAPTER_IP_REQUEST_RETRY_TIME = 52, /**< request IP address retry counter */ } tcpip_adapter_option_id_t; +/** + * @brief Initialize tcpip adpater + * + * This will initialize TCPIP stack inside. + */ void tcpip_adapter_init(void); +/** + * @brief Start an interface with specific MAC and IP + * + * softAP or station interface will be initialized, connect WiFi stack with TCPIP stack. + * + * For softAP interface, DHCP server will be started automatically. + * + * @param[in] tcpip_if: the interface which we will start + * @param[in] mac: set MAC address of this interface + * @param[in] ip_info: set IP address of this interface + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_NO_MEM + */ esp_err_t tcpip_adapter_start(tcpip_adapter_if_t tcpip_if, uint8_t *mac, tcpip_adapter_ip_info_t *ip_info); +/** + * @brief Stop an interface + * + * The interface will be cleanup in this API, if DHCP server/client are started, will be stopped. + * + * @param[in] tcpip_if: the interface which will be started + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + */ esp_err_t tcpip_adapter_stop(tcpip_adapter_if_t tcpip_if); +/** + * @brief Bring up an interface + * + * Only station interface need to be brought up, since station interface will be shut down when disconnect. + * + * @param[in] tcpip_if: the interface which will be up + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + */ esp_err_t tcpip_adapter_up(tcpip_adapter_if_t tcpip_if); +/** + * @brief Shut down an interface + * + * Only station interface need to be shut down, since station interface will be brought up when connect. + * + * @param[in] tcpip_if: the interface which will be down + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + */ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if); +/** + * @brief Get interface's IP information + * + * There has an IP information copy in adapter library, if interface is up, get IP information from + * interface, otherwise get from copy. + * + * @param[in] tcpip_if: the interface which we want to get IP information + * @param[out] ip_info: If successful, IP information will be returned in this argument. + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + */ esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); +/** + * @brief Set interface's IP information + * + * There has an IP information copy in adapter library, if interface is up, also set interface's IP. + * DHCP client/server should be stopped before set new IP information. + * + * This function is mainly used for setting static IP. + * + * @param[in] tcpip_if: the interface which we want to set IP information + * @param[in] ip_info: If successful, IP information will be returned in this argument. + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + */ esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); #if 0 @@ -113,22 +201,171 @@ esp_err_t tcpip_adapter_get_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac); esp_err_t tcpip_adapter_set_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac); #endif +/** + * @brief Get DHCP server's status + * + * @param[in] tcpip_if: the interface which we will get status of DHCP server + * @param[out] status: If successful, the status of DHCP server will be return in this argument. + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_dhcps_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status); + +/** + * @brief Set or Get DHCP server's option + * + * @param[in] opt_op: option operate type, 1 for SET, 2 for GET. + * @param[in] opt_id: option index, 32 for ROUTER, 50 for IP POLL, 51 for LEASE TIME, 52 for REQUEST TIME + * @param[in] opt_val: option parameter + * @param[in] opt_len: option length + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + */ esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_option_mode_t opt_op, tcpip_adapter_option_id_t opt_id, void *opt_val, uint32_t opt_len); + +/** + * @brief Start DHCP server + * + * @note Currently DHCP server is bind to softAP interface. + * + * @param[in] tcpip_if: the interface which we will start DHCP server + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + */ esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if); + +/** + * @brief Stop DHCP server + * + * @note Currently DHCP server is bind to softAP interface. + * + * @param[in] tcpip_if: the interface which we will stop DHCP server + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPED + * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + */ esp_err_t tcpip_adapter_dhcps_stop(tcpip_adapter_if_t tcpip_if); +/** + * @brief Get DHCP client status + * + * @param[in] tcpip_if: the interface which we will get status of DHCP client + * @param[out] status: If successful, the status of DHCP client will be return in this argument. + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_dhcpc_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status); + +/** + * @brief Set or Get DHCP client's option + * + * @note This function is not implement now. + * + * @param[in] opt_op: option operate type, 1 for SET, 2 for GET. + * @param[in] opt_id: option index, 32 for ROUTER, 50 for IP POLL, 51 for LEASE TIME, 52 for REQUEST TIME + * @param[in] opt_val: option parameter + * @param[in] opt_len: option length + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_dhcpc_option(tcpip_adapter_option_mode_t opt_op, tcpip_adapter_option_id_t opt_id, void *opt_val, uint32_t opt_len); + +/** + * @brief Start DHCP client + * + * @note Currently DHCP client is bind to station interface. + * + * @param[in] tcpip_if: the interface which we will start DHCP client + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + * ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED + */ esp_err_t tcpip_adapter_dhcpc_start(tcpip_adapter_if_t tcpip_if); + +/** + * @brief Stop DHCP client + * + * @note Currently DHCP client is bind to station interface. + * + * @param[in] tcpip_if: the interface which we will stop DHCP client + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPED + * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + */ esp_err_t tcpip_adapter_dhcpc_stop(tcpip_adapter_if_t tcpip_if); +/** + * @brief Get data from station interface + * + * This function should be installed by esp_wifi_reg_rxcb, so WiFi packets will be forward to TCPIP stack. + * + * @param[in] void *buffer: the received data point + * @param[in] uint16_t len: the received data length + * @param[in] void *eb: parameter + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_sta_input(void *buffer, uint16_t len, void *eb); + +/** + * @brief Get data from softAP interface + * + * This function should be installed by esp_wifi_reg_rxcb, so WiFi packets will be forward to TCPIP stack. + * + * @param[in] void *buffer: the received data point + * @param[in] uint16_t len: the received data length + * @param[in] void *eb: parameter + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_ap_input(void *buffer, uint16_t len, void *eb); +/** + * @brief Get WiFi interface index + * + * Get WiFi interface from TCPIP interface struct pointer. + * + * @param[in] void *dev: adapter interface + * + * @return WIFI_IF_STA + * WIFI_IF_AP + * WIFI_IF_MAX + */ wifi_interface_t tcpip_adapter_get_wifi_if(void *dev); +/** + * @brief Get the station information list + * + * @note This function should be called in AP mode and dhcp server started, and the list should + * be by using tcpip_adapter_free_sta_list. + * + * @param[in] sta_info: station information + * @param[out] sta_list: station information list + * + * @return ESP_OK + * ESP_ERR_TCPIP_ADAPTER_NO_MEM + * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + */ esp_err_t tcpip_adapter_get_sta_list(struct station_info *sta_info, struct station_list **sta_list); + +/** + * @brief Free the station information list's memory + * + * @param sta_list: station information list + * + * @return ESP_OK + */ esp_err_t tcpip_adapter_free_sta_list(struct station_list *sta_list); #ifdef __cplusplus From 60d0cb29d310c1bf5af38fca58c4a0c7ed498101 Mon Sep 17 00:00:00 2001 From: liuhan Date: Mon, 26 Sep 2016 20:44:42 +0800 Subject: [PATCH 123/179] components/expat: add expat library description add XML instruction, see expat file. --- components/expat/expat.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 components/expat/expat.rst diff --git a/components/expat/expat.rst b/components/expat/expat.rst new file mode 100644 index 0000000000..ee095d5ea7 --- /dev/null +++ b/components/expat/expat.rst @@ -0,0 +1,22 @@ +The Expat XML Parse Instruction +============================= + +Expat is an XML parser library written in C which be used for parse XML documents. + +It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document. + +It can parse some larger files. + +- Expat XML Parser Support many different processor, But for the most part function you only need four function as follows: + + *XML_ParserCreate:* Create a new parser object + + *XML_SetElementHandler:* Set handlers for start and end tags + + *XML_SetCharacterDataHandler:* Set handler for text + + *XML_Parse:* Pass a buffer full of document to the parser + +More information about Expat library will show them on http://expat.sourceforge.net + +An introductory article on using Expat is available on http://xml.com From bee7f5e4554395b7f8453a02b5fef9de5fad417e Mon Sep 17 00:00:00 2001 From: liuhan Date: Mon, 26 Sep 2016 20:49:06 +0800 Subject: [PATCH 124/179] components/nghttp: add nghttp library description add HTTP/2 instruction, see nghttp file. --- components/nghttp/nghttp.rst | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 components/nghttp/nghttp.rst diff --git a/components/nghttp/nghttp.rst b/components/nghttp/nghttp.rst new file mode 100644 index 0000000000..45297d16d9 --- /dev/null +++ b/components/nghttp/nghttp.rst @@ -0,0 +1,44 @@ +The nghttp Instruction +============================= + +This is an implementation of the Hypertext Transfer Protocol version 2 in C. + +The framing layer of HTTP/2 is implemented as a reusable C library. + +An HPACK encoder and decoder are available as a public API. + +- The nghttp support many different processor, But for the most part function you only need the function as follows: + + *nghttp2_session_callbacks_new:* Initializes *callbacks_ptr with NULL values + + *nghttp2_session_client_new:* Initializes *session_ptr for client use + + *nghttp2_session_callbacks_del:* Frees any resources allocated for callbacks + + *nghttp2_submit_settings:* Stores local settings and submits SETTINGS frame + + *nghttp2_submit_request:* Submits HEADERS frame and optionally one or more DATA frames + + *nghttp2_session_want_read:* Returns nonzero value if session wants to receive data from the remote peer + + *nghttp2_session_want_write:* Returns nonzero value if session wants to send data to the remote peer + + *nghttp2_session_recv:* Receives frames from the remote peer + + *nghttp2_session_send:* Sends pending frames to the remote peer + + *nghttp2_session_del:* Frees any resources allocated for session + +If you are following TLS related RFC, you know that NPN is not the standardized way to negotiate HTTP/2. NPN itself is not event published as RFC. + +The standard way to negotiate HTTP/2 is ALPN, Application-Layer Protocol Negotiation Extension, defined in RFC 7301. + +- The following endpoints are available to try out the nghttp2 implementation: + + https://nghttp2.org/ (TLS + ALPN/NPN) + + This endpoint supports h2, h2-16, h2-14, spdy/3.1 and http/1.1 via ALPN/NPN and requires TLSv1.2 for HTTP/2 connection. + +More information about nghttp library will show them on https://nghttp2.org + +An introductory article on protocol is available on RFC 7540 HTTP/2 and RFC 7541 HPACK - Header Compression for HTTP/2 From b366d5b1e71bf0f516b46da5399e0ec1c4635399 Mon Sep 17 00:00:00 2001 From: liuhan Date: Wed, 28 Sep 2016 10:10:36 +0800 Subject: [PATCH 125/179] components/expat: a few grammar fixes modify a few grammar, see expat.rst file. --- components/expat/expat.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/expat/expat.rst b/components/expat/expat.rst index ee095d5ea7..75c6bcaf83 100644 --- a/components/expat/expat.rst +++ b/components/expat/expat.rst @@ -7,7 +7,7 @@ It is a stream-oriented parser in which an application registers handlers for th It can parse some larger files. -- Expat XML Parser Support many different processor, But for the most part function you only need four function as follows: +- Expat XML Parser support many different processor, but for the most part function you only need the following functions: *XML_ParserCreate:* Create a new parser object @@ -17,6 +17,6 @@ It can parse some larger files. *XML_Parse:* Pass a buffer full of document to the parser -More information about Expat library will show them on http://expat.sourceforge.net +More information about Expat library can be found on http://expat.sourceforge.net An introductory article on using Expat is available on http://xml.com From 89bc31e15865383827cfb97ec62f0bd704304904 Mon Sep 17 00:00:00 2001 From: liuhan Date: Wed, 28 Sep 2016 10:18:15 +0800 Subject: [PATCH 126/179] components/nghttp: a few grammar fixes modify a few grammar, see nghttp.rst file. --- components/nghttp/nghttp.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/nghttp/nghttp.rst b/components/nghttp/nghttp.rst index 45297d16d9..77988a2a7f 100644 --- a/components/nghttp/nghttp.rst +++ b/components/nghttp/nghttp.rst @@ -7,7 +7,7 @@ The framing layer of HTTP/2 is implemented as a reusable C library. An HPACK encoder and decoder are available as a public API. -- The nghttp support many different processor, But for the most part function you only need the function as follows: +- The nghttp support many different processor, but for the most part you only need the following functions: *nghttp2_session_callbacks_new:* Initializes *callbacks_ptr with NULL values @@ -29,7 +29,7 @@ An HPACK encoder and decoder are available as a public API. *nghttp2_session_del:* Frees any resources allocated for session -If you are following TLS related RFC, you know that NPN is not the standardized way to negotiate HTTP/2. NPN itself is not event published as RFC. +If you are following TLS related RFC, you know that NPN is not the standardized way to negotiate HTTP/2. NPN itself is not even published as RFC. The standard way to negotiate HTTP/2 is ALPN, Application-Layer Protocol Negotiation Extension, defined in RFC 7301. @@ -39,6 +39,6 @@ The standard way to negotiate HTTP/2 is ALPN, Application-Layer Protocol Negotia This endpoint supports h2, h2-16, h2-14, spdy/3.1 and http/1.1 via ALPN/NPN and requires TLSv1.2 for HTTP/2 connection. -More information about nghttp library will show them on https://nghttp2.org +More information about nghttp library can be found at https://nghttp2.org An introductory article on protocol is available on RFC 7540 HTTP/2 and RFC 7541 HPACK - Header Compression for HTTP/2 From 9eb29ab43e49391af6b393861aac2bd28a7fe0e7 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 28 Sep 2016 13:50:34 +0800 Subject: [PATCH 127/179] components/nghttp: just change format of nghttp.rst preview will be better. --- components/nghttp/nghttp.rst | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/components/nghttp/nghttp.rst b/components/nghttp/nghttp.rst index 77988a2a7f..21dd697bff 100644 --- a/components/nghttp/nghttp.rst +++ b/components/nghttp/nghttp.rst @@ -1,39 +1,39 @@ The nghttp Instruction ============================= - + This is an implementation of the Hypertext Transfer Protocol version 2 in C. The framing layer of HTTP/2 is implemented as a reusable C library. An HPACK encoder and decoder are available as a public API. -- The nghttp support many different processor, but for the most part you only need the following functions: +- The nghttp support many different processor, but for the most part you only need the following functions: - *nghttp2_session_callbacks_new:* Initializes *callbacks_ptr with NULL values + **nghttp2_session_callbacks_new**: Initializes \*callbacks_ptr with NULL values - *nghttp2_session_client_new:* Initializes *session_ptr for client use + **nghttp2_session_client_new**: Initializes \*session_ptr for client use - *nghttp2_session_callbacks_del:* Frees any resources allocated for callbacks + **nghttp2_session_callbacks_del**: Frees any resources allocated for callbacks + + **nghttp2_submit_settings**: Stores local settings and submits SETTINGS frame + + **nghttp2_submit_request**: Submits HEADERS frame and optionally one or more DATA frames + + **nghttp2_session_want_read**: Returns nonzero value if session wants to receive data from the remote peer + + **nghttp2_session_want_write**: Returns nonzero value if session wants to send data to the remote peer + + **nghttp2_session_recv**: Receives frames from the remote peer + + **nghttp2_session_send**: Sends pending frames to the remote peer + + **nghttp2_session_del**: Frees any resources allocated for session - *nghttp2_submit_settings:* Stores local settings and submits SETTINGS frame - - *nghttp2_submit_request:* Submits HEADERS frame and optionally one or more DATA frames - - *nghttp2_session_want_read:* Returns nonzero value if session wants to receive data from the remote peer - - *nghttp2_session_want_write:* Returns nonzero value if session wants to send data to the remote peer - - *nghttp2_session_recv:* Receives frames from the remote peer - - *nghttp2_session_send:* Sends pending frames to the remote peer - - *nghttp2_session_del:* Frees any resources allocated for session - If you are following TLS related RFC, you know that NPN is not the standardized way to negotiate HTTP/2. NPN itself is not even published as RFC. The standard way to negotiate HTTP/2 is ALPN, Application-Layer Protocol Negotiation Extension, defined in RFC 7301. -- The following endpoints are available to try out the nghttp2 implementation: +- The following endpoints are available to try out the nghttp2 implementation: https://nghttp2.org/ (TLS + ALPN/NPN) From 83ea5be9a21faa7d9b4167e45f9ba12900356c59 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Wed, 28 Sep 2016 13:53:38 +0800 Subject: [PATCH 128/179] components/expat: just change format of expat.rst preview will be better. --- components/expat/expat.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/expat/expat.rst b/components/expat/expat.rst index 75c6bcaf83..9e681229e7 100644 --- a/components/expat/expat.rst +++ b/components/expat/expat.rst @@ -1,21 +1,21 @@ The Expat XML Parse Instruction ============================= - + Expat is an XML parser library written in C which be used for parse XML documents. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document. - + It can parse some larger files. - + - Expat XML Parser support many different processor, but for the most part function you only need the following functions: - *XML_ParserCreate:* Create a new parser object + **XML_ParserCreate**: Create a new parser object - *XML_SetElementHandler:* Set handlers for start and end tags + **XML_SetElementHandler**: Set handlers for start and end tags - *XML_SetCharacterDataHandler:* Set handler for text + **XML_SetCharacterDataHandler**: Set handler for text - *XML_Parse:* Pass a buffer full of document to the parser + **XML_Parse**: Pass a buffer full of document to the parser More information about Expat library can be found on http://expat.sourceforge.net From b3309a03a3561cf63c0a9aa5eb7bcce0bed2fae6 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Wed, 28 Sep 2016 17:02:44 +0800 Subject: [PATCH 129/179] Automatically pin no-cpu-affinity task to a core when FPU is used --- components/freertos/include/freertos/task.h | 6 ++++++ components/freertos/tasks.c | 12 ++++++++++++ components/freertos/xtensa_vectors.S | 15 +++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/components/freertos/include/freertos/task.h b/components/freertos/include/freertos/task.h index ddf7a7589d..9f3f3d659e 100644 --- a/components/freertos/include/freertos/task.h +++ b/components/freertos/include/freertos/task.h @@ -1979,6 +1979,12 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcN */ UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; + +/* + * Get the current core affinity of a task + */ +BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; + /* * Set the uxTaskNumber of the task referenced by the xTask parameter to * uxHandle. diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index b9035bda0f..bdf3712b7d 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -3337,6 +3337,18 @@ TCB_t *pxNewTCB; } /*-----------------------------------------------------------*/ +BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) +{ + TCB_t *pxTCB; + UBaseType_t uxReturn; + + pxTCB = prvGetTCBFromHandle( xTask ); + + return pxTCB->xCoreID; +} +/*-----------------------------------------------------------*/ + + #if ( configUSE_TRACE_FACILITY == 1 ) static UBaseType_t prvListTaskWithinSingleList( TaskStatus_t *pxTaskStatusArray, List_t *pxList, eTaskState eState ) diff --git a/components/freertos/xtensa_vectors.S b/components/freertos/xtensa_vectors.S index 0ff6c4c19b..57bfbe9f1e 100644 --- a/components/freertos/xtensa_vectors.S +++ b/components/freertos/xtensa_vectors.S @@ -92,6 +92,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xtensa_rtos.h" +.extern pxCurrentTCB /* Enable stack backtrace across exception/interrupt - see below */ #define XT_DEBUG_BACKTRACE 0 @@ -892,6 +893,20 @@ _xt_coproc_exc: addx4 a0, a5, a0 /* a0 = &_xt_coproc_mask[n] */ l32i a0, a0, 0 /* a0 = (n << 16) | (1 << n) */ + /* TODO: Remove this as soon as coprocessor state moving works across cores - JD */ + /* FPU operations are incompatible with non-pinned tasks. If we have a FPU operation + here, to keep the entire thing from crashing, it's better to pin the task to whatever + core we're running on now. */ + movi a2, pxCurrentTCB + getcoreid a3 + slli a3, a3, 2 + add a2, a2, a3 + l32i a2, a2, 0 /* a2 = start of pxCurrentTCB[cpuid] */ + addi a2, a2, (0x3C+configMAX_TASK_NAME_LEN+3)&~3 /* offset to xCoreID in tcb struct */ + getcoreid a3 + s32i a3, a2, 0 /* store current cpuid */ + + /* Grab correct xt_coproc_owner_sa for this core */ getcoreid a2 movi a3, XCHAL_CP_MAX << 2 mull a2, a2, a3 From 8800d073e84c9a8dabf080471ececbce1157e26e Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Wed, 28 Sep 2016 21:35:49 +0800 Subject: [PATCH 130/179] components/lib: update wifi lib fe8baaca - tw6513 fix a memory leak issue --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index a6967f4c1b..ef242f4fe5 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit a6967f4c1bac9269eb6651e84f2cebf81eb5f982 +Subproject commit ef242f4fe5ef5cfc639bced63d129ee869ee79cd From e523a2532a4515205e517a740b07e50ed1dd251a Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Wed, 28 Sep 2016 23:20:34 +0800 Subject: [PATCH 131/179] Modify LEDC driver 1. configure LEDC timer saparately 2. add peripher_crtl.c/.h To enable the peripheral modules, we have to set/clear the control register in dport_reg.h. These bits are disabled by default and they are all in a same register, so we need to add a lock on that. 3. add include esp_err.h in gpio.h --- components/driver/include/driver/gpio.h | 2 +- components/driver/include/driver/ledc.h | 126 ++++++++----- .../driver/include/driver/periph_ctrl.h | 70 ++++++++ components/driver/ledc.c | 120 +++++++------ components/driver/periph_ctrl.c | 170 ++++++++++++++++++ 5 files changed, 383 insertions(+), 105 deletions(-) create mode 100644 components/driver/include/driver/periph_ctrl.h create mode 100644 components/driver/periph_ctrl.c diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index 862d4e5927..9b47c88e69 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -14,7 +14,7 @@ #ifndef _DRIVER_GPIO_H_ #define _DRIVER_GPIO_H_ - +#include "esp_err.h" #include #include "soc/gpio_reg.h" #include "soc/gpio_struct.h" diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 3e3d3740df..79a6c7f9f3 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -20,6 +20,7 @@ #include "soc/ledc_reg.h" #include "soc/ledc_struct.h" #include "driver/gpio.h" +#include "driver/periph_ctrl.h" #ifdef __cplusplus extern "C" { @@ -51,10 +52,10 @@ typedef enum { } ledc_clk_src_t; typedef enum { - LEDC_TIMER0 = 0, /*LEDC source timer TIMER0 */ - LEDC_TIMER1, /*LEDC source timer TIMER1 */ - LEDC_TIMER2, /*LEDC source timer TIMER2 */ - LEDC_TIMER3, /*LEDC source timer TIMER3 */ + LEDC_TIMER_0 = 0, /*LEDC source timer TIMER0 */ + LEDC_TIMER_1, /*LEDC source timer TIMER1 */ + LEDC_TIMER_2, /*LEDC source timer TIMER2 */ + LEDC_TIMER_3, /*LEDC source timer TIMER3 */ } ledc_timer_t; typedef enum { @@ -77,40 +78,57 @@ typedef enum { LEDC_TIMER_15_BIT = 15, /*LEDC PWM depth 15Bit */ } ledc_timer_bit_t; -typedef struct ledc_channel_t_config { +typedef struct { int gpio_num; /*the LEDC output gpio_num, if you want to use gpio16, gpio_num = 16*/ ledc_mode_t speed_mode; /*LEDC speed speed_mode, high-speed mode or low-speed mode*/ ledc_channel_t channel; /*LEDC channel(0 - 7)*/ ledc_intr_type_t intr_type; /*configure interrupt, Fade interrupt enable or Fade interrupt disable*/ - ledc_timer_t timer_sel; /*Select the timer source of channel (0 - 3)*/ - uint32_t freq_hz; /*LEDC channel frequency(Hz)*/ + ledc_timer_t timer_sel; /*Select the timer source of channel (0 - 3)*/ uint32_t duty; /*LEDC channel duty, the duty range is [0, (2**bit_num) - 1], */ +} ledc_channel_config_t; + +typedef struct { + ledc_mode_t speed_mode; /*LEDC speed speed_mode, high-speed mode or low-speed mode*/ ledc_timer_bit_t bit_num; /*LEDC channel duty depth*/ -} ledc_config_t; + ledc_timer_t timer_num; /*The timer source of channel (0 - 3)*/ + uint32_t freq_hz; /*LEDC timer frequency(Hz)*/ +} ledc_timer_config_t; + /** - * @brief LEDC common configuration + * @brief LEDC channel configuration * - * User this Function, configure LEDC with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth + * User this Function, configure LEDC channel with the given channel/output gpio_num/interrupt/source timer/frequency(Hz)/LEDC depth * - * @param[in] ledc_config_t - * ledc_config_t.speed_mode : LEDC speed speed_mode - * ledc_config_t.gpio_num : LEDC output gpio_num, if you want to use gpio16, ledc_config_t.gpio_num = 16 - * ledc_config_t.channel : LEDC channel(0 - 7) - * ledc_config_t.intr_type : configure interrupt, Fade interrupt enable or Fade interrupt disable - * ledc_config_t.timer_sel : Select the timer source of channel (0 - 3) - * When different channel, select same timer, their freq_hz and bit_num must be the same - * ledc_config_t.freq_hz : LEDC channel frequency(Hz), - * When different channel, select same time, their freq_hz and bit_num must be same - * ledc_config_t.duty : LEDC channel duty, the duty range is [0, (2**bit_num) - 1], - * ledc_config_t.bit_num : LEDC channel duty depth - * When different channel, select same time, their freq_hz and bit_num must be same + * @param[in] ledc_channel_config_t + * ledc_channel_config_t.speed_mode : LEDC speed speed_mode + * ledc_channel_config_t.gpio_num : LEDC output gpio_num, if you want to use gpio16, ledc_channel_config_t.gpio_num = 16 + * ledc_channel_config_t.channel : LEDC channel(0 - 7) + * ledc_channel_config_t.intr_type : configure interrupt, Fade interrupt enable or Fade interrupt disable + * ledc_channel_config_t.timer_sel : Select the timer source of channel (0 - 3), high speed channel must bind with high speed timer. + * ledc_channel_config_t.duty : LEDC channel duty, the duty range is [0, (2**timer_bit_num) - 1], + * @return ESP_OK: success + * ESP_ERR_INVALID_ARG: parameter error + * + */ +esp_err_t ledc_channel_config(ledc_channel_config_t* ledc_conf); + +/** + * @brief LEDC timer configuration + * + * User this Function, configure LEDC timer with the given source timer/frequency(Hz)/bit_num + * + * @param[in] ledc_timer_config_t + * ledc_timer_config_t.speed_mode : LEDC speed speed_mode + * ledc_timer_config_t.timer_num : Select the timer source of channel (0 - 3) + * ledc_timer_config_t.freq_hz : LEDC channel frequency(Hz), + * ledc_timer_config_t.bit_num : LEDC channel duty depth * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error * ESP_FAIL: Can not find a proper pre-divider number base on the given frequency and the current bit_num. * */ -esp_err_t ledc_config(ledc_config_t* ledc_conf); +esp_err_t ledc_timer_config(ledc_timer_config_t* timer_conf); /** * @brief LEDC update channel parameters @@ -120,13 +138,13 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf); * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7), select from ledc_channel_t * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error * */ -esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); +esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel); /** * @brief LEDC stop @@ -135,7 +153,7 @@ esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel); * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7), select from ledc_channel_t * * @return ESP_OK: success * ESP_ERR_INVALID_ARG: parameter error @@ -149,7 +167,7 @@ esp_err_t ledc_stop(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t idl * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] timer_num : LEDC timer index(0-3) + * @param[in] timer_num : LEDC timer index(0-3), select from ledc_timer_t * * @param[in] freq_hz : set the LEDC frequency * @@ -164,7 +182,7 @@ esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num, uint32_t * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] timer_num : LEDC timer index(0-3) + * @param[in] timer_num : LEDC timer index(0-3), select from ledc_timer_t * * @return 0 : error * others : current LEDC frequency @@ -175,11 +193,11 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num); /** * @brief LEDC set duty * - * Set LEDC duty, After the function calls the ledc_update function, the function can take effect. + * Set LEDC duty, After the function calls the ledc_update_duty function, the function can take effect. * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7), select from ledc_channel_t * * @param[in] duty : set the LEDC duty, the duty range is [0, (2**bit_num) - 1] * @@ -193,7 +211,7 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7), select from ledc_channel_t * * * @return -1: parameter error @@ -205,11 +223,11 @@ int ledc_get_duty(ledc_mode_t speed_mode, ledc_channel_t channel); /** * @brief LEDC set gradient * - * Set LEDC gradient, After the function calls the ledc_update function, the function can take effect. + * Set LEDC gradient, After the function calls the ledc_update_duty function, the function can take effect. * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel(0-7) + * @param[in] channel : LEDC channel(0-7), select from ledc_channel_t * * @param[in] duty : set the start of the gradient duty, the duty range is [0, (2**bit_num) - 1] * @@ -233,10 +251,10 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, uint32_t channel, uint32_t duty, * Users should know that which CPU is running and then pick a INUM that is not used by system. * We can find the information of INUM and interrupt level in soc.h. * TODO: to move INUM options to menu_config - * @parameter uint32_t ledc_intr_num : LEDC interrupt number, check the info in soc.h, and please see the core-isa.h for more details - * @parameter void (* fn)(void* ) : interrupt handler function. + * @param[in] uint32_t ledc_intr_num : LEDC interrupt number, check the info in soc.h, and please see the core-isa.h for more details + * @param[in] void (* fn)(void* ) : interrupt handler function. * Note that the handler function MUST be defined with attribution of "IRAM_ATTR". - * @parameter void * arg : parameter for handler function + * @param[in] void * arg : parameter for handler function * * @return ESP_OK : success ; * ESP_ERR_INVALID_ARG : function ptr error. @@ -260,14 +278,14 @@ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * ar * other value: current LEDC duty * */ -esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src); +esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src); /** * @brief reset LEDC timer * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] timer_sel : LEDC timer index(0-3) + * @param[in] timer_sel : LEDC timer index(0-3), select from ledc_timer_t * * * @return ESP_ERR_INVALID_ARG: parameter error @@ -281,7 +299,7 @@ esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, uint32_t timer_sel); * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] timer_sel : LEDC timer index(0-3) + * @param[in] timer_sel : LEDC timer index(0-3), select from ledc_timer_t * * * @return ESP_ERR_INVALID_ARG: parameter error @@ -295,7 +313,7 @@ esp_err_t ledc_timer_pause(ledc_mode_t speed_mode, uint32_t timer_sel); * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] timer_sel : LEDC timer index(0-3) + * @param[in] timer_sel : LEDC timer index(0-3), select from ledc_timer_t * * * @return ESP_ERR_INVALID_ARG: parameter error @@ -309,9 +327,9 @@ esp_err_t ledc_timer_resume(ledc_mode_t speed_mode, uint32_t timer_sel); * * @param[in] speed_mode : select the LEDC speed_mode, high-speed mode and low-speed mode, now we only support high-speed mode. We will access low-speed mode in next version * - * @param[in] channel : LEDC channel index(0-7) + * @param[in] channel : LEDC channel index(0-7), select from ledc_channel_t * - * @param[in] timer_idx : LEDC timer index(0-3) + * @param[in] timer_idx : LEDC timer index(0-3), select from ledc_timer_t * * * @return ESP_ERR_INVALID_ARG: parameter error @@ -324,22 +342,34 @@ esp_err_t ledc_bind_channel_timer(ledc_mode_t speed_mode, uint32_t channel, uint * * * ----------------EXAMPLE OF LEDC SETTING --------------------- - * ledc_config_t ledc_conf = { + * //1. enable LEDC + * periph_module_enable(PERIPH_LEDC_MODULE); //enable LEDC module, or you can not set any register of it. + * + * //2. set LEDC timer + * ledc_timer_config_t timer_conf = { + * .bit_num = LEDC_TIMER_12_BIT, //set timer counter bit number + * .freq_hz = 1000, //set frequency of pwm, here, 1000Hz + * .speed_mode = LEDC_HIGH_SPEED_MODE //timer mode, + * .timer_num = LEDC_TIMER_0, //timer number + * }; + * ledc_timer_config(&timer_conf); //setup timer. + * + * //3. set LEDC channel + * ledc_channel_config_t ledc_conf = { * .channel = LEDC_CHANNEL_0; //set LEDC channel 0 * .duty = 1000; //set the duty for initialization.(duty range is 0 ~ ((2**bit_num)-1) - * .freq_hz = 1000; //set frequency, e.g., 1KHz * .gpio_num = 16; //GPIO number * .intr_type = LEDC_INTR_FADE_END; //GPIO INTR TYPE, as an example, we enable fade_end interrupt here. - * .bit_num = LEDC_TIMER_12_BIT; //set bit_num, (duty range is 0 ~ ((2**bit_num)-1) * .speed_mode = LEDC_HIGH_SPEED_MODE; //set LEDC mode, from ledc_mode_t - * .timer_sel = LEDC_TIMER0; //set LEDC timer source, if different channel use one timer, the frequency and bit_num of these channels should be the same + * .timer_sel = LEDC_TIMER_0; //set LEDC timer source, if different channel use one timer, the frequency and bit_num of these channels should be the same * } - * ledc_config(&ledc_conf); //setup the configuration + * ledc_channel_config(&ledc_conf); //setup the configuration + * * ----------------EXAMPLE OF SETTING DUTY --- ----------------- * uint32_t ledc_channel = LEDC_CHANNEL_0; //LEDC channel(0-73) * uint32_t duty = 2000; //duty range is 0 ~ ((2**bit_num)-1) * LEDC_set_duty(LEDC_HIGH_SPEED_MODE, ledc_channel, duty); //set speed mode, channel, and duty. - * ledc_update(LEDC_HIGH_SPEED_MODE, ledc_channel); //after set duty, we need to call ledc_update to update the settings. + * ledc_update_duty(LEDC_HIGH_SPEED_MODE, ledc_channel); //after set duty, we need to call ledc_update_duty to update the settings. * * * ----------------EXAMPLE OF LEDC INTERRUPT ------------------ diff --git a/components/driver/include/driver/periph_ctrl.h b/components/driver/include/driver/periph_ctrl.h new file mode 100644 index 0000000000..3faa347b54 --- /dev/null +++ b/components/driver/include/driver/periph_ctrl.h @@ -0,0 +1,70 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 _DRIVER_PERIPH_CTRL_H_ +#define _DRIVER_PERIPH_CTRL_H_ +#include "esp_err.h" +#include "soc/soc.h" +#include "soc/dport_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PERIPH_LEDC_MODULE = 0, + PERIPH_UART0_MODULE, + PERIPH_UART1_MODULE, + PERIPH_UART2_MODULE, + PERIPH_I2C0_MODULE, + PERIPH_I2C1_MODULE, + PERIPH_I2S0_MODULE, + PERIPH_I2S1_MODULE, + PERIPH_TIMG0_MODULE, + PERIPH_TIMG1_MODULE, + PERIPH_PWM0_MODULE, + PERIPH_PWM1_MODULE, + PERIPH_PWM2_MODULE, + PERIPH_PWM3_MODULE, + PERIPH_UHCI0_MODULE, + PERIPH_UHCI1_MODULE, +} periph_module_t; + +/** + * @brief enable peripheral module + * + * @param[in] periph : Peripheral module name + * + * + * @return NULL + * + */ +void periph_module_enable(periph_module_t periph); + +/** + * @brief disable peripheral module + * + * @param[in] periph : Peripheral module name + * + * + * @return NULL + * + */ +void periph_module_disable(periph_module_t periph); + +#ifdef __cplusplus +} +#endif + +#endif /* _DRIVER_PERIPH_CTRL_H_ */ diff --git a/components/driver/ledc.c b/components/driver/ledc.c index 3fd0f27afb..386c93dfa6 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -16,7 +16,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/xtensa_api.h" -#include "soc/dport_reg.h" #include "soc/gpio_sig_map.h" #include "driver/ledc.h" @@ -84,14 +83,14 @@ static bool ledc_is_valid_mode(uint32_t mode) static bool ledc_is_valid_timer(int timer) { - if(timer > LEDC_TIMER3) { + if(timer > LEDC_TIMER_3) { LEDC_ERROR("LEDC TIMER ERR: %d\n", timer); return false; } return true; } -esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src) +esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; @@ -103,7 +102,7 @@ esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint LEDC.timer_group[speed_mode].timer[timer_sel].conf.div_num = div_num; LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = clk_src; LEDC.timer_group[speed_mode].timer[timer_sel].conf.bit_num = bit_num; - if(speed_mode == LEDC_HIGH_SPEED_MODE) { + if(speed_mode != LEDC_HIGH_SPEED_MODE) { LEDC.timer_group[speed_mode].timer[timer_sel].conf.low_speed_update = 1; } portEXIT_CRITICAL(&ledc_spinlock); @@ -213,45 +212,28 @@ esp_err_t ledc_isr_register(uint32_t ledc_intr_num, void (*fn)(void*), void * ar return ESP_OK; } -esp_err_t ledc_config(ledc_config_t* ledc_conf) +esp_err_t ledc_timer_config(ledc_timer_config_t* timer_conf) { - SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN); - CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST); + int freq_hz = timer_conf->freq_hz; + int bit_num = timer_conf->bit_num; + int timer_num = timer_conf->timer_num; + int speed_mode = timer_conf->speed_mode; - uint32_t speed_mode = ledc_conf->speed_mode; - uint32_t gpio_num = ledc_conf->gpio_num; - uint32_t ledc_channel = ledc_conf->channel; - uint32_t freq_hz = ledc_conf->freq_hz; - uint32_t timer_select = ledc_conf->timer_sel; - uint32_t bit_num = ledc_conf->bit_num; - uint32_t intr_type = ledc_conf->intr_type; - uint32_t duty = ledc_conf->duty; - uint32_t div_param = 0; - uint32_t precision = 0; - int timer_clk_src = 0; - - if(!ledc_is_valid_channel(ledc_channel)) { - return ESP_ERR_INVALID_ARG; - } if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; } - if(!GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) { - LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); - return ESP_ERR_INVALID_ARG; - } if(freq_hz == 0 || bit_num == 0 || bit_num > LEDC_TIMER_15_BIT) { - LEDC_ERROR("freq_hz=%u bit_num=%u\n", div_param, bit_num); + LEDC_ERROR("freq_hz=%u bit_num=%u\n", freq_hz, bit_num); return ESP_ERR_INVALID_ARG; } - if(timer_select > LEDC_TIMER3) { - LEDC_ERROR("Time Select %u\n", timer_select); + if(timer_num > LEDC_TIMER_3) { + LEDC_ERROR("Time Select %u\n", timer_num); return ESP_ERR_INVALID_ARG; } - portENTER_CRITICAL(&ledc_spinlock); esp_err_t ret = ESP_OK; - precision = (0x1 << bit_num); //2**depth - div_param = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; //8bit fragment + uint32_t precision = (0x1 << bit_num); //2**depth + uint64_t div_param = ((uint64_t) LEDC_APB_CLK_HZ << 8) / freq_hz / precision; //8bit fragment + int timer_clk_src; /*Fail ,because the div_num overflow or too small*/ if(div_param <= 256 || div_param > LEDC_DIV_NUM_HSTIMER0_V) { //REF TICK /*Selet the reference tick*/ @@ -264,33 +246,59 @@ esp_err_t ledc_config(ledc_config_t* ledc_conf) } else { //APB TICK timer_clk_src = LEDC_APB_CLK; } - //1. set timer parameters - // timer settings decide the clk of counter and the period of PWM - ledc_timer_config(speed_mode, timer_select, div_param, bit_num, timer_clk_src); - // reset timer. - ledc_timer_rst(speed_mode, timer_select); - //2. set channel parameters - // channel parameters decide how the waveform looks like in one period - // set channel duty, duty range is (0 ~ ((2 ** bit_num) - 1)) - ledc_set_duty(speed_mode, ledc_channel, duty); - //update duty settings - ledc_update(speed_mode, ledc_channel); - //3. bind the channel with the timer - ledc_bind_channel_timer(speed_mode, ledc_channel, timer_select); - //4. set interrupt type - ledc_enable_intr_type(speed_mode, ledc_channel, intr_type); - LEDC_INFO("LEDC_PWM CHANNEL %1u|GPIO %02u|FreHz %05u|Duty %04u|Depth %04u|Time %01u|SourceClk %01u|Divparam %u\n", - ledc_channel, gpio_num, freq_hz, duty, bit_num, timer_select, timer_clk_src, div_param - ); - /*5. set LEDC signal in gpio matrix*/ - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); - gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); - gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); - portEXIT_CRITICAL(&ledc_spinlock); + /*set timer parameters*/ + /*timer settings decide the clk of counter and the period of PWM*/ + ledc_timer_set(speed_mode, timer_num, div_param, bit_num, timer_clk_src); + /* reset timer.*/ + ledc_timer_rst(speed_mode, timer_num); return ret; } -esp_err_t ledc_update(ledc_mode_t speed_mode, ledc_channel_t channel) +esp_err_t ledc_channel_config(ledc_channel_config_t* ledc_conf) +{ + uint32_t speed_mode = ledc_conf->speed_mode; + uint32_t gpio_num = ledc_conf->gpio_num; + uint32_t ledc_channel = ledc_conf->channel; + uint32_t timer_select = ledc_conf->timer_sel; + uint32_t intr_type = ledc_conf->intr_type; + uint32_t duty = ledc_conf->duty; + + if(!ledc_is_valid_channel(ledc_channel)) { + return ESP_ERR_INVALID_ARG; + } + if(!ledc_is_valid_mode(speed_mode)) { + return ESP_ERR_INVALID_ARG; + } + if(!GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) { + LEDC_ERROR("GPIO number error: IO%d\n ", gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(timer_select > LEDC_TIMER_3) { + LEDC_ERROR("Time Select %u\n", timer_select); + return ESP_ERR_INVALID_ARG; + } + esp_err_t ret = ESP_OK; + /*set channel parameters*/ + /* channel parameters decide how the waveform looks like in one period*/ + /* set channel duty, duty range is (0 ~ ((2 ** bit_num) - 1))*/ + ledc_set_duty(speed_mode, ledc_channel, duty); + /*update duty settings*/ + ledc_update_duty(speed_mode, ledc_channel); + /*bind the channel with the timer*/ + ledc_bind_channel_timer(speed_mode, ledc_channel, timer_select); + /*set interrupt type*/ + ledc_enable_intr_type(speed_mode, ledc_channel, intr_type); + LEDC_INFO("LEDC_PWM CHANNEL %1u|GPIO %02u|Duty %04u|Time %01u\n", + ledc_channel, gpio_num, duty, timer_select + ); + /*set LEDC signal in gpio matrix*/ + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); + gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); + gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); + return ret; +} + +esp_err_t ledc_update_duty(ledc_mode_t speed_mode, ledc_channel_t channel) { if(!ledc_is_valid_mode(speed_mode)) { return ESP_ERR_INVALID_ARG; diff --git a/components/driver/periph_ctrl.c b/components/driver/periph_ctrl.c new file mode 100644 index 0000000000..df1abbf556 --- /dev/null +++ b/components/driver/periph_ctrl.c @@ -0,0 +1,170 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. +#include +#include "esp_intr.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/xtensa_api.h" +#include "soc/dport_reg.h" +#include "driver/periph_ctrl.h" + +static portMUX_TYPE periph_spinlock = portMUX_INITIALIZER_UNLOCKED; + +void periph_module_enable(periph_module_t periph) +{ + portENTER_CRITICAL(&periph_spinlock); + switch(periph) { + case PERIPH_LEDC_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST); + break; + case PERIPH_UART0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART_RST); + break; + case PERIPH_UART1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART1_RST); + break; + case PERIPH_UART2_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART2_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART2_RST); + break; + case PERIPH_I2C0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2C_EXT0_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2C_EXT0_RST); + break; + case PERIPH_I2C1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2C_EXT1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2C_EXT1_RST); + break; + case PERIPH_I2S0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2S0_RST); + break; + case PERIPH_I2S1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2S1_RST); + break; + case PERIPH_TIMG0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_TIMERGROUP_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_TIMERGROUP_RST); + break; + case PERIPH_TIMG1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_TIMERGROUP1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_TIMERGROUP1_RST); + break; + case PERIPH_PWM0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM0_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM0_RST); + break; + case PERIPH_PWM1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM1_RST); + break; + case PERIPH_PWM2_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM2_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM2_RST); + break; + case PERIPH_PWM3_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM3_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM3_RST); + break; + case PERIPH_UHCI0_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UHCI0_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UHCI0_RST); + break; + case PERIPH_UHCI1_MODULE: + SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UHCI1_CLK_EN); + CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UHCI1_RST); + break; + default: + break; + } + portENTER_CRITICAL(&periph_spinlock); +} + +void periph_module_disable(periph_module_t periph) +{ + portENTER_CRITICAL(&periph_spinlock); + switch(periph) { + case PERIPH_LEDC_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST); + break; + case PERIPH_UART0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART_RST); + break; + case PERIPH_UART1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART1_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART1_RST); + break; + case PERIPH_UART2_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UART2_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UART2_RST); + break; + case PERIPH_I2C0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2C_EXT0_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2C_EXT0_RST); + break; + case PERIPH_I2C1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2C_EXT0_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2C_EXT1_RST); + break; + case PERIPH_I2S0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2S0_RST); + break; + case PERIPH_I2S1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S1_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2S1_RST); + break; + case PERIPH_TIMG0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_TIMERGROUP_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_TIMERGROUP_RST); + break; + case PERIPH_TIMG1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_TIMERGROUP1_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_TIMERGROUP1_RST); + break; + case PERIPH_PWM0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM0_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM0_RST); + break; + case PERIPH_PWM1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM1_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM1_RST); + break; + case PERIPH_PWM2_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM2_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM2_RST); + break; + case PERIPH_PWM3_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PWM3_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PWM3_RST); + break; + case PERIPH_UHCI0_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UHCI0_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UHCI0_RST); + break; + case PERIPH_UHCI1_MODULE: + CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UHCI1_CLK_EN); + SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UHCI1_RST); + break; + default: + break; + } + portENTER_CRITICAL(&periph_spinlock); +} From 3533c6b7f4d9aeef4baec3e5f325ce86b49bf686 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Thu, 29 Sep 2016 10:55:52 +0800 Subject: [PATCH 132/179] components/tcpip_adapter: add some comments --- components/tcpip_adapter/include/tcpip_adapter.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 5737ab7a02..5b0fc4c627 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -21,7 +21,19 @@ * The aim of this adapter is to provide an abstract layer upon TCPIP stack. * With this layer, switch to other TCPIP stack is possible and easy in esp-idf. * - * TODO: ipv6 support will be added. + * If users want to use other TCPIP stack, all those functions should be implemented + * by using the specific APIs of that stack. The macros in CONFIG_TCPIP_LWIP should be + * re-defined. + * + * tcpip_adapter_init should be called in the start of app_main for only once. + * + * Currently most adapter APIs are called in event_default_handlers.c. + * + * We recommend users only use set/get IP APIs, DHCP server/client APIs, + * get free station list APIs in application side. Other APIs are used in esp-idf internal, + * otherwise the state maybe wrong. + * + * TODO: ipv6 support will be added, use menuconfig to disable CONFIG_TCPIP_LWIP */ #include From 4daa768e3cfa1633b8b60f2401b2a58f52dad7bb Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Thu, 29 Sep 2016 11:07:18 +0800 Subject: [PATCH 133/179] Define xcoreid offset, add warning in tcb struct wrt the need to also change that define when struct changes --- components/freertos/tasks.c | 2 +- components/freertos/xtensa_vectors.S | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index bdf3712b7d..6131892a65 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -157,7 +157,7 @@ typedef struct tskTaskControlBlock StackType_t *pxStack; /*< Points to the start of the stack. */ char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ BaseType_t xCoreID; /*< Core this task is pinned to */ - + /* If this moves around (other than pcTaskName size changes), please change the define in xtensa_vectors.S as well. */ #if ( portSTACK_GROWTH > 0 ) StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */ #endif diff --git a/components/freertos/xtensa_vectors.S b/components/freertos/xtensa_vectors.S index 57bfbe9f1e..f0d874a59c 100644 --- a/components/freertos/xtensa_vectors.S +++ b/components/freertos/xtensa_vectors.S @@ -92,6 +92,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xtensa_rtos.h" +/* + Define for workaround: pin no-cpu-affinity tasks to a cpu when fpu is used. + Please change this when the tcb structure is changed +*/ +#define TASKTCB_XCOREID_OFFSET (0x3C+configMAX_TASK_NAME_LEN+3)&~3 .extern pxCurrentTCB /* Enable stack backtrace across exception/interrupt - see below */ @@ -902,7 +907,7 @@ _xt_coproc_exc: slli a3, a3, 2 add a2, a2, a3 l32i a2, a2, 0 /* a2 = start of pxCurrentTCB[cpuid] */ - addi a2, a2, (0x3C+configMAX_TASK_NAME_LEN+3)&~3 /* offset to xCoreID in tcb struct */ + addi a2, a2, TASKTCB_XCOREID_OFFSET /* offset to xCoreID in tcb struct */ getcoreid a3 s32i a3, a2, 0 /* store current cpuid */ From d82cb7f60faeea990424a725edbebbb806127e60 Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Thu, 29 Sep 2016 11:50:25 +0800 Subject: [PATCH 134/179] Modify spinlock error in periph_ctrl.c --- components/driver/periph_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/driver/periph_ctrl.c b/components/driver/periph_ctrl.c index df1abbf556..3a671abad4 100644 --- a/components/driver/periph_ctrl.c +++ b/components/driver/periph_ctrl.c @@ -92,7 +92,7 @@ void periph_module_enable(periph_module_t periph) default: break; } - portENTER_CRITICAL(&periph_spinlock); + portEXIT_CRITICAL(&periph_spinlock); } void periph_module_disable(periph_module_t periph) @@ -166,5 +166,5 @@ void periph_module_disable(periph_module_t periph) default: break; } - portENTER_CRITICAL(&periph_spinlock); + portEXIT_CRITICAL(&periph_spinlock); } From 4e092be6d636141ec4fa6c282a47478a59c73e4c Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 29 Sep 2016 16:29:13 +0800 Subject: [PATCH 135/179] Add Comments We reserve 4KB Slow RTC memory to save RF calibation result and BT NVS data. If not all these Slow RTC momory Blocks are used, we will open the other parts. --- components/esp32/include/rom/rtc.h | 4 ++-- components/esp32/ld/esp32.ld | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp32/include/rom/rtc.h b/components/esp32/include/rom/rtc.h index 9577119f5c..1ff7f033b9 100644 --- a/components/esp32/include/rom/rtc.h +++ b/components/esp32/include/rom/rtc.h @@ -44,8 +44,8 @@ extern "C" { ************************************************************************************* * rtc memory addr type size usage * 0x3ff61000(0x50000000) Slow SIZE_CP Co-Processor code/Reset Entry - * 0x3ff61000+SIZE_CP Slow 6144-SIZE_CP - * 0x3ff62800 Slow 2048 Reserved + * 0x3ff61000+SIZE_CP Slow 4096-SIZE_CP + * 0x3ff62800 Slow 4096 Reserved * * 0x3ff80000(0x400c0000) Fast 8192 deep sleep entry code * diff --git a/components/esp32/ld/esp32.ld b/components/esp32/ld/esp32.ld index 7ecfd19e54..d6b0ac42d1 100644 --- a/components/esp32/ld/esp32.ld +++ b/components/esp32/ld/esp32.ld @@ -48,7 +48,7 @@ MEMORY Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled. */ rtc_slow_seg(RW) : org = 0x50000000 + CONFIG_ULP_COPROC_RESERVE_MEM, - len = 0x2000 - CONFIG_ULP_COPROC_RESERVE_MEM + len = 0x1000 - CONFIG_ULP_COPROC_RESERVE_MEM } /* Heap ends at top of dram0_0_seg */ From aeef4cf58ddd6446af07f2478d25be53133dc893 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Thu, 29 Sep 2016 18:19:38 +0800 Subject: [PATCH 136/179] esp32/lib: update wifi lib to 3853d7ae 1. add debug api for debugging rx buffer leak issue 2. fix rx buffer leak issue --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index ef242f4fe5..3853d7ae3d 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit ef242f4fe5ef5cfc639bced63d129ee869ee79cd +Subproject commit 3853d7ae3dd455492ff4ed663662d42d28c817e4 From 9d0daa37221f2e8d1ade39b32799211e53ec67bf Mon Sep 17 00:00:00 2001 From: Wangjialin Date: Fri, 30 Sep 2016 02:31:14 +0800 Subject: [PATCH 137/179] add smartconfig header files(merge this after updating libsmartconfig.a version v2.6.2) 1. change the original API names. 2. return esp_err_t 3. merge this after updating libsmartconfig.a version v2.6.2 --- components/esp32/include/esp_smartconfig.h | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 components/esp32/include/esp_smartconfig.h diff --git a/components/esp32/include/esp_smartconfig.h b/components/esp32/include/esp_smartconfig.h new file mode 100644 index 0000000000..b30ce1a111 --- /dev/null +++ b/components/esp32/include/esp_smartconfig.h @@ -0,0 +1,143 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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 __ESP_SMARTCONFIG_H__ +#define __ESP_SMARTCONFIG_H__ +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SC_STATUS_WAIT = 0, /**< waiting, do not start connection in this phase */ + SC_STATUS_FIND_CHANNEL, /**< find target channel, start connection by APP in this phase */ + SC_STATUS_GETTING_SSID_PSWD, /**< getting SSID and password of target AP */ + SC_STATUS_LINK, /**< connecting to target AP */ + SC_STATUS_LINK_OVER, /**< got IP, connect to AP successfully */ +} smartconfig_status_t; + +typedef enum { + SC_TYPE_ESPTOUCH = 0, /**< protocol: ESPTouch */ + SC_TYPE_AIRKISS, /**< protocol: AirKiss */ + SC_TYPE_ESPTOUCH_AIRKISS, /**< protocol: ESPTouch and AirKiss */ +} smartconfig_type_t; + +/** + * @brief The callback of SmartConfig, executed when smart-config status changed. + * + * @param smartconfig_status_t status : status of SmartConfig: + * - if status == SC_STATUS_GETTING_SSID_PSWD, parameter void *pdata is a pointer + of smartconfig_type_t, means SmartConfig type: AirKiss or ESP-TOUCH. + * - if status == SC_STATUS_LINK, parameter void *pdata is a pointer of struct station_config; + * - if status == SC_STATUS_LINK_OVER, parameter void *pdata is a pointer of mobile + * phone's IP address, 4 bytes. This is only available in ESPTOUCH, otherwise, + * it is NULL. + * - otherwise, parameter void *pdata is NULL. + * @param void *pdata : data of SmartConfig + * + * @return null + */ +typedef void (*sc_callback_t)(smartconfig_status_t status, void *pdata); + +/** + * @brief Get the version of SmartConfig. + * + * @param null + * + * @return SmartConfig version + */ +const char *esp_smartconfig_get_version(void); + +/** + * @brief Start SmartConfig mode. + * + * Start SmartConfig mode, to connect ESP32 station to AP, by sniffing + * for special packets from the air, containing SSID and password of desired AP. + * You need to broadcast the SSID and password (e.g. from mobile device or computer) + * with the SSID and password encoded. + * + * @attention 1. This API can only be called in station mode. + * @attention 2. During SmartConfig, ESP32 station and soft-AP are disabled. + * @attention 3. Can not call esp_smartconfig_start twice before it finish, please call + * esp_smartconfig_stop first. + * @attention 4. Don't call any other APIs during SmartConfig, please call esp_smartconfig_stop first. + * + * @param sc_callback_t cb : SmartConfig callback; executed when SmartConfig status changed; + * @param uint8 log : 1, UART output logs; otherwise, UART only outputs the result. + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_smartconfig_start(sc_callback_t cb, ...); + +/** + * @brief Stop SmartConfig, free the buffer taken by esp_smartconfig_start. + * + * @attention Whether connect to AP succeed or not, this API should be called to free + * memory taken by smartconfig_start. + * + * @param null + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_smartconfig_stop(void); + +/** + * @brief Set timeout of SmartConfig. + * + * @attention SmartConfig timeout start at SC_STATUS_FIND_CHANNEL, SmartConfig will + * restart if timeout. + * + * @param uint8 time_s : range 15s~255s, offset:45s. + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_esptouch_set_timeout(uint8_t time_s); + +/** + * @brief Set protocol type of SmartConfig. + * + * @attention If users need to set the SmartConfig type, please set it before calling + * esp_smartconfig_start. + * + * @param smartconfig_type_t type : AirKiss, ESP-TOUCH or both. + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_smartconfig_set_type(smartconfig_type_t type); + +/** + * @brief Set mode of SmartConfig. default normal mode. + * + * @attention If users need to set the SmartConfig mode, please set it before calling + * esp_smartconfig_start. Different mode should match different APP(phone). + * + * @param bool enable : false-disable(default); true-enable; + * + * @return ESP_OK : succeed + * @return others : fail + */ +esp_err_t esp_smartconfig_fast_mode(bool enable); + + +#ifdef __cplusplus +} +#endif + +#endif From f17f57b48df6c0efda06bc853d0b215e8a66b42c Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Fri, 30 Sep 2016 13:48:37 +0800 Subject: [PATCH 138/179] esp32: remove esp_wps.h not support now --- components/esp32/include/esp_wps.h | 131 ----------------------------- 1 file changed, 131 deletions(-) delete mode 100644 components/esp32/include/esp_wps.h diff --git a/components/esp32/include/esp_wps.h b/components/esp32/include/esp_wps.h deleted file mode 100644 index b37fe542e0..0000000000 --- a/components/esp32/include/esp_wps.h +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed 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 __ESP_WPS_H__ -#define __ESP_WPS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** \defgroup WiFi_APIs WiFi Related APIs - * @brief WiFi APIs - */ - -/** @addtogroup WiFi_APIs - * @{ - */ - -/** \defgroup WPS_APIs WPS APIs - * @brief ESP32 WPS APIs - * - * WPS can only be used when ESP32 station is enabled. - * - */ - -/** @addtogroup WPS_APIs - * @{ - */ - -typedef enum wps_type { - WPS_TYPE_DISABLE = 0, - WPS_TYPE_PBC, - WPS_TYPE_PIN, - WPS_TYPE_DISPLAY, - WPS_TYPE_MAX, -} WPS_TYPE_t; - -enum wps_cb_status { - WPS_CB_ST_SUCCESS = 0, /**< WPS succeed */ - WPS_CB_ST_FAILED, /**< WPS fail */ - WPS_CB_ST_TIMEOUT, /**< WPS timeout, fail */ - WPS_CB_ST_WEP, /**< WPS failed because that WEP is not supported */ - WPS_CB_ST_SCAN_ERR, /**< can not find the target WPS AP */ -}; - -/** - * @brief Enable Wi-Fi WPS function. - * - * @attention WPS can only be used when ESP32 station is enabled. - * - * @param WPS_TYPE_t wps_type : WPS type, so far only WPS_TYPE_PBC is supported - * - * @return true : succeed - * @return false : fail - */ -bool wifi_wps_enable(WPS_TYPE_t wps_type); - -/** - * @brief Disable Wi-Fi WPS function and release resource it taken. - * - * @param null - * - * @return true : succeed - * @return false : fail - */ -bool wifi_wps_disable(void); - -/** - * @brief WPS starts to work. - * - * @attention WPS can only be used when ESP32 station is enabled. - * - * @param null - * - * @return true : WPS starts to work successfully, but does not mean WPS succeed. - * @return false : fail - */ -bool wifi_wps_start(void); - -/** - * @brief WPS callback. - * - * @param int status : status of WPS, enum wps_cb_status. - * - If parameter status == WPS_CB_ST_SUCCESS in WPS callback, it means WPS got AP's - * information, user can call wifi_wps_disable to disable WPS and release resource, - * then call wifi_station_connect to connect to target AP. - * - Otherwise, it means that WPS fail, user can create a timer to retry WPS by - * wifi_wps_start after a while, or call wifi_wps_disable to disable WPS and release resource. - * - * @return null - */ -typedef void (*wps_st_cb_t)(int status); - -/** - * @brief Set WPS callback. - * - * @attention WPS can only be used when ESP32 station is enabled. - * - * @param wps_st_cb_t cb : callback. - * - * @return true : WPS starts to work successfully, but does not mean WPS succeed. - * @return false : fail - */ -bool wifi_set_wps_cb(wps_st_cb_t cb); - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ESP_WPS_H__ */ From e3f46f424c1c4c64f8119d570f1fc764b68b1114 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Fri, 30 Sep 2016 13:50:11 +0800 Subject: [PATCH 139/179] esp32/lib: update wifi lib to a1e5f8b9 1. update smartconfig 2.6.2; 2. add watch dog 3. remove libwpa2.a/libwps.a --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index 3853d7ae3d..a1e5f8b953 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 3853d7ae3dd455492ff4ed663662d42d28c817e4 +Subproject commit a1e5f8b953c7934677ba7a6ed0a6dd2da0e6bd0f From 6827f27b99e63cf5b8588b996645a1b180029f26 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Fri, 30 Sep 2016 14:04:03 +0800 Subject: [PATCH 140/179] esp32: not link wps --- components/esp32/component.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 223c955d51..ca91059f7f 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -10,7 +10,7 @@ COMPONENT_SRCDIRS := . hwcrypto -LIBS := crypto core net80211 phy rtc pp wpa wps +LIBS := crypto core net80211 phy rtc pp wpa LINKER_SCRIPTS += -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld From d2c938d88139f7114142998ae90383ef4cceb610 Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Fri, 30 Sep 2016 15:40:08 +0800 Subject: [PATCH 141/179] esp32: add libsmartconfig.a to link libs --- components/esp32/component.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index ca91059f7f..6eac77afd3 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -10,7 +10,7 @@ COMPONENT_SRCDIRS := . hwcrypto -LIBS := crypto core net80211 phy rtc pp wpa +LIBS := crypto core net80211 phy rtc pp wpa smartconfig LINKER_SCRIPTS += -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld From 7bdcafe5532a5eb22a7e56c3549bef0605e38150 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Fri, 30 Sep 2016 18:06:41 +0800 Subject: [PATCH 142/179] Also push relevant tags over --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d788a65ce..e0cea70fa7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -164,4 +164,4 @@ push_master_to_github: - chmod 600 ~/.ssh/id_rsa - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - git remote add github git@github.com:espressif/esp-idf.git - - git push github HEAD:master + - git push --follow-tags github HEAD:master From aae3e84829a58db9ac464d2794bc4ded8e58309a Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 6 Oct 2016 09:51:51 +1100 Subject: [PATCH 143/179] syscall write: Should return number of bytes written Fixes bug where sometimes output truncates after a newline, or large chunks of large output buffers are lost. --- components/esp32/syscalls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/esp32/syscalls.c b/components/esp32/syscalls.c index 350f5f4105..537efed1d4 100644 --- a/components/esp32/syscalls.c +++ b/components/esp32/syscalls.c @@ -143,7 +143,7 @@ int _open_r(struct _reent *r, const char * path, int flags, int mode) { } ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) { - const char* p = (const char*) data; + const char *data_c = (const char *)data; if (fd == STDOUT_FILENO) { static _lock_t stdout_lock; /* lazily initialised */ /* Even though newlib does stream locking on stdout, we need @@ -160,14 +160,13 @@ ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) { which aren't fully valid.) */ _lock_acquire_recursive(&stdout_lock); - while(size--) { + for (size_t i = 0; i < size; i++) { #if CONFIG_NEWLIB_STDOUT_ADDCR - if (*p=='\n') { + if (data_c[i]=='\n') { uart_tx_one_char('\r'); } #endif - uart_tx_one_char(*p); - ++p; + uart_tx_one_char(data_c[i]); } _lock_release_recursive(&stdout_lock); } From 5cd3bd5c4be0d1a63ed45c2dc0499b98daa1a89f Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sat, 8 Oct 2016 13:15:06 +0800 Subject: [PATCH 144/179] Add data memory for RMT peripheral --- components/esp32/include/soc/rmt_struct.h | 18 ++++++++++++++++++ components/esp32/ld/esp32.peripherals.ld | 1 + 2 files changed, 19 insertions(+) diff --git a/components/esp32/include/soc/rmt_struct.h b/components/esp32/include/soc/rmt_struct.h index 15beb8c6d6..fb4c21055e 100644 --- a/components/esp32/include/soc/rmt_struct.h +++ b/components/esp32/include/soc/rmt_struct.h @@ -225,4 +225,22 @@ typedef volatile struct { uint32_t date; /*This is the version register.*/ } rmt_dev_t; extern rmt_dev_t RMT; + +//Allow access to RMT memory using RMTMEM.chan[0].data[8] +typedef volatile struct { + struct { + union { + struct { + uint32_t level1: 1; + uint32_t duration1: 15; + uint32_t level0: 1; + uint32_t duration0: 15; + + }; + uint32_t val; + } data[64]; + } chan[8]; +} rmt_mem_t; +extern rmt_mem_t RMTMEM; + #endif /* _SOC_RMT_STRUCT_H_ */ diff --git a/components/esp32/ld/esp32.peripherals.ld b/components/esp32/ld/esp32.peripherals.ld index aaadedce49..95aaadcbcc 100644 --- a/components/esp32/ld/esp32.peripherals.ld +++ b/components/esp32/ld/esp32.peripherals.ld @@ -9,6 +9,7 @@ PROVIDE ( UART1 = 0x3ff50000 ); PROVIDE ( I2C0 = 0x3ff53000 ); PROVIDE ( UHCI0 = 0x3ff54000 ); PROVIDE ( RMT = 0x3ff56000 ); +PROVIDE ( RMTMEM = 0x3ff56800 ); PROVIDE ( PCNT = 0x3ff57000 ); PROVIDE ( LEDC = 0x3ff59000 ); PROVIDE ( TIMERG0 = 0x3ff5F000 ); From a03e75d34ccc977ef1d3aa7efb944beee4b6748a Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sat, 8 Oct 2016 14:11:34 +0800 Subject: [PATCH 145/179] Move heap_alloc_caps.h to a location where it can be included by components --- components/esp32/{ => include}/heap_alloc_caps.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename components/esp32/{ => include}/heap_alloc_caps.h (100%) diff --git a/components/esp32/heap_alloc_caps.h b/components/esp32/include/heap_alloc_caps.h similarity index 100% rename from components/esp32/heap_alloc_caps.h rename to components/esp32/include/heap_alloc_caps.h From 82df5f9aa0c6131cd9b167d5a2501d4f941959b3 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sat, 8 Oct 2016 14:12:55 +0800 Subject: [PATCH 146/179] Convert Windows -> Unix line ends in gpio.c --- components/driver/gpio.c | 736 +++++++++++++++++++-------------------- 1 file changed, 368 insertions(+), 368 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index 320533e8d4..14dfc00b43 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -1,368 +1,368 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed 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. -#include -#include "esp_err.h" -#include "esp_intr.h" -#include "freertos/FreeRTOS.h" -#include "freertos/xtensa_api.h" -#include "driver/gpio.h" -#include "soc/soc.h" - -//TODO: move debug options to menuconfig -#define GPIO_DBG_ENABLE (0) -#define GPIO_WARNING_ENABLE (0) -#define GPIO_ERROR_ENABLE (0) -#define GPIO_INFO_ENABLE (0) -//DBG INFOR -#if GPIO_INFO_ENABLE -#define GPIO_INFO ets_printf -#else -#define GPIO_INFO(...) -#endif -#if GPIO_WARNING_ENABLE -#define GPIO_WARNING(format,...) do{\ - ets_printf("[waring][%s#%u]",__FUNCTION__,__LINE__);\ - ets_printf(format,##__VA_ARGS__);\ -}while(0) -#else -#define GPIO_WARNING(...) -#endif -#if GPIO_ERROR_ENABLE -#define GPIO_ERROR(format,...) do{\ - ets_printf("[error][%s#%u]",__FUNCTION__,__LINE__);\ - ets_printf(format,##__VA_ARGS__);\ -}while(0) -#else -#define GPIO_ERROR(...) -#endif - -const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT] = { - GPIO_PIN_REG_0, - GPIO_PIN_REG_1, - GPIO_PIN_REG_2, - GPIO_PIN_REG_3, - GPIO_PIN_REG_4, - GPIO_PIN_REG_5, - GPIO_PIN_REG_6, - GPIO_PIN_REG_7, - GPIO_PIN_REG_8, - GPIO_PIN_REG_9, - GPIO_PIN_REG_10, - GPIO_PIN_REG_11, - GPIO_PIN_REG_12, - GPIO_PIN_REG_13, - GPIO_PIN_REG_14, - GPIO_PIN_REG_15, - GPIO_PIN_REG_16, - GPIO_PIN_REG_17, - GPIO_PIN_REG_18, - GPIO_PIN_REG_19, - 0, - GPIO_PIN_REG_21, - GPIO_PIN_REG_22, - GPIO_PIN_REG_23, - 0, - GPIO_PIN_REG_25, - GPIO_PIN_REG_26, - GPIO_PIN_REG_27, - 0, - 0, - 0, - 0, - GPIO_PIN_REG_32, - GPIO_PIN_REG_33, - GPIO_PIN_REG_34, - GPIO_PIN_REG_35, - GPIO_PIN_REG_36, - GPIO_PIN_REG_37, - GPIO_PIN_REG_38, - GPIO_PIN_REG_39 -}; - -static int is_valid_gpio(int gpio_num) -{ - if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { - GPIO_ERROR("GPIO io_num=%d does not exist\n",gpio_num); - return 0; - } - return 1; -} - -esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(intr_type >= GPIO_INTR_MAX) { - GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); - return ESP_ERR_INVALID_ARG; - } - GPIO.pin[gpio_num].int_type = intr_type; - return ESP_OK; -} - -esp_err_t gpio_intr_enable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(xPortGetCoreID() == 0) { - GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr - } else { - GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr - } - return ESP_OK; -} - -esp_err_t gpio_intr_disable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr - return ESP_OK; -} - -static esp_err_t gpio_output_disable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(gpio_num < 32) { - GPIO.enable_w1tc = (0x1 << gpio_num); - } else { - GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); - } - return ESP_OK; -} - -static esp_err_t gpio_output_enable(gpio_num_t gpio_num) -{ - if(gpio_num >= 34) { - GPIO_ERROR("io_num=%d can only be input\n",gpio_num); - return ESP_ERR_INVALID_ARG; - } - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(gpio_num < 32) { - GPIO.enable_w1ts = (0x1 << gpio_num); - } else { - GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); - } - return ESP_OK; -} - -esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) -{ - if(!GPIO_IS_VALID_GPIO(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(level) { - if(gpio_num < 32) { - GPIO.out_w1ts = (1 << gpio_num); - } else { - GPIO.out1_w1ts.data = (1 << (gpio_num - 32)); - } - } else { - if(gpio_num < 32) { - GPIO.out_w1tc = (1 << gpio_num); - } else { - GPIO.out1_w1tc.data = (1 << (gpio_num - 32)); - } - } - return ESP_OK; -} - -int gpio_get_level(gpio_num_t gpio_num) -{ - if(gpio_num < 32) { - return (GPIO.in >> gpio_num) & 0x1; - } else { - return (GPIO.in1.data >> (gpio_num - 32)) & 0x1; - } -} - -esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - esp_err_t ret = ESP_OK; - switch(pull) { - case GPIO_PULLUP_ONLY: - PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_PULLDOWN_ONLY: - PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_PULLUP_PULLDOWN: - PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); - break; - case GPIO_FLOATING: - PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); - PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); - break; - default: - GPIO_ERROR("Unknown pull up/down mode,gpio_num=%u,pull=%u\n",gpio_num,pull); - ret = ESP_ERR_INVALID_ARG; - break; - } - return ret; -} - -esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - if(gpio_num >= 34 && (mode & (GPIO_MODE_DEF_OUTPUT))) { - GPIO_ERROR("io_num=%d can only be input\n",gpio_num); - return ESP_ERR_INVALID_ARG; - } - esp_err_t ret = ESP_OK; - if(mode & GPIO_MODE_DEF_INPUT) { - PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); - } else { - PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]); - } - if(mode & GPIO_MODE_DEF_OUTPUT) { - if(gpio_num < 32) { - GPIO.enable_w1ts = (0x1 << gpio_num); - } else { - GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); - } - } else { - if(gpio_num < 32) { - GPIO.enable_w1tc = (0x1 << gpio_num); - } else { - GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); - } - } - if(mode & GPIO_MODE_DEF_OD) { - GPIO.pin[gpio_num].pad_driver = 1; - } else { - GPIO.pin[gpio_num].pad_driver = 0; - } - return ret; -} - -esp_err_t gpio_config(gpio_config_t *pGPIOConfig) -{ - uint64_t gpio_pin_mask = (pGPIOConfig->pin_bit_mask); - uint32_t io_reg = 0; - uint32_t io_num = 0; - uint64_t bit_valid = 0; - if(pGPIOConfig->pin_bit_mask == 0 || pGPIOConfig->pin_bit_mask >= (((uint64_t) 1) << GPIO_PIN_COUNT)) { - GPIO_ERROR("GPIO_PIN mask error \n"); - return ESP_ERR_INVALID_ARG; - } - if((pGPIOConfig->mode) & (GPIO_MODE_DEF_OUTPUT)) { - //GPIO 34/35/36/37/38/39 can only be used as input mode; - if((gpio_pin_mask & ( GPIO_SEL_34 | GPIO_SEL_35 | GPIO_SEL_36 | GPIO_SEL_37 | GPIO_SEL_38 | GPIO_SEL_39))) { - GPIO_ERROR("GPIO34-39 can only be used as input mode\n"); - return ESP_ERR_INVALID_ARG; - } - } - do { - io_reg = GPIO_PIN_MUX_REG[io_num]; - if(((gpio_pin_mask >> io_num) & BIT(0)) && io_reg) { - GPIO_INFO("Gpio%02d |Mode:",io_num); - if((pGPIOConfig->mode) & GPIO_MODE_DEF_INPUT) { - GPIO_INFO("INPUT "); - PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[io_num]); - } else { - PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[io_num]); - } - if((pGPIOConfig->mode) & GPIO_MODE_DEF_OD) { - GPIO_INFO("OD "); - GPIO.pin[io_num].pad_driver = 1; /*0x01 Open-drain */ - } else { - GPIO.pin[io_num].pad_driver = 0; /*0x00 Normal gpio output */ - } - if((pGPIOConfig->mode) & GPIO_MODE_DEF_OUTPUT) { - GPIO_INFO("OUTPUT "); - gpio_output_enable(io_num); - } else { - gpio_output_disable(io_num); - } - GPIO_INFO("|"); - if(pGPIOConfig->pull_up_en) { - GPIO_INFO("PU "); - PIN_PULLUP_EN(io_reg); - } else { - PIN_PULLUP_DIS(io_reg); - } - if(pGPIOConfig->pull_down_en) { - GPIO_INFO("PD "); - PIN_PULLDWN_EN(io_reg); - } else { - PIN_PULLDWN_DIS(io_reg); - } - GPIO_INFO("Intr:%d |\n",pGPIOConfig->intr_type); - gpio_set_intr_type(io_num, pGPIOConfig->intr_type); - if(pGPIOConfig->intr_type) { - gpio_intr_enable(io_num); - } else { - gpio_intr_disable(io_num); - } - PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO); /*function number 2 is GPIO_FUNC for each pin */ - } else if(bit_valid && (io_reg == 0)) { - GPIO_WARNING("io_num=%d does not exist\n",io_num); - } - io_num++; - } while(io_num < GPIO_PIN_COUNT); - return ESP_OK; -} - -esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) -{ - if(fn == NULL) { - return ESP_ERR_INVALID_ARG; - } - ESP_INTR_DISABLE(gpio_intr_num); - intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); - xt_set_interrupt_handler(gpio_intr_num, fn, arg); - ESP_INTR_ENABLE(gpio_intr_num); - return ESP_OK; -} - -/*only level interrupt can be used for wake-up function*/ -esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - esp_err_t ret = ESP_OK; - if((intr_type == GPIO_INTR_LOW_LEVEL) || (intr_type == GPIO_INTR_HIGH_LEVEL)) { - GPIO.pin[gpio_num].int_type = intr_type; - GPIO.pin[gpio_num].wakeup_enable = 0x1; - } else { - GPIO_ERROR("GPIO wakeup only support Level mode,but edge mode set. gpio_num:%u\n",gpio_num); - ret = ESP_ERR_INVALID_ARG; - } - return ret; -} - -esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) -{ - if(!is_valid_gpio(gpio_num)) { - return ESP_ERR_INVALID_ARG; - } - GPIO.pin[gpio_num].wakeup_enable = 0; - return ESP_OK; -} +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed 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. +#include +#include "esp_err.h" +#include "esp_intr.h" +#include "freertos/FreeRTOS.h" +#include "freertos/xtensa_api.h" +#include "driver/gpio.h" +#include "soc/soc.h" + +//TODO: move debug options to menuconfig +#define GPIO_DBG_ENABLE (0) +#define GPIO_WARNING_ENABLE (0) +#define GPIO_ERROR_ENABLE (0) +#define GPIO_INFO_ENABLE (0) +//DBG INFOR +#if GPIO_INFO_ENABLE +#define GPIO_INFO ets_printf +#else +#define GPIO_INFO(...) +#endif +#if GPIO_WARNING_ENABLE +#define GPIO_WARNING(format,...) do{\ + ets_printf("[waring][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define GPIO_WARNING(...) +#endif +#if GPIO_ERROR_ENABLE +#define GPIO_ERROR(format,...) do{\ + ets_printf("[error][%s#%u]",__FUNCTION__,__LINE__);\ + ets_printf(format,##__VA_ARGS__);\ +}while(0) +#else +#define GPIO_ERROR(...) +#endif + +const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT] = { + GPIO_PIN_REG_0, + GPIO_PIN_REG_1, + GPIO_PIN_REG_2, + GPIO_PIN_REG_3, + GPIO_PIN_REG_4, + GPIO_PIN_REG_5, + GPIO_PIN_REG_6, + GPIO_PIN_REG_7, + GPIO_PIN_REG_8, + GPIO_PIN_REG_9, + GPIO_PIN_REG_10, + GPIO_PIN_REG_11, + GPIO_PIN_REG_12, + GPIO_PIN_REG_13, + GPIO_PIN_REG_14, + GPIO_PIN_REG_15, + GPIO_PIN_REG_16, + GPIO_PIN_REG_17, + GPIO_PIN_REG_18, + GPIO_PIN_REG_19, + 0, + GPIO_PIN_REG_21, + GPIO_PIN_REG_22, + GPIO_PIN_REG_23, + 0, + GPIO_PIN_REG_25, + GPIO_PIN_REG_26, + GPIO_PIN_REG_27, + 0, + 0, + 0, + 0, + GPIO_PIN_REG_32, + GPIO_PIN_REG_33, + GPIO_PIN_REG_34, + GPIO_PIN_REG_35, + GPIO_PIN_REG_36, + GPIO_PIN_REG_37, + GPIO_PIN_REG_38, + GPIO_PIN_REG_39 +}; + +static int is_valid_gpio(int gpio_num) +{ + if(gpio_num >= GPIO_PIN_COUNT || GPIO_PIN_MUX_REG[gpio_num] == 0) { + GPIO_ERROR("GPIO io_num=%d does not exist\n",gpio_num); + return 0; + } + return 1; +} + +esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(intr_type >= GPIO_INTR_MAX) { + GPIO_ERROR("Unknown GPIO intr:%u\n",intr_type); + return ESP_ERR_INVALID_ARG; + } + GPIO.pin[gpio_num].int_type = intr_type; + return ESP_OK; +} + +esp_err_t gpio_intr_enable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(xPortGetCoreID() == 0) { + GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr + } else { + GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr + } + return ESP_OK; +} + +esp_err_t gpio_intr_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + GPIO.pin[gpio_num].int_ena = 0; //disable GPIO intr + return ESP_OK; +} + +static esp_err_t gpio_output_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(gpio_num < 32) { + GPIO.enable_w1tc = (0x1 << gpio_num); + } else { + GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); + } + return ESP_OK; +} + +static esp_err_t gpio_output_enable(gpio_num_t gpio_num) +{ + if(gpio_num >= 34) { + GPIO_ERROR("io_num=%d can only be input\n",gpio_num); + return ESP_ERR_INVALID_ARG; + } + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(gpio_num < 32) { + GPIO.enable_w1ts = (0x1 << gpio_num); + } else { + GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); + } + return ESP_OK; +} + +esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) +{ + if(!GPIO_IS_VALID_GPIO(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(level) { + if(gpio_num < 32) { + GPIO.out_w1ts = (1 << gpio_num); + } else { + GPIO.out1_w1ts.data = (1 << (gpio_num - 32)); + } + } else { + if(gpio_num < 32) { + GPIO.out_w1tc = (1 << gpio_num); + } else { + GPIO.out1_w1tc.data = (1 << (gpio_num - 32)); + } + } + return ESP_OK; +} + +int gpio_get_level(gpio_num_t gpio_num) +{ + if(gpio_num < 32) { + return (GPIO.in >> gpio_num) & 0x1; + } else { + return (GPIO.in1.data >> (gpio_num - 32)) & 0x1; + } +} + +esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + esp_err_t ret = ESP_OK; + switch(pull) { + case GPIO_PULLUP_ONLY: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLDOWN_ONLY: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_PULLUP_PULLDOWN: + PIN_PULLUP_EN(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_EN(GPIO_PIN_MUX_REG[gpio_num]); + break; + case GPIO_FLOATING: + PIN_PULLUP_DIS(GPIO_PIN_MUX_REG[gpio_num]); + PIN_PULLDWN_DIS(GPIO_PIN_MUX_REG[gpio_num]); + break; + default: + GPIO_ERROR("Unknown pull up/down mode,gpio_num=%u,pull=%u\n",gpio_num,pull); + ret = ESP_ERR_INVALID_ARG; + break; + } + return ret; +} + +esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if(gpio_num >= 34 && (mode & (GPIO_MODE_DEF_OUTPUT))) { + GPIO_ERROR("io_num=%d can only be input\n",gpio_num); + return ESP_ERR_INVALID_ARG; + } + esp_err_t ret = ESP_OK; + if(mode & GPIO_MODE_DEF_INPUT) { + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); + } else { + PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]); + } + if(mode & GPIO_MODE_DEF_OUTPUT) { + if(gpio_num < 32) { + GPIO.enable_w1ts = (0x1 << gpio_num); + } else { + GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); + } + } else { + if(gpio_num < 32) { + GPIO.enable_w1tc = (0x1 << gpio_num); + } else { + GPIO.enable1_w1tc.data = (0x1 << (gpio_num - 32)); + } + } + if(mode & GPIO_MODE_DEF_OD) { + GPIO.pin[gpio_num].pad_driver = 1; + } else { + GPIO.pin[gpio_num].pad_driver = 0; + } + return ret; +} + +esp_err_t gpio_config(gpio_config_t *pGPIOConfig) +{ + uint64_t gpio_pin_mask = (pGPIOConfig->pin_bit_mask); + uint32_t io_reg = 0; + uint32_t io_num = 0; + uint64_t bit_valid = 0; + if(pGPIOConfig->pin_bit_mask == 0 || pGPIOConfig->pin_bit_mask >= (((uint64_t) 1) << GPIO_PIN_COUNT)) { + GPIO_ERROR("GPIO_PIN mask error \n"); + return ESP_ERR_INVALID_ARG; + } + if((pGPIOConfig->mode) & (GPIO_MODE_DEF_OUTPUT)) { + //GPIO 34/35/36/37/38/39 can only be used as input mode; + if((gpio_pin_mask & ( GPIO_SEL_34 | GPIO_SEL_35 | GPIO_SEL_36 | GPIO_SEL_37 | GPIO_SEL_38 | GPIO_SEL_39))) { + GPIO_ERROR("GPIO34-39 can only be used as input mode\n"); + return ESP_ERR_INVALID_ARG; + } + } + do { + io_reg = GPIO_PIN_MUX_REG[io_num]; + if(((gpio_pin_mask >> io_num) & BIT(0)) && io_reg) { + GPIO_INFO("Gpio%02d |Mode:",io_num); + if((pGPIOConfig->mode) & GPIO_MODE_DEF_INPUT) { + GPIO_INFO("INPUT "); + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[io_num]); + } else { + PIN_INPUT_DISABLE(GPIO_PIN_MUX_REG[io_num]); + } + if((pGPIOConfig->mode) & GPIO_MODE_DEF_OD) { + GPIO_INFO("OD "); + GPIO.pin[io_num].pad_driver = 1; /*0x01 Open-drain */ + } else { + GPIO.pin[io_num].pad_driver = 0; /*0x00 Normal gpio output */ + } + if((pGPIOConfig->mode) & GPIO_MODE_DEF_OUTPUT) { + GPIO_INFO("OUTPUT "); + gpio_output_enable(io_num); + } else { + gpio_output_disable(io_num); + } + GPIO_INFO("|"); + if(pGPIOConfig->pull_up_en) { + GPIO_INFO("PU "); + PIN_PULLUP_EN(io_reg); + } else { + PIN_PULLUP_DIS(io_reg); + } + if(pGPIOConfig->pull_down_en) { + GPIO_INFO("PD "); + PIN_PULLDWN_EN(io_reg); + } else { + PIN_PULLDWN_DIS(io_reg); + } + GPIO_INFO("Intr:%d |\n",pGPIOConfig->intr_type); + gpio_set_intr_type(io_num, pGPIOConfig->intr_type); + if(pGPIOConfig->intr_type) { + gpio_intr_enable(io_num); + } else { + gpio_intr_disable(io_num); + } + PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO); /*function number 2 is GPIO_FUNC for each pin */ + } else if(bit_valid && (io_reg == 0)) { + GPIO_WARNING("io_num=%d does not exist\n",io_num); + } + io_num++; + } while(io_num < GPIO_PIN_COUNT); + return ESP_OK; +} + +esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg) +{ + if(fn == NULL) { + return ESP_ERR_INVALID_ARG; + } + ESP_INTR_DISABLE(gpio_intr_num); + intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num); + xt_set_interrupt_handler(gpio_intr_num, fn, arg); + ESP_INTR_ENABLE(gpio_intr_num); + return ESP_OK; +} + +/*only level interrupt can be used for wake-up function*/ +esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + esp_err_t ret = ESP_OK; + if((intr_type == GPIO_INTR_LOW_LEVEL) || (intr_type == GPIO_INTR_HIGH_LEVEL)) { + GPIO.pin[gpio_num].int_type = intr_type; + GPIO.pin[gpio_num].wakeup_enable = 0x1; + } else { + GPIO_ERROR("GPIO wakeup only support Level mode,but edge mode set. gpio_num:%u\n",gpio_num); + ret = ESP_ERR_INVALID_ARG; + } + return ret; +} + +esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num) +{ + if(!is_valid_gpio(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + GPIO.pin[gpio_num].wakeup_enable = 0; + return ESP_OK; +} From df31bb8dfc2d6967a7bfbe122d6024b935802b2b Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sun, 9 Oct 2016 15:32:08 +0800 Subject: [PATCH 147/179] Rename include, use spaces instead of tabs --- components/esp32/heap_alloc_caps.c | 294 +++++++++--------- .../esp32/include/esp_heap_alloc_caps.h | 34 ++ components/freertos/tasks.c | 1 - 3 files changed, 181 insertions(+), 148 deletions(-) create mode 100644 components/esp32/include/esp_heap_alloc_caps.h diff --git a/components/esp32/heap_alloc_caps.c b/components/esp32/heap_alloc_caps.c index 5b3ec33dba..46b1125ccb 100644 --- a/components/esp32/heap_alloc_caps.c +++ b/components/esp32/heap_alloc_caps.c @@ -15,7 +15,7 @@ #include -#include "heap_alloc_caps.h" +#include "esp_heap_alloc_caps.h" #include "spiram.h" #include "esp_log.h" @@ -40,23 +40,23 @@ Tag descriptors. These describe the capabilities of a bit of memory that's tagge Each tag contains NO_PRIOS entries; later entries are only taken if earlier ones can't fulfill the memory request. */ static const uint32_t tagDesc[][NO_PRIOS]={ - { MALLOC_CAP_DMA|MALLOC_CAP_8BIT, MALLOC_CAP_32BIT, 0 }, //Tag 0: Plain ole D-port RAM - { 0, MALLOC_CAP_DMA|MALLOC_CAP_8BIT, MALLOC_CAP_32BIT|MALLOC_CAP_EXEC }, //Tag 1: Plain ole D-port RAM which has an alias on the I-port - { MALLOC_CAP_EXEC|MALLOC_CAP_32BIT, 0, 0 }, //Tag 2: IRAM - { MALLOC_CAP_PID2, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, //Tag 3-8: PID 2-7 IRAM - { MALLOC_CAP_PID3, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID4, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID5, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID6, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID7, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID2, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, //Tag 9-14: PID 2-7 DRAM - { MALLOC_CAP_PID3, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID4, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID5, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID6, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // - { MALLOC_CAP_PID7, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // - { MALLOC_CAP_SPISRAM, 0, MALLOC_CAP_DMA|MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}, //Tag 15: SPI SRAM data - { MALLOC_CAP_INVALID, MALLOC_CAP_INVALID, MALLOC_CAP_INVALID } //End + { MALLOC_CAP_DMA|MALLOC_CAP_8BIT, MALLOC_CAP_32BIT, 0 }, //Tag 0: Plain ole D-port RAM + { 0, MALLOC_CAP_DMA|MALLOC_CAP_8BIT, MALLOC_CAP_32BIT|MALLOC_CAP_EXEC }, //Tag 1: Plain ole D-port RAM which has an alias on the I-port + { MALLOC_CAP_EXEC|MALLOC_CAP_32BIT, 0, 0 }, //Tag 2: IRAM + { MALLOC_CAP_PID2, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, //Tag 3-8: PID 2-7 IRAM + { MALLOC_CAP_PID3, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID4, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID5, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID6, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID7, 0, MALLOC_CAP_EXEC|MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID2, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, //Tag 9-14: PID 2-7 DRAM + { MALLOC_CAP_PID3, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID4, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID5, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID6, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // + { MALLOC_CAP_PID7, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT }, // + { MALLOC_CAP_SPISRAM, 0, MALLOC_CAP_DMA|MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}, //Tag 15: SPI SRAM data + { MALLOC_CAP_INVALID, MALLOC_CAP_INVALID, MALLOC_CAP_INVALID } //End }; /* @@ -79,81 +79,81 @@ be sorted from low to high start address. This array is *NOT* const because it gets modified depending on what pools are/aren't available. */ static HeapRegionTagged_t regions[]={ - { (uint8_t *)0x3F800000, 0x20000, 15, 0}, //SPI SRAM, if available - { (uint8_t *)0x3FFAE000, 0x2000, 0, 0}, //pool 16 <- used for rom code - { (uint8_t *)0x3FFB0000, 0x8000, 0, 0}, //pool 15 <- can be used for BT - { (uint8_t *)0x3FFB8000, 0x8000, 0, 0}, //pool 14 <- can be used for BT - { (uint8_t *)0x3FFC0000, 0x2000, 0, 0}, //pool 10-13, mmu page 0 - { (uint8_t *)0x3FFC2000, 0x2000, 0, 0}, //pool 10-13, mmu page 1 - { (uint8_t *)0x3FFC4000, 0x2000, 0, 0}, //pool 10-13, mmu page 2 - { (uint8_t *)0x3FFC6000, 0x2000, 0, 0}, //pool 10-13, mmu page 3 - { (uint8_t *)0x3FFC8000, 0x2000, 0, 0}, //pool 10-13, mmu page 4 - { (uint8_t *)0x3FFCA000, 0x2000, 0, 0}, //pool 10-13, mmu page 5 - { (uint8_t *)0x3FFCC000, 0x2000, 0, 0}, //pool 10-13, mmu page 6 - { (uint8_t *)0x3FFCE000, 0x2000, 0, 0}, //pool 10-13, mmu page 7 - { (uint8_t *)0x3FFD0000, 0x2000, 0, 0}, //pool 10-13, mmu page 8 - { (uint8_t *)0x3FFD2000, 0x2000, 0, 0}, //pool 10-13, mmu page 9 - { (uint8_t *)0x3FFD4000, 0x2000, 0, 0}, //pool 10-13, mmu page 10 - { (uint8_t *)0x3FFD6000, 0x2000, 0, 0}, //pool 10-13, mmu page 11 - { (uint8_t *)0x3FFD8000, 0x2000, 0, 0}, //pool 10-13, mmu page 12 - { (uint8_t *)0x3FFDA000, 0x2000, 0, 0}, //pool 10-13, mmu page 13 - { (uint8_t *)0x3FFDC000, 0x2000, 0, 0}, //pool 10-13, mmu page 14 - { (uint8_t *)0x3FFDE000, 0x2000, 0, 0}, //pool 10-13, mmu page 15 - { (uint8_t *)0x3FFE0000, 0x4000, 1, 0x400BC000}, //pool 9 blk 1 - { (uint8_t *)0x3FFE4000, 0x4000, 1, 0x400B8000}, //pool 9 blk 0 - { (uint8_t *)0x3FFE8000, 0x8000, 1, 0x400B0000}, //pool 8 <- can be remapped to ROM, used for MAC dump - { (uint8_t *)0x3FFF0000, 0x8000, 1, 0x400A8000}, //pool 7 <- can be used for MAC dump - { (uint8_t *)0x3FFF8000, 0x4000, 1, 0x400A4000}, //pool 6 blk 1 <- can be used as trace memory - { (uint8_t *)0x3FFFC000, 0x4000, 1, 0x400A0000}, //pool 6 blk 0 <- can be used as trace memory - { (uint8_t *)0x40070000, 0x8000, 2, 0}, //pool 0 - { (uint8_t *)0x40078000, 0x8000, 2, 0}, //pool 1 - { (uint8_t *)0x40080000, 0x2000, 2, 0}, //pool 2-5, mmu page 0 - { (uint8_t *)0x40082000, 0x2000, 2, 0}, //pool 2-5, mmu page 1 - { (uint8_t *)0x40084000, 0x2000, 2, 0}, //pool 2-5, mmu page 2 - { (uint8_t *)0x40086000, 0x2000, 2, 0}, //pool 2-5, mmu page 3 - { (uint8_t *)0x40088000, 0x2000, 2, 0}, //pool 2-5, mmu page 4 - { (uint8_t *)0x4008A000, 0x2000, 2, 0}, //pool 2-5, mmu page 5 - { (uint8_t *)0x4008C000, 0x2000, 2, 0}, //pool 2-5, mmu page 6 - { (uint8_t *)0x4008E000, 0x2000, 2, 0}, //pool 2-5, mmu page 7 - { (uint8_t *)0x40090000, 0x2000, 2, 0}, //pool 2-5, mmu page 8 - { (uint8_t *)0x40092000, 0x2000, 2, 0}, //pool 2-5, mmu page 9 - { (uint8_t *)0x40094000, 0x2000, 2, 0}, //pool 2-5, mmu page 10 - { (uint8_t *)0x40096000, 0x2000, 2, 0}, //pool 2-5, mmu page 11 - { (uint8_t *)0x40098000, 0x2000, 2, 0}, //pool 2-5, mmu page 12 - { (uint8_t *)0x4009A000, 0x2000, 2, 0}, //pool 2-5, mmu page 13 - { (uint8_t *)0x4009C000, 0x2000, 2, 0}, //pool 2-5, mmu page 14 - { (uint8_t *)0x4009E000, 0x2000, 2, 0}, //pool 2-5, mmu page 15 - { NULL, 0, 0, 0} //end + { (uint8_t *)0x3F800000, 0x20000, 15, 0}, //SPI SRAM, if available + { (uint8_t *)0x3FFAE000, 0x2000, 0, 0}, //pool 16 <- used for rom code + { (uint8_t *)0x3FFB0000, 0x8000, 0, 0}, //pool 15 <- can be used for BT + { (uint8_t *)0x3FFB8000, 0x8000, 0, 0}, //pool 14 <- can be used for BT + { (uint8_t *)0x3FFC0000, 0x2000, 0, 0}, //pool 10-13, mmu page 0 + { (uint8_t *)0x3FFC2000, 0x2000, 0, 0}, //pool 10-13, mmu page 1 + { (uint8_t *)0x3FFC4000, 0x2000, 0, 0}, //pool 10-13, mmu page 2 + { (uint8_t *)0x3FFC6000, 0x2000, 0, 0}, //pool 10-13, mmu page 3 + { (uint8_t *)0x3FFC8000, 0x2000, 0, 0}, //pool 10-13, mmu page 4 + { (uint8_t *)0x3FFCA000, 0x2000, 0, 0}, //pool 10-13, mmu page 5 + { (uint8_t *)0x3FFCC000, 0x2000, 0, 0}, //pool 10-13, mmu page 6 + { (uint8_t *)0x3FFCE000, 0x2000, 0, 0}, //pool 10-13, mmu page 7 + { (uint8_t *)0x3FFD0000, 0x2000, 0, 0}, //pool 10-13, mmu page 8 + { (uint8_t *)0x3FFD2000, 0x2000, 0, 0}, //pool 10-13, mmu page 9 + { (uint8_t *)0x3FFD4000, 0x2000, 0, 0}, //pool 10-13, mmu page 10 + { (uint8_t *)0x3FFD6000, 0x2000, 0, 0}, //pool 10-13, mmu page 11 + { (uint8_t *)0x3FFD8000, 0x2000, 0, 0}, //pool 10-13, mmu page 12 + { (uint8_t *)0x3FFDA000, 0x2000, 0, 0}, //pool 10-13, mmu page 13 + { (uint8_t *)0x3FFDC000, 0x2000, 0, 0}, //pool 10-13, mmu page 14 + { (uint8_t *)0x3FFDE000, 0x2000, 0, 0}, //pool 10-13, mmu page 15 + { (uint8_t *)0x3FFE0000, 0x4000, 1, 0x400BC000}, //pool 9 blk 1 + { (uint8_t *)0x3FFE4000, 0x4000, 1, 0x400B8000}, //pool 9 blk 0 + { (uint8_t *)0x3FFE8000, 0x8000, 1, 0x400B0000}, //pool 8 <- can be remapped to ROM, used for MAC dump + { (uint8_t *)0x3FFF0000, 0x8000, 1, 0x400A8000}, //pool 7 <- can be used for MAC dump + { (uint8_t *)0x3FFF8000, 0x4000, 1, 0x400A4000}, //pool 6 blk 1 <- can be used as trace memory + { (uint8_t *)0x3FFFC000, 0x4000, 1, 0x400A0000}, //pool 6 blk 0 <- can be used as trace memory + { (uint8_t *)0x40070000, 0x8000, 2, 0}, //pool 0 + { (uint8_t *)0x40078000, 0x8000, 2, 0}, //pool 1 + { (uint8_t *)0x40080000, 0x2000, 2, 0}, //pool 2-5, mmu page 0 + { (uint8_t *)0x40082000, 0x2000, 2, 0}, //pool 2-5, mmu page 1 + { (uint8_t *)0x40084000, 0x2000, 2, 0}, //pool 2-5, mmu page 2 + { (uint8_t *)0x40086000, 0x2000, 2, 0}, //pool 2-5, mmu page 3 + { (uint8_t *)0x40088000, 0x2000, 2, 0}, //pool 2-5, mmu page 4 + { (uint8_t *)0x4008A000, 0x2000, 2, 0}, //pool 2-5, mmu page 5 + { (uint8_t *)0x4008C000, 0x2000, 2, 0}, //pool 2-5, mmu page 6 + { (uint8_t *)0x4008E000, 0x2000, 2, 0}, //pool 2-5, mmu page 7 + { (uint8_t *)0x40090000, 0x2000, 2, 0}, //pool 2-5, mmu page 8 + { (uint8_t *)0x40092000, 0x2000, 2, 0}, //pool 2-5, mmu page 9 + { (uint8_t *)0x40094000, 0x2000, 2, 0}, //pool 2-5, mmu page 10 + { (uint8_t *)0x40096000, 0x2000, 2, 0}, //pool 2-5, mmu page 11 + { (uint8_t *)0x40098000, 0x2000, 2, 0}, //pool 2-5, mmu page 12 + { (uint8_t *)0x4009A000, 0x2000, 2, 0}, //pool 2-5, mmu page 13 + { (uint8_t *)0x4009C000, 0x2000, 2, 0}, //pool 2-5, mmu page 14 + { (uint8_t *)0x4009E000, 0x2000, 2, 0}, //pool 2-5, mmu page 15 + { NULL, 0, 0, 0} //end }; //Modify regions array to disable the given range of memory. static void disable_mem_region(void *from, void *to) { - int i; - //Align from and to on word boundaries - from=(void*)((uint32_t)from&~3); - to=(void*)(((uint32_t)to+3)&~3); - for (i=0; regions[i].xSizeInBytes!=0; i++) { - void *regStart=regions[i].pucStartAddress; - void *regEnd=regions[i].pucStartAddress+regions[i].xSizeInBytes; - if (regStart>=from && regEnd<=to) { - //Entire region falls in the range. Disable entirely. - regions[i].xTag=-1; - } else if (regStart>=from && regEnd>to && regStartfrom && regEnd<=to) { - //End of the region falls in the range. Modify length. - regions[i].xSizeInBytes-=(uint8_t *)regEnd-(uint8_t *)from; - } else if (regStartto) { - //Range punches a hole in the region! We do not support this. - ESP_EARLY_LOGE(TAG, "region %d: hole punching is not supported!", i); - regions[i].xTag=-1; //Just disable memory region. That'll teach them! - } - } + int i; + //Align from and to on word boundaries + from=(void*)((uint32_t)from&~3); + to=(void*)(((uint32_t)to+3)&~3); + for (i=0; regions[i].xSizeInBytes!=0; i++) { + void *regStart=regions[i].pucStartAddress; + void *regEnd=regions[i].pucStartAddress+regions[i].xSizeInBytes; + if (regStart>=from && regEnd<=to) { + //Entire region falls in the range. Disable entirely. + regions[i].xTag=-1; + } else if (regStart>=from && regEnd>to && regStartfrom && regEnd<=to) { + //End of the region falls in the range. Modify length. + regions[i].xSizeInBytes-=(uint8_t *)regEnd-(uint8_t *)from; + } else if (regStartto) { + //Range punches a hole in the region! We do not support this. + ESP_EARLY_LOGE(TAG, "region %d: hole punching is not supported!", i); + regions[i].xTag=-1; //Just disable memory region. That'll teach them! + } + } } @@ -170,52 +170,52 @@ ToDo: The regions are different when stuff like trace memory, BT, ... is used. M Same with loading of apps. Same with using SPI RAM. */ void heap_alloc_caps_init() { - int i; - //Disable the bits of memory where this code is loaded. - disable_mem_region(&_bss_start, &_heap_start); - disable_mem_region((void*)0x3ffae000, (void*)0x3ffb0000); //knock out ROM data region - disable_mem_region((void*)0x40070000, (void*)0x40078000); //CPU0 cache region - disable_mem_region((void*)0x40078000, (void*)0x40080000); //CPU1 cache region - disable_mem_region((void*)0x40080000, (void*)0x400a0000); //pool 2-5 + int i; + //Disable the bits of memory where this code is loaded. + disable_mem_region(&_bss_start, &_heap_start); + disable_mem_region((void*)0x3ffae000, (void*)0x3ffb0000); //knock out ROM data region + disable_mem_region((void*)0x40070000, (void*)0x40078000); //CPU0 cache region + disable_mem_region((void*)0x40078000, (void*)0x40080000); //CPU1 cache region + disable_mem_region((void*)0x40080000, (void*)0x400a0000); //pool 2-5 - // TODO: this region should be checked, since we don't need to knock out all region finally - disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region + // TODO: this region should be checked, since we don't need to knock out all region finally + disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region #if CONFIG_MEMMAP_BT - disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region + disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region #endif #if CONFIG_MEMMAP_TRACEMEM - disable_mem_region((void*)0x3fff8000, (void*)0x40000000); //knock out trace mem region + disable_mem_region((void*)0x3fff8000, (void*)0x40000000); //knock out trace mem region #endif #if 0 - enable_spi_sram(); + enable_spi_sram(); #else - disable_mem_region((void*)0x3f800000, (void*)0x3f820000); //SPI SRAM not installed + disable_mem_region((void*)0x3f800000, (void*)0x3f820000); //SPI SRAM not installed #endif - //The heap allocator will treat every region given to it as separate. In order to get bigger ranges of contiguous memory, - //it's useful to coalesce adjacent regions that have the same tag. + //The heap allocator will treat every region given to it as separate. In order to get bigger ranges of contiguous memory, + //it's useful to coalesce adjacent regions that have the same tag. - for (i=1; regions[i].xSizeInBytes!=0; i++) { - if (regions[i].pucStartAddress == (regions[i-1].pucStartAddress + regions[i-1].xSizeInBytes) && - regions[i].xTag == regions[i-1].xTag ) { - regions[i-1].xTag=-1; - regions[i].pucStartAddress=regions[i-1].pucStartAddress; - regions[i].xSizeInBytes+=regions[i-1].xSizeInBytes; - } - } + for (i=1; regions[i].xSizeInBytes!=0; i++) { + if (regions[i].pucStartAddress == (regions[i-1].pucStartAddress + regions[i-1].xSizeInBytes) && + regions[i].xTag == regions[i-1].xTag ) { + regions[i-1].xTag=-1; + regions[i].pucStartAddress=regions[i-1].pucStartAddress; + regions[i].xSizeInBytes+=regions[i-1].xSizeInBytes; + } + } - ESP_EARLY_LOGI(TAG, "Initializing heap allocator:"); - for (i=0; regions[i].xSizeInBytes!=0; i++) { - if (regions[i].xTag != -1) { - ESP_EARLY_LOGI(TAG, "Region %02d: %08X len %08X tag %d", i, - (int)regions[i].pucStartAddress, regions[i].xSizeInBytes, regions[i].xTag); - } - } - //Initialize the malloc implementation. - vPortDefineHeapRegionsTagged( regions ); + ESP_EARLY_LOGI(TAG, "Initializing heap allocator:"); + for (i=0; regions[i].xSizeInBytes!=0; i++) { + if (regions[i].xTag != -1) { + ESP_EARLY_LOGI(TAG, "Region %02d: %08X len %08X tag %d", i, + (int)regions[i].pucStartAddress, regions[i].xSizeInBytes, regions[i].xTag); + } + } + //Initialize the malloc implementation. + vPortDefineHeapRegionsTagged( regions ); } /* @@ -223,7 +223,7 @@ Standard malloc() implementation. Will return ho-hum byte-accessible data memory */ void *pvPortMalloc( size_t xWantedSize ) { - return pvPortMallocCaps( xWantedSize, MALLOC_CAP_8BIT ); + return pvPortMallocCaps( xWantedSize, MALLOC_CAP_8BIT ); } /* @@ -231,30 +231,30 @@ Routine to allocate a bit of memory with certain capabilities. caps is a bitfiel */ void *pvPortMallocCaps( size_t xWantedSize, uint32_t caps ) { - int prio; - int tag, j; - void *ret=NULL; - uint32_t remCaps; - for (prio=0; prio Date: Sun, 9 Oct 2016 15:45:25 +0800 Subject: [PATCH 148/179] lwip/esp32: support iperf 1. Add _exit() definition in syscalls.c 2. Fix a bug in sockets.c on which iperf depends --- components/esp32/syscalls.c | 4 ++++ components/lwip/api/sockets.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/esp32/syscalls.c b/components/esp32/syscalls.c index 537efed1d4..052605ee3e 100644 --- a/components/esp32/syscalls.c +++ b/components/esp32/syscalls.c @@ -142,6 +142,10 @@ int _open_r(struct _reent *r, const char * path, int flags, int mode) { return 0; } +void _exit(int __status) { + abort(); +} + ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) { const char *data_c = (const char *)data; if (fd == STDOUT_FILENO) { diff --git a/components/lwip/api/sockets.c b/components/lwip/api/sockets.c index 91a5222e68..350847b57c 100755 --- a/components/lwip/api/sockets.c +++ b/components/lwip/api/sockets.c @@ -1442,8 +1442,15 @@ lwip_sendto(int s, const void *data, size_t size, int flags, #ifdef LWIP_ESP8266 /*fix the code for getting the UDP proto's remote information by liuh at 2014.8.27*/ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP){ - buf.addr.u_addr.ip4.addr = sock->conn->pcb.udp->remote_ip.u_addr.ip4.addr; - remote_port = sock->conn->pcb.udp->remote_port; + if(NETCONNTYPE_ISIPV6(netconn_type(sock->conn))) { + memcpy(&buf.addr.u_addr.ip6.addr, sock->conn->pcb.udp->remote_ip.u_addr.ip6.addr,16); + remote_port = sock->conn->pcb.udp->remote_port; + IP_SET_TYPE(&buf.addr, IPADDR_TYPE_V6); + } else { + buf.addr.u_addr.ip4.addr = sock->conn->pcb.udp->remote_ip.u_addr.ip4.addr; + remote_port = sock->conn->pcb.udp->remote_port; + IP_SET_TYPE(&buf.addr, IPADDR_TYPE_V4); + } } else { #endif remote_port = 0; From a20c2f10881abb082184cab36067bc9866459971 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 4 Oct 2016 10:12:17 +1100 Subject: [PATCH 149/179] 'make flash' targets: Print serial port when flashing Inspired by github #30 and related mentions where selected serial port is not clear from the make output. --- components/esptool_py/Makefile.projbuild | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index 49f0548369..a3d49b7df9 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -24,10 +24,11 @@ $(APP_BIN): $(APP_ELF) $(ESPTOOLPY_SRC) $(Q) $(ESPTOOLPY) elf2image --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) -o $@ $< flash: all_binaries $(ESPTOOLPY_SRC) - @echo "Flashing project app to $(CONFIG_APP_OFFSET)..." + @echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS) app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) + @echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN) $(eval $(call SubmoduleRequiredForFiles,$(ESPTOOLPY_SRC))) From 71c09d8f66445b029620e1f97602d0b2ca5d15c9 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Sun, 2 Oct 2016 02:04:09 +0200 Subject: [PATCH 150/179] Fix stack overflow message format Poorly formatted message for stack overflow for task. Closes #36 --- components/freertos/panic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/freertos/panic.c b/components/freertos/panic.c index b575022369..9400867356 100644 --- a/components/freertos/panic.c +++ b/components/freertos/panic.c @@ -79,9 +79,9 @@ inline static void panicPutDec(int a) { } int xPortGetCoreID(); void __attribute__((weak)) vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) { - panicPutStr("***ERROR*** A stack overflow in task"); + panicPutStr("***ERROR*** A stack overflow in task "); panicPutStr((char*)pcTaskName); - panicPutStr("has been detected.\r\n"); + panicPutStr(" has been detected.\r\n"); } static const char *edesc[]={ From 79bd6af7e74cc174f83b36c026f0788ebbc38143 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 4 Oct 2016 16:33:18 +1100 Subject: [PATCH 151/179] build system: Print a WARNING if any submodule is out of date Inspired by Github #27 and related "gotchas" with keeping submodules up to date. --- components/bt/component.mk | 4 +--- components/esp32/component.mk | 2 +- components/esptool_py/Makefile.projbuild | 2 +- make/common.mk | 24 ++++++++++++++++-------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/components/bt/component.mk b/components/bt/component.mk index a9233cc74a..e88651aa13 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -4,8 +4,6 @@ #COMPONENT_ADD_INCLUDEDIRS := -CURRENT_DIR=$(IDF_PATH)/components/bt - COMPONENT_ADD_INCLUDEDIRS := include CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses @@ -22,4 +20,4 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) # automatically trigger a git submodule update if BT library is missing -$(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) +$(eval $(call SubmoduleCheck,$(ALL_LIB_FILES),$(COMPONENT_PATH)/lib)) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 6eac77afd3..b41acee60d 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -27,7 +27,7 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) # automatically trigger a git submodule update # if any libraries are missing -$(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) +$(eval $(call SubmoduleCheck,$(ALL_LIB_FILES),$(COMPONENT_PATH)/lib)) # this is a hack to make sure the app is re-linked if the binary # libraries change or are updated. If they change, the main esp32 diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index a3d49b7df9..4d0dd1b3e5 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -31,4 +31,4 @@ app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) @echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN) -$(eval $(call SubmoduleRequiredForFiles,$(ESPTOOLPY_SRC))) +$(eval $(call SubmoduleCheck,$(ESPTOOLPY_SRC),$(COMPONENT_PATH)/esptool)) diff --git a/make/common.mk b/make/common.mk index a515584a9b..14aa4074b3 100644 --- a/make/common.mk +++ b/make/common.mk @@ -23,19 +23,27 @@ summary := @echo details := @true endif -# Pseudo-target to handle the case where submodules need to be -# re-initialised. +# Pseudo-target to check a git submodule has been properly initialised # -# $(eval $(call SubmoduleRequiredForFiles,FILENAMES)) to create a target that -# automatically runs 'git submodule update --init' if those files -# are missing, and fails if this is not possible. -define SubmoduleRequiredForFiles +# $(eval $(call SubmoduleCheck,FILENAMES,SUBMODULE_PATH)) to create a target that +# automatically runs 'git submodule update --init SUBMODULE_PATH' if any of +# the files in FILENAMES are missing, and fails if this is not possible. +# +# Will also print a WARNING if the submodule at SUBMODULE_PATH appears +# to require an update. +define SubmoduleCheck $(1): - @echo "WARNING: Missing submodule for $$@..." + @echo "WARNING: Missing submodule $(2) for $$@..." $(Q) [ -d ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1) $(Q) [ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule --init' in esp-idf root directory."; exit 1) @echo "Attempting 'git submodule update --init' in esp-idf root directory..." - cd ${IDF_PATH} && git submodule update --init + cd ${IDF_PATH} && git submodule update --init $(2) + +# Parse 'git submodule status' output for out-of-date submodule. +# Status output prefixes status line with '+' if the submodule commit doesn't match +ifneq ("$(shell cd ${IDF_PATH} && git submodule status $(2) | grep '^+')","") +$$(info WARNING: git submodule $2 may be out of date. Run 'git submodule update' to update.) +endif endef From c12582c122a0141119a38d518e0bb9510976024d Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 6 Oct 2016 09:55:43 +1100 Subject: [PATCH 152/179] bootloader: Fix accidental tabs introduced in !78 --- .../bootloader/src/main/bootloader_start.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/bootloader/src/main/bootloader_start.c b/components/bootloader/src/main/bootloader_start.c index e0ab7f9e2a..a61ea77d59 100644 --- a/components/bootloader/src/main/bootloader_start.c +++ b/components/bootloader/src/main/bootloader_start.c @@ -411,15 +411,15 @@ void unpack_load_app(const partition_pos_t* partition) map = true; } - if(!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) { - ESP_LOGD(TAG, "Skipping RTC code section at %08x\n", pos); - load = false; - } + if (!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) { + ESP_LOGD(TAG, "Skipping RTC code section at %08x\n", pos); + load = false; + } - if(!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) { - ESP_LOGD(TAG, "Skipping RTC data section at %08x\n", pos); - load = false; - } + if (!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) { + ESP_LOGD(TAG, "Skipping RTC data section at %08x\n", pos); + load = false; + } ESP_LOGI(TAG, "section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); From 1bae606ccce4f6925f33726a14067c0624db37f5 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 6 Oct 2016 10:06:01 +1100 Subject: [PATCH 153/179] FreeRTOS KConfig: Limit tick rate to 1000Hz >1000Hz breaks portTICK_PERIOD_MS (see gitlab 4) A working >1000Hz tick rate is possible with some changes, but beyond a certain point it's dimishing returns to preempt tasks this often. --- components/freertos/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 7e0245e92d..1a65e1eeb7 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -39,7 +39,7 @@ endchoice config FREERTOS_HZ int "Tick rate (Hz)" - range 1 10000 + range 1 1000 default 100 help Select the tick rate at which FreeRTOS does pre-emptive context switching. From 609c1c2cdba08d75613673a252c0e8e1a83ab3be Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 10 Oct 2016 17:19:13 +1100 Subject: [PATCH 154/179] build system: Add -fno-rtti when compiling C++ code --- make/project.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/project.mk b/make/project.mk index 35dccaf248..d91165cfd7 100644 --- a/make/project.mk +++ b/make/project.mk @@ -165,7 +165,7 @@ CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-func CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fstrict-volatile-bitfields # CXXFLAGS uses by C++ only -CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields +CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields -fno-rtti export CFLAGS CPPFLAGS CXXFLAGS From 90e57cdf8f3f15c3af257b42feb28ade4907d581 Mon Sep 17 00:00:00 2001 From: Yinling Date: Mon, 26 Sep 2016 14:27:57 +0800 Subject: [PATCH 155/179] add auto generated test folder to components: 1. add test cases and related scripts 2. add CI config files read README.md for detail --- components/test/CIConfigs/Function_SYS_01.yml | 5 + .../test/CIConfigs/Function_TCPIP_01.yml | 11 + .../test/CIConfigs/Function_TCPIP_02.yml | 11 + .../test/CIConfigs/Function_TCPIP_03.yml | 11 + .../test/CIConfigs/Function_TCPIP_04.yml | 11 + .../test/CIConfigs/Function_TCPIP_05.yml | 11 + .../test/CIConfigs/Function_TCPIP_06.yml | 8 + .../test/CIConfigs/Function_TCPIP_07.yml | 5 + .../test/CIConfigs/Function_WIFI_01.yml | 11 + .../test/CIConfigs/Function_WIFI_02.yml | 9 + components/test/InitialConditionAll.yml | 2923 ++++ components/test/README.md | 35 + components/test/TestCaseAll.yml | 13810 ++++++++++++++++ .../TestCaseScript/ATFunc/CmdInterruptTest.py | 130 + components/test/TestCaseScript/ATFunc/LAP.py | 64 + .../ATFunc/SendDataValidation.py | 161 + .../test/TestCaseScript/ATFunc/UARTTest.py | 164 + .../test/TestCaseScript/ATFunc/__init__.py | 2 + .../TestCaseScript/ATStress/ATPassThrough.py | 179 + .../test/TestCaseScript/ATStress/ATSleep.py | 251 + .../TestCaseScript/ATStress/SoftAPServer.py | 308 + .../TestCaseScript/ATStress/TCPClientMulti.py | 116 + .../ATStress/TCPClientSingle.py | 123 + .../TestCaseScript/ATStress/TCPSendPerf.py | 148 + .../TestCaseScript/ATStress/TCPServerMulti.py | 126 + .../TestCaseScript/ATStress/TCPTransparent.py | 280 + .../test/TestCaseScript/ATStress/UDPMulti.py | 113 + .../test/TestCaseScript/ATStress/UDPSingle.py | 105 + .../TestCaseScript/ATStress/UDPTransparent.py | 262 + .../test/TestCaseScript/ATStress/__init__.py | 2 + components/test/TestCaseScript/IOT/SCIOT.py | 357 + .../test/TestCaseScript/IOT/SCUDPServer.py | 378 + .../TestCaseScript/IOT/WifiConnUtility.py | 244 + components/test/TestCaseScript/IOT/WifiJAP.py | 183 + .../test/TestCaseScript/IOT/__init__.py | 1 + .../TestCaseScript/MeshStress/MeshSendRecv.py | 525 + .../TestCaseScript/MeshStress/__init__.py | 1 + .../test/TestCaseScript/SSLTest/Capability.py | 90 + .../TestCaseScript/SSLTest/ConfigUtility.py | 333 + .../test/TestCaseScript/SSLTest/Parameter.py | 56 + .../test/TestCaseScript/SSLTest/SSLHandler.py | 498 + .../TestCaseScript/SSLTest/SSLHandshake.py | 240 + .../test/TestCaseScript/SSLTest/SSLLowMem.py | 140 + .../TestCaseScript/SSLTest/SSLSendRecv.py | 147 + .../test/TestCaseScript/SSLTest/__init__.py | 1 + .../TestCaseScript/SleepMode/AutoSleep.py | 561 + .../TestCaseScript/SleepMode/DeepSleep.py | 259 + .../TestCaseScript/SleepMode/ForceSleep.py | 254 + .../test/TestCaseScript/SleepMode/__init__.py | 1 + .../TestCaseScript/StableTest/StableCase1.py | 160 + .../TestCaseScript/StableTest/__init__.py | 1 + .../TestCaseScript/TCPIPStress/ARPStress.py | 121 + .../TestCaseScript/TCPIPStress/PingStress.py | 122 + .../TestCaseScript/TCPIPStress/__init__.py | 1 + .../TestCaseScript/TCPStress/TCPAP4STA.py | 168 + .../TestCaseScript/TCPStress/TCPAPNSTA.py | 209 + .../TCPStress/TCPConnStressTC.py | 363 + .../TCPStress/TCPConnUtility.py | 273 + .../TestCaseScript/TCPStress/TCPConnection.py | 321 + .../TCPStress/TCPConnectionUtility.py | 251 + .../TCPStress/TCPDataValidation.py | 244 + .../TestCaseScript/TCPStress/TCPRandomSend.py | 103 + .../TestCaseScript/TCPStress/TCPSendRecv.py | 143 + .../TCPStress/TCPSoftAPSTASendRecv.py | 318 + .../TestCaseScript/TCPStress/TCPThroughput.py | 315 + .../test/TestCaseScript/TCPStress/__init__.py | 1 + .../TestCaseScript/UDPStress/UDPSendRecv.py | 130 + .../TestCaseScript/UDPStress/UDPThroughput.py | 305 + .../test/TestCaseScript/UDPStress/__init__.py | 1 + .../TestCaseScript/WiFiStress/SoftAPNSTA.py | 178 + .../WiFiStress/WifiConnUtility.py | 240 + .../test/TestCaseScript/WiFiStress/WifiJAP.py | 218 + .../TestCaseScript/WiFiStress/WifiJAPAtt.py | 173 + .../WiFiStress/WifiSmartConfig.py | 273 + .../TestCaseScript/WiFiStress/__init__.py | 1 + components/test/TestCaseScript/__init__.py | 2 + components/test/TestEnvAll.yml | 275 + 77 files changed, 28574 insertions(+) create mode 100644 components/test/CIConfigs/Function_SYS_01.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_01.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_02.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_03.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_04.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_05.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_06.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_07.yml create mode 100644 components/test/CIConfigs/Function_WIFI_01.yml create mode 100644 components/test/CIConfigs/Function_WIFI_02.yml create mode 100644 components/test/InitialConditionAll.yml create mode 100644 components/test/README.md create mode 100644 components/test/TestCaseAll.yml create mode 100755 components/test/TestCaseScript/ATFunc/CmdInterruptTest.py create mode 100644 components/test/TestCaseScript/ATFunc/LAP.py create mode 100755 components/test/TestCaseScript/ATFunc/SendDataValidation.py create mode 100644 components/test/TestCaseScript/ATFunc/UARTTest.py create mode 100755 components/test/TestCaseScript/ATFunc/__init__.py create mode 100755 components/test/TestCaseScript/ATStress/ATPassThrough.py create mode 100644 components/test/TestCaseScript/ATStress/ATSleep.py create mode 100755 components/test/TestCaseScript/ATStress/SoftAPServer.py create mode 100755 components/test/TestCaseScript/ATStress/TCPClientMulti.py create mode 100755 components/test/TestCaseScript/ATStress/TCPClientSingle.py create mode 100755 components/test/TestCaseScript/ATStress/TCPSendPerf.py create mode 100755 components/test/TestCaseScript/ATStress/TCPServerMulti.py create mode 100755 components/test/TestCaseScript/ATStress/TCPTransparent.py create mode 100755 components/test/TestCaseScript/ATStress/UDPMulti.py create mode 100755 components/test/TestCaseScript/ATStress/UDPSingle.py create mode 100755 components/test/TestCaseScript/ATStress/UDPTransparent.py create mode 100755 components/test/TestCaseScript/ATStress/__init__.py create mode 100755 components/test/TestCaseScript/IOT/SCIOT.py create mode 100755 components/test/TestCaseScript/IOT/SCUDPServer.py create mode 100755 components/test/TestCaseScript/IOT/WifiConnUtility.py create mode 100755 components/test/TestCaseScript/IOT/WifiJAP.py create mode 100755 components/test/TestCaseScript/IOT/__init__.py create mode 100755 components/test/TestCaseScript/MeshStress/MeshSendRecv.py create mode 100755 components/test/TestCaseScript/MeshStress/__init__.py create mode 100755 components/test/TestCaseScript/SSLTest/Capability.py create mode 100755 components/test/TestCaseScript/SSLTest/ConfigUtility.py create mode 100755 components/test/TestCaseScript/SSLTest/Parameter.py create mode 100644 components/test/TestCaseScript/SSLTest/SSLHandler.py create mode 100755 components/test/TestCaseScript/SSLTest/SSLHandshake.py create mode 100644 components/test/TestCaseScript/SSLTest/SSLLowMem.py create mode 100644 components/test/TestCaseScript/SSLTest/SSLSendRecv.py create mode 100755 components/test/TestCaseScript/SSLTest/__init__.py create mode 100755 components/test/TestCaseScript/SleepMode/AutoSleep.py create mode 100755 components/test/TestCaseScript/SleepMode/DeepSleep.py create mode 100755 components/test/TestCaseScript/SleepMode/ForceSleep.py create mode 100755 components/test/TestCaseScript/SleepMode/__init__.py create mode 100755 components/test/TestCaseScript/StableTest/StableCase1.py create mode 100755 components/test/TestCaseScript/StableTest/__init__.py create mode 100755 components/test/TestCaseScript/TCPIPStress/ARPStress.py create mode 100755 components/test/TestCaseScript/TCPIPStress/PingStress.py create mode 100755 components/test/TestCaseScript/TCPIPStress/__init__.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPAP4STA.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPAPNSTA.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPConnStressTC.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPConnUtility.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPConnection.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPDataValidation.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPRandomSend.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPSendRecv.py create mode 100644 components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py create mode 100755 components/test/TestCaseScript/TCPStress/TCPThroughput.py create mode 100755 components/test/TestCaseScript/TCPStress/__init__.py create mode 100755 components/test/TestCaseScript/UDPStress/UDPSendRecv.py create mode 100755 components/test/TestCaseScript/UDPStress/UDPThroughput.py create mode 100755 components/test/TestCaseScript/UDPStress/__init__.py create mode 100755 components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py create mode 100755 components/test/TestCaseScript/WiFiStress/WifiConnUtility.py create mode 100755 components/test/TestCaseScript/WiFiStress/WifiJAP.py create mode 100755 components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py create mode 100755 components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py create mode 100755 components/test/TestCaseScript/WiFiStress/__init__.py create mode 100755 components/test/TestCaseScript/__init__.py create mode 100644 components/test/TestEnvAll.yml diff --git a/components/test/CIConfigs/Function_SYS_01.yml b/components/test/CIConfigs/Function_SYS_01.yml new file mode 100644 index 0000000000..501f15f6ba --- /dev/null +++ b/components/test/CIConfigs/Function_SYS_01.yml @@ -0,0 +1,5 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- ADD: + ID: [SYS_MISC_0101, SYS_MISC_0201] diff --git a/components/test/CIConfigs/Function_TCPIP_01.yml b/components/test/CIConfigs/Function_TCPIP_01.yml new file mode 100644 index 0000000000..9b43ab589b --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_01.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [TCPIP_ICMP_0101, TCPIP_ARP_0202, ^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, + TCPIP_DHCP_0302, TCPIP_DHCP_0301, TCPIP_ARP_0204, TCPIP_TCP_0412, TCPIP_TCP_0403, + TCPIP_TCP_0402, TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, TCPIP_TCP_0404, + TCPIP_TCP_0408, ^TCPIP_TCP_0202, TCPIP_TCP_0110, ^TCPIP_TCP_0203, TCPIP_DHCP_0101, + TCPIP_DHCP_0103, TCPIP_DHCP_0102, ^TCPIP_UDP_0303, ^TCPIP_UDP_0302, ^TCPIP_UDP_0301, + TCPIP_DNS_0102, TCPIP_DNS_0101, TCPIP_IP_0101, TCPIP_IP_0102, ^TCPIP_IGMP_0102, + ^TCPIP_IGMP_0101] diff --git a/components/test/CIConfigs/Function_TCPIP_02.yml b/components/test/CIConfigs/Function_TCPIP_02.yml new file mode 100644 index 0000000000..7e0a3ead43 --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_02.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [^TCPIP_IGMP_0104, ^TCPIP_UDP_0110, TCPIP_IGMP_0104, TCPIP_IGMP_0103, TCPIP_IGMP_0102, + TCPIP_IGMP_0101, ^TCPIP_UDP_0201, ^TCPIP_ICMP_0101, TCPIP_UDP_0108, TCPIP_UDP_0109, + TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0104, TCPIP_UDP_0105, TCPIP_UDP_0102, + TCPIP_UDP_0103, TCPIP_UDP_0101, TCPIP_IGMP_0204, TCPIP_IGMP_0201, TCPIP_IGMP_0202, + TCPIP_IGMP_0203, ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, + ^TCPIP_TCP_0402, ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, TCPIP_UDP_0201, ^TCPIP_UDP_0307, + ^TCPIP_UDP_0306] diff --git a/components/test/CIConfigs/Function_TCPIP_03.yml b/components/test/CIConfigs/Function_TCPIP_03.yml new file mode 100644 index 0000000000..33dcd14bea --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_03.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [^TCPIP_UDP_0305, ^TCPIP_UDP_0304, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0102, + ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, + ^TCPIP_DHCP_0211, TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, + TCPIP_DHCP_0211, TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, ^TCPIP_IP_0102, + ^TCPIP_UDP_0105, ^TCPIP_UDP_0104, ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, + ^TCPIP_UDP_0103, ^TCPIP_UDP_0102, ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, ^TCPIP_UDP_0108, + ^TCPIP_IGMP_0201] diff --git a/components/test/CIConfigs/Function_TCPIP_04.yml b/components/test/CIConfigs/Function_TCPIP_04.yml new file mode 100644 index 0000000000..af2cc7d22f --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_04.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, TCPIP_UDP_0114, TCPIP_UDP_0111, + TCPIP_UDP_0110, TCPIP_UDP_0113, TCPIP_UDP_0112, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, + ^TCPIP_TCP_0207, TCPIP_TCP_0501, ^TCPIP_DNS_0101, ^TCPIP_DNS_0103, ^TCPIP_DNS_0102, + TCPIP_TCP_0106, TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, TCPIP_TCP_0102, + TCPIP_TCP_0103, TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114, ^TCPIP_TCP_0115, + ^TCPIP_TCP_0112, ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, TCPIP_ARP_0101, + TCPIP_UDP_0304] diff --git a/components/test/CIConfigs/Function_TCPIP_05.yml b/components/test/CIConfigs/Function_TCPIP_05.yml new file mode 100644 index 0000000000..a89ece34cc --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_05.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [TCPIP_UDP_0305, TCPIP_UDP_0306, TCPIP_UDP_0307, TCPIP_UDP_0301, TCPIP_UDP_0302, + TCPIP_UDP_0303, ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, + ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, + TCPIP_TCP_0204, TCPIP_TCP_0207, TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, + TCPIP_TCP_0203, TCPIP_TCP_0202, TCPIP_TCP_0208, TCPIP_DNS_0103, TCPIP_DHCP_0206, + TCPIP_DHCP_0207, TCPIP_DHCP_0204, TCPIP_DHCP_0205, TCPIP_DHCP_0202, TCPIP_DHCP_0203, + ^TCPIP_TCP_0204] diff --git a/components/test/CIConfigs/Function_TCPIP_06.yml b/components/test/CIConfigs/Function_TCPIP_06.yml new file mode 100644 index 0000000000..929aafd13e --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_06.yml @@ -0,0 +1,8 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [TCPIP_DHCP_0201, ^TCPIP_TCP_0208, TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, + ^TCPIP_TCP_0411, TCPIP_ARP_0203, ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, + ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, TCPIP_ARP_0201, TCPIP_TCP_0115, TCPIP_TCP_0114, + TCPIP_TCP_0116, TCPIP_TCP_0111, TCPIP_TCP_0113, TCPIP_TCP_0112] diff --git a/components/test/CIConfigs/Function_TCPIP_07.yml b/components/test/CIConfigs/Function_TCPIP_07.yml new file mode 100644 index 0000000000..d42b5902ad --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_07.yml @@ -0,0 +1,5 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- ADD: + ID: [TCPIP_TCP_0405, ^TCPIP_TCP_0405] diff --git a/components/test/CIConfigs/Function_WIFI_01.yml b/components/test/CIConfigs/Function_WIFI_01.yml new file mode 100644 index 0000000000..594a1fc212 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_01.yml @@ -0,0 +1,11 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, ^WIFI_CONN_0903, WIFI_SCAN_0103, WIFI_SCAN_0102, + WIFI_SCAN_0101, WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0702, + WIFI_CONN_0703, WIFI_CONN_0701, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0701, + ^WIFI_CONN_0703, ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, + ^WIFI_ADDR_0102, WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, + WIFI_CONN_0301, ^WIFI_CONN_0801, WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, + WIFI_CONN_0502] diff --git a/components/test/CIConfigs/Function_WIFI_02.yml b/components/test/CIConfigs/Function_WIFI_02.yml new file mode 100644 index 0000000000..30735791b7 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_02.yml @@ -0,0 +1,9 @@ +Config: {debug mode: false, execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- ADD: + ID: [^WIFI_CONN_0401, WIFI_MODE_0101, WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, + ^WIFI_CONN_0902, ^WIFI_CONN_0901, WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0902, + WIFI_CONN_0903, WIFI_CONN_0503, ^WIFI_CONN_0104, WIFI_CONN_0101, WIFI_CONN_0102, + WIFI_CONN_0103, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, ^WIFI_CONN_0503, + ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] diff --git a/components/test/InitialConditionAll.yml b/components/test/InitialConditionAll.yml new file mode 100644 index 0000000000..797ccad550 --- /dev/null +++ b/components/test/InitialConditionAll.yml @@ -0,0 +1,2923 @@ +initial condition: +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + initial condition detail: root as LOCAL, rest node as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: ENABLED_2 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + initial condition detail: all mesh node enabled as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ENABLED_1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: APSTA mode, connected to AP, running BIN0 (located on + flash id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: STAAPBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: testing ap on sta + ap mode, PC join AP (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 66.0 + tag: APSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + initial condition detail: testing ap on sta + ap mode (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 59.0 + tag: APSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: testing sta on sta + ap mode, quit AP (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: STAAP1 + test script: InitCondBase +- check cmd set: + - '' + - - DELAY 0.1 + - [dummy] + force restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + initial condition detail: none 2 + restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 108.0 + tag: ATNone2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: testing sta on sta + ap mode, join AP, DHCP on (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: STAAP2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 94.0 + tag: ATAPSTA3 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:3 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] + initial condition detail: Target 1 in SoftAP mode, Target 2 in StationSoftAP mode, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 80.0 + tag: ATT2_2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 5 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, PC join Target AP, multi link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 R *] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: ATAP3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, will NOT autogen a TC with initial + condition STAAP1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: STAO1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, both PC join Target AP, single link, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAP5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 10 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, PC join Target AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: ATAP4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, both PC join Target AP, multi link, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAP6 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + initial condition detail: AP only mode, running BIN0 (located on flash id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: APOBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, DHCP on + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: STAM1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: STAM2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: none + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATNone + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, connected to AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 101.0 + tag: ATAPSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: same as STA4, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ATOSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: same as STA1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATOSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 5 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + initial condition detail: StationSoftAP mode + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: ATAP1 + test script: InitCondBase +- check cmd set: + - '' + - - DELAY 0.1 + - [dummy] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + initial condition detail: none + restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: None + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + initial condition detail: 'first time usage. Use restore function. ' + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 143.0 + tag: ATFTU + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: SoftAP mode, both PC join Target AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAPO5 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on, will NOT autogen a TC with + initial condition STAAP2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: STAO2 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + initial condition detail: all mesh node disabled + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: DISABLED + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:1 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + initial condition detail: Target 1 in StationSoftAP mode, Target 2 in station mode, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: ATT2_1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: APO2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: APO1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 R *] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 66.0 + tag: ATAPO3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['R SSC[1-] C !!!ready!!!'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -m -o 2 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + initial condition detail: one target in AP mode and espnow is de-initialized + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -m -o 2 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: NOW1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1-] op -Q + - ['R SSC[1-] C +CURMODE:2'] + - - SSC SSC[1-] mac -Q -o 3 + - ['R SSC[1-] P ]_ap_mac> P ]_mac>'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['R SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] op -S -o 3 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] mac -S -m ]_ap_mac> -o 2 + - ['R SSC[1-] C +MAC:AP,OK'] + - - SSC SSC[1-] mac -S -m ]_mac> -o 1 + - ['R SSC[1-] C +MAC:STA,OK'] + - - SSC SSC[1-] op -S -o 2 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + initial condition detail: multiple () targets in AP mode, espnow is initialized + with self role slave + restore cmd set: + - '' + - - SSC SSC[1-] op -S -o 3 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] mac -S -m ]_ap_mac> -o 2 + - ['R SSC[1-] C +MAC:AP,OK'] + - - SSC SSC[1-] mac -S -m ]_mac> -o 1 + - ['R SSC[1-] C +MAC:STA,OK'] + - - SSC SSC[1-] op -S -o 2 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: NOW2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, single link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 73.0 + tag: ATAPO4 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + initial condition detail: one target and simple is de-inited + restore cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: PAIR1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: SoftAP mode, both PC join Target AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAPO6 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1,2] op -Q + - ['R SSC[1,2] C +MODE:[3,3]'] + - - SSC SSC[1,2] mac -Q -o 3 + - ['R SSC[1,2] P P '] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC[1,2] reboot + - ['R SSC[1,2] C !!!ready!!!'] + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + initial condition detail: target1 and target2 in STA+AP mode, two targets de-init + and init simple pair + restore cmd set: + - '' + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: PAIR3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1,2] op -Q + - ['R SSC[1,2] C +MODE:[2,1]'] + - - SSC SSC[1,2] mac -Q -o 3 + - ['R SSC[1,2] P P '] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC[1,2] reboot + - ['R SSC[1,2] C !!!ready!!!'] + - - SSC SSC[1,2] op -S -o 3 + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] op -S -o [2,1] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + initial condition detail: target1 in AP mode, target2 in STA mode, two targets de-init + and init simple pair + restore cmd set: + - '' + - - SSC SSC[1,2] op -S -o 3 + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] op -S -o [2,1] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: PAIR2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:1'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: same as T2_1 but will NOT autogen a TC with initial condition + T2_2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 73.0 + tag: T2O_1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:2'] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 59.0 + tag: ATAPO1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, DHCP on + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: APM1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:1'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: target 1 as SoftAP, target 2 as STA + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 73.0 + tag: T2_1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:1 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + initial condition detail: same as OT2_1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: ATOT2_1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 129.0 + tag: ATAPSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: STA mode, connected to AP, running BIN0 (located on flash + id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: STAMBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: station mode, DHCP client on, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1-3] op -Q + - ['R SSC[1-3] C +CURMODE:3'] + - - SSC SSC[1-3] phy -Q -o 3 + - ['R SSC[1-3] C STA,n,40 C AP,n,40'] + force restore cmd set: + - '' + - - SSC SSC[1-3] reboot + - ['R SSC[1-3] C !!!ready!!!'] + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] + initial condition detail: '1. target 1 and target 2 set to AP+STA mode, target 3 + set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + restore cmd set: + - '' + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 sta -R -r 1 + - [R SSC1 C OK] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: T3_PHY1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, DHCP client on + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:3'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 3 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: target 1 as AP+STA, target 2 as AP+STA (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 3 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 80.0 + tag: T2_2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, single link, use + static ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 136.0 + tag: ATAPSTA6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, single link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 122.0 + tag: ATSTA6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, multi link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 115.0 + tag: ATSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, single link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ATSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: ATSTA3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, PC join AP, DHCP on + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: APM2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: station mode, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA1 + test script: InitCondBase diff --git a/components/test/README.md b/components/test/README.md new file mode 100644 index 0000000000..0e4172d62c --- /dev/null +++ b/components/test/README.md @@ -0,0 +1,35 @@ +# The test folder in SDK + +## File Structure + +``` +test --- CIConfigs --- sanity_test1.yml (Runner config files) + | |-- stress_test1.yml + |-- TestCaseAll.yml (TestCaseFiles) + |-- TestEnvAll.yml (TestCaseFiles) + |-- InitialConditionAll.yml (TestCaseFiles) + |-- TestCaseScript --- ... (Test case scripts) +``` + +1. CIConfigs folder + * config for CI config files are put in this folder + * CI config files configs the cases and some other options for the CI job with same name +1. Test case files + * TestCaseAll.yml (test cases) + * InitialConditionAll.yml (initial conditions) + * TestEnvAll.yml (test environments) + * [how to modify test cases](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestCaseFiles.DesignNote.md) +1. Test case scripts + * some cases are implemented by specified script. those scripts are put in this folder. + + +## Modify test cases + +1. check if the "SDK" of the test case only contain the current SDK + * if Yes, then just modify the test case behavior + * if No: + 1. then remove current SDK name from "SDK" of the test case + 2. Add a new test case, and set "SDK" only support current SDK name +2. use [auto_test_script](https://gitlab.espressif.cn:6688/yinling/auto_test_script) to load the modified case and verify the modification +3. create a merge request and assign to HYL (or add comment @yinling for merging test). +After review it will be merged to SDK and will be The cases will be synced to database in auto_test_script. diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml new file mode 100644 index 0000000000..c5e10b794a --- /dev/null +++ b/components/test/TestCaseAll.yml @@ -0,0 +1,13810 @@ +test cases: +- CI ready: 'Yes' + ID: ^WIFI_CONN_0601 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.PC WIFI CONNECTED + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式 + + 2.PC WIFI CONNECTED target1 + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + sub module: WIFI Connect + summary: list stations connected to soft ap test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: list SoftAP connected station + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ICMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ping -i + - ['R SSC1 C +PING:OK'] + - - SSC SSC1 ping -i -c 2 + - ['R SSC1 C +PING:OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.ping -i + + 2.ping -i -c 2' + sub module: ICMP + summary: ping function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: ping function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: SYS_MISC_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + comment: '' + execution time: 0.0 + expected result: 重启成功 + initial condition: None + initial condition description (auto): none + module: System + steps: 系统重启 + sub module: Misc + summary: test reboot function + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: sw reboot + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ARP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+send+block_arp_ip + - ['R PC_COM C +NIC_START:OK'] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr "192.168.11.240" + ethernet_len_type "ARP" ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_sender_hw_addr + "18:18:18:18:18:18" ethernet_len_type "ARP" ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_sender_proto_addr + ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + comment: '' + execution time: 0.0 + expected result: 1. PC can't recv ARP reply from target + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. PC send ARP req with target_hw_addr, sender_hw_addr and sender_proto_addr + not correct + sub module: ARP + summary: PC send invalid ARP request to target 2 + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: handling ARP request + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 2 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.4.1 -o 2 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target 1 OK + + 2.target1 ERROR + + 3.target1 ERROR + + 4.target2 jap target1 OK + + 5.target1 OK + + 6.target1 OK + + 7.target1 OK + + 8.target2 jap target1 OK' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n3.target1 设置地址池\n\ + 4.target1下设置ssid 和pwd 加密方式\n5.target2 连接target1 \n6.target1 关闭DHCP 2\n7.target1\ + \ 设置softAP ip \n8.target1 设置正确的地址池\n9.target2 连接target1" + sub module: DHCP + summary: ap dhcp static ip interaction + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -S -i 0.0.0.0 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.JAP CONNETED + + 4.OK + + 5.等待10s,JAP fail' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: TCPIP + steps: '1.target1 关闭DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 jap AP + + 5.target1 设置sta ip 0.0.0.0 + + 6.target1 jap AP' + sub module: DHCP + summary: sta dhcp static ip interaction + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: AP mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 2 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.4.1 -o 2 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target 1 OK + + 2.target1 ERROR + + 3.target1 ERROR + + 4.target2 jap target1 OK + + 5.target1 OK + + 6.target1 OK + + 7.target1 OK + + 8.target2 jap target1 OK' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n3.target1 设置地址池\n\ + 4.target1下设置ssid 和pwd 加密方式\n5.target2 连接target1 \n6.target1 关闭DHCP 2\n7.target1\ + \ 设置softAP ip \n8.target1 设置正确的地址池\n9.target2 连接target1 " + sub module: DHCP + summary: ap dhcp static ip interaction + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -S -i 0.0.0.0 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.JAP CONNETED + + 4.OK + + 5.等待10s,JAP fail' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: TCPIP + steps: '1.target1 关闭DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 jap AP + + 5.target1 设置sta ip 0.0.0.0 + + 6.target1 jap AP' + sub module: DHCP + summary: sta dhcp static ip interaction + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: SYS_MISC_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ram -H + - ['R SSC1 RE FREEHEAP:\d+\r\n'] + comment: '' + execution time: 0.0 + expected result: ' + + 可以查询到一个数值 + + ' + initial condition: None + initial condition description (auto): none + module: System + steps: 查询空闲ram + sub module: Misc + summary: get heap size test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: 'get heap size ' + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ARP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+send+block_arp_ip + - ['R PC_COM C +NIC_START:OK'] + - - NIC NIC1 SEND ARP arp_op_code 0xFF arp_target_proto_addr ethernet_dst_addr + "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + comment: '' + execution time: 0.0 + expected result: 1. PC can't recv ARP reply from target + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. PC send ARP with error op_code + sub module: ARP + summary: PC send invalid ARP request to target 4 + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: handling ARP request + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0412 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.关闭socket1 连接 + + 7.关闭socket2连接' + sub module: TCP + summary: close TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0403 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0402 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.关闭建立的socket1连接' + sub module: TCP + summary: "close TCP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.8266往PC上发送5字节数据' + sub module: TCP + summary: do TCP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_ADDR_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 mac -Q -o 3 + - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ + \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ + \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac" + sub module: MAC Address + summary: set mac, query mac + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0407 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0406 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0404 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 C +JAP:DISCONNECTED,4,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0408 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: STA mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: AP mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s 1000 + - ['R SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.ERROR + + 6.OK + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket1, + + 3.target1上使用步骤2创建的socket1,去发送数据 + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去发送数据 + + 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 + + 7.target1上shutdown 步骤4的socket2 + + 8.target1往socket2发送错误命令发送数据 + + 9.target1上不指定socket往上发送数据' + sub module: TCP + summary: send test. use socket in state that can't send + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 0.0.0.0 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -Q + - ['R SSC1 C +STAIP:0.0.0.0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -Q + - ['R SSC1 RE "\+STAIP:%%s"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ + 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: TCPIP + steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ + \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + sub module: DHCP + summary: dhcp client function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -E -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.STA&AP STARTED + + 4.STA STARTED + + 5.AP STARTED + + 6.OK + + 7.STA&AP STOPPED' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: TCPIP + steps: '1.target1 设置mode 为sta+softAP mode + + 2.target1 打开DHCP 3 + + 3.target1 查询DHCP 状态 + + 4.target1 查询sta DHCP 状态 + + 5.target1 查询softAP DHCP 状态 + + 6.target1 关闭 DHCP 3 + + 7.target1 查询 DHCP 状态' + sub module: DHCP + summary: dhcp status query + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ + \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ + 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + sub module: DHCP + summary: dhcp server function test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0303 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -n 5 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -n 6 + - ['R SSC2 C +SCAN:', R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set channel 6 + + 3.target2 上scan不到 channel 5 + + 4.target2 上查询channel 6的' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target1 断开连接AP + + 2.target1下设置ssid 和pwd 加密方式,set channel 6 + + 3.target2 上scan channel 5 + + 4.target2 上查询channel 6的' + sub module: WIFI Scan + summary: scan with scan config channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC2 sta -S -b + - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target2 上不能查询到此mac + + 2.target2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 + + 2.target2上查询' + sub module: WIFI Scan + summary: scan with scan config bssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -s .,juhg123 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s + - ['R SSC2 C +SCAN:', R SSC2 P , 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target 2上不能scan .,juhg123 + + 2.target1 set AP + + 3.target2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target 2 scan .,juhg123 + + 2.target1下设置ssid 和pwd 加密方式 + + 3.target2 scan ' + sub module: WIFI Scan + summary: scan with scan config ssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 10 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + sub module: WIFI Scan + summary: scan with several configs + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + - - SSC SSC1 ap -S -s -p 123456789 -h 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1 set AP,set ssid hidden, + + 5.target 2上不能查询到 + + 6.target 2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 5.target 2上查询 + + 6.target 2上查询' + sub module: WIFI Scan + summary: scan with scan config show hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.关闭建立的socket1连接' + sub module: UDP + summary: "close UDP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' + sub module: UDP + summary: do UDP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + sub module: WIFI Connect + summary: JAP query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query JAP status + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0702 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,3'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,2'] + comment: '' + execution time: 0.0 + expected result: '1. get status AP not exist in disconnect event + + 2. get status wrong password in disconnect event' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. sta connect to ap not exist + + 2. sta connect to ap with wrong password + + ' + sub module: WIFI Connect + summary: check wifi status wrong password, no ap found + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0703 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 C +JAP:DISCONNECTED,4,2'] + comment: '' + execution time: 0.0 + expected result: 1. connect status connect fail in disconnect evnet + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: check wifi status connect fail + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0701 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - [R SSC1 C QAP] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:1', 'R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:5'] + - - APC OFF + - [P PC_COM L OK, P SSC1 C bcn_timout] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:4'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. idle state + + 2. connecting state + + 3. got IP state + + 4. connect fail state' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. sta disconnected, query status + + 2. sta connect to AP, query status + + 3. got IP, query status + + 4. AP power off, query status when beacon timeout' + sub module: WIFI Connect + summary: check wifi status idle, connecting, got ip and connect fail + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DNS_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p 9001 + - ['R SSC1 RE \+CONNECT:\d+,OK'] + - - SSC SSC1 soc -S -s -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. connect, send, recv1. get host name "espressif.cn" + + 2. connect, send, recv' + sub module: DNS + summary: TCP connect to iot.espressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DNS_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] + comment: '' + execution time: 0.0 + expected result: 1.OK + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. get host name "espressif.cn" + sub module: DNS + summary: get host by name test + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0904 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p 1234567890 + - ['R SSC2 C +JAP:DISCONNECTED,1,204'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:DISCONNECTED,1,5'] + - - WIFI DISCONN + - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:DISCONNECTED,5,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_HANDSHAKE_TIMEOUT + + 3. succeed + + 4. succeed + + 5. disconnect event REASON_ASSOC_TOOMANY + + 6. succeed, target2 connect succeed + + 7. disconnect event REASON_ASSOC_EXPIRE' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1. config target1 softap max sta allowed 1 + + 2. target2 connect to target1 with wrong password + + 3. target2 disconnect + + 4. PC WIFI NIC connect to target1 + + 5. target2 connect to target1 with correct password + + 6. PC WIFI NIC disconnect + + 7. reconfig softap' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, + REASON_ASSOC_EXPIRE + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.123.123'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.STAIP:192.168.123.123' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: TCPIP + steps: '1.target1 打开DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 关闭DHCP 1 + + 5.target1 设置sta ip 192.168.123.123 + + 6.target1 查询 当前sta ip ' + sub module: IP + summary: sta set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 2 + - ['R SSC1 C +APIP:192.168.123.123'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.APIP:192.168.123.123 + + 6.OK' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n4.target1 关闭DHCP\ + \ 2\n5.target1 设置softAP ip 192.168.123.123\n6.target1 查询 当前sta ip \n7.target1\ + \ 设置softAP ip 为target_ap_ip" + sub module: IP + summary: ap set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + sub module: WIFI Connect + summary: JAP query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query JAP status + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: station IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: station IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: softAP IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0701 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - [R SSC1 C QAP] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:1', 'R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:5'] + - - APC OFF + - [P PC_COM L OK, P SSC1 C bcn_timout] + - - SSC SSC1 sta -Q + - ['R SSC1 C +STA_STATUS:4'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. idle state + + 2. connecting state + + 3. got IP state + + 4. connect fail state' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. sta disconnected, query status + + 2. sta connect to AP, query status + + 3. got IP, query status + + 4. AP power off, query status when beacon timeout' + sub module: WIFI Connect + summary: check wifi status idle, connecting, got ip and connect fail + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0703 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 C +JAP:DISCONNECTED,4,2'] + comment: '' + execution time: 0.0 + expected result: 1. connect status connect fail in disconnect evnet + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: check wifi status connect fail + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 + -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: AP mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_SCAN_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC2 sta -S -b + - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target2 上不能查询到此mac + + 2.target2上查询到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 + + 2.target2上查询' + sub module: WIFI Scan + summary: scan with scan config bssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_SCAN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -n 5 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -n 6 + - ['R SSC2 C +SCAN:', R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set channel 6 + + 3.target2 上scan不到 channel 5 + + 4.target2 上查询channel 6的' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target1 断开连接AP + + 2.target1下设置ssid 和pwd 加密方式,set channel 6 + + 3.target2 上scan channel 5 + + 4.target2 上查询channel 6的' + sub module: WIFI Scan + summary: scan with scan config channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_SCAN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + - - SSC SSC1 ap -S -s -p 123456789 -h 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1 set AP,set ssid hidden, + + 5.target 2上不能查询到 + + 6.target 2上查询到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 5.target 2上查询 + + 6.target 2上查询' + sub module: WIFI Scan + summary: scan with scan config show hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_SCAN_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 10 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + sub module: WIFI Scan + summary: scan with several configs + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: softAP IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: softAP IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: station IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: station IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_ICMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ping -i + - ['R SSC1 C +PING:OK'] + - - SSC SSC1 ping -i -c 2 + - ['R SSC1 C +PING:OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.ping -i + + 2.ping -i -c 2' + sub module: ICMP + summary: ping function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: ping function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_ADDR_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -S -b 44:55:66:77:88:99 + - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -Q -o 1 + - ['R SSC2 A :\+STAMAC:(.+)\r\n'] + - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:22:33:44:55:66:77'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok + + 7.ok + + 8.ok + + 9.ok' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ + 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ + 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ + 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac" + sub module: MAC Address + summary: set mac and do scan/JAP/SAP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0108 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: AP mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0109 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC2 ip + - ['R SSC2 A :STAIP:(.+)\r\n'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - [R SOC1 UL 5] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['R SSC2 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.PC上SOC2 UDP传输,bing + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 + + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: AP mode, sendto test. use different ip, port + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: STA mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 1 + - [R SSC1 SL +1] + - - SOC SOC1 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + - - SOC SOC1 SENDTO 1473 + - [P SSC1 NC +RECVFROM, P SOC_COM C OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SOC SOC2 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recvfrom basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: STA mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.PC上SOC2 UDP传输,bing + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 + + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: STA mode, sendto test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没有到UDP包 + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: STA mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: STA mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. target2 join SoftAP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: softAP send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: station IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. target2 set to sta mode and join AP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: station send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: softAP IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -a 0 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:0'] + - - SSC SSC1 reboot + - [''] + - - DELAY 15 + - [''] + - - SSC SSC1 sta -Q + - ['R SSC1 C JAP:DISCONNECTED'] + - - SSC SSC1 sta -R -a 1 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:1'] + - - SSC SSC1 reboot + - ['R SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: WIFI MAC + steps: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + sub module: WIFI Connect + summary: auto reconnect test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: power on auto reconnect test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0404 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0406 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0407 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.8266往PC上发送5字节数据' + sub module: TCP + summary: do TCP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0402 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.关闭建立的socket1连接' + sub module: TCP + summary: "close TCP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0403 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0408 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0307 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0306 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0305 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0304 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 ap -S -s -p -t -h + 1 + - ['R SSC1 C +SAP:OK'] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 C +SCANDONE] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3.target1 set AP,set ssid hidden, + + 4.target 2上不能scan target_ap_mac' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 4.target 2上scan target_ap_mac' + sub module: WIFI Connect + summary: station SAP+JAP test, ssid hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: STA mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc上回accept + + 4.OK + + 5.target收到5 byte + + 6.PC收到5 byte + + 7.target收到 146000 byte + + 8.OK,PC 回SOC_RECV=SOC2,RECV_LEN=字节数' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC.' + sub module: TCP + summary: STA mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: STA mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: STA mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept OK + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept OK + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept OK + + 10.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: STA mode, shutdown basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6" + sub module: TCP + summary: STA mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: STA mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI CONN2 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to get IP (discover with requested + IP) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0211 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - DELAY 10 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to renew IP (direct send request) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0212 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 6.OK + + 7.收到 146000 数据 + + ' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target停止调用recv + + 6.PC send 100 * 1460 data to 8266, + + 7.target重新调用recv' + sub module: TCP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 6.OK + + 7.收到 146000 数据' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target停止调用recv + + 6.PC send 100 * 1460 data to 8266, + + 7.target重新调用recv' + sub module: TCP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0212 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0211 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - DELAY 10 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to renew IP (direct send request) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI CONN2 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to get IP (discover with requested + IP) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_ADDR_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 mac -Q -o 3 + - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ + \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ + \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac\n" + sub module: MAC Address + summary: set mac, query mac + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_ADDR_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -S -b 44:55:66:77:88:99 + - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -Q -o 1 + - ['R SSC2 A :\+STAMAC:(.+)\r\n'] + - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:22:33:44:55:66:77'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok + + 7.ok + + 8.ok + + 9.ok' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ + 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ + 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ + 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac\n" + sub module: MAC Address + summary: set mac and do scan/JAP/SAP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0411 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.8266往PC socket2上发送5字节数据 + + 7.8266往PC socket1上发送5字节数据' + sub module: TCP + summary: do TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 -m 8 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致 + + ' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致 + + ' + sub module: WIFI Connect + summary: AP config query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query AP config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 2 + - ['R SSC1 C +APIP:192.168.123.123'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.APIP:192.168.123.123 + + 6.OK' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n4.target1 关闭DHCP\ + \ 2\n5.target1 设置softAP ip 192.168.123.123\n6.target1 查询 当前sta ip \n7.target1\ + \ 设置softAP ip 为target_ap_ip" + sub module: IP + summary: ap set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: STA mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 1 + - [R SSC1 SL +1] + - - SOC SOC1 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + - - SOC SOC1 SENDTO 1473 + - [P SSC1 NC +RECVFROM, P SOC_COM C OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SOC SOC2 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recvfrom basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: STA mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: STA mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没有到UDP包 + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: STA mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.PC上SOC2 UDP传输,bing + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 + + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: STA mode, sendto test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ + \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ + 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + sub module: DHCP + summary: dhcp server function test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -E -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.STA&AP STARTED + + 4.STA STARTED + + 5.AP STARTED + + 6.OK + + 7.STA&AP STOPPED' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: TCPIP + steps: '1.target1 设置mode 为sta+softAP mode + + 2.target1 打开DHCP 3 + + 3.target1 查询DHCP 状态 + + 4.target1 查询sta DHCP 状态 + + 5.target1 查询softAP DHCP 状态 + + 6.target1 关闭 DHCP 3 + + 7.target1 查询 DHCP 状态' + sub module: DHCP + summary: dhcp status query + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0801 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] + - - SSC SSC1 ap -S -s -p -t 0 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. auth change event old mode 0 new mode 2 + + 4. auth change event old mode 2 new mode 3 + + 5. auth change event old mode 3 new mode 4 + + 6. auth change event old mode 4 new mode 0' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set target1 softap auth mode 0 + + 2. target2 connect to target1 + + 3. set target1 softap auth mode 2, wait sta connected + + 4. set target1 softap auth mode 3, wait sta connected + + 5. set target1 softap auth mode 4, wait sta connected + + 6. set target1 softap auth mode 0, wait sta connected' + sub module: WIFI Connect + summary: test auth change event + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi auth changed event test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0108 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: AP mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -m + 1 + - ['R SSC1 C +SAP:OK'] + - - WIFI DISCONN + - ['R PC_COM C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set max allowed sta as 1 + + 2. use PC disconnect, + + 3.target 2 jap succeed + + 4.PC WIFI can not CONN' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 + + 2.use PC disconnect target1 + + 3.target 2 jap target1 + + 4.PC WIFI CONNECT target1' + sub module: WIFI Connect + summary: station SAP test, max allowed sta + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: station IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: softAP IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. target2 set to sta mode and join AP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: station send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. target2 join SoftAP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: softAP send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 -m 8 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + module: WIFI MAC + steps: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致' + sub module: WIFI Connect + summary: AP config query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query AP config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC2 ip + - ['R SSC2 A :STAIP:(.+)\r\n'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 5 + - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + - - SSC SSC2 soc -S -s -i -p -l 5 + - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK + + 7.OK' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: AP mode, recvfrom basic test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 + -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: AP mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: AP mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: AP mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0501 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 0 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC2 sta -R -r 2 + - ['R SSC2 C +RECONN:0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + comment: '' + execution time: 0.0 + expected result: '1.设置reconn,开启(此功能不需要重启系统) + + 2.target1 set AP + + 3.target2 JAP target1 成功 + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.成功 + + 7.查询reconn状态,关闭 + + 8.修改mode 成功 + + 9.等待15s,target2 不会自动重连target1' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: "1.设置reconn,开启(此功能不需要重启系统)\n2.target1下设置ssid 和pwd 加密方式\n3.target2 JAP target1\ + \ \n4.target1 修改mode 为sta mode\n5.等待10s,target1 修改mode 为softAP mode\n6.设置reconn,关闭\n\ + 7.查询reconn状态,关闭\n8.target1 修改mode 为sta mode\n9.等待15s,target1 修改mode 为softAP mode" + sub module: WIFI Connect + summary: reconnect policy test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0502 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 5 + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + sub module: WIFI Connect + summary: will not do reconnect after manually disconnected + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -a 0 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:0'] + - - SSC SSC1 reboot + - [''] + - - DELAY 15 + - [''] + - - SSC SSC1 sta -Q + - ['R SSC1 C JAP:DISCONNECTED'] + - - SSC SSC1 sta -R -a 1 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:1'] + - - SSC SSC1 reboot + - ['R SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: WIFI MAC + steps: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + sub module: WIFI Connect + summary: auto reconnect test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: power on auto reconnect test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC2 sta -S + - [R SSC2 NP C +SCANDONE] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1下设置ssid 和pwd 、加密方式成功 + + 2.修改target 1的mode 为sta mode + + 3.target1的dhcp打开 + + 4.target1成功连接上AP + + 5.target2上不能查询到target_ssid + + 6.target1断开AP' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.修改target1的mode 为sta mode + + 3.target1的dhcp打开 + + 4.target1连接AP + + 5.target2查询target_ssid + + 6.target1断开AP' + sub module: WIFI Mode + summary: mode switch test (sta mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC2 sta -S + - [R SSC2 P , R SSC2 C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 change to AP mode + + 2.target1 set AP + + 3.target 1 的dhcp 打开 + + 4.target 1 成功连接上AP + + 5.target 2 上查询到target_ssid' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: WIFI MAC + steps: '1.target1 change to AP mode + + 2.target1下设置ssid 和pwd 加密方式 + + 3.target1 的dhcp 打开 + + 4.target1 连接AP + + 5.target2 上查询target_ssid' + sub module: WIFI Mode + summary: mode switch test (STA+AP mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:ERROR'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP + + 2.target 2 上查询到target_ssid + + 3. target1 can''t join AP + + 4. target1 can''t QAP' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.target 2 上查询target_ssid + + 3.target1 join AP + + 4.target1 DISCONN AP' + sub module: WIFI Mode + summary: mode switch test (AP mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0904 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p 1234567890 + - ['R SSC2 C +JAP:DISCONNECTED,1,204'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:DISCONNECTED,1,5'] + - - WIFI DISCONN + - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:DISCONNECTED,5,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_HANDSHAKE_TIMEOUT + + 3. succeed + + 4. succeed + + 5. disconnect event REASON_ASSOC_TOOMANY + + 6. succeed, target2 connect succeed + + 7. disconnect event REASON_ASSOC_EXPIRE' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. config target1 softap max sta allowed 1 + + 2. target2 connect to target1 with wrong password + + 3. target2 disconnect + + 4. PC WIFI NIC connect to target1 + + 5. target2 connect to target1 with correct password + + 6. PC WIFI NIC disconnect + + 7. reconfig softap' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, + REASON_ASSOC_EXPIRE + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 C +JAP:DISCONNECTED,1,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0901 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: basic function + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 C +JAP:DISCONNECTED,0,8'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:DISCONNECTED,2,15'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:DISCONNECTED,1,201'] + comment: '' + execution time: 0.0 + expected result: '1. disconnect event reason REASON_ASSOC_LEAVE + + 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT + + 3. disconnect event reason REASON_NO_AP_FOUND' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. sta connect to AP, and disconnect + + 2. connect to AP with wrong password + + 3. connect to AP not exist' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, + REASON_NO_AP_FOUND + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: STA mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2 OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: AP mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0501 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+block_ip + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - [''] + - - DELAY 10 + - ['R SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: 2. connect failed, no exception + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. PC do not reply any IP packet on NIC + + 2. target try to connect to TCP server with PC NIC IP' + sub module: TCP + summary: PC do not reply TCP SYN of target + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP connect and disconnect abnormal case + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] + comment: '' + execution time: 0.0 + expected result: 1.OK + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: 1. get host name "espressif.cn" + sub module: DNS + summary: get host by name test + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t UDP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p 9003 -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. sendto, recvfrom1. get host name "espressif.cn" + + 2. sendto, recvfrom' + sub module: DNS + summary: UDP send to iot.expressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p 9001 + - ['R SSC1 RE \+CONNECT:\d+,OK'] + - - SSC SSC1 soc -S -s -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. connect, send, recv1. get host name "espressif.cn" + + 2. connect, send, recv' + sub module: DNS + summary: TCP connect to iot.espressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: STA mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ + \ " + sub module: TCP + summary: STA mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept OK + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept OK + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept OK + + 10.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: STA mode, shutdown basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: STA mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: STA mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc上回accept + + 4.OK + + 5.target收到5 byte + + 6.PC收到5 byte + + 7.target收到 146000 byte + + 8.OK,PC 回SOC_RECV=SOC2,RECV_LEN=字节数' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC. ' + sub module: TCP + summary: STA mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: STA mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0116 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6" + sub module: TCP + summary: AP mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK,target1上accept 成功 + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: AP mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0115 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: AP mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.target收到5byte数据 + + 6.PC收到5byte数据 + + 7.target收到146000 byte数据 + + 8.OK,PC 收到146000 byte数据' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC.' + sub module: TCP + summary: AP mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept成功 + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept成功 + + 10.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: AP mode, shutdown basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: AP mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT 0 + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: AP mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ARP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+send+block_arp_ip + - ['R PC_COM C +NIC_START:OK'] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr ethernet_dst_addr + "ff:ff:ff:ff:ff:ff" + - ['P PC_COM C +NIC_SEND:OK', P NIC1 PDU (Ethernet.dst_addr=)(ARP.hw_type="Ethernet")(ARP.protocol="IPv4")(ARP.hw_len="6")(ARP.proto_len="4")(ARP.op_code="reply")(ARP.sender_hw_addr=)(ARP.sender_proto_addr=)(ARP.target_hw_addr=)(ARP.target_proto_addr=)] + comment: '' + execution time: 0.0 + expected result: 1. PC recv target valid ARP reply + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. PC send ARP req to target + sub module: ARP + summary: PC send valid ARP request to target + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: handling ARP request + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0304 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0305 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0306 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0307 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' + sub module: UDP + summary: do UDP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + ' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.关闭建立的socket1连接' + sub module: UDP + summary: "close UDP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0303 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0601 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.PC WIFI CONNECTED + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式 + + 2.PC WIFI CONNECTED target1 + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + sub module: WIFI Connect + summary: list stations connected to soft ap test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: list SoftAP connected station + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0209 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - DELAY 20 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client and new client able to get IP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. get IP 192.168.4.2 + + 5. can only find target2 with IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. PC NIC connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. target2 connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig and new client able to get first IP in pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI DISCONN2 + - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 4. succeed + + 5. succeed + + 6. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. PC WIFI NIC connect to target1 softap + + 4. target2 connect to target1 softap and disnnect + + 5. PC release IP and disconnected + + 6. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server prefer assign released IP to new client + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 4. get IP 192.168.4.2 - 192.168.4.4 + + 5. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. target2 change mac, connect to softap, disconnect + + 4. Loop step3 twice + + 5. change to first mac, connect to softap' + sub module: DHCP + summary: dhcp server assign same IP to same MAC when it's not released + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0205 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['P SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. target2 wifi disconnected' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 + + 3. disable DHCP server, do config and enable' + sub module: DHCP + summary: disconnect STA if config dhcp server + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - DELAY 90 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - DELAY 60 + - [''] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 5. succeed + + 6. succeed + + 8. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP timeout as 1 minute + + 3. target2 connect to target1 + + 4. wait 90 seconds + + 5. check if target2 IP is same + + 6. target2 disconnect + + 7. wait 60s + + 8. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server timeout test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 2 4 "['01','02']" "[2,3]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - DELAY 20 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:0.0.0.0'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4.1 succeed + + 4.2 failed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1(.4.2 - .4.3) + + 3. target change mac, connect to Target1 + + 4. Loop step3 twice' + sub module: DHCP + summary: dhcp server ip pool empty + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 3 4 "['01','02','03']" "[2,3,4]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3,4: get IP from dhcp pool with correct sequence' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1 + + 3. target change mac, connect to Target1 + + 4. Loop step3' + sub module: DHCP + summary: dhcp server ip pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1 关闭DHCP 2 OK + + 2.target1 设置ip 成功 + + 3.设置dhcp 地址池 OK + + 4.ERROR + + 5.ERROR + + 6.ERROR + + 7.target1 打开DHCP ok' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + module: TCPIP + steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ + 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" + sub module: DHCP + summary: server dhcp lease test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc server accept OK + + 4.OK + + 5.OK + + 6.OK + + 7.target收到146000 byte + + ' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target上不进行recv + + 6.PC send 100 * 1460 data to target, + + 7.在target上开始recv' + sub module: TCP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2 OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: AP mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: STA mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 0.0.0.0 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -Q + - ['R SSC1 C +STAIP:0.0.0.0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -Q + - ['R SSC1 RE "\+STAIP:%%s"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ + 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: TCPIP + steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ + \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + sub module: DHCP + summary: dhcp client function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s 1000 + - ['R SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.ERROR + + 6.OK + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket1, + + 3.target1上使用步骤2创建的socket1,去发送数据 + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去发送数据 + + 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 + + 7.target1上shutdown 步骤4的socket2 + + 8.target1往socket2发送错误命令发送数据 + + 9.target1上不指定socket往上发送数据' + sub module: TCP + summary: send test. use socket in state that can't send + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: STA mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4 OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: AP mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DNS_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t UDP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p 9003 -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. sendto, recvfrom1. get host name "espressif.cn" + + 2. sendto, recvfrom' + sub module: DNS + summary: UDP send to iot.expressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 4. get IP 192.168.4.2 - 192.168.4.4 + + 5. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. target2 change mac, connect to softap, disconnect + + 4. Loop step3 twice + + 5. change to first mac, connect to softap' + sub module: DHCP + summary: dhcp server assign same IP to same MAC when it's not released + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI DISCONN2 + - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 4. succeed + + 5. succeed + + 6. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. PC WIFI NIC connect to target1 softap + + 4. target2 connect to target1 softap and disnnect + + 5. PC release IP and disconnected + + 6. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server prefer assign released IP to new client + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - DELAY 90 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - DELAY 60 + - [''] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 5. succeed + + 6. succeed + + 8. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP timeout as 1 minute + + 3. target2 connect to target1 + + 4. wait 90 seconds + + 5. check if target2 IP is same + + 6. target2 disconnect + + 7. wait 60s + + 8. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server timeout test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0205 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['P SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. target2 wifi disconnected' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 + + 3. disable DHCP server, do config and enable' + sub module: DHCP + summary: disconnect STA if config dhcp server + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 3 4 "['01','02','03']" "[2,3,4]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3,4: get IP from dhcp pool with correct sequence' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1 + + 3. target change mac, connect to Target1 + + 4. Loop step3' + sub module: DHCP + summary: dhcp server ip pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 2 4 "['01','02']" "[2,3]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - DELAY 20 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:0.0.0.0'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4.1 succeed + + 4.2 failed' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1(.4.2 - .4.3) + + 3. target change mac, connect to Target1 + + 4. Loop step3 twice' + sub module: DHCP + summary: dhcp server ip pool empty + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc server accept OK + + 4.OK + + 5.OK + + 6.OK + + 7.target收到146000 byte' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target上不进行recv + + 6.PC send 100 * 1460 data to target, + + 7.在target上开始recv' + sub module: TCP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1 关闭DHCP 2 OK + + 2.target1 设置ip 成功 + + 3.设置dhcp 地址池 OK + + 4.ERROR + + 5.ERROR + + 6.ERROR + + 7.target1 打开DHCP ok' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: TCPIP + steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ + 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" + sub module: DHCP + summary: server dhcp lease test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4 OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: AP mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. get IP 192.168.4.2 + + 5. can only find target2 with IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. PC NIC connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. target2 connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig and new client able to get first IP in pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0209 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - DELAY 20 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client and new client able to get IP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0412 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.关闭socket1 连接 + + 7.关闭socket2连接' + sub module: TCP + summary: close TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0411 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.8266往PC socket2上发送5字节数据 + + 7.8266往PC socket1上发送5字节数据' + sub module: TCP + summary: do TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0901 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: basic function + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 C +JAP:DISCONNECTED,0,8'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:DISCONNECTED,2,15'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:DISCONNECTED,1,201'] + comment: '' + execution time: 0.0 + expected result: '1. disconnect event reason REASON_ASSOC_LEAVE + + 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT + + 3. disconnect event reason REASON_NO_AP_FOUND' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. sta connect to AP, and disconnect + + 2. connect to AP with wrong password + + 3. connect to AP not exist' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, + REASON_NO_AP_FOUND + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 C +JAP:DISCONNECTED,1,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ARP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+send+block_arp_ip + - ['R PC_COM C +NIC_START:OK'] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_hw_len + 10 ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_proto_len + 10 ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + comment: '' + execution time: 0.0 + expected result: 1. PC can't recv ARP reply from target + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. PC send ARP req with hw_addr_len and proto_addr_len not correct + sub module: ARP + summary: PC send invalid ARP request to target 3 + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: handling ARP request + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 C +JAP:DISCONNECTED,4,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0503 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -r 0 + - [R SSC1 C OK] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,3'] + - - DELAY 5 + - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,2'] + - - DELAY 5 + - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] + - - SSC SSC1 sta -R -r 1 + - [SSC SSC1 C OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. not reconnect when connect failed, status when recv disconnect event is correct + + 3. not reconnect when connect failed, status when recv disconnect event is correct + + 4. succeed' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. set sta reconnect policy as not reconnect + + 2. sta connect to ap not exist + + 3. sta connect to ap with wrong password + + 4. reset sta reconnect policy as auto reconnect + + ' + sub module: WIFI Connect + summary: reconnect policy interact with failed STA connect/reconnect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: AP mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -m + 1 + - ['R SSC1 C +SAP:OK'] + - - WIFI DISCONN + - ['R PC_COM C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set max allowed sta as 1 + + 2. use PC disconnect, + + 3.target 2 jap succeed + + 4.PC WIFI can not CONN' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 + + 2.use PC disconnect target1 + + 3.target 2 jap target1 + + 4.PC WIFI CONNECT target1' + sub module: WIFI Connect + summary: station SAP test, max allowed sta + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: softAP IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + - - SSC SSC1 ap -S -s -p -t 5 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP,open, \n2.target 2 jap succeed\n3.target1 set\ + \ AP,wpa_psk \n4.target 2 jap succeed\n5.target1 set AP, wpa2_psk \n6.target 2\ + \ jap succeed\n7.target1 set AP,wap_wpa2_psk\n8.target 2 jap succeed\n9.target1\ + \ set AP,加密方式为t 1\n10.target 2 上查询到target_ssid\n11.target1 set AP,加密方式为t 5\n12.target\ + \ 2 上查询到target_ssid" + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: "1.target1下设置ssid 和pwd,加密方式 open\n2.target2 jap target1\n3.target1下设置ssid\ + \ 和pwd,加密方式 wpa_psk \n4.target2 jap target1\n5.target1下设置ssid 和pwd,加密方式 wpa2_psk\ + \ \n6.target 2 jap target1\n7.target1下设置ssid 和pwd,加密方式 wap_wpa2_psk\n8.target2\ + \ jap target1\n9.target1下设置ssid 和pwd,加密方式 wep \n10.target2上查询target_ssid\n11.target1下设置ssid\ + \ 和pwd,加密方式 t 5 错误的加密方式\n12.target2上查询 target_ssid" + sub module: WIFI Connect + summary: station SAP+JAP test, different encryption + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -t 0 -n 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -t 0 -n 13 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -n 15 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,\d+,1"%%()'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set channel 1 + + 2.target 2 jap succeed + + 3.target1 set AP,set channel 10 + + 4.target 2 jap succeed + + 5.target1 set AP,set channel 15 + + 6.target 2 上查询到target_ssid' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set channel 1 + + 2.target2 jap target 1 + + 3.target1下设置ssid 和pwd 加密方式,set channel 10 + + 4.target2 jap target 1 + + 5.target1下设置ssid 和pwd 加密方式,set channel 15 + + 6.target 2 上查询target_ssid' + sub module: WIFI Connect + summary: station SAP+JAP test, different channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 ap -S -s -p -t -h + 1 + - ['R SSC1 C +SAP:OK'] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 C +SCANDONE] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3.target1 set AP,set ssid hidden, + + 4.target 2上不能scan target_ap_mac' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 4.target 2上scan target_ap_mac' + sub module: WIFI Connect + summary: station SAP+JAP test, ssid hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.123.123'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.STAIP:192.168.123.123' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: TCPIP + steps: '1.target1 打开DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 关闭DHCP 1 + + 5.target1 设置sta ip 192.168.123.123 + + 6.target1 查询 当前sta ip' + sub module: IP + summary: sta set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0702 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,3'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,2'] + comment: '' + execution time: 0.0 + expected result: '1. get status AP not exist in disconnect event + + 2. get status wrong password in disconnect event' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. sta connect to ap not exist + + 2. sta connect to ap with wrong password' + sub module: WIFI Connect + summary: check wifi status wrong password, no ap found + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi connect status check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0801 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] + - - SSC SSC1 ap -S -s -p -t 0 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. auth change event old mode 0 new mode 2 + + 4. auth change event old mode 2 new mode 3 + + 5. auth change event old mode 3 new mode 4 + + 6. auth change event old mode 4 new mode 0' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + module: WIFI MAC + steps: '1. set target1 softap auth mode 0 + + 2. target2 connect to target1 + + 3. set target1 softap auth mode 2, wait sta connected + + 4. set target1 softap auth mode 3, wait sta connected + + 5. set target1 softap auth mode 4, wait sta connected + + 6. set target1 softap auth mode 0, wait sta connected' + sub module: WIFI Connect + summary: test auth change event + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi auth changed event test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + - - SSC SSC1 ap -S -s -p -t 5 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP,open, \n2.target 2 jap succeed\n3.target1 set\ + \ AP,wpa_psk \n4.target 2 jap succeed\n5.target1 set AP, wpa2_psk \n6.target 2\ + \ jap succeed\n7.target1 set AP,wap_wpa2_psk\n8.target 2 jap succeed\n9.target1\ + \ set AP,加密方式为t 1\n10.target 2 上查询到target_ssid\n11.target1 set AP,加密方式为t 5\n12.target\ + \ 2 上查询到target_ssid" + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: "1.target1下设置ssid 和pwd,加密方式 open\n2.target2 jap target1\n3.target1下设置ssid\ + \ 和pwd,加密方式 wpa_psk \n4.target2 jap target1\n5.target1下设置ssid 和pwd,加密方式 wpa2_psk\ + \ \n6.target 2 jap target1\n7.target1下设置ssid 和pwd,加密方式 wap_wpa2_psk\n8.target2\ + \ jap target1\n9.target1下设置ssid 和pwd,加密方式 wep \n10.target2上查询target_ssid\n11.target1下设置ssid\ + \ 和pwd,加密方式 t 5 错误的加密方式\n12.target2上查询 target_ssid" + sub module: WIFI Connect + summary: station SAP+JAP test, different encryption + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_ARP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s + + - [R PC_COM C OK] + - - NIC NIC1 START capture+send+block_arp_ip + - ['R PC_COM C +NIC_START:OK'] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_hw_type 0xF1F1 arp_target_proto_addr + ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + - - NIC NIC1 SEND ARP arp_op_code "request" arp_proto_type 0xF1F1 arp_target_proto_addr + ethernet_dst_addr "ff:ff:ff:ff:ff:ff" + - [''] + - - DELAY 2 + - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] + comment: '' + execution time: 0.0 + expected result: 1. PC can't recv ARP reply from target + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: 1. PC send ARP req with unsupported hw type and protocol type + sub module: ARP + summary: PC send invalid ARP request to target 1 + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: handling ARP request + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0503 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -r 0 + - [R SSC1 C OK] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,3'] + - - DELAY 5 + - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,2'] + - - DELAY 5 + - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] + - - SSC SSC1 sta -R -r 1 + - [SSC SSC1 C OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. not reconnect when connect failed, status when recv disconnect event is correct + + 3. not reconnect when connect failed, status when recv disconnect event is correct + + 4. succeed' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. set sta reconnect policy as not reconnect + + 2. sta connect to ap not exist + + 3. sta connect to ap with wrong password + + 4. reset sta reconnect policy as auto reconnect' + sub module: WIFI Connect + summary: reconnect policy interact with failed STA connect/reconnect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0502 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 5 + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + sub module: WIFI Connect + summary: will not do reconnect after manually disconnected + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0501 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 0 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC2 sta -R -r 2 + - ['R SSC2 C +RECONN:0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + comment: '' + execution time: 0.0 + expected result: '1.设置reconn,开启(此功能不需要重启系统) + + 2.target1 set AP + + 3.target2 JAP target1 成功 + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.成功 + + 7.查询reconn状态,关闭 + + 8.修改mode 成功 + + 9.等待15s,target2 不会自动重连target1' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: "1.设置reconn,开启(此功能不需要重启系统)\n2.target1下设置ssid 和pwd 加密方式\n3.target2 JAP target1\ + \ \n4.target1 修改mode 为sta mode\n5.等待10s,target1 修改mode 为softAP mode\n6.设置reconn,关闭\n\ + 7.查询reconn状态,关闭\n8.target1 修改mode 为sta mode\n9.等待15s,target1 修改mode 为softAP mode" + sub module: WIFI Connect + summary: reconnect policy test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0115 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: AP mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_SCAN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -s .,juhg123 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s + - ['R SSC2 C +SCAN:', R SSC2 P , 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target 2上不能scan .,juhg123 + + 2.target1 set AP + + 3.target2上查询到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1.target 2 scan .,juhg123 + + 2.target1下设置ssid 和pwd 加密方式 + + 3.target2 scan ' + sub module: WIFI Scan + summary: scan with scan config ssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK,target1上accept 成功 + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: AP mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0116 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ + \ " + sub module: TCP + summary: AP mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT 0 + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: AP mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept成功 + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept成功 + + 10.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: AP mode, shutdown basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.target收到5byte数据 + + 6.PC收到5byte数据 + + 7.target收到146000 byte数据 + + 8.OK,PC 收到146000 byte数据' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC. ' + sub module: TCP + summary: AP mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) diff --git a/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py b/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py new file mode 100755 index 0000000000..e11ae6f1d8 --- /dev/null +++ b/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py @@ -0,0 +1,130 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +from TCAction import CmdHandler +import time + + +ATCmdList = ["GMR", + "UART=115200,8,1,0,0", + "CWMODE=3", + "CWJAP=\"TL_WR845N_T\",\"1234567890\"", + "CWLAP", + "CWQAP", + "CWSAP=\"asdf\",\"123456789\",5,3", + "CWLIF", + "CWDHCP=3", + "AT+CWAUTOCONN", + "CIPSTAMAC=\"18:fe:34:97:f3:43\"", + "CIPAPMAC=\"1a:fe:34:97:f3:43\"", + "CIPSTA=\"192.168.1.2\"", + "CIPAP=\"192.168.4.1\"", + "CIPSTATUS", + "CIPSTART=\"UDP\",\"192.168.1.4\",6531,7895,1", + "CIPSTART=\"TCP\",\"192.168.1.4\",6531", + "CIPCLOSE", + "CIFSR", + "CIPMUX=1", + "CIPSERVER=1,4567", + "CIPMODE=0", + "CIPSTO=7200", + "PING=\"192.168.1.4\""] + + +class CmdInterruptTest(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=20, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def load_and_exe_one_step(self, checker_stings, test_action_strings, fail_string, + check_freq=0.1, check_time=50, sleep_time=0.1): + # set checker for next executing step + checkers = CmdHandler.parse_results(checker_stings, self.test_env) + self.result_cntx.set_next_step(checkers, check_time, check_freq) + # execute 1 step + for action_string in test_action_strings: + test_action = CmdHandler.parse_action(action_string, self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + time.sleep(sleep_time) + + ret = self.wait_to_execute() + + if ret is False: # # timeout + self.result_cntx.set_result(fail_string) + if ret == check_time: + self.result_cntx.set_result(fail_string) + ret = False + + self.require_waiting() + + return ret + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # step 1, sleep time 0.1 + for cmd1 in ATCmdList: + # check if match CMD - AT - busy - OK/ERROR pattern + checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] + test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + # check again if match CMD - OK/ERROR - AT - OK pattern + checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] + test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + NativeLog.add_trace_critical("CMD Fail: AT+%s; sleep time is 0.1" % cmd1) + + # step 2, sleep time 0 + for cmd1 in ATCmdList: + # check if match CMD - AT - busy - OK/ERROR pattern + checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] + test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + # check again if match CMD - OK/ERROR - AT - OK pattern + checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] + test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + NativeLog.add_trace_critical("CMD Fail: AT+%s; sleep time is 0" % cmd1) + + # step 3, cat string + for cmd1 in ATCmdList: + # check if match CMD - AT - busy - OK/ERROR pattern + checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] + test_action_string = ["ATSO AT1 AT+%s\r\nAT\r\n" % cmd1] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + # check again if match CMD - OK/ERROR - AT - OK pattern + checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] + test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] + fail_string = "Fail, Fail on step 1" + if self.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, sleep_time=0.1) is False: + NativeLog.add_trace_critical("CMD Fail: AT+%s; cat string" % cmd1) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATFunc/LAP.py b/components/test/TestCaseScript/ATFunc/LAP.py new file mode 100644 index 0000000000..b389e48c04 --- /dev/null +++ b/components/test/TestCaseScript/ATFunc/LAP.py @@ -0,0 +1,64 @@ +from TCAction import TCActionBase +import time +import re + + +class LAP(TCActionBase.CommonTCActionBase): + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + # restore set LAPOPT + if self.load_and_exe_one_step(["R AT1 L OK"], + ["ATS AT1 AT+CWLAPOPT=0,127"], + "Failed to set LAP option") is False: + return + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # step 1. set LAPOPT + if self.load_and_exe_one_step(["R AT1 L OK"], + ["ATS AT1 AT+CWLAPOPT=1,4"], + "Failed to set LAP option") is False: + return + + # step 2. LAP + if self.load_and_exe_one_step(["R AT1 A :([[^OK]]+)OK"], # [] is list generator, use [[]] for [] + ["ATS AT1 AT+CWLAP"], + "Failed to LAP") is False: + return + lap_result = self.get_parameter("lap_result") + rssi_list = re.findall("CWLAP:\((-\d+)\)", lap_result) + if len(rssi_list) > 1: + for i in range(len(rssi_list)-1): + if int(rssi_list[i]) < int(rssi_list[i+1]): + break + else: + self.result_cntx.set_result("Succeed") + else: + self.result_cntx.set_result("Succeed") + pass + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + pass + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/ATFunc/SendDataValidation.py b/components/test/TestCaseScript/ATFunc/SendDataValidation.py new file mode 100755 index 0000000000..27f1e7f7c1 --- /dev/null +++ b/components/test/TestCaseScript/ATFunc/SendDataValidation.py @@ -0,0 +1,161 @@ +from TCAction import TCActionBase +from TCAction import CmdHandler +from NativeLog import NativeLog +import time +import threading +import sys +reload(sys) +sys.setdefaultencoding('iso-8859-1') # # use encoding that with 1 Byte length and contain 256 chars + + +VALIDATION_STRING = "".join([chr((m+65) % 256) for m in range(256)]) # make it start from 'A' + + +class ResultCheckCntx(TCActionBase.ResultCheckContext): + + def __init__(self, test_action, test_env, name): + TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) + pass + + def run(self): + tx_result = -1 + rx_result = -1 + + while True: + exit_flag = self.wait_exit_event(2) + # force exit + if exit_flag is True: + break + try: + self.lock_data() + rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) + tx_port = filter(lambda x: x[0] == "SOC2", self.data_cache) + finally: + self.unlock_data() + + if len(rx_port) == 1: + data = rx_port[0][1] + rx_result = data.find(VALIDATION_STRING) + if len(tx_port) == 1: + data = tx_port[0][1] + tx_result = data.find(VALIDATION_STRING) + + if tx_result != -1: + self.test_action.tx_check_done.set() + if rx_result != -1: + self.test_action.rx_check_done.set() + + +class SendDataValidation(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.timestamp = time.strftime("%d%H%M%S", time.localtime()) + self.tx_check_done = threading.Event() + self.rx_check_done = threading.Event() + + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + # enable target TCP TX + tx_enable = self.tx_enable + # enable target TCP RX + rx_enable = self.rx_enable + # transparent mode select + is_transparent_mode = self.is_transparent_mode + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step1 create PC server + checker_stings = ["SOCR SOC_COM L OK"] + test_action_string = ["SOC SOC1 LISTEN "] + fail_string = "Fail, Fail on create PC server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 target connect, switch to transparent + checker_stings = ["SOCR SOC1 C +ACCEPT", "ATR AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] + fail_string = "Fail, Fail on connect to PC server" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["SOCR SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC2"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # set to transparent mode + if is_transparent_mode is True: + checker_stings = ["ATR AT1 L OK"] + test_action_strings = ["ATS AT1 AT+CIPMODE=1"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["ATR AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + else: + checker_stings = ["ATR AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=256"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 + + # switch to new result check context + self.result_cntx.stop_thread() + self.result_cntx.join() + self.result_cntx = ResultCheckCntx(self, self.test_env, self.tc_name) + self.result_cntx.start() + + # step 3 send data + if rx_enable is True: + test_action = CmdHandler.parse_action("SOC SOC2 SEND 256", self.test_env) + CmdHandler.do_actions(test_action[0], self.test_env) + self.rx_check_done.wait(5) + if self.rx_check_done.isSet() is False: + # rx fail + return + # flush all data + self.result_cntx.data_flush() + self.tx_check_done.clear() + + if tx_enable is True: + test_action = CmdHandler.parse_action("ATSN AT1 256", self.test_env) + CmdHandler.do_actions(test_action[0], self.test_env) + self.tx_check_done.wait(5) + if self.tx_check_done.isSet() is False: + # tx fail + return + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + pass + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATFunc/UARTTest.py b/components/test/TestCaseScript/ATFunc/UARTTest.py new file mode 100644 index 0000000000..184f440d49 --- /dev/null +++ b/components/test/TestCaseScript/ATFunc/UARTTest.py @@ -0,0 +1,164 @@ +import socket +import serial + +from TCAction import PerformanceTCBase +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class UARTTest(PerformanceTCBase.PerformanceTCBase): + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.test_mode = "command" + self.baudrate = None + self.bytesize = None + self.parity = None + self.stopbits = None + self.xonxoff = None + self.rtscts = None + + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + # restore UART config + self.restore_serial_port("AT1") + PerformanceTCBase.PerformanceTCBase.cleanup(self) + + STOP_BITS = { + 1: serial.STOPBITS_ONE, + 2: serial.STOPBITS_ONE_POINT_FIVE, + 3: serial.STOPBITS_TWO, + } + BYTE_SIZE = { + 5: serial.FIVEBITS, + 6: serial.SIXBITS, + 7: serial.SEVENBITS, + 8: serial.EIGHTBITS, + } + PARITY = { + 0: serial.PARITY_NONE, + 1: serial.PARITY_ODD, + 2: serial.PARITY_EVEN, + } + RTSCTS = {} + + def config_serial_port(self): + port = self.test_env.get_port_by_name("AT1") + kwargs = dict() + if self.baudrate is not None: + kwargs["baudrate"] = self.baudrate + if self.bytesize is not None: + kwargs["bytesize"] = self.BYTE_SIZE[self.bytesize] + if self.parity is not None: + kwargs["parity"] = self.PARITY[self.parity] + if self.stopbits is not None: + kwargs["stopbits"] = self.STOP_BITS[self.stopbits] + if self.xonxoff is not None: + kwargs["xonxoff"] = self.xonxoff + if self.rtscts is not None: + kwargs["rtscts"] = self.rtscts + NativeLog.add_prompt_trace("[change PC UART config] %s" % kwargs) + port.reconfig(**kwargs) + + def send_commands(self): + # first change UART config + self.config_serial_port() + # do send commands + for i in range(1, 256): + cmd = bytes().join([chr(x % 256) for x in range(i)]) + try: + self.serial_write_line("AT1", cmd) + except StandardError, e: + NativeLog.add_exception_log(e) + pass + self.flush_data("AT1") + # restore UART config + self.restore_serial_port("AT1") + + def send_data(self): + # create TCP connection and enter send mode + pc_ip = self.get_parameter("pc_ip") + tcp_port = self.get_parameter("test_tcp_port1") + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, tcp_port)) + server_sock.settimeout(10) + server_sock.listen(5) + self.serial_write_line("AT1", "AT+CIPSTART=\"TCP\",\"%s\",%s" % (pc_ip, tcp_port)) + self.check_response("AT1", "OK") + sock, addr = server_sock.accept() + server_sock.close() + self.serial_write_line("AT1", "AT+CIPSEND=1460") + self.check_response("AT1", ">") + # change UART config + self.config_serial_port() + # send data + try: + self.serial_write("AT1", bytes().join([chr(x % 256) for x in range(146000)])) + except StandardError, e: + NativeLog.add_exception_log(e) + pass + sock.send("A"*1460) + # restore UART config + sock.close() + self.restore_serial_port("AT1") + + def pass_through_mode(self): + # create TCP connection and enter pass through mode + pc_ip = self.get_parameter("pc_ip") + tcp_port = self.get_parameter("test_tcp_port1") + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, tcp_port)) + server_sock.settimeout(10) + server_sock.listen(5) + self.serial_write_line("AT1", "AT+CIPMODE=1") + self.check_response("AT1", "OK") + self.serial_write_line("AT1", "AT+CIPSTART=\"TCP\",\"%s\",%s" % (pc_ip, tcp_port)) + self.check_response("AT1", "OK") + sock, addr = server_sock.accept() + server_sock.close() + self.serial_write_line("AT1", "AT+CIPSEND") + self.check_response("AT1", ">") + # change UART config + self.config_serial_port() + # send data + try: + self.serial_write("AT1", bytes().join([chr(x % 256) for x in range(146000)])) + except StandardError, e: + NativeLog.add_exception_log(e) + pass + sock.send("A" * 1460) + # restore UART config + sock.close() + self.restore_serial_port("AT1") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + # test sending command + try: + if self.test_mode == "command": + self.send_commands() + elif self.test_mode == "send_data": + self.send_data() + elif self.test_mode == "pass_through": + self.pass_through_mode() + else: + raise StandardError("test mode not supported: %s" % self.test_mode) + self.set_result("Succeed") + except StandardError, e: + NativeLog.add_exception_log(e) + self.set_result("Failed") + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/ATFunc/__init__.py b/components/test/TestCaseScript/ATFunc/__init__.py new file mode 100755 index 0000000000..5a3bbc44dd --- /dev/null +++ b/components/test/TestCaseScript/ATFunc/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["TCPClientMulti", "TCPClientSingle", "TCPServerMulti", + "TCPTransparent", "UDPMulti", "UDPSingle"] \ No newline at end of file diff --git a/components/test/TestCaseScript/ATStress/ATPassThrough.py b/components/test/TestCaseScript/ATStress/ATPassThrough.py new file mode 100755 index 0000000000..5149ffe3de --- /dev/null +++ b/components/test/TestCaseScript/ATStress/ATPassThrough.py @@ -0,0 +1,179 @@ +import time + +from TCAction import TCActionBase +from NativeLog import NativeLog + + +BEACON_TIMEOUT = 3 +WAIT_FOR_RECONNECT = 20 + + +class ATPassThrough(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.do_scan = True + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + tx_enable = self.tx_enable + rx_enable = self.rx_enable + att_set = self.att_set + do_scan = self.do_scan + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPClientMulti script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # step0, set att and join ap + fail_string = "Fail, Fail on JAP, set to single link mode" + + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT 1"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 C ready"] + test_action_string = ["ATS AT1 AT+RST"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATS AT1 AT+CWMODE=1"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATC AT1 CWJAP "] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATS AT1 AT+CIPMUX=0"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step1, create TCP connection and enter pass through mode + fail_string = "Fail, Fail on create server, create connection or enter pass through mode" + + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 LISTEN "] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] + test_action_string = ["ATC AT1 CIPSTART \"TCP\" "] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_strings = ["ATS AT1 AT+CIPMODE=1"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC2"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step2 + # while + # set att from, send data on both direction + # if TCP connection disconnected, then set att to 1, wait reconnect succeed, continue test + for i in xrange(test_count): + for _att in att_set: + + # set att + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT %d" % _att] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + time.sleep(BEACON_TIMEOUT) + + # do scan to get ssid + if do_scan is True: + checker_stings = [] + test_action_string = ["ATSO AT1 +++"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATC AT1 CWLAP "] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # send data + checker_stings = [] + test_action_string = [] + if tx_enable is True: + checker_stings += ["P SOC2 RL %d" % at_send_length] + test_action_string += ["ATSN AT1 %d" % at_send_length] + if rx_enable is True: + checker_stings += ["P AT1 RL %d" % soc_send_length] + test_action_string += ["SOC SOC2 SEND %d" % soc_send_length] + + if len(test_action_string) > 0: + if self.load_and_exe_one_step(checker_stings, test_action_string, "", + check_freq=1, check_time=30) is False: + # send data fail + NativeLog.add_prompt_trace("Failed to send data @ att %d" % _att) + # set att back to 1 + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT 1"] + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + # wait for reconnect + time.sleep(WAIT_FOR_RECONNECT) + fail_string = "Failed, failed to accept socket" + checker_stings = ["SOCR SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC2"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + break + pass + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/ATSleep.py b/components/test/TestCaseScript/ATStress/ATSleep.py new file mode 100644 index 0000000000..586862a777 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/ATSleep.py @@ -0,0 +1,251 @@ +import random +import os +import time + +from TCAction import TCActionBase, PerformanceTCBase +from NativeLog import NativeLog +from Utility import MakeFolder +from Utility import MultimeterUtil + +LOG_PATH = os.path.join("AT_LOG", "SLEEP") + +SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] +SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) + +SAMPLE_RATE_SLEEP_MODE_CHANGE = 0.002 +SAMPLE_NUM_SLEEP_MODE_CHANGE = 256 + +SAMPLE_RATE = 0.002 +SAMPLE_NUM = 512 +MAX_VALUE = 1 +Y_AXIS_LABEL = "Current (mA)" +GPIO_EDGE_DELAY = 120 # 20 ms + +NONE_SLEEP_MIN_CUR = 30 +LIGHT_SLEEP_MIN_CUR = 1.5 +MODEM_SLEEP_MIN_CUR = 20 + +GPIO_WAKE_UP = 15 + +AT_WAKE_UP_IND_PIN = 14 +AT_WAKE_UP_PIN = 12 + + +class ATSleep(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.test_mode = "mode_change" + self.test_count = 100 + self.sleep_mode = SLEEP_MODE_LIST + self.sleep_wake_pin = AT_WAKE_UP_PIN + self.sleep_wakeup_ind_pin = AT_WAKE_UP_IND_PIN + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, + "AT_AUTO_SLEEP_%s_%s" % + (self.test_mode, + time.strftime("%d%H%M%S", time.localtime())))) + self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) + + @staticmethod + def find_min_items(item_list, count): + assert count < len(item_list) + min_items = [] + for i in range(count): + min_val = min(item_list) + min_items.append(min_val) + item_list.remove(min_val) + return min_items + + def sleep_mode_change(self, sleep_mode): + result = True + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] %s start" % sleep_mode) + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + # set sleep mode + self.serial_write_line("AT1", "AT+SLEEP=%d" % sleep_mode_enum) + self.check_response("AT1", "OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] mode set") + time.sleep(10) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE_SLEEP_MODE_CHANGE, + sample_num=SAMPLE_NUM_SLEEP_MODE_CHANGE, + max_value=MAX_VALUE) + # do check measure + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] measure done, average min current %f" % average_val) + + if sleep_mode == "none_sleep": + if average_val < NONE_SLEEP_MIN_CUR: + result = False + elif sleep_mode == "light_sleep": + if average_val > LIGHT_SLEEP_MIN_CUR: + result = False + elif sleep_mode == "modem_sleep": + if average_val > MODEM_SLEEP_MIN_CUR or average_val < LIGHT_SLEEP_MIN_CUR: + result = False + if result is False: + NativeLog.add_trace_critical("[AutoSleep][ModeChange] %s failed" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, "%s_fail" % sleep_mode, Y_AXIS_LABEL) + + time.sleep(5) + return result + + def sleep_current_measure(self, sleep_mode): + result = True + + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] %s start" % sleep_mode) + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + # set sleep mode + self.serial_write_line("AT1", "AT+SLEEP=%d" % sleep_mode_enum) + self.check_response("AT1", "OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] set mode done") + time.sleep(10) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, sleep_mode, Y_AXIS_LABEL) + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] measure done") + return result + + def light_sleep_wakeup(self): + result = True + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] start") + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(1) + self.serial_write_line("AT1", "") + time.sleep(1) + self.check_response("SSC2", "+GPIO_SET:OK", timeout=1) + + for i in range(10): + self.serial_write_line("SSC2", "gpio -G -p %d" % self.sleep_wakeup_ind_pin) + if self.check_response("SSC2", "+GPIO_GET:0", timeout=0.73) is True: + break + else: + NativeLog.add_prompt_trace("AT Sleep wakeup pin is not correct when in sleep") + + # check if respond to uart + self.flush_data("AT1") + for i in range(60): + self.serial_write("AT1", "a") + time.sleep(0.43) + time.sleep(0.1) + respond_data = self.serial_read_data("AT1") + if len(respond_data) >= 60: + NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " + "Failed when recving data during sleep, %d" % len(respond_data)) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on sleep mode done") + + # change GPIO to make target wakeup + self.serial_write_line("SSC2", "gpio -L -p %d -t 0" % GPIO_WAKE_UP) + self.check_response("SSC2", "+GPIO_SET:OK") + time.sleep(0.01) + + for i in range(3): + self.serial_write_line("SSC2", "gpio -G -p %d" % self.sleep_wakeup_ind_pin) + if self.check_response("SSC2", "+GPIO_GET:1") is False: + NativeLog.add_prompt_trace("AT Sleep wakeup pin is not correct when wakeup") + + self.serial_write_line("AT1", "") + time.sleep(1) + self.flush_data("AT1") + for i in range(60): + self.serial_write("AT1", "a") + time.sleep(0.043) + time.sleep(0.1) + respond_data = self.serial_read_data("AT1") + if len(respond_data) < 60: + NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " + "Failed when recving data during wakeup, %d" % len(respond_data)) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on wakeup mode done") + self.serial_write_line("AT1", "") + # restore GPIO level + self.serial_write_line("SSC2", "gpio -L -p %d -t 1" % GPIO_WAKE_UP) + time.sleep(2) + return result + + def cleanup(self): + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + self.serial_write_line("AT1", "") + self.serial_write_line("AT1", "AT+RST") + self.check_response("SSC2", "+GPIO_SET:OK") + self.check_response("AT1", "ready") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + + try: + test_mode = self.test_mode + test_count = self.test_count + sleep_mode = self.sleep_mode + except StandardError, e: + return + + # make sure enter modem sleep mode before start test + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + self.serial_write_line("AT1", "AT+RST") + self.check_response("SSC2", "+GPIO_SET:OK") + self.check_response("AT1", "ready") + self.check_response("AT1", "WIFI GOT IP") + # set AT light sleep wakeup pin + self.serial_write_line("AT1", "AT+WAKEUPGPIO=1,%d,0" % self.sleep_wake_pin) + self.check_response("AT1", "OK") + + # start test + if "mode_change" in test_mode: + for i in range(test_count): + result = self.sleep_mode_change(random.choice(SLEEP_MODE_LIST)) + + elif "measure_current" in test_mode: + for i in range(test_count): + for mode in sleep_mode: + result = self.sleep_current_measure(mode) + pass + elif "gpio_wakeup" in test_mode: + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + # config wakeup gpio + self.serial_write_line("AT1", "AT+WAKEUPGPIO=1,%d,0,%d,1" % (self.sleep_wake_pin, self.sleep_wakeup_ind_pin)) + self.check_response("AT1", "OK") + # set sleep mode + self.serial_write_line("AT1", "AT+SLEEP=%d" % SLEEP_MODE["light_sleep"]) + self.check_response("AT1", "OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + for i in range(test_count): + result = self.light_sleep_wakeup() + pass + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/ATStress/SoftAPServer.py b/components/test/TestCaseScript/ATStress/SoftAPServer.py new file mode 100755 index 0000000000..7522658f15 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/SoftAPServer.py @@ -0,0 +1,308 @@ +from TCAction import PerformanceTCBase +import time +import socket +import threading +import Queue +import re +import random +from NativeLog import NativeLog + + +SEND_CMD = ("CIPSEND, CIPSENDBUF", "CIPSENDEX") + + +class RecvThread(threading.Thread): + def __init__(self, test_action): + threading.Thread.__init__(self) + self.setDaemon(True) + self.test_action = test_action + self.exit_flag = threading.Event() + pass + + def run(self): + data = "" + ipd_line = re.compile("IPD,\d,\d+:") + recv_bytes_line = re.compile("Recv \d+ bytes") + allow_send_line = re.compile("OK\r\n>") + send_ok_line = re.compile("SEND OK") + while self.exit_flag.is_set() is False: + flush_pos = 0 + data += self.test_action.serial_read_data("AT1") + # do process IPD data + match_set = ipd_line.findall(data) + for match_line in match_set: + link_id = match_line[4] + flush_pos = data.find(match_line) + len(match_line) + self.test_action.send_queue.put(link_id, 1) + pass + # do process send > + match = allow_send_line.search(data) + if match is not None: + match_line = match.group() + self.test_action.add_info_log("find OK >") + self.test_action.send_allow_evt.set() + pos = data.find(match_line) + len(match_line) + flush_pos = pos if pos > flush_pos else flush_pos + # do process Recv xx bytes + match = recv_bytes_line.search(data) + if match is not None: + match_line = match.group() + self.test_action.add_info_log("find Recv xx bytes") + self.test_action.recv_data_evt.set() + pos = data.find(match_line) + len(match_line) + flush_pos = pos if pos > flush_pos else flush_pos + + match = send_ok_line.search(data) + if match is not None: + match_line = match.group() + self.test_action.add_info_log("find send ok") + self.test_action.send_ok_evt.set() + pos = data.find(match_line) + len(match_line) + flush_pos = pos if pos > flush_pos else flush_pos + # pass + + # flush processed data + if flush_pos > 0: + data = data[flush_pos:] + + pass + + def exit(self): + self.exit_flag.set() + pass + + +class TCPClientThread(threading.Thread): + send_char = "A" + sync_lock = threading.Lock() + + def __init__(self, test_action, pc_ip, target_ip, target_port, request_len, response_len, client_id, + connect_timeout, recv_timeout): + threading.Thread.__init__(self) + self.setDaemon(True) + self.exit_flag = threading.Event() + self.test_action = test_action + self.pc_ip = pc_ip + self.target_ip = target_ip + self.target_port = target_port + self.request_len = request_len + self.response_len = response_len + self.client_id = client_id + self.connect_timeout = connect_timeout + self.recv_timeout = recv_timeout + pass + + @classmethod + def get_send_char(cls): + with cls.sync_lock: + send_char = cls.send_char + cls.send_char = chr(ord(send_char) + 1) if ord(send_char) < ord("Z") else "A" + return send_char + pass + + def run(self): + while self.exit_flag.is_set() is False: + exception_occurred = False + client_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + client_sock.bind((self.pc_ip, 0)) + client_sock.settimeout(20) + time1 = time.time() + name = client_sock.getsockname() + + try: + client_sock.connect((self.target_ip, self.target_port)) + except StandardError, e: + exception_occurred = True + self.test_action.add_critical_log("failed to connect succeed within 2 seconds %s, %d" + % (name[0], name[1])) + client_sock.close() + + time2 = time.time() - time1 + if exception_occurred is True: + self.test_action.add_critical_log("connect timeout %f; ip is %s, port is %d" + % (time2, name[0], name[1])) + continue + if time2 > self.connect_timeout: + self.test_action.add_critical_log("connect time too long %f; ip is %s, port is %d" + % (time2, name[0], name[1])) + + time.sleep(float(random.randint(0, 30))/100) + send_char = self.get_send_char() + data = send_char * self.request_len + try: + client_sock.send(data) + except StandardError: + NativeLog.add_trace_critical("send fail") + # try: + # data = client_sock.recv(1) + # except socket.error, e: + # self.handle_processing_fail("failed to receive data within 2 seconds") + data_received = 0 + time1 = time.time() + while data_received < self.response_len: + try: + data = client_sock.recv(4*1024) + except StandardError, e: + exception_occurred = True + break + data_received += len(data) + + time2 = time.time() - time1 + if exception_occurred is True or time2 > self.recv_timeout: + self.test_action.add_critical_log("receive time too long %f; ip is %s, port is %d"\ + % (time2, name[0], name[1])) + client_sock.close() + time.sleep(float(random.randint(0, 30))/100) + pass + pass + + def exit(self): + self.exit_flag.set() + pass + + +class SendThread(threading.Thread): + def __init__(self, test_action, test_count, send_cmd, response_len, check_send_ok): + threading.Thread.__init__(self) + self.setDaemon(True) + self.test_action = test_action + self.test_count = test_count + self.send_cmd = send_cmd + self.response_len = response_len + self.check_send_ok = check_send_ok + pass + + def run(self): + send_char = "a" + for i in xrange(self.test_count): + link_id = self.test_action.send_queue.get(1) + + self.test_action.send_allow_evt.clear() + self.test_action.serial_write_line("AT1", "AT+%s=%s,%d" % (self.send_cmd, link_id, self.response_len)) + self.test_action.add_info_log("write CIPSEND cmd") + + self.test_action.send_allow_evt.wait(10) + if self.test_action.send_allow_evt.is_set() is False: + self.test_action.add_critical_log("Failed to find OK > in 10s, test break") + break + self.test_action.send_allow_evt.clear() + + data = send_char * self.response_len + send_char = chr(ord(send_char) + 1) if ord(send_char) < ord("z") else "a" + self.test_action.recv_data_evt.clear() + self.test_action.send_ok_evt.clear() + self.test_action.serial_write("AT1", data) + self.test_action.add_info_log("data write done") + self.test_action.recv_data_evt.wait(10) + if self.test_action.recv_data_evt.is_set() is False: + self.test_action.add_critical_log("Failed to find Recv xx bytes in 10s, test break") + break + self.test_action.recv_data_evt.clear() + # if self.test_action.send_cmd == "CIPSEND": + if self.check_send_ok is True: + self.test_action.send_ok_evt.wait(10) + if self.test_action.send_ok_evt.is_set() is False: + self.test_action.add_critical_log("Failed to find SEND OK in 10s, test break") + break + self.test_action.add_info_log("send ok") + self.test_action.send_ok_evt.clear() + pass + pass + + +class SoftAPServer(PerformanceTCBase.PerformanceTCBase): + def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # init value for ip and port + self.pc_ip = "pc_ip" + self.server_port = "test_tcp_port1" + self.send_cmd = "CIPSEND" + self.baudrate = 115200 + self.rtscts = 3 + self.test_count = 1000 + self.request_len = 500 + self.response_len = 1600 + self.check_send_ok = True + self.concurrent_connections = 5 + self.connect_timeout = 3 + self.receive_timeout = 2 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.send_queue = Queue.Queue(maxsize=100) + self.send_allow_evt = threading.Event() + self.recv_data_evt = threading.Event() + self.send_ok_evt = threading.Event() + + pass + + @staticmethod + def add_critical_log(data): + NativeLog.add_trace_critical(data+"\r\n") + pass + + @staticmethod + def add_info_log(data): + NativeLog.add_trace_info(data) + + def process(self): + # step0, use initial condition AP3 (8266 as AP, PC connected to 8266, multiple connection) + pc_ip = self.get_parameter(self.pc_ip) + target_ip = self.get_parameter("target_ip") + server_port = self.get_parameter(self.server_port) + send_cmd = self.send_cmd + test_count = self.test_count + baudrate = self.baudrate + rtscts = self.rtscts + concurrent_connections = self.concurrent_connections + check_send_ok = self.check_send_ok + connect_timeout = self.connect_timeout + receive_timeout = self.receive_timeout + + self.serial_write_line("AT1", "AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)) + self.check_response("AT1", "OK\r\n") + self.reconfig_serial_port("AT1", baudrate, rtscts) + # step1, create server on 8266, create client thread + self.serial_write_line("AT1", "AT+CIPSERVER=1,%d" % server_port) + self.check_response("AT1", "OK") + + recv_thread = RecvThread(self) + send_thread = SendThread(self, test_count, send_cmd, self.response_len, check_send_ok) + send_thread.start() + recv_thread.start() + client_thread_list = [None] * concurrent_connections + for i in range(concurrent_connections): + client_thread_list[i] = TCPClientThread(self, pc_ip, target_ip, server_port, + self.request_len, self.response_len, i, + connect_timeout, receive_timeout) + client_thread_list[i].start() + pass + + # step3, wait sending thread join + send_thread.join() + + recv_thread.exit() + recv_thread.join() + + for i in range(concurrent_connections): + client_thread_list[i].exit() + client_thread_list[i].join() + pass + + self.serial_write_line("AT1", "AT+UART_CUR=115200,8,1,0,3") + self.check_response("AT1", "OK\r\n") + self.restore_serial_port("AT1") + self.set_result("Succeed") + pass + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/ATStress/TCPClientMulti.py b/components/test/TestCaseScript/ATStress/TCPClientMulti.py new file mode 100755 index 0000000000..610a55cbc4 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/TCPClientMulti.py @@ -0,0 +1,116 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class TCPClientMulti(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.max_conn = test_env.get_variable_by_name("max_conn")[1] + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + tx_enable = self.tx_enable + rx_enable = self.rx_enable + enable_log = self.enable_log + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPClientMulti script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # step1 + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 LISTEN "] + fail_string = "Fail, Fail on create PC server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 + for i in range(0, self.max_conn): + checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" " % i] + fail_string = "Fail, Fail on connect to PC server" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC%d" % (i+2)] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 + # turn off AT UART logging + if enable_log is False: + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + + data = "A" * at_send_length + fail_string = "Fail, Fail on send and recv data" + + for j in range(0, test_count): + + if tx_enable is True: + for i in range(0, self.max_conn): + checker_stings = ["P AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail on target send command for link %d" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + return + + checker_stings = ["P SOC%d RL %d" % ((i+2), at_send_length), "P AT1 C OK"] + test_action_strings = ["ATSO AT1 %s" % data] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + return + + if rx_enable is True: + checker_stings = [] + test_action_strings = [] + for i in range(0, self.max_conn): + checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) + test_action_strings.extend(["SOC SOC%d SEND %d %s" % (i+2, soc_send_length, data)]) + + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail to receive PC sent data") + NativeLog.add_trace_critical("Test count is %d" % j) + return + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/TCPClientSingle.py b/components/test/TestCaseScript/ATStress/TCPClientSingle.py new file mode 100755 index 0000000000..7127c3d0f1 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/TCPClientSingle.py @@ -0,0 +1,123 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class TCPClientSingle(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.link_type = "TCP" + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + tx_enable = self.tx_enable + rx_enable = self.rx_enable + enable_log = self.enable_log + link_type = self.link_type + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPClientSingle script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # step1 + checker_stings = ["R SOC_COM L OK"] + if link_type == "TCP": + test_action_string = ["SOC SOC1 LISTEN "] + elif link_type == "SSL": + test_action_string = ["SOC SOC1 SLISTEN "] + pass + else: + raise StandardError() + fail_string = "Fail, Fail on create PC server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 + if link_type == "TCP": + checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] + elif link_type == "SSL": + checker_stings = ["R SOC1 C +SACCEPT", "R AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"SSL\" "] + else: + raise StandardError() + fail_string = "Fail, Fail on connect to PC server" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC2"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 + # turn off AT UART logging + if enable_log is False: + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + + for j in range(0, test_count): + data = "A" * at_send_length + fail_string = "Fail, Fail on send and recv data" + + if tx_enable is True: + checker_stings = ["P AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d" % at_send_length] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail on target send command") + NativeLog.add_trace_critical("Test count is %d" % j) + return + + checker_stings = ["P SOC2 RL %d" % at_send_length, "P AT1 C OK"] + test_action_strings = ["ATSO AT1 %s" % data] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail on target send, send or recv error") + NativeLog.add_trace_critical("Test count is %d" % j) + return + + if rx_enable is True: + checker_stings = ["P AT1 DL S+%d" % soc_send_length] + test_action_strings = ["SOC SOC2 SEND %d" % soc_send_length] + + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail to receive PC sent data") + NativeLog.add_trace_critical("Test count is %d" % j) + return + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/TCPSendPerf.py b/components/test/TestCaseScript/ATStress/TCPSendPerf.py new file mode 100755 index 0000000000..a2f6e1a060 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/TCPSendPerf.py @@ -0,0 +1,148 @@ +import time +import os +import socket +import ssl + +from NativeLog import NativeLog +from TCAction import PerformanceTCBase +from Utility import MakeFolder + + +SEND_CMD = ("CIPSEND, CIPSENDBUF", "CIPSENDEX") + +LOG_PATH = os.path.join("AT_LOG", "Performance", "AT_SEND") + + +class TCPSendPerf(PerformanceTCBase.PerformanceTCBase): + def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # init value for ip and port + self.pc_ip = "pc_ip" + self.server_port = "test_tcp_port1" + self.packet_len = 1 + self.test_count = 100 + self.send_cmd = "CIPSEND" + self.baudrate = 115200 + self.rtscts = 0 + self.link_type = "TCP" + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + pass + + def process(self): + pc_ip = self.get_parameter(self.pc_ip) + server_port = self.get_parameter(self.server_port) + packet_len = self.packet_len + test_count = self.test_count + send_cmd = self.send_cmd + baudrate = self.baudrate + rtscts = self.rtscts + result = True + link_type = self.link_type + + # create TCP connection + sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + sock.bind((pc_ip, server_port)) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.settimeout(10) + sock.listen(1) + + self.serial_write_line("AT1", "AT+CIPSTART=0,\"%s\",\"%s\",%d" % (link_type, pc_ip, server_port)) + sock_client = sock.accept()[0] + if link_type == "SSL": + sock_client = ssl.wrap_socket(sock_client, + server_side=True, + certfile=os.path.join("Certificate", "default.cer"), + keyfile=os.path.join("Certificate", "default.key")) + pass + if self.check_response("AT1", "OK") is False: + result = False + + self.serial_write_line("AT1", "AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)) + if self.check_response("AT1", "OK\r\n") is False: + result = False + + self.reconfig_serial_port("AT1", baudrate, rtscts) + + # restore to read line mode + self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) + + sock_client.settimeout(0) + + for _dummy in range(1): + if result is False: + NativeLog.add_trace_critical("Fail to create TCP connection") + break + # send TCP packets + data = "A" * packet_len + time1 = time.time() + + i = 0 + data_recv_len = 0 + while i < test_count: + self.serial_write_line("AT1", "AT+%s=0,%d" % (send_cmd, packet_len)) + if self.check_response("AT1", ">", 0.05) is False: + continue + + i += 1 + self.serial_write("AT1", data) + if send_cmd == "CIPSENDBUF": + result = self.check_response("AT1", "Recv %d bytes" % packet_len, 3) + else: + result = self.check_response("AT1", "SEND OK", 3) + if result is False: + NativeLog.add_trace_critical("Fail during sending data") + break + try: + if link_type == "TCP": + data_recv = sock_client.recv(10*1460) + elif link_type == "SSL": + data_recv = sock_client.read(10*1024) + else: + raise StandardError() + data_recv_len += len(data_recv) + except socket.error, e: + if e.errno == 10035: + pass + elif e.message == "The read operation timed out": + pass + else: + NativeLog.add_exception_log(e) + else: + self.set_result("Succeed") + + time2 = time.time() + + folder_path = MakeFolder.make_folder(LOG_PATH) + file_name = os.path.join(folder_path, + "%s_%s_%s.log" % (send_cmd, + packet_len, + time.strftime("%d%H%M%S", time.localtime()))) + with open(file_name, "ab+") as f: + f.write("\r\n[performance] %f packets per second " + "(including failed send operation)" + % (test_count/(time2-time1))) + f.write("\r\n[performance] %f Kbps" % (data_recv_len/(125*(time2-time1)))) + + self.serial_write_line("AT1", "AT+UART_CUR=115200,8,1,0,3") + self.check_response("AT1", "OK\r\n") + self.restore_serial_port("AT1") + + # restore to read line mode + self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) + # close socket + sock.close() + sock_client.close() + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/ATStress/TCPServerMulti.py b/components/test/TestCaseScript/ATStress/TCPServerMulti.py new file mode 100755 index 0000000000..c317bc9749 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/TCPServerMulti.py @@ -0,0 +1,126 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class TCPServerMulti(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.max_conn = test_env.get_variable_by_name("max_conn")[1] + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + target_ip_str = self.target_ip_str + enable_log = self.enable_log + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPSeverMulti script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # turn off AT UART logging + if enable_log is False: + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + + # step1 create TCP server on target + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATC AT1 CIPSERVER 1 "] + fail_string = "Fail, Fail on create target TCP server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 PC connect to target server + for j in range(0, test_count): + data = "A" * at_send_length + fail_string = "Fail, Fail on connect to target server" + + # check if all connection can send data on target + checker_stings = ["P AT1 C OK"] + test_action_strings = ["ATS AT1 AT+CIPCLOSE=%d" % self.max_conn] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=100) is False: + NativeLog.add_trace_critical("Fail to close all connection") + NativeLog.add_trace_critical("Test count is %d" % j) + continue # if fail on this step, we can recover and continue + + # a) do connect + fail_flag = False + for i in range(0, self.max_conn): + checker_stings = ["P SOC_COM C OK", "P AT1 C CONNECT"] + test_action_strings = ["SOC SOC%d CONNECT %s" % (i+1, target_ip_str)] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail to connect to target for link %d" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + # if fail on this step, we can recover and continue + fail_flag = True + break + + if fail_flag is True: + # fail on step a) + continue + + # b) check if all connection can recv data on target + checker_stings = [] + test_action_strings = [] + for i in range(0, self.max_conn): + checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) + test_action_strings.extend(["SOC SOC%d SEND %d" % (i+1, soc_send_length)]) + + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail to receive data from PC") + NativeLog.add_trace_critical("Test count is %d" % j) + continue # if fail on this step, we can recover and continue + + # c) check if all connection can send data on target + for i in range(0, self.max_conn): + checker_stings = ["P AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail on target send command for link %d" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + return + + checker_stings = ["P SOC%d RL %d" % ((i+1), at_send_length), "P AT1 C OK"] + test_action_strings = ["ATSO AT1 %s" % data] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + return + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/TCPTransparent.py b/components/test/TestCaseScript/ATStress/TCPTransparent.py new file mode 100755 index 0000000000..d116923bf5 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/TCPTransparent.py @@ -0,0 +1,280 @@ +from TCAction import TCActionBase +from TCAction import CmdHandler +from NativeLog import NativeLog +import time +import random +import string +import os + + +class TransparentResultCheckCntx(TCActionBase.ResultCheckContext): + + def __init__(self, test_action, test_env, name): + TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) + self.result_array = [] + self.at_data_recv_total = 0 + self.pc_data_recv_total = 0 + self.temp_data_at2wifi = "" + self.temp_data_wifi2at = "" + pass + + def run(self): + validation_required = self.test_action.data_validation + path = os.path.split(self.test_action.log_file_name) + file_name_at2wifi = os.path.join(path[0], "%s_at2wifi_pc.bin" % self.test_action.timestamp) + file_name_wifi2at = os.path.join(path[0], "%s_wifi2at_at.bin" % self.test_action.timestamp) + + while True: + exit_flag = self.wait_exit_event(2) + # force exit + if exit_flag is True: + break + rx_len = 0 + tx_len = 0 + try: + self.lock_data() + rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) + tx_port = filter(lambda x: x[0] == "SOC2", self.data_cache) + self.data_cache = [] + finally: + self.unlock_data() + + if len(rx_port) == 1: + rx_len = len(rx_port[0][1]) + self.at_data_recv_total += rx_len + if validation_required is True: + self.temp_data_wifi2at += rx_port[0][1] + if len(tx_port) == 1: + tx_len = len(tx_port[0][1]) + self.pc_data_recv_total += tx_len + if validation_required is True: + self.temp_data_at2wifi += tx_port[0][1] + + self.result_array.append(["TX %8d %s" % + (tx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) + self.result_array.append(["RX %8d %s" % + (rx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) + + if validation_required is True: + with open(file_name_at2wifi, "ab+") as f: + f.write(self.temp_data_at2wifi) + with open(file_name_wifi2at, "ab+") as f: + f.write(self.temp_data_wifi2at) + + def get_validation_data(self): + return self.temp_data_at2wifi, self.temp_data_wifi2at + + def get_test_results(self): + return self.result_array, self.at_data_recv_total, self.pc_data_recv_total + + +class TCPTransparent(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.timestamp = time.strftime("%d%H%M%S", time.localtime()) + + pass + + def cleanup(self): + # close current result check context + self.result_cntx.stop_thread() + self.result_cntx.join() + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + # restore to read line mode + self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) + + # make sure enter condition that can respond to AT command + self.result_cntx = TCActionBase.ResultCheckContext(self, self.test_env, self.tc_name) + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + checker_stings = ["ATR AT1 R *"] + test_action_string = ["ATSO AT1 +++", "DELAY 0.1", "ATS AT1 AT"] + fail_string = "Fail, Fail to reconfig UART" + + result = False + + while result is False: + result = self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + + # reset baudrate + + checker_stings = ["ATR AT1 L OK"] + test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,3" % 115200] + fail_string = "Fail, Fail to reconfig UART" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + test_action = CmdHandler.parse_action("UART AT1 %d" % 115200, self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + TCActionBase.CommonTCActionBase.cleanup(self) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + # at send data len + at_send_data_len = self.at_send_data_len + # pc send data len + pc_send_data_len = self.pc_send_data_len + # sleep time between each send, test count + test_dispatch = self.test_dispatch + # enable target TCP TX + tx_enable = self.tx_enable + # enable target TCP RX + rx_enable = self.rx_enable + # if need to record tx/rx data to file + data_validation = self.data_validation + # UART baudrate + baudrate = self.baudrate + # HW flow control + rtscts = self.rtscts + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step0 reconfig baudrate + if baudrate != 0: + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)] + fail_string = "Fail, Fail to reconfig UART" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + test_action = CmdHandler.parse_action("UART AT1 %d %d" % (baudrate, rtscts), self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + + # step1 create PC server + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 LISTEN "] + fail_string = "Fail, Fail on create PC server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 target connect, switch to transparent + checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] + fail_string = "Fail, Fail on connect to PC server" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC2"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_strings = ["ATS AT1 AT+CIPMODE=1"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 + # turn off AT UART logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + # uart try to return data ASAP + self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) + + # switch to new result check context + self.result_cntx.stop_thread() + self.result_cntx.join() + self.result_cntx = TransparentResultCheckCntx(self, self.test_env, self.tc_name) + self.result_cntx.start() + + at_data_sent_total = 0 + pc_data_sent_total = 0 + at2wifi_data = "" + wifi2at_data = "" + + for j in range(0, len(at_send_data_len) * len(pc_send_data_len)): + at_data_len = at_send_data_len[j / len(pc_send_data_len)] + pc_data_len = pc_send_data_len[j % len(pc_send_data_len)] + # data = "".join(["A"] * at_data_len) + chars = string.ascii_lowercase + data_list = ["".join([random.choice(chars) for m in range(at_data_len-16)])] + chars = string.ascii_uppercase + data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) + chars = string.digits + data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) + + for i in range(0, len(test_dispatch)): + for k in range(0, test_dispatch[i][1]): + data_str = "%.2d%.2d%.10d%s\r\n" % (j, i, k, data_list[k % 3]) + # time1 = time.time() + if tx_enable is True: + test_action = CmdHandler.parse_action("ATSO AT1 %s" % data_str, self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + at_data_sent_total += at_data_len + if data_validation is True: + at2wifi_data += data_str + # time2 = time.time() + if rx_enable is True: + if tx_enable is True: + test_action = CmdHandler.parse_action("SOC SOC2 SENDNB %d %s" % (pc_data_len, data_str), + self.test_env) + else: + test_action = CmdHandler.parse_action("SOC SOC2 SEND %d %s" % (pc_data_len, data_str), + self.test_env) + sent_len = CmdHandler.do_action(test_action[0], self.test_env) + pc_data_sent_total += sent_len + if data_validation is True: + wifi2at_data += data_str[:sent_len] + # time3 = time.time() + # if time3-time2 > 0.1: + # break + if test_dispatch[i][0] != 0: + time.sleep(test_dispatch[i][0]) + time.sleep(3) # wait 3 seconds + + # write send data to file for data validation + if data_validation is True: + path = os.path.split(self.log_file_name) + with open(os.path.join(path[0], "%s_at2wifi_at.bin" % self.timestamp), "ab+") as f: + f.write(at2wifi_data) + with open(os.path.join(path[0], "%s_wifi2at_pc.bin" % self.timestamp), "ab+") as f: + f.write(wifi2at_data) + + temp_data_at2wifi, temp_data_wifi2at = self.result_cntx.get_validation_data() + if temp_data_at2wifi != at2wifi_data: + NativeLog.add_prompt_trace("[Validation Fail] at2wifi") + if temp_data_wifi2at != wifi2at_data: + NativeLog.add_prompt_trace("[Validation Fail] wifi2at") + + throughput_results, at_data_recv_total, pc_data_recv_total = self.result_cntx.get_test_results() + result_str = "AT sent %15d\r\n" % at_data_sent_total + result_str += "PC recv %15d\r\n" % pc_data_recv_total + result_str += "PC sent %15d\r\n" % pc_data_sent_total + result_str += "AT recv %15d\r\n" % at_data_recv_total + for _result in throughput_results: + result_str += "%s\r\n" % _result + with open(self.log_file_name, "ab+") as f: + f.write(result_str) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/UDPMulti.py b/components/test/TestCaseScript/ATStress/UDPMulti.py new file mode 100755 index 0000000000..4423db3ce3 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/UDPMulti.py @@ -0,0 +1,113 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import time + + +class UDPMulti(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.max_conn = test_env.get_variable_by_name("max_conn")[1] + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + target_ip_str = self.target_ip_str + tx_enable = self.tx_enable + rx_enable = self.rx_enable + enable_log = self.enable_log + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for UDPMulti script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # step1, bind one PC UDP port + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 BIND "] + fail_string = "Fail, Fail on binding socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 2 create 5 UDP link on target + for i in range(0, self.max_conn): + checker_stings = ["R AT1 C CONNECT L OK"] + test_action_strings = ["ATC AT1 CIPSTART %d \"UDP\" 1" + % (i, i+1)] + fail_string = "Fail, Fail on create UDP link" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 send recv data + # turn off AT UART logging + if enable_log is False: + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + + for j in range(0, test_count): + data = "A" * at_send_length + fail_string = "Fail, Fail on send/recv data" + + if tx_enable is True: + # target link 0-5 sendto PC + for i in range(0, self.max_conn): + checker_stings = ["P AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Target fail on send cmd on link %d" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + + checker_stings = ["P SOC_COM C RECV_LEN=%d P " % (at_send_length, i+1), + "P AT1 C OK"] + test_action_strings = ["ATSO AT1 %s" % data] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Target sent UDP packet error on link %d" % i) + NativeLog.add_trace_critical("Test count is %d" % j) + + if rx_enable is True: + # PC send to target + checker_stings = [] + test_action_strings = [] + for i in range(0, self.max_conn): + checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) + test_action_strings.extend(["SOC SOC1 SENDTO %d %s" + % (soc_send_length, i+1, target_ip_str)]) + + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("PC sent UDP packet error") + NativeLog.add_trace_critical("Test count is %d" % j) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/UDPSingle.py b/components/test/TestCaseScript/ATStress/UDPSingle.py new file mode 100755 index 0000000000..0f30330ab6 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/UDPSingle.py @@ -0,0 +1,105 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class UDPSingle(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + TCActionBase.CommonTCActionBase.cleanup(self) + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + try: + at_send_length = self.at_send_length + soc_send_length = self.soc_send_length + test_count = self.test_count + target_ip_str = self.target_ip_str + tx_enable = self.tx_enable + rx_enable = self.rx_enable + enable_log = self.enable_log + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for UDPSingle script, error is %s" % e) + raise StandardError("Error configuration") + # configurable params + + # step1, bind one PC UDP port + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 BIND "] + fail_string = "Fail, Fail on binding UDP socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 2 create UDP link on target + checker_stings = ["R AT1 C CONNECT L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"UDP\" 1"] + fail_string = "Fail, Fail on create UDP link" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 send recv data + # turn off AT UART logging + if enable_log is False: + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + + for j in range(0, test_count): + data = "A" * at_send_length + fail_string = "Fail, Fail on send recv data" + + # target sendto PC + if tx_enable is True: + checker_stings = ["P AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d" % at_send_length] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Target fail on send cmd") + NativeLog.add_trace_critical("Test count is %d" % j) + + checker_stings = ["P SOC_COM C RECV_LEN=%d P " % at_send_length, + "P AT1 C OK"] + test_action_strings = ["ATSO AT1 %s" % data] + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Target sent UDP packet error") + NativeLog.add_trace_critical("Test count is %d" % j) + + # PC send to target + if rx_enable is True: + checker_stings = (["P AT1 DL S+%d" % soc_send_length]) + test_action_strings = (["SOC SOC1 SENDTO %d %s" % (soc_send_length, target_ip_str)]) + + if self.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("PC sent UDP packet error") + NativeLog.add_trace_critical("Test count is %d" % j) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/UDPTransparent.py b/components/test/TestCaseScript/ATStress/UDPTransparent.py new file mode 100755 index 0000000000..699d2b1ad8 --- /dev/null +++ b/components/test/TestCaseScript/ATStress/UDPTransparent.py @@ -0,0 +1,262 @@ +from TCAction import TCActionBase +from TCAction import CmdHandler +from NativeLog import NativeLog +import time +import random +import string +import os + + +class TransparentResultCheckCntx(TCActionBase.ResultCheckContext): + + def __init__(self, test_action, test_env, name): + TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) + self.result_array = [] + self.at_data_recv_total = 0 + self.pc_data_recv_total = 0 + pass + + def run(self): + validation_required = self.test_action.data_validation + temp_data_at2wifi = "" + temp_data_wifi2at = "" + path = os.path.split(self.test_action.log_file_name) + file_name_at2wifi = os.path.join(path[0], "%s_at2wifi_pc.bin" % self.test_action.timestamp) + file_name_wifi2at = os.path.join(path[0], "%s_wifi2at_at.bin" % self.test_action.timestamp) + + while True: + exit_flag = self.wait_exit_event(2) + # force exit + if exit_flag is True: + break + rx_len = 0 + tx_len = 0 + try: + self.lock_data() + rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) + tx_port = filter(lambda x: x[0] == "SOC1", self.data_cache) + self.data_cache = [] + finally: + self.unlock_data() + + if len(rx_port) == 1: + rx_len = len(rx_port[0][1]) + self.at_data_recv_total += rx_len + if validation_required is True: + temp_data_wifi2at += rx_port[0][1] + if len(tx_port) == 1: + tx_len = len(tx_port[0][1]) + self.pc_data_recv_total += tx_len + if validation_required is True: + temp_data_at2wifi += tx_port[0][1] + + self.result_array.append(["TX %8d %s" % + (tx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) + self.result_array.append(["RX %8d %s" % + (rx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) + + if validation_required is True: + with open(file_name_at2wifi, "ab+") as f: + f.write(temp_data_at2wifi) + with open(file_name_wifi2at, "ab+") as f: + f.write(temp_data_wifi2at) + + def get_test_results(self): + return self.result_array, self.at_data_recv_total, self.pc_data_recv_total + + +class UDPTransparent(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.timestamp = time.strftime("%d%H%M%S", time.localtime()) + + pass + + def cleanup(self): + # close current result check context + self.result_cntx.stop_thread() + self.result_cntx.join() + # turn on logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) + # restore to read line mode + self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) + + # make sure enter condition that can respond to AT command + self.result_cntx = TCActionBase.ResultCheckContext(self, self.test_env, self.tc_name) + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + checker_stings = ["R AT1 R *"] + test_action_string = ["ATSO AT1 +++", "DELAY 0.1", "ATS AT1 AT"] + fail_string = "Fail, Fail to reconfig UART" + + result = False + + while result is False: + result = self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + + # reset baudrate + + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,3" % 115200] + fail_string = "Fail, Fail to reconfig UART" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + test_action = CmdHandler.parse_action("UART AT1 %d" % 115200, self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + TCActionBase.CommonTCActionBase.cleanup(self) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + # at send data len + at_send_data_len = self.at_send_data_len + # pc send data len + pc_send_data_len = self.pc_send_data_len + # sleep time between each send, test count + test_dispatch = self.test_dispatch + # enable target TCP TX + tx_enable = self.tx_enable + # enable target TCP RX + rx_enable = self.rx_enable + # if need to record tx/rx data to file + data_validation = self.data_validation + # UART baudrate + baudrate = self.baudrate + # HW flow control + rtscts = self.rtscts + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step0 reconfig baudrate + if baudrate != 0: + checker_stings = ["R AT1 L OK"] + test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)] + fail_string = "Fail, Fail to reconfig UART" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + test_action = CmdHandler.parse_action("UART AT1 %d %d" % (baudrate, rtscts), self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + + # step1 create PC server + checker_stings = ["R SOC_COM L OK"] + test_action_string = ["SOC SOC1 BIND "] + fail_string = "Fail, Fail on create PC server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2 target connect, switch to transparent + checker_stings = ["R AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART \"UDP\" 0"] + fail_string = "Fail, Fail on connect to PC server" + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R AT1 L OK"] + test_action_strings = ["ATS AT1 AT+CIPMODE=1"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + checker_stings = ["R AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND"] + if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: + return + + # step 3 + # turn off AT UART logging + self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) + # restore to read data asap + self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) + + # switch to new result check context + self.result_cntx.stop_thread() + self.result_cntx.join() + self.result_cntx = TransparentResultCheckCntx(self, self.test_env, self.tc_name) + self.result_cntx.start() + + at_data_sent_total = 0 + pc_data_sent_total = 0 + at2wifi_data = "" + wifi2at_data = "" + + for j in range(0, len(at_send_data_len) * len(pc_send_data_len)): + at_data_len = at_send_data_len[j / len(pc_send_data_len)] + pc_data_len = pc_send_data_len[j % len(pc_send_data_len)] + # data = "".join(["A"] * at_data_len) + chars = string.ascii_lowercase + data_list = ["".join([random.choice(chars) for m in range(at_data_len-16)])] + chars = string.ascii_uppercase + data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) + chars = string.digits + data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) + + for i in range(0, len(test_dispatch)): + for k in range(0, test_dispatch[i][1]): + data_str = "%.2d%.2d%.10d%s\r\n" % (j, i, k, data_list[k % 3]) + # time1 = time.time() + if tx_enable is True: + test_action = CmdHandler.parse_action("ATSO AT1 %s" % data_str, self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + at_data_sent_total += at_data_len + if data_validation is True: + at2wifi_data += data_str + # time2 = time.time() + if rx_enable is True: + test_action = CmdHandler.parse_action("SOC SOC1 SENDTO %d %s %s %s" + % (pc_data_len, "", + "", data_str), self.test_env) + CmdHandler.do_actions(test_action, self.test_env) + pc_data_sent_total += pc_data_len + if data_validation is True: + wifi2at_data += data_str + # time3 = time.time() + # if time3-time2 > 0.1: + # pass + if test_dispatch[i][0] != 0: + time.sleep(test_dispatch[i][0]) + time.sleep(3) # wait 3 seconds + + # write send data to file for data validation + if data_validation is True: + path = os.path.split(self.log_file_name) + with open(os.path.join(path[0], "%s_at2wifi_at.bin" % self.timestamp), "ab+") as f: + f.write(at2wifi_data) + with open(os.path.join(path[0], "%s_wifi2at_pc.bin" % self.timestamp), "ab+") as f: + f.write(wifi2at_data) + throughput_results, at_data_recv_total, pc_data_recv_total = self.result_cntx.get_test_results() + result_str = "AT sent %15d\r\n" % at_data_sent_total + result_str += "PC recv %15d\r\n" % pc_data_recv_total + result_str += "PC sent %15d\r\n" % pc_data_sent_total + result_str += "AT recv %15d\r\n" % at_data_recv_total + for _result in throughput_results: + result_str += "%s\r\n" % _result + with open(self.log_file_name, "ab+") as f: + f.write(result_str) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/ATStress/__init__.py b/components/test/TestCaseScript/ATStress/__init__.py new file mode 100755 index 0000000000..5a3bbc44dd --- /dev/null +++ b/components/test/TestCaseScript/ATStress/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["TCPClientMulti", "TCPClientSingle", "TCPServerMulti", + "TCPTransparent", "UDPMulti", "UDPSingle"] \ No newline at end of file diff --git a/components/test/TestCaseScript/IOT/SCIOT.py b/components/test/TestCaseScript/IOT/SCIOT.py new file mode 100755 index 0000000000..5ced3ef121 --- /dev/null +++ b/components/test/TestCaseScript/IOT/SCIOT.py @@ -0,0 +1,357 @@ +import Queue + +from TCAction import TCActionBase +from NativeLog import NativeLog +from SCUDPServer import * +from TCAction.CmdExecutor import CmdExecutorBasic +from Utility import MakeFolder + +TEST_RESULT_CATEGORY = ("AP", "Phone") +TEST_RESULT_PROPERTY = ("model", "total", "succeed", "failed", "total time1", "total time2") +SINGLE_TEST_RESULT = ("AP", "Phone", "result", "time1", "time2") + +LOG_FILES = ("by_ap.tmp", "by_phone.tmp", "failed_item.tmp", "disqualified_item.tmp", "total.tmp") + +LOG_PATH = os.path.join("AT_LOG", "IOT") + + +def make_session_id(mac, test_id): + return mac_to_bytes(mac) + chr((test_id & 0xFF00) >> 8) + chr(test_id & 0xFF) + + +class TestHandler(threading.Thread): + def __init__(self, session_id, ap, phone, udp_server, test_action): + threading.Thread.__init__(self) + self.setDaemon(True) + self.udp_server = udp_server + self.session_id = session_id + self.ap = ap + self.phone = phone + self.test_action = test_action + self.recv_queue = Queue.Queue(10) + self.abort_event = threading.Event() + self.start_time = time.time() + self.test_result = None + udp_server.register_test_handler(session_id, self) + pass + + def req_receiver(self, msg, address): + self.recv_queue.put([msg, address]) + pass + + def res_receiver(self, msg, address): + self.recv_queue.put([msg, address]) + pass + + def abort_handler(self): + NativeLog.add_prompt_trace("[Test Handler][Debug] test aborted") + self.abort_event.set() + self.test_action.remove_from_available_list(self.phone) + pass + + def wait_result(self, event, timeout=None): + time_start = time.time() + while True: + if self.abort_event.isSet() is True: + return False + + if time.time() - self.start_time > ABORT_TIMEOUT: + return False + + if timeout is not None: + if time.time() - time_start > timeout: + return False + + if event == "ACK" or event == "result": + try: + ret = self.recv_queue.get(timeout=0.5) + except Queue.Empty, e: + continue + else: + msg = ret[0] + value_list = get_value_from_msg("type", msg) + msg_typ = ord(value_list[0]) + if msg_typ == TYPE_VAL[event]: + NativeLog.add_prompt_trace("[Test Handler][Debug] wait message succeed") + return msg + elif (msg_typ & 0x80) == 0: # invalid request + self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["Not support"]], + [VALUE_NAME["session id"], self.session_id]], + ret[1]) + pass + else: + pass + pass + + def run(self): + for i in range(1): + # step1 send broadcast to SP + msg = [[VALUE_NAME["type"], TYPE_VAL["Init new test"]], + [VALUE_NAME["session id"], self.session_id]] + self.udp_server.send_request(("", self.udp_server.udp_port), self.session_id, msg) + # wait response + if self.wait_result("ACK") is False: + break + NativeLog.add_prompt_trace("[Step1] Initial new test succeed") + + # step2 start smart config + checker_stings = ["ATR AT1 L OK"] + test_action_string = ["ATS AT1 AT+CWSTOPSMART"] + fail_string = "Fail, Failed to start smart config" + if self.test_action.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + NativeLog.add_prompt_trace(fail_string) + break + checker_stings = ["ATR AT1 L OK"] + test_action_string = ["ATS AT1 AT+CWSTARTSMART=1"] + if self.test_action.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + NativeLog.add_prompt_trace(fail_string) + break + NativeLog.add_prompt_trace("[Step2] Start smart config succeed") + + # step3 send test request to SP + msg = [[VALUE_NAME["type"], TYPE_VAL["test request"]], + [VALUE_NAME["session id"], self.session_id], + [VALUE_NAME["ap ssid"], self.ap["ssid"]], + [VALUE_NAME["ap password"], self.ap["password"]], + [VALUE_NAME["ap bssid"], mac_to_bytes(self.ap["bssid"])], + # [VALUE_NAME["ET version"], 0x20], + [VALUE_NAME["ssid hidden"], self.ap["is_hidden"]], + [VALUE_NAME["ap encryption"], AP_ENCRYPTION_VAL[self.ap["encryption"]]] + ] + self.udp_server.send_request((self.phone["ip"], self.udp_server.udp_port), self.session_id, msg) + # wait SP reply + if self.wait_result("ACK") is False: + break + NativeLog.add_prompt_trace("[Step3] Send test request succeed") + time_base = time.time() + + # step4 wait target smart config succeed + checker_stings = ["ATR AT1 C get%%20wifi%%20info C %s C %s" + % (self.ap["ssid"], self.ap["password"])] + test_action_string = [] + fail_string = "Fail, Fail to get ap info" + # if check target get smart config result fail, continue and get result from SP + ret = self.test_action.load_and_exe_one_step(checker_stings, test_action_string, + fail_string, check_time=600) + if ret is False: + NativeLog.add_prompt_trace("[Step4] Target smart config fail") + step_4_fail = True + else: + NativeLog.add_prompt_trace("[Step4] Target smart config succeed") + step_4_fail = False + time_target_succeed = time.time() - time_base + + # step5 wait SP result + msg = self.wait_result("result") + if msg is False: + NativeLog.add_prompt_trace("[Test Handler][Debug] Failed to get result from SP") + break + else: + self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["ACK"]], + [VALUE_NAME["session id"], self.session_id]], + (self.phone["ip"], self.udp_server.udp_port)) + tmp = get_value_from_msg(["result code", "start SC time", "recv UDP time"], msg) + result_code = ord(tmp[0]) + if result_code == RESULT_CODE_VAL["OK"]: + sp_start_time = bytes_to_time(tmp[1]) + sp_recv_udp_time = bytes_to_time(tmp[2]) + smart_config_protocol_cost = time_target_succeed - sp_start_time + user_experience_time = sp_recv_udp_time - sp_start_time + self.test_result = ["Succeed", smart_config_protocol_cost, user_experience_time] + elif result_code == RESULT_CODE_VAL["recv UDP fail"]: + sp_start_time = bytes_to_time(tmp[1]) + if step_4_fail is True: + smart_config_protocol_cost = 0 + else: + smart_config_protocol_cost = time_target_succeed - sp_start_time + self.test_result = ["Failed", smart_config_protocol_cost, 0] + pass + else: + NativeLog.add_prompt_trace("[Test Handler][Debug] Disqualified message: %s" % tmp) + + for k in range(RETRANSMIT_COUNT - 1): + if self.wait_result("result", RETRANSMIT_TIMEOUT) is not False: + self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["ACK"]], + [VALUE_NAME["session id"], self.session_id]], + (self.phone["ip"], self.udp_server.udp_port)) + + NativeLog.add_prompt_trace("[Step5] Receive test result from SP") + + if self.test_result is None: + self.test_result = ["Disqualified", 0, 0] + self.udp_server.deregister_test_handler(self.session_id) + NativeLog.add_prompt_trace("One Test Done") + pass + + def get_result(self): + if self.test_result is None: + NativeLog.add_trace_critical("Get result before test finish") + return self.test_result + pass + + +class SCIOT(TCActionBase.CommonTCActionBase): + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.ap_list = [] + self.test_result = dict.fromkeys(TEST_RESULT_CATEGORY) + self.test_result["AP"] = [] + self.test_result["Phone"] = [] + self.available_phone_list = [] + self.pc_ip = "" + self.udp_port = "" + self.test_id = 0x00 + self.resource_lock = threading.Lock() + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROPERTY, " + cmd_set[i][1][j] + ")))" + exec cmd_string + for ap in self.ap_list: + self.test_result["AP"].append(dict(zip(TEST_RESULT_PROPERTY, [ap["ssid"], 0, 0, 0, 0, 0]))) + + self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, "TEST_%s" + % (time.strftime("%y%m%d%H%M%S", time.localtime())))) + self.log_files = dict.fromkeys(LOG_FILES) + for _file in self.log_files: + self.log_files[_file] = os.path.join(self.log_folder, + (time.strftime("%H%M%S", time.localtime())) + _file) + pass + + def update_phone_list(self, phone): + with self.resource_lock: + tmp = filter(lambda x: x["model"] == phone["model"], self.available_phone_list) + if len(tmp) == 1: + tmp[0]["ip"] = phone["ip"] + else: + self.available_phone_list.append(phone) + + tmp = filter(lambda x: x["model"] == phone["model"], self.test_result["Phone"]) + if len(tmp) == 0: + self.test_result["Phone"].append(dict(zip(TEST_RESULT_PROPERTY, [phone["model"], 0, 0, 0, 0, 0]))) + pass + + def remove_from_available_list(self, phone): + with self.resource_lock: + tmp = filter(lambda x: x["model"] == phone["model"], self.available_phone_list) + if len(tmp) == 1: + self.available_phone_list.remove(tmp[0]) + pass + + def allocate_test(self): + phone = None + test_count = 0xFFFF + with self.resource_lock: + for _phone in self.available_phone_list: + tmp = filter(lambda x: x["model"] == _phone["model"], self.test_result["Phone"]) + if len(tmp) == 1: + _count = tmp[0]["total"] + if _count < test_count: + test_count = _count + phone = _phone + ap_list = self.ap_list[test_count % len(self.ap_list):] + return phone, ap_list + pass + + def output_test_result(self, ap, phone, test_result): + result_str = "Time stamp" + ":\t" + NativeLog.generate_timestamp() + "\r\n" + result_str += "AP model" + ":\t" + str(ap["ssid"]) + "\r\n" + result_str += "AP encryption" + ":\t" + str(ap["encryption"]) + "\r\n" + result_str += "AP HT" + ":\t" + str(ap["ht"]) + "\r\n" + result_str += "AP ssid hidden" + ":\t" + str(ap["is_hidden"]) + "\r\n" + result_str += "Phone model" + ":\t" + str(phone["model"]) + "\r\n" + result_str += "Result" + ":\t" + str(test_result[0]) + "\r\n" + result_str += "Time1" + ":\t" + str(test_result[1]) + "\r\n" + result_str += "Time2" + ":\t" + str(test_result[2]) + "\r\n" + + with self.resource_lock: + tmp = [filter(lambda x: x["model"] == ap["ssid"], self.test_result["AP"])[0], + filter(lambda x: x["model"] == phone["model"], self.test_result["Phone"])[0]] + if test_result[0] == "Succeed": + for _tmp in tmp: + _tmp["total"] += 1 + _tmp["succeed"] += 1 + _tmp["total time1"] += test_result[1] + _tmp["total time2"] += test_result[2] + pass + elif test_result[0] == "Disqualified": + for _tmp in tmp: + _tmp["total"] += 1 + pass + else: + for _tmp in tmp: + _tmp["total"] += 1 + _tmp["failed"] += 1 + pass + tmp_result = dict(zip(TEST_RESULT_CATEGORY, ["", ""])) + for category in self.test_result: + for _result in self.test_result[category]: + for n in _result: + tmp_result[category] += str(n) + ":\t" + str(_result[n]) + "\r\n" + + # update to log file + with open(self.log_files["by_ap.tmp"], "wb+") as f: + f.write(tmp_result["AP"]) + with open(self.log_files["by_phone.tmp"], "wb+") as f: + f.write(tmp_result["Phone"]) + + with open(self.log_files["total.tmp"], "ab+") as f: + f.write(result_str) + if test_result[0] == "Failed": + with open(self.log_files["failed_item.tmp"], "ab+") as f: + f.write(result_str) + elif test_result[0] == "Disqualified": + with open(self.log_files["disqualified_item.tmp"], "ab+") as f: + f.write(result_str) + + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + pc_ip = CmdExecutorBasic.extract_parameter(self.pc_ip, self.test_env) + if isinstance(self.udp_port, int) is False: + udp_port = CmdExecutorBasic.extract_parameter(self.udp_port, self.test_env) + else: + udp_port = self.udp_port + + server = UDPServer(pc_ip, udp_port, self.update_phone_list) + server.start() + + while True: + phone, ap_list = self.allocate_test() + if phone is None: + time.sleep(5) + continue + for ap in ap_list: + NativeLog.add_prompt_trace("AP is %s, Phone is %s" % (ap["ssid"], phone["model"])) + session_id = make_session_id(phone["mac"], self.test_id) + self.test_id += 1 + test_handler = TestHandler(session_id, ap, phone, server, self) + test_handler.start() + test_handler.join() + result = test_handler.get_result() + self.output_test_result(ap, phone, result) + + # finally, execute done + server.join() + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/IOT/SCUDPServer.py b/components/test/TestCaseScript/IOT/SCUDPServer.py new file mode 100755 index 0000000000..75f24f79ac --- /dev/null +++ b/components/test/TestCaseScript/IOT/SCUDPServer.py @@ -0,0 +1,378 @@ +import socket +import time +import os +import threading + +from NativeLog import NativeLog + + +RETRANSMIT_COUNT = 5 +RETRANSMIT_TIMEOUT = 0.5 +ABORT_TIMEOUT = 120 +BEACON_SEND_RATE = 30 + + +VALUE_NAME = {"type": 0x00, + "session id": 0x01, + "result code": 0x02, + "ap ssid": 0x03, + "ap password": 0x04, + "start SC time": 0x05, + "recv UDP time": 0x06, + "SP model": 0x07, + "SP mac": 0x08, + "ET version": 0x09, + "ap bssid": 0x0A, + "ssid hidden": 0x0B, + "ap encryption": 0x0C, + } + +TYPE_VAL = {"Init new test": 0x00, + "test request": 0x01, + "result": 0x02, + "query phone": 0x03, + "ACK": 0x80, + "phone report": 0x81, + "Not support": 0xFF, + "invalid session": 0xFE, + } + +RESULT_CODE_VAL = {"OK": 0x80, + "JAP fail": 0x81, # SP join AP fail, should disqualify this result + "recv UDP fail": 0x82, # SP did not receive UDP sent by target + } + +AP_ENCRYPTION_VAL = {"OPEN": 0x00, + "WEP": 0x01, + "WPA": 0x02, + } + +AP_PROPERTY = ("ssid", "password", "bssid", "is_hidden", "encryption", "ht") +PHONE_PROPERTY = ("ip", "mac", "model") + + +SERIAL_PORT_NUM = 3 +LOG_FILE_PREFIX = "SC_IOT" +LOG_FOLDER = os.path.join("AT_LOG", "TEMP") +LOG_FILE_NAME = os.path.join(LOG_FOLDER, "%s_%s.log" % (LOG_FILE_PREFIX, time.strftime("%d%H%M%S", time.localtime()))) + + +REQUEST_LOCK = threading.Lock() +HANDLER_LOCK = threading.Lock() + + +def sync_request_list(func): + def handle_args(*args, **kwargs): + with REQUEST_LOCK: + ret = func(*args, **kwargs) + return ret + return handle_args + + +def sync_handler_list(func): + def handle_args(*args, **kwargs): + with HANDLER_LOCK: + ret = func(*args, **kwargs) + return ret + return handle_args + + +def _process_one_tlv_pair(data): + typ = ord(data[0]) + length = ord(data[1]) + value = data[2:2+length] + processed_data = data[2+length:] + return (typ, value), processed_data + pass + + +def bytes_to_msg(data): + data_to_process = data + msg = [] + while True: + one_pair, data_to_process = _process_one_tlv_pair(data_to_process) + msg.append(one_pair) + if len(data_to_process) == 0: + break + return msg + pass + + +def msg_to_bytes(msg): + byte_str = "" + for pair in msg: + byte_str += chr(pair[0]) + if isinstance(pair[1], list) is True: + byte_str += chr(len(pair[1])) + byte_str.join([chr(m) for m in pair[1]]) + elif isinstance(pair[1], str) is True: + byte_str += chr(len(pair[1])) + byte_str += pair[1] + elif isinstance(pair[1], int) is True: + byte_str += chr(1) + byte_str += chr(pair[1]) + else: + raise TypeError("msg content only support list and string type") + return byte_str + + +def get_value_from_msg(type_list, msg): + if isinstance(type_list, str) is True: + type_list = [type_list] + ret = [""] * len(type_list) + for pair in msg: + for i in range(len(type_list)): + if pair[0] == VALUE_NAME[type_list[i]]: + ret[i] = pair[1] + if "" not in ret: + # all type value found + break + else: + NativeLog.add_prompt_trace("missing required type in msg") + return ret + + +def bytes_to_time(bytes_in): + if len(bytes_in) != 4: + return 0 + t = float(ord(bytes_in[0])*256*256*256 + ord(bytes_in[1])*256*256 + + ord(bytes_in[2])*256 + ord(bytes_in[2]))/1000 + return t + pass + + +def mac_to_bytes(mac): + tmp = mac.split(':') + return "".join([chr(int(m[:2], base=16)) for m in tmp]) + pass + + +def bytes_to_mac(bytes_in): + mac = "".join(["%x:" % ord(m) for m in bytes_in] ) + return mac[:-1] + + +class RetransmitHandler(threading.Thread): + def __init__(self, udp_server): + threading.Thread.__init__(self) + self.setDaemon(True) + self.udp_server = udp_server + self.exit_event = threading.Event() + pass + + @sync_request_list + def find_required_retransmit_msg(self): + time_now = time.time() + aborted_sessions = [] + retransmit_msg = [] + msgs = filter(lambda x: time_now - x[4] >= RETRANSMIT_TIMEOUT, self.udp_server.unconfirmed_request) + for msg in msgs: + if msg[3] == 0: + aborted_sessions.append(msg[0]) + self.udp_server.unconfirmed_request.remove(msg) + else: + msg[3] -= 1 + msg[4] = time_now + retransmit_msg.append(msg) + pass + return aborted_sessions, retransmit_msg + pass + + def run(self): + while True: + self.exit_event.wait(0.1) + if self.exit_event.isSet() is True: + break + aborted_sessions, retransmit_msg = self.find_required_retransmit_msg() + for msg in retransmit_msg: + self.udp_server.udp_socket.sendto(msg[1], msg[2]) + for session_id in aborted_sessions: + self.udp_server.session_aborted(session_id) + + def exit(self): + self.exit_event.set() + pass + + +class SendBeacon(threading.Thread): + def __init__(self, sock, udp_port): + threading.Thread.__init__(self) + self.setDaemon(True) + self.udp_sock = sock + self.udp_port = udp_port + self.exit_event = threading.Event() + + def run(self): + while True: + msg = [[VALUE_NAME["type"], TYPE_VAL["query phone"]]] + data = msg_to_bytes(msg) + self.udp_sock.sendto(data, ("", self.udp_port)) + for i in range(BEACON_SEND_RATE): + self.exit_event.wait(1) + if self.exit_event.isSet() is True: + return + pass + + def exit(self): + self.exit_event.set() + pass + + +class UDPServer(threading.Thread): + def __init__(self, pc_ip, udp_port, update_phone_handler): + threading.Thread.__init__(self) + self.setDaemon(True) + sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) + sock.bind((pc_ip, udp_port)) + sock.settimeout(1) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) + self.udp_socket = sock + self.unconfirmed_request = [] + self.test_handler_list = [] + self.pc_ip = pc_ip + self.udp_port = udp_port + self.update_phone_handler = update_phone_handler + self.retransmit_thread = RetransmitHandler(self) + self.beacon_thread = SendBeacon(self.udp_socket, self.udp_port) + self.retransmit_thread.start() + self.beacon_thread.start() + self.exit_event = threading.Event() + pass + + @sync_handler_list + def register_test_handler(self, session_id, test_handler): + tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) + if len(tmp) > 0: + NativeLog.add_prompt_trace("handler with same session id exist") + else: + self.test_handler_list.append([session_id, test_handler]) + pass + + @sync_handler_list + def deregister_test_handler(self, session_id): + tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) + if len(tmp) > 1: + NativeLog.add_prompt_trace("deregister test handler fail") + elif len(tmp) == 1: + self.test_handler_list.remove(tmp[0]) + pass + + @sync_handler_list + def get_test_handler(self, session_id): + ret = None + tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) + if len(tmp) != 1: + NativeLog.add_prompt_trace("failed to get test handler, " + "%d handler found, session id %s" % (len(tmp), session_id)) + elif len(tmp) == 1: + ret = tmp[0][1] + return ret + pass + + def session_aborted(self, session_id): + test_handler = self.get_test_handler(session_id) + if test_handler is not None: + test_handler.abort_handler() + pass + + def confirm_request(self, session_id, msg, address): + test_handler = self.get_test_handler(session_id) + if test_handler is not None: + test_handler.res_receiver(msg, address) + self.remove_pending_request(session_id) + pass + + def receive_request(self, msg, address): + result = get_value_from_msg(["type", "session id"], msg) + msg_type = ord(result[0]) + session_id = result[1] + if msg_type != TYPE_VAL["result"]: + self.send_response([[VALUE_NAME["type"], TYPE_VAL["Not support"]]], address) + else: + test_handler = self.get_test_handler(session_id) + if test_handler is None: + self.send_response([[VALUE_NAME["type"], TYPE_VAL["invalid session"]], + [VALUE_NAME["session id"], session_id]], + address) + pass + else: + test_handler.req_receiver(msg, address) + pass + + @sync_request_list + def add_request_to_queue(self, dest_addr, session_id, data): + tmp = filter(lambda x: x[0] == session_id, self.unconfirmed_request) + if len(tmp) != 0: + NativeLog.add_prompt_trace("One pending request belong to same session id %s" % session_id) + pass + else: + self.unconfirmed_request.append([session_id, data, + dest_addr, RETRANSMIT_COUNT-1, time.time()]) + + def send_request(self, dest_addr, session_id, msg): + data = msg_to_bytes(msg) + self.add_request_to_queue(dest_addr, session_id, data) + self.udp_socket.sendto(data, dest_addr) + pass + + def send_response(self, msg, address): + self.udp_socket.sendto(msg_to_bytes(msg), address) + + @sync_request_list + def remove_pending_request(self, session_id): + tmp = filter(lambda x: x[0] == session_id, self.unconfirmed_request) + if len(tmp) > 0: + self.unconfirmed_request.remove(tmp[0]) + pass + pass + + def handle_response(self, msg, address): + result = get_value_from_msg(["type", "session id"], msg) + msg_type = ord(result[0]) + session_id = result[1] + if msg_type == TYPE_VAL["ACK"]: + self.confirm_request(session_id, msg, address) + elif msg_type == TYPE_VAL["phone report"]: + # add new available phone + tmp = get_value_from_msg(["SP model", "SP mac"], msg) + phone = dict(zip(PHONE_PROPERTY, [address[0], bytes_to_mac(tmp[1]), tmp[0]])) + self.update_phone_handler(phone) + pass + elif msg_type == TYPE_VAL["Not support"] or msg_type == TYPE_VAL["invalid session"]: + self.session_aborted(session_id) + pass + + def run(self): + while self.exit_event.isSet() is False: + try: + data, address = self.udp_socket.recvfrom(65535) + except socket.error, e: + continue + + if address[0] == self.pc_ip: + continue + + msg = bytes_to_msg(data) + msg_type = get_value_from_msg(["type"], msg)[0] + + if msg_type is None: + NativeLog.add_prompt_trace("invalid incoming msg: %s" % "".join(["0x%X, " % m for m in data])) + else: + msg_type = ord(msg_type) + # check if request or reply + if (msg_type & 0x80) != 0: + self.handle_response(msg, address) + else: + self.receive_request(msg, address) + pass + + self.retransmit_thread.exit() + self.beacon_thread.exit() + self.retransmit_thread.join() + self.beacon_thread.join() + pass + + def exit(self): + self.exit_event.set() + pass diff --git a/components/test/TestCaseScript/IOT/WifiConnUtility.py b/components/test/TestCaseScript/IOT/WifiConnUtility.py new file mode 100755 index 0000000000..d50474561b --- /dev/null +++ b/components/test/TestCaseScript/IOT/WifiConnUtility.py @@ -0,0 +1,244 @@ +from NativeLog import NativeLog +import time +import random +import string + + +ERROR_AP_PROP = {"ssid": "123456789012345678901234567890", + "ssid_len": 30, + "pwd": "12345678901234567890", + "pwd_len": 20, + "channel": 10, + "enc": 3, + "apc": 9, # invalid apc count + } + + +class WifiConnUtilError(StandardError): + pass + + +class WifiConnUtility(object): + + def __init__(self, tc_action): + self.tc_action = tc_action + self.target_type = tc_action.target_type + pass + + def set_mode(self, mode): + ret = True + fail_string = "set mode fail" + cmd = [] + checker_stings = [] + for i in range(2): + if self.target_type[0] == "SSC": + cmd.append("SSCC SSC%d op -S -o %d" % (i+1, mode[i])) + checker_stings.append("SSCP SSC%d C cur_mode C %d" % (i+1, mode[i])) + pass + else: + cmd.append("ATC AT%d CWMODE %d" % (i+1, mode[i])) + checker_stings.append("ATP AT%d L OK" % (i+1)) + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Failed to set mode") + ret = False + return ret + pass + + def _apc_switch(self, outlet_list, action_list): + checker_stings = ["R PC_COM C OK"] + switch_cmd = "APC APC1" + fail_string = "Error when switching APC" + ret = True + + for [_outlet, _action] in zip(action_list, outlet_list): + switch_cmd += " %s %d" % (_action, _outlet) + + if self.tc_action.load_and_exe_one_step(checker_stings, [switch_cmd], + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Error when switching APC") + ret = False + return ret + pass + + def _set_target_ap(self, ap_prop): + ret = True + fail_string = "set target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + if self.target_type[1] == "SSC": + if ap_prop["pwd"] == "": + cmd = ["SSCC SSC2 ap -S -s %s -t %d" % (ap_prop["ssid"], + ap_prop["enc"]) + ] + else: + cmd = ["SSCC SSC2 ap -S -s %s -p %s -t %d" % (ap_prop["ssid"], + ap_prop["pwd"], + ap_prop["enc"]) + ] + checker_stings = ["SSCP SSC2 C +SAP:OK"] + pass + else: + cmd = ["ATC AT2 CWSAP \"%s\" \"%s\" %d %d" % (ap_prop["ssid"], + ap_prop["pwd"], + ap_prop["channel"], + ap_prop["enc"]) + ] + checker_stings = ["ATR AT2 L OK"] + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("set target ap fail") + ret = False + return ret + pass + + def setup_ap(self, ap_type, ap_prop): + if ap_type == "target": + ret = self._set_target_ap(ap_prop) + pass + else: + ret = self._apc_switch(["ON"], [ap_prop["apc"]]) + # delay for 5 seconds, wait AP ready + time.sleep(5) + pass + return ret + + def do_scan(self, ap_prop): + fail_string = "Scan fail" + ret = True + # do not check if the set AP can be scanned + if self.target_type[1] == "SSC": + cmd = ["SSCC SSC1 sta -S"] + checker_stings = ["SSCR SSC1 C ssc%20scan%20done"] + pass + else: + cmd = ["ATS AT1 AT+CWLAP"] + checker_stings = ["ATR AT1 L OK"] + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=100) is False: + NativeLog.add_trace_critical("Scan fail") + ret = False + return ret + pass + + def _switch_off_target_ap(self, delay): + time.sleep(delay) + self._set_target_ap(ERROR_AP_PROP) + pass + + def _switch_on_target_ap(self, ap_prop, delay): + time.sleep(delay) + self._set_target_ap(ap_prop) + pass + + def _switch_off_ap(self, ap_type, ap_prop, delay_range): + delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 + if ap_type == "target": + self._switch_off_target_ap(delay) + else: + delay -= 1.5 + time.sleep(delay if delay > 0 else 0) + self._apc_switch(["OFF"], [ap_prop["apc"]]) + pass + + def _switch_on_ap(self, ap_type, ap_prop, delay_range): + delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 + if ap_type == "target": + self._switch_on_target_ap(ap_prop, delay) + else: + delay -= 1.5 + time.sleep(delay if delay > 0 else 0) + self._apc_switch(["ON"], [ap_prop["apc"]]) + pass + + def _join_ap(self, ap_prop, test_method): + fail_string = "join target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + if self.target_type[1] == "SSC": + cmd = ["SSCC SSC1 ap -C -s %s -p %s" % (ap_prop["ssid"], + ap_prop["pwd"],) + ] + checker_stings = ["SSCR SSC1 C %s" % ap_prop["ssid"], + "SSCR SSC1 C dhcp%20client%20start", + "SSCR SSC1 C ip C mask C gw"] + pass + else: + cmd = ["ATC AT1 CWJAP \"%s\" \"%s\"" % (ap_prop["ssid"], + ap_prop["pwd"]) + ] + checker_stings = ["ATR AT1 NC ERROR NC FAIL L OK"] + pass + if test_method == "Normal": + ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_freq=0.1, check_time=350) + if ret is not False: + ret *= 0.1 + else: + ret = self.tc_action.load_and_exe_one_step([], cmd, fail_string) + return ret + pass + + def _check_join_ap_result(self, ap_prop): + ret = False + fail_string = "join ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + + if self.target_type[1] == "SSC": + checker_stings = ["SSCR SSC1 C dhcp%20client%20start", + "SSCR SSC1 C ip C mask C gw"] + ret = self.tc_action.load_and_exe_one_step(checker_stings, ["DELAY 0"], + fail_string, check_freq=1, check_time=120) + pass + else: + cmd = ["ATS AT1 AT+CWJAP?"] + checker_stings = ["ATR AT1 NC busy NC No%20AP C +CWJAP"] + for i in range(3): + ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_freq=1, check_time=2) + if ret is not False: + break + time.sleep(15) + + return ret + pass + + def join_ap(self, join_test_method, ap_type, ap_prop, delay): + + if join_test_method == "WRONG_PROP": + _prop = ERROR_AP_PROP + else: + _prop = ap_prop + + ret = self._join_ap(_prop, join_test_method) + + if join_test_method == "OFF_ON": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + self._switch_on_ap(ap_type, ap_prop, delay[1]) + ret = self._check_join_ap_result(_prop) + pass + elif join_test_method == "OFF": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + time.sleep(25) + pass + + return ret + pass + + def do_reconnect(self, reconnect_test_method, ap_type, ap_prop, delay): + ret = True + if reconnect_test_method == "OFF_ON": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + self._switch_on_ap(ap_type, ap_prop, delay[1]) + ret = self._check_join_ap_result(ap_prop) + pass + elif reconnect_test_method == "OFF": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + pass + return ret + pass + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/IOT/WifiJAP.py b/components/test/TestCaseScript/IOT/WifiJAP.py new file mode 100755 index 0000000000..0bb6292955 --- /dev/null +++ b/components/test/TestCaseScript/IOT/WifiJAP.py @@ -0,0 +1,183 @@ +import os +import random +import time + +import WifiConnUtility +from NativeLog import NativeLog +from TCAction import TCActionBase +from Utility import Encoding +from Utility import MakeFolder + +STEPS = {"SCAN1": 0x01, "JAP": 0x02, "SCAN2": 0x04, "RECONNECT": 0x08} + +AP_PROP = ("ssid", "ssid_len", "pwd", + "pwd_len", "channel", "enc", "apc") + +JAP_TEST_METHOD = ("Normal", "OFF_ON", "OFF", "WRONG_PROP") + +RECONNECT_TEST_METHOD = ("OFF_ON", "OFF") + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") + + +SSID_LEN_RANGE = (1, 32) # in bytes +ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP +PWD_RANGE = {0: [0, 0], + 1: [5, 5], + 2: [8, 63], + 3: [8, 63], + 4: [8, 63], + } + + +class WifiJAP(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # default value for optional configurable params + self.pwd_len = [8, 64] + self.step_config = [0x03, 0x01, 0x02, 0x0B, 0x0F] + self.join_test_method = ["Normal"] + self.join_delay = [[1.5, 5], [1.5, 5]] + self.reconnect_test_method = ["OFF_ON"] + self.reconnect_delay = [[1.5, 5], [1.5, 6]] + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # read AP list + self.ap_list = [] + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROP, " + cmd_set[i][1][j] + ")))" + exec cmd_string + + folder_path = MakeFolder.make_folder(LOG_FOLDER) + file_name = "JAP_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) + self._performance_log_file = os.path.join(folder_path, file_name) + + # test statistics + self._succeed_count = self._fail_count = self._time_cost_count = 0 + self._total_time = self._longest_time = 0 + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + # get target type "SSC" or "AT" + self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] + self.target_type.append("SSC" if test_env.get_port_by_name("AT1") is None else "AT") + self._utility = WifiConnUtility.WifiConnUtility(self) + pass + + def _generate_random_ap_prop(self): + ap_prop = dict.fromkeys(AP_PROP) + # generate target ap_value + ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) + ap_prop["channel"] = random.choice(range(1, 14)) + ap_prop["enc"] = random.choice(ENC_TYPE) + ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) + # generate string + if self.target_type[0] == self.target_type[1] == "AT": + ap_prop["ssid"] = Encoding.generate_random_utf8_str(ap_prop["ssid_len"]) + ap_prop["pwd"] = Encoding.generate_random_utf8_str(ap_prop["pwd_len"]) + # NativeLog.add_trace_info("ssid hex is : %x" % ap_prop["ssid"]) + # NativeLog.add_trace_info("pwd hex is : %x" % ap_prop["pwd"]) + else: + ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) + ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) + + return ap_prop + + def _logging_performance(self, ssid, join_method="Normal", time_cost=0): + # log performance to performance log file + with open(self._performance_log_file, "ab+") as f: + # log time and ssid + f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % + (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) + if join_method == "Normal" or join_method == "OFF_ON": + if time_cost is not False: + self._succeed_count += 1 + if join_method == "Normal": + f.write("[Succeed][%f]\r\n" % time_cost) + self._longest_time = (time_cost > self._longest_time and + [time_cost] or [self._longest_time])[0] + self._time_cost_count += 1 + self._total_time += time_cost + else: + f.write("[Succeed][%s]\r\n" % join_method) + else: + self._fail_count += 1 + f.write("[Fail][%s]\r\n" % join_method) + pass + + def _logging_fail_step(self, ssid, step): + with open(self._performance_log_file, "ab+") as f: + f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % + (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) + f.write("[Fail][%s]\r\n" % step) + pass + + def _generate_performance_report(self): + with open(self._performance_log_file, "ab+") as f: + f.write("[Test report] Succeed: %d\r\n" % self._succeed_count) + f.write("[Test report] Failed: %d\r\n" % self._fail_count) + if self._succeed_count > 0 or self._fail_count > 0: + f.write("[Test report] Pass Rate: %f\r\n" % + (self._succeed_count/(self._fail_count+self._succeed_count))) + if self._time_cost_count > 0: + f.write("[Test report] Average time: %f\r\n" % (self._total_time/self._time_cost_count)) + f.write("[Test report] Longest time: %f\r\n" % self._longest_time) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # mandatory configurable params + try: + target_ap_num = self.target_ap_num + test_count = self.test_count + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) + raise StandardError("Error configuration") + + # prepare ap list + _ap_list = [["target", None]] * target_ap_num + for _ap_prop in self.ap_list: + _ap_list.append(["AP", _ap_prop]) + + # set to correct mode first + # self._utility.set_mode([1, 2]) + + for _ap in _ap_list: + # arrange ap + _ap_type = _ap[0] + _ap_prop = _ap[1] + if _ap_type == "target": + _ap_prop = self._generate_random_ap_prop() + + for i in xrange(test_count): + # step 3 : mandatory step, join AP + _join_test_method = "Normal" + time_cost = self._utility.join_ap(_join_test_method, _ap_type, _ap_prop, self.join_delay) + # log performance to performance log file + self._logging_performance(_ap_prop["ssid"], _join_test_method, time_cost) + NativeLog.add_prompt_trace("[Step] Join AP done") + + NativeLog.add_prompt_trace("[WifiJAP] One AP Done") + + # generate report and cleanup + self._generate_performance_report() + + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/IOT/__init__.py b/components/test/TestCaseScript/IOT/__init__.py new file mode 100755 index 0000000000..db0afd1fc5 --- /dev/null +++ b/components/test/TestCaseScript/IOT/__init__.py @@ -0,0 +1 @@ +__author__ = 'Administrator' diff --git a/components/test/TestCaseScript/MeshStress/MeshSendRecv.py b/components/test/TestCaseScript/MeshStress/MeshSendRecv.py new file mode 100755 index 0000000000..bad4619a70 --- /dev/null +++ b/components/test/TestCaseScript/MeshStress/MeshSendRecv.py @@ -0,0 +1,525 @@ +from __future__ import division +import time +import threading +import re +import random +import os +import binascii + +from TCAction import PerformanceTCBase +from NativeLog import NativeLog +from NativeLog import HTMLGenerator +from comm import MeshPort +from Utility import Encoding + +# check frequency in second +CHECK_FREQ = 0.05 +# check timeout in seconds +CHECK_TIMEOUT = 30 +# multicast group len +MULTICAST_GROUP_LEN = 2 + + +LOG_PATH = os.path.join("..", "log") + +def _convert_to_mesh_mac_format(value_in): + value_out = "" + match_list = re.findall("([0-9a-fA-F]+)", value_in) + try: + for i in range(6): + value_out += "%02X" % int(match_list[i], base=16) + pass + except StandardError, e: + NativeLog.add_exception_log(e) + raise e + return value_out + +class SendRecvTime(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.setDaemon(True) + self.send_time = dict() + self.recv_time = dict() + self.send_time_lock = threading.Lock() + self.recv_time_lock = threading.Lock() + + def add_send_time(self, key, timestamp): + with self.send_time_lock: + self.send_time[key] = timestamp + + def add_recv_time(self, key, timestamp): + with self.recv_time_lock: + if key in self.recv_time.keys(): + self.recv_time[key].append(timestamp) + else: + self.recv_time[key] = [timestamp] + + def calculate(self): + # add compute delay time code here + print 'send dict len:', len(self.send_time) + print 'recv dict len:', len(self.recv_time) + recv_time_keys = self.recv_time.keys() + Max_delay_time = 0.0 + Total_delay_time = 0.0 + # for i in range(len(recv_time_keys)): + # key = recv_time_keys[i] + for key in recv_time_keys: + Total_delay_time_t = 0.0 + if isinstance(self.recv_time[key], list): + for time1 in self.recv_time[key]: + if time1 - self.send_time[key] >= Max_delay_time: + Max_delay_time = time1 - self.send_time[key] + Total_delay_time_t += (time1 - self.send_time[key]) + else: + pass + else: + if self.recv_time[key] - self.send_time[key] > Max_delay_time: + Max_delay_time = self.recv_time[key] - self.send_time[key] + Total_delay_time_t += (self.recv_time[key] - self.send_time[key]) + Total_delay_time_t += (Total_delay_time_t / len(self.recv_time[key])) + Total_delay_time += Total_delay_time_t + Avg_delay_time = Total_delay_time / len(recv_time_keys) + loss_rate = (len(self.send_time.keys()) - len(self.recv_time.keys())) / len(self.send_time.keys()) + return [Max_delay_time, Avg_delay_time, loss_rate] + pass + +class EntitySendThread(threading.Thread): + def __init__(self, port, behavior, unicast_addr, send_delay, typ, device_mac_list, server_addr, send_recv_time): + threading.Thread.__init__(self) + self.setDaemon(True) + self.recv_data_cache = "" + self.packets_sent = 0 + self.port = port + self.behavior = behavior + self.typ = typ + self.unicast_addr = unicast_addr + self.node_num = len(device_mac_list) + self.device_mac_list = list(device_mac_list) + self.server_addr = server_addr + if typ != "SERVER": + self.device_mac_list.remove(port.device_mac) + self.send_delay = send_delay + self.cache_lock = threading.Lock() + self.exit_event = threading.Event() + self.send_recv_time = send_recv_time + pass + + def data_recv_callback(self, data): + with self.cache_lock: + self.recv_data_cache += data + if self.typ == "SSC": + while True: + if self.recv_data_cache is not None: + match = re.compile(".+\+MSEND1:\d+:OK", re.DOTALL) + res = match.search(self.recv_data_cache) + index = re.search("\+MSEND1:(\d+):OK", self.recv_data_cache) + if index is not None: + time1 = time.time() + index1 = int(index.group(1)) + self.send_recv_time.add_send_time(index1, time1) + #print 'send index:', index1 + process_index = res.group().split("MSEND1") + if len(process_index) > 1: + process_index_t = len(process_index[0]) + len("MSEND1") + self.recv_data_cache = self.recv_data_cache[process_index_t:] + else: + self.recv_data_cache = self.recv_data_cache[len(res.group()):] + else: + break + else: + break + pass + + + def __server_send_packet(self, dst_addr, option_list=None, group_addr=None): + ver = 0x0 + flags = 0x0 + proto = 0x0 + index = random.randint(10000, 999999999) + if group_addr is not None: + len_t = hex(len(group_addr) * 6).split("0x") + if len(group_addr) <= 2: + option_list = "070" + len_t[1] + else: + option_list = "07" + len_t[1] + group = "" + for addr in group_addr: + group += _convert_to_mesh_mac_format(addr) + option_list += group + else: + option_list = None + if self.behavior == "broadcast": + dst_addr = "00:00:00:00:00:00" + elif self.behavior == "unicast": + if self.unicast_addr == "random": + dst_addr = random.choice(self.device_mac_list) + else: + dst_addr = self.unicast_addr + elif self.behavior == "p2p": + proto = 0x2 + if self.unicast_addr == "random": + dst_addr = random.choice(self.device_mac_list) + else: + dst_addr = self.unicast_addr + packet = MeshPort.Packet(ver=ver, flags=flags, proto=proto, + dst_addr=dst_addr, src_addr=self.server_addr, option_list=option_list, data="A" * 100, index=index) + send_data = packet.dumps + try: + self.port.socket.send(send_data) + time2 = time.time() + self.send_recv_time.add_send_time(index, time2) + except StandardError, e: + NativeLog.add_exception_log(e) + return False + + def __server_do_send(self): + if self.behavior == "broadcast": + if self.__server_send_packet(dst_addr="00:00:00:00:00:00", group_addr=None) is True: + self.packets_sent += self.node_num + elif self.behavior == "multicast": + random.shuffle(self.device_mac_list) + group_addr_list = self.device_mac_list[:MULTICAST_GROUP_LEN] + if self.__server_send_packet(dst_addr="01:00:5E:00:00:00", group_addr=group_addr_list) is True: + self.packets_sent += MULTICAST_GROUP_LEN + elif self.behavior == "unicast": + if self.__server_send_packet(dst_addr=random.choice(self.device_mac_list), group_addr=None) is True: + self.packets_sent += 1 + elif self.behavior == "p2p": + if self.__server_send_packet(dst_addr=random.choice(self.device_mac_list), group_addr=None) is True: + self.packets_sent += 1 + else: + NativeLog.add_trace_critical("unsupported behavior [%s]" % self.behavior) + self.exit() + return + + def __node_send_packet(self, dst_addr, group_addr=None): + send_data = "" + ret = False + if group_addr is not None: + len_t = hex(len(group_addr) * 6).split("0x") + if len(group_addr) <= 2: + option_list = "070" + len_t[1] + else: + option_list = "07" + len_t[1] + group = "" + for addr in group_addr: + group += _convert_to_mesh_mac_format(addr) + option_list += group + dst_addr = "01:00:5E:00:00:00" + send_data = "meshsend -S -d %s -o %s -l 100\r\n" % (dst_addr, option_list) + else: + if self.behavior == "broadcast": + dst_addr = "00:00:00:00:00:00" + send_data = "meshsend -S -d %s -l 100\r\n" % dst_addr + elif self.behavior == "unicast": + if self.unicast_addr == "random": + dst_addr = random.choice(self.device_mac_list) + else: + dst_addr = self.unicast_addr + send_data = "meshsend -S -d %s -l 100\r\n" % dst_addr + elif self.behavior == "p2p": + if self.unicast_addr == "random": + dst_addr = random.choice(self.device_mac_list) + else: + dst_addr = self.unicast_addr + send_data = "meshsend -S -d %s -t 1 -l 100\r\n" % dst_addr + try: + self.port.write(send_data) + except StandardError, e: + NativeLog.add_exception_log(e) + pass + for i in range(int(CHECK_TIMEOUT / CHECK_FREQ)): + time.sleep(CHECK_FREQ) + with self.cache_lock: + if self.recv_data_cache.find("+MESHSEND:OK") != -1: + ret = True + break + elif self.recv_data_cache.find("+MESHSEND:ERROR") != -1: + break + return ret + + + def __node_do_send(self): + if self.behavior == "broadcast": + if self.__node_send_packet("00:00:00:00:00:00", group_addr=None) is True: + self.packets_sent += self.node_num + elif self.behavior == "multicast": + random.shuffle(self.device_mac_list) + group_addr_list = self.device_mac_list[:MULTICAST_GROUP_LEN] + if self.__node_send_packet("01:00:5E:00:00:00", group_addr_list) is True: + self.packets_sent += MULTICAST_GROUP_LEN + elif self.behavior == "unicast": + if self.__node_send_packet(random.choice(self.device_mac_list), group_addr=None) is True: + self.packets_sent += 1 + elif self.behavior == "p2p": + if self.__node_send_packet(random.choice(self.device_mac_list), group_addr=None) is True: + self.packets_sent += 1 + else: + NativeLog.add_trace_critical("unsupported behavior [%s]" % self.behavior) + self.exit() + return + + def get_sent_packets(self): + return self.packets_sent + + def exit(self): + self.exit_event.set() + pass + + def run(self): + while self.exit_event.isSet() is False: + if self.typ == "SSC": + self.__node_do_send() + elif self.typ == "SERVER": + self.__server_do_send() + else: + NativeLog.add_trace_critical("type [%s] is neither SSC nor SERVER" % self.typ) + break + time.sleep(self.send_delay) + + pass + + +class EntityRecvThread(threading.Thread): + def __init__(self, port, typ, send_recv_time): + threading.Thread.__init__(self) + self.setDaemon(True) + self.recv_data_cache = "" + self.packets_recv = 0 + self.port = port + self.typ = typ + self.cache_lock = threading.Lock() + self.exit_event = threading.Event() + self.send_recv_time = send_recv_time + pass + + def data_recv_callback(self, data): + # if self.typ == "SERVER": + # NativeLog.add_prompt_trace("[data_recv_callback] server recv len %d" % len(data)) + with self.cache_lock: + self.recv_data_cache += data + pass + + def __server_do_recv(self): + while True: + if self.recv_data_cache: + data_cache = self.recv_data_cache + data_cache_hex = binascii.hexlify(data_cache) + packet_len = int(data_cache_hex[2:6], 16) + if len(self.recv_data_cache) >= packet_len: + time3 = time.time() + data_catch_t = self.recv_data_cache[:packet_len] + packet = binascii.hexlify(data_catch_t) + index3 = int(packet[-8:], 16) + self.send_recv_time.add_recv_time(index3, time3) + self.recv_data_cache = self.recv_data_cache[packet_len:] + else: + break + #self.packets_recv += 1 + else: + break + + def __node_do_recv(self): + with self.cache_lock: + while True: + if self.recv_data_cache: + match = re.search("\+MESHRECV:\d+", self.recv_data_cache) + index = re.search(",(\d+),OK", self.recv_data_cache) + res = re.compile(".+,\d+,OK", re.DOTALL) + res_t = res.search(self.recv_data_cache) + if match is not None: + time4 = time.time() + if index is not None: + index4 = int(index.group(1)) + self.send_recv_time.add_recv_time(index4, time4) + if len(res_t.group()) > 1: + process_index = len(res_t.group(0)) + self.recv_data_cache = self.recv_data_cache[process_index:] + else: + process_index = len(res_t.group()) + self.recv_data_cache = self.recv_data_cache[process_index:] + else: + break + else: + break + # self.packets_recv += 1 + else: + break + pass + + def get_recv_packets(self): + return self.packets_recv + + def exit(self): + self.exit_event.set() + pass + + def run(self): + while self.exit_event.isSet() is False: + if self.typ == "SSC": + self.__node_do_recv() + elif self.typ == "SERVER": + self.__server_do_recv() + else: + NativeLog.add_trace_critical("type [%s] is neither SSC nor SERVER" % self.typ) + break + time.sleep(CHECK_FREQ) + + pass + + +class MeshSendRecv(PerformanceTCBase.PerformanceTCBase): + def __init__(self, name, test_env, cmd_set, timeout, log_path): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.send_config = [] + self.test_time = 0 + self.loss_rate_standard = 0.8 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # load node send config + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.send_config.extend([" + cmd_set[i][1][j] + "])" + exec cmd_string + node_num = self.get_parameter("node_num") + self.recv_cb = dict.fromkeys(["SSC%s" % (x + 1) for x in range(int(node_num))] + ["GSOC1"]) + self.recv_cb_lock = threading.Lock() + pass + + def register_recv_callback(self, port_name, callback): + with self.recv_cb_lock: + if self.recv_cb[port_name] is None: + self.recv_cb[port_name] = [callback] + else: + self.recv_cb[port_name].append(callback) + pass + + def process(self): + try: + test_time = self.test_time * 60 + send_config = self.send_config + loss_rate_standard = self.loss_rate_standard + node_num = self.get_parameter("node_num") + pc_ip_list = self.get_parameter("pc_ip").split(".") + port = self.get_parameter("test_tcp_port1") + send_recv_time = SendRecvTime() + except StandardError: + return + #create server_addr + server_addr = "" + for i in range(len(pc_ip_list)): + if pc_ip_list[i] in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]: + server_addr = server_addr + "0" + pc_ip_list[i] + else: + list_t = hex(int(pc_ip_list[i])).split("0x") + server_addr += list_t[1] + port_t = hex(port).split("0x") + port_t_list = list(port_t[1]) + server_addr = server_addr + port_t_list[2] + port_t_list[3] + port_t_list[0] + port_t_list[1] + server_port = self.test_env.get_port_by_name("GSOC1") + if server_port is None: + return + + # create thread dict + thread_dict = dict.fromkeys(["SSC%s" % (x + 1) for x in range(int(node_num))] + ["GSOC1"]) + for port_name in thread_dict: + thread_dict[port_name] = dict(zip(["tx", "rx"], [None, None])) + device_mac_list = [] + # init recv thread & register port for SSC + for port_name in ["SSC%s" % (x + 1) for x in range(int(node_num))]: + port = self.test_env.get_port_by_name(port_name) + thread_dict[port_name]["rx"] = EntityRecvThread(port, "SSC", send_recv_time) + self.register_recv_callback(port_name, thread_dict[port_name]["rx"].data_recv_callback) + device_mac_list.append(port.device_mac) + + thread_dict["GSOC1"]["rx"] = EntityRecvThread(server_port, "SERVER", send_recv_time) + self.register_recv_callback("GSOC1", thread_dict["GSOC1"]["rx"].data_recv_callback) + + # config[0]: target_name; config[1]: behavior; config[2]: destination; config[3]:send_delay; + for config in send_config: + port = self.test_env.get_port_by_name(config[0]) + name = port.name + if config[2] == "GSOC1": + dst = server_addr[:2] + ":" + server_addr[2:4] + ":" + server_addr[4:6] + ":" + server_addr[6:8] + \ + ":" + server_addr[8:10] + ":" + server_addr[10:12] + elif config[2] == "random": + dst = "random" + else: + dst = self.test_env.get_port_by_name(config[2]).device_mac + if name != "GSOC1": + server_addr = None + if config[1] == "broadcast" or config[1] == "multicast": + dst = None + typ = "SSC" if isinstance(port, MeshPort.MeshPort) is False else "SERVER" + thread_dict[name]["tx"] = EntitySendThread(port, config[1], dst, config[3], typ, device_mac_list, + server_addr, send_recv_time) + self.register_recv_callback(name, thread_dict[name]["tx"].data_recv_callback) + pass + + # start all thread + for port_name in thread_dict: + if thread_dict[port_name]["rx"] is not None: + thread_dict[port_name]["rx"].start() + if thread_dict[port_name]["tx"] is not None: + thread_dict[port_name]["tx"].start() + + # wait test time + time.sleep(test_time) + # close all send thread + for port_name in thread_dict: + if thread_dict[port_name]["tx"] is not None: + thread_dict[port_name]["tx"].exit() + thread_dict[port_name]["tx"].join() + # make sure all packet received before close recv thread + time.sleep(10) + # close all recv thread + for port_name in thread_dict: + if thread_dict[port_name]["rx"] is not None: + thread_dict[port_name]["rx"].exit() + thread_dict[port_name]["rx"].join() + + [max_delay_time, avg_delay_time, loss_rate] = send_recv_time.calculate() + + NativeLog.add_trace_critical("[Mesh Send Recv Test] MAX Delay Time is %.3f" % max_delay_time) + NativeLog.add_trace_critical("[Mesh Send Recv Test] Avg Delay Time is %.3f" % avg_delay_time) + NativeLog.add_trace_critical("[Mesh Send Recv Test] loss rate is %.2f%%" % (loss_rate * 100)) + + # set succeed if loss rate higher than required + if loss_rate < loss_rate_standard: + self.set_result("Succeed") + pass + + @Encoding.encode_utf8(3) + def result_check(self, port_name, data): + if port_name in self.recv_cb: + # if port_name == "GSOC1": + # NativeLog.add_prompt_trace("[result_check] recv GSOC1 data len %s" % len(data)) + with self.recv_cb_lock: + callback_list = self.recv_cb[port_name] + if callback_list is not None: + for callback in callback_list: + callback(data) + + # do logging + timestamp = NativeLog.generate_timestamp() + with self.sync_lock: + _formatted_data = HTMLGenerator.process_one_log_item(data, self.log_index, port_name, timestamp) + self.log_index += 1 + + self.append_to_log_file(_formatted_data) + + NativeLog.add_all_tc_log(data, port_name, timestamp) + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/MeshStress/__init__.py b/components/test/TestCaseScript/MeshStress/__init__.py new file mode 100755 index 0000000000..6e94287c45 --- /dev/null +++ b/components/test/TestCaseScript/MeshStress/__init__.py @@ -0,0 +1 @@ +__all__ = ["StableCase1"] \ No newline at end of file diff --git a/components/test/TestCaseScript/SSLTest/Capability.py b/components/test/TestCaseScript/SSLTest/Capability.py new file mode 100755 index 0000000000..efdb6eeb9d --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/Capability.py @@ -0,0 +1,90 @@ + + +class SSLCapability(object): + CAPABILITY_TYPE = ["version", "cipher_suite", "fragment_size", # for hello capability negotiation + "verify_server", "verify_client", # if support verify server/client + "key_algorithm", "key_encoding", "pem_encryption", # what kind of private it supports + "certificate_encoding", "certificate_digest", # what kind of certificate it supports + ] + SSL_TYPE = ("TargetClient", "TargetServer", "PCClient", "PCServer") + + def __init__(self, typ, **kwargs): + assert typ in self.SSL_TYPE + self.type = typ + self.capability = dict.fromkeys(self.CAPABILITY_TYPE, None) + for kw in kwargs: + self.capability[kw] = kwargs[kw] + for kw in self.capability: + assert self.capability[kw] is not None + pass + + def get(self, kw): + return self.capability[kw] + + def set(self, **kwargs): + for kw in kwargs: + self.capability[kw] = kwargs[kw] + pass + + +class TargetSSLCapability(SSLCapability): + DEFAULT_CAPABILITY = { + "version": ["SSLv23_2"], + "cipher_suite": ["TLS_RSA_WITH_AES_128_CBC_SHA", + "TLS_RSA_WITH_AES_256_CBC_SHA", + "TLS_RSA_WITH_RC4_128_SHA", + "TLS_RSA_WITH_RC4_128_MD5"], + "fragment_size": [2048, 4096, 8192], + "verify_server": True, + "verify_client": False, + "key_algorithm": ["RSA512", "RSA1024", "RSA2048", "RSA4096"], + "key_encoding": ["PEM", "DER"], + "pem_encryption": [None, "aes128", "aes256"], + "certificate_encoding": ["PEM", "DER"], + "certificate_digest": ["md5", "sha1", "sha256", "sha384", "sha512"], + } + + def __init__(self, typ, **kwargs): + assert typ == "TargetClient" or typ == "TargetServer" + capability = dict(self.DEFAULT_CAPABILITY) + for kw in kwargs: + capability[kw] = kwargs[kw] + SSLCapability.__init__(self, typ, **capability) + pass + pass + + +class PCSSLCapability(SSLCapability): + DEFAULT_CAPABILITY = { + "version": ["SSLv23", "SSLv20", "SSLv30", "TLSv10", "TLSv11", "TLSv12"], + "cipher_suite": ["TLS_RSA_WITH_AES_128_CBC_SHA", + "TLS_RSA_WITH_AES_256_CBC_SHA", + "TLS_RSA_WITH_RC4_128_SHA", + "TLS_RSA_WITH_RC4_128_MD5", + "TLS_DH_DSS_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"], + "fragment_size": [16384], + "verify_server": True, + "verify_client": True, + "key_algorithm": ["RSA512", "RSA1024", "RSA2048", "RSA4096"], + "key_encoding": ["PEM"], + "pem_encryption": [None], + "certificate_encoding": ["PEM"], + "certificate_digest": ["md5", "sha1", "sha256", "sha384", "sha512"], + } + + def __init__(self, typ): + assert typ == "PCClient" or typ == "PCServer" + SSLCapability.__init__(self, typ, **self.DEFAULT_CAPABILITY) + pass + pass + + +def main(): + pc = PCSSLCapability("PCClient") + target = TargetSSLCapability("TargetClient") + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/ConfigUtility.py b/components/test/TestCaseScript/SSLTest/ConfigUtility.py new file mode 100755 index 0000000000..f36fe44fe9 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/ConfigUtility.py @@ -0,0 +1,333 @@ +from PKI import PKIDict, PKIItem +import Parameter + + +def multiply_2_lists(list1, list2): + def make_list(li): + if not isinstance(li, list): + li = [li] + return li + list1 = make_list(list1) + list2 = make_list(list2) + ret = [] + for a in list1: + for b in list2: + ret.append(make_list(a) + make_list(b)) + return ret + + +def list_multiply(list1, *args): + ret = list1 + for arg in args: + ret = multiply_2_lists(ret, arg) + return ret + + +def list_and(list1, list2): + ret = [] + for item in list1: + if item in list2: + ret.append(item) + return ret + + +class ComputeResult(object): + NEGOTIATION_CONFIG = ["client_version", "client_cipher_suite", "client_fragment_size", + "server_version", "server_cipher_suite", "server_fragment_size"] + CERT_KEY_CONFIG = ["verify_server", "verify_client", + "client_trust_anchor", "client_certificate", "client_key", + "server_trust_anchor", "server_certificate", "server_key"] + + TYPE_CONTEXT = "context" + TYPE_NEGOTIATION = "negotiation" + TYPE_CERT_KEY = "cert_key" + TYPE_SEND_PARAM = "send_param" + + # results + SUCCEED = 0 + CREATE_CONTEXT_FAIL = 1 + HANDSHAKE_FAIL = 2 + CERT_KEY_FAIL = 3 + + def __init__(self, client_capability, server_capability): + self.client_capability = client_capability + self.server_capability = server_capability + pass + + @staticmethod + def __check_cert(cert, capability, check_encoding=True): + ret = True + if cert.name is not None: + if check_encoding is True: + if cert.digest not in capability.get("certificate_digest") \ + or cert.key_algorithm not in capability.get("key_algorithm") \ + or cert.file_encoding not in capability.get("certificate_encoding"): + ret = False + else: + if cert.digest not in capability.get("certificate_digest") \ + or cert.key_algorithm not in capability.get("key_algorithm"): + ret = False + return ret + + @staticmethod + def __check_key(key, capability, check_encoding=True): + ret = True + if key.name is not None: + if check_encoding is True: + if key.algorithm not in capability.get("key_algorithm") \ + or key.file_encoding not in capability.get("key_encoding") \ + or key.file_encryption not in capability.get("pem_encryption"): + ret = False + else: + if key.algorithm not in capability.get("key_algorithm") \ + or key.file_encryption not in capability.get("pem_encryption"): + ret = False + return ret + + # compute result functions + def check_context(self, config): + result = self.SUCCEED + check_list = [(self.__check_cert, PKIItem.Certificate(config["client_trust_anchor"]), + self.client_capability), + (self.__check_cert, PKIItem.Certificate(config["client_certificate"]), + self.client_capability), + (self.__check_key, PKIItem.PrivateKey(config["client_key"]), + self.client_capability), + (self.__check_cert, PKIItem.Certificate(config["server_trust_anchor"]), + self.server_capability), + (self.__check_cert, PKIItem.Certificate(config["server_certificate"]), + self.server_capability), + (self.__check_key, PKIItem.PrivateKey(config["server_key"]), + self.server_capability)] + for _check in check_list: + if _check[0](_check[1], _check[2]) is False: + result = self.CREATE_CONTEXT_FAIL + break + return result + + def check_negotiation_param(self, config): + result = self.SUCCEED + # first check version + while True: + if Parameter.VERSION[config["client_version"]]\ + & Parameter.VERSION[config["server_version"]] == 0: + result = self.HANDSHAKE_FAIL + break + # check cipher suite + supported_cipher_suite = list_and(self.client_capability.get("cipher_suite"), + self.server_capability.get("cipher_suite")) + if config["client_cipher_suite"] not in supported_cipher_suite\ + or config["server_cipher_suite"] not in supported_cipher_suite\ + or config["client_cipher_suite"] != config["server_cipher_suite"]: + result = self.HANDSHAKE_FAIL + break + break + return result + + # check cert key, if it can be supported by both client and server, if it matches + def __check_cert_key_content(self, cert, key): + if self.__check_cert(cert, self.client_capability, check_encoding=False) is True\ + and self.__check_cert(cert, self.server_capability, check_encoding=False) is True \ + and self.__check_key(key, self.client_capability, check_encoding=False) is True \ + and self.__check_key(key, self.server_capability, check_encoding=False) is True \ + and key.name.find(cert.private_key) != -1: + result = True + else: + result = False + return result + + def __verify_ca(self, ca, cert, capability): + result = True + while True: + # if ca supported + if self.__check_cert(ca, capability) is False: + result = False + break + # check if ca in cert chain + try: + index = cert.cert_chain.index(ca.name) + except StandardError: + result = False + break + + # for pem cert, it contains cert chain to issuer, any cert in chain works + # der cert do not contain cert chain + # only der root cert verify L1 cert and root cert works + if cert.file_encoding == "DER": + if len(cert.cert_chain) > 2 and index != len(cert.cert_chain) - 1: + result = False + break + # check if all certs in before trust anchor supported + for cert_name in cert.cert_chain[1:index]: + _cert = PKIItem.Certificate(cert_name + ".pem") + if self.__check_cert(_cert, capability) is False: + result = False + break + break + return result + + def __check_verify_client(self, client_cert, client_key, server_ca): + result = self.__check_cert_key_content(client_cert, client_key) + if result is True: + result = self.__verify_ca(server_ca, client_cert, self.server_capability) + return result + + def __check_verify_server(self, client_ca, server_cert): + return self.__verify_ca(client_ca, server_cert, self.client_capability) + + def check_cert_key(self, config): + result = self.SUCCEED + while True: # break if when anything failed + if (config["verify_server"] is True and self.client_capability.get("verify_server") is False) \ + or (config["verify_client"] is True and + (self.server_capability.get("verify_client") is False or + self.client_capability.get("verify_client") is False)): + result = self.CERT_KEY_FAIL + break + + server_cert = PKIItem.Certificate(config["server_certificate"]) + server_key = PKIItem.PrivateKey(config["server_key"]) + server_ca = PKIItem.Certificate(config["server_trust_anchor"]) + client_cert = PKIItem.Certificate(config["client_certificate"]) + client_key = PKIItem.PrivateKey(config["client_key"]) + client_ca = PKIItem.Certificate(config["client_trust_anchor"]) + # always check server cert key + if self.__check_cert_key_content(server_cert, server_key) is False: + result = self.CERT_KEY_FAIL + break + # if require to verify server + if config["verify_server"] is True: + if self.__check_verify_server(client_ca, server_cert) is False: + result = self.CERT_KEY_FAIL + break + # if require to verify client + if config["verify_client"] is True: + if self.__check_verify_client(client_cert, client_key, server_ca) is False: + result = self.CERT_KEY_FAIL + break + break + return result + + CHECK_FUNC = { + TYPE_CONTEXT: check_context, + TYPE_NEGOTIATION: check_negotiation_param, + TYPE_CERT_KEY: check_cert_key, + } + CONFIG_KEY = { + TYPE_CONTEXT: CERT_KEY_CONFIG, + TYPE_NEGOTIATION: NEGOTIATION_CONFIG, + TYPE_CERT_KEY: CERT_KEY_CONFIG, + } + + def compute_result(self, typ, config_list): + succeed_list = [] + fail_list = [] + for config in config_list: + if self.CHECK_FUNC[typ](self, dict(zip(self.CONFIG_KEY[typ], config))) != self.SUCCEED: + fail_list.append(config) + else: + succeed_list.append(config) + return succeed_list, fail_list + pass + + +class GenerateTestConfig(ComputeResult): + TEST_CONFIG = ComputeResult.NEGOTIATION_CONFIG + \ + ComputeResult.CERT_KEY_CONFIG + + def __init__(self, client_capability, server_capability): + ComputeResult.__init__(self, client_capability, server_capability) + self.key_dict = PKIDict.PKIDict.KEY_DICT + self.cert_dict = PKIDict.PKIDict.CERT_DICT + pass + + def generate_negotiation_config(self): + _config = list_multiply(self.client_capability.get("version"), + self.client_capability.get("cipher_suite"), + self.client_capability.get("fragment_size"), + self.server_capability.get("version"), + self.server_capability.get("cipher_suite"), + self.server_capability.get("fragment_size")) + return self.compute_result(self.TYPE_NEGOTIATION, _config) + + def __choose_cert_key(self, verify_server, verify_client, + client_ca_opt, client_cert_key_opt, + server_ca_opt, server_cert_key_opt): + pass + + # CERT_KEY_CONFIG = ["verify_server", "verify_client", + # "client_trust_anchor", "client_certificate", "client_key", + # "server_trust_anchor", "server_certificate", "server_key"] + def generate_cert_key_config(self): + # first handle not verify certificate case + _config_list = [] + for cert in PKIDict.PKIDict.CERT_DICT: + for key in PKIDict.PKIDict.KEY_DICT: + _config_list.append([False, False, None, None, None, None, cert, key]) + cert_key_succeed, context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) + cert_key_succeed, cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, cert_key_succeed) + key_cert_pair = [[x[6], x[7]] for x in cert_key_succeed] + # for succeed config, do server cert verify + _config_list = [] + for _config in cert_key_succeed: + for cert in PKIDict.PKIDict.CERT_DICT: + _config_list.append([True, False, cert, None, None, + None, _config[6], _config[7]]) + _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) + context_fail += _context_fail + _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) + cert_key_fail += _cert_key_fail + cert_key_succeed += _cert_key_succeed + # for succeed config, do client verify + _config_list = [] + for _config in _cert_key_succeed: + for key_cert in key_cert_pair: + _config_list.append([True, True, _config[2], key_cert[0], key_cert[1], + key_cert[0], _config[6], _config[7]]) + _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) + context_fail += _context_fail + _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) + cert_key_fail += _cert_key_fail + cert_key_succeed += _cert_key_succeed + # only verify client not verify server + _config_list = [] + for _config in _cert_key_succeed: + _config_list.append([False, True, None, + _config[3], _config[4], _config[5], _config[6], _config[7]]) + _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) + context_fail += _context_fail + _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) + cert_key_fail += _cert_key_fail + cert_key_succeed += _cert_key_succeed + return cert_key_succeed, context_fail, cert_key_fail + + +class ConfigUtility(GenerateTestConfig): + # test config + _TEST_CONFIG_DICT_KEY = ("config", "result") + + def __init__(self, client_capability, server_capability): + GenerateTestConfig.__init__(self, client_capability, server_capability) + pass + + def get_all_test_config(self): + negotiation_succeed, negotiation_fail = self.generate_negotiation_config() + cert_key_succeed, context_fail, cert_key_fail = self.generate_cert_key_config() + succeed_config = list_multiply(negotiation_succeed, cert_key_succeed) + context_fail_config = list_multiply([negotiation_succeed[0]], context_fail) + negotiation_fail_config = list_multiply(negotiation_fail, [cert_key_succeed[0]]) + cert_key_fail_config = list_multiply([negotiation_succeed[0]], cert_key_fail) + return dict(zip(["succeed", "context_fail", "negotiation_fail", "cert_key_fail"], + [[dict(zip(self.TEST_CONFIG, x)) for x in succeed_config], + [dict(zip(self.TEST_CONFIG, x)) for x in context_fail_config], + [dict(zip(self.TEST_CONFIG, x)) for x in negotiation_fail_config], + [dict(zip(self.TEST_CONFIG, x)) for x in cert_key_fail_config]])) + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/Parameter.py b/components/test/TestCaseScript/SSLTest/Parameter.py new file mode 100755 index 0000000000..1670c5fd29 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/Parameter.py @@ -0,0 +1,56 @@ + + +VERSION = { + "SSLv23": 0x1F, + "SSLv23_2": 0x1C, # current target ssl implementation do not support SSLv20 and TLSv12 + "SSLv20": 0x01, + "SSLv30": 0x02, + "TLSv10": 0x04, + "TLSv11": 0x08, + "TLSv12": 0x10, +} + + +CIPHER_SUITE = { + # supported algorithm + "TLS_RSA_WITH_AES_128_CBC_SHA": "AES128-SHA", + "TLS_RSA_WITH_AES_256_CBC_SHA": "AES256-SHA", + "TLS_RSA_WITH_RC4_128_SHA": "RC4-SHA", + "TLS_RSA_WITH_RC4_128_MD5": "RC4-MD5", + "TLS_DH_DSS_WITH_AES_128_CBC_SHA": "DH-DSS-AES128-SHA", + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "ECDHE-RSA-AES128-GCM-SHA256", +} + + +FRAGMENT_SIZE = { + "SIZE_DEFAULT": 0, + "SIZE_512": 512, + "SIZE_1024": 1024, + "SIZE_2048": 2048, + "SIZE_4096": 4096, + "SIZE_8192": 8192, +} + + +VERIFY_OPTION = { + "NOT_VERIFY": "NOT_VERIFY", + "VERIFY": "VERIFY", +} + + +SEND_OPTION = { + "MAX_SEND_SIZE_512": 512, + "MAX_SEND_SIZE_1K": 1024, + "MAX_SEND_SIZE_2K": 2048, + "MAX_SEND_SIZE_4K": 4096, + "MAX_SEND_SIZE_8K": 8192, + "MAX_SEND_SIZE_16K": 16384, +} + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/SSLHandler.py b/components/test/TestCaseScript/SSLTest/SSLHandler.py new file mode 100644 index 0000000000..7fe19b3cef --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/SSLHandler.py @@ -0,0 +1,498 @@ +import socket +import ssl +import os +import re +import time +import threading + +import Parameter +from PKI import PKIDict +from PKI import PKIItem +from NativeLog import NativeLog + + +class SerialPortCheckFail(StandardError): + pass + + +class SSLHandlerFail(StandardError): + pass + + +class PCFail(StandardError): + pass + + +class TargetFail(StandardError): + pass + + +def ssl_handler_wrapper(handler_type): + if handler_type == "PC": + exception_type = PCFail + elif handler_type == "Target": + exception_type = TargetFail + else: + exception_type = None + + def _handle_func(func): + def _handle_args(*args, **kwargs): + try: + ret = func(*args, **kwargs) + except StandardError, e: + NativeLog.add_exception_log(e) + raise exception_type(str(e)) + return ret + return _handle_args + return _handle_func + + +class SerialPort(object): + def __init__(self, tc_action, port_name): + self.tc_action = tc_action + self.port_name = port_name + + def flush(self): + self.tc_action.flush_data(self.port_name) + + def write_line(self, data): + self.tc_action.serial_write_line(self.port_name, data) + + def check(self, condition, timeout=10): + if self.tc_action.check_response(self.port_name, condition, timeout) is False: + raise SerialPortCheckFail("serial port check fail, condition is %s" % condition) + + def read_data(self): + return self.tc_action.serial_read_data(self.port_name) + pass + + +class SSLHandler(object): + # ssl operation timeout is 30 seconds + TIMEOUT = 30 + + def __init__(self, typ, config, serial_port): + self.type = typ + self.config = config + self.timeout = self.TIMEOUT + self.serial_port = serial_port + self.accept_thread = None + self.data_validation = False + + def set_timeout(self, timeout): + self.timeout = timeout + + def init_context(self): + pass + + def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): + pass + + def listen(self, local_port=0, local_ip=0): + pass + + def send(self, size, data): + pass + + def recv(self, length, timeout): + pass + + def set_data_validation(self, validation): + pass + + def close(self): + if self.accept_thread is not None: + self.accept_thread.exit() + self.accept_thread.join(5) + pass + + +class TargetSSLHandler(SSLHandler): + def __init__(self, typ, config, serial_port): + SSLHandler.__init__(self, typ, config, serial_port) + self.ssl_id = None + self.server_id = None + + @ssl_handler_wrapper("Target") + def init_context(self): + self.serial_port.flush() + self.serial_port.write_line("soc -T") + self.serial_port.check("+CLOSEALL") + + if self.type == "client": + version = Parameter.VERSION[self.config["client_version"]] + fragment = self.config["client_fragment_size"] + ca = self.config["client_trust_anchor"] + cert = self.config["client_certificate"] + key = self.config["client_key"] + verify_required = 0x01 if self.config["verify_server"] is True else 0x00 + context_type = 1 + else: + version = Parameter.VERSION[self.config["server_version"]] + fragment = self.config["server_fragment_size"] + ca = self.config["server_trust_anchor"] + cert = self.config["server_certificate"] + key = self.config["server_key"] + verify_required = 0x02 if self.config["verify_client"] is True else 0x00 + context_type = 2 + ssc_cmd = "ssl -I -t %u -r %u -v %u -o %u" % (context_type, fragment, version, verify_required) + + if ca is not None: + _index = PKIDict.PKIDict.CERT_DICT[ca] + ssc_cmd += " -a %d" % _index + if cert is not None: + _index = PKIDict.PKIDict.CERT_DICT[cert] + ssc_cmd += " -c %d" % _index + if key is not None: + _index = PKIDict.PKIDict.KEY_DICT[key] + ssc_cmd += " -k %d" % _index + # write command and check result + self.serial_port.flush() + self.serial_port.write_line(ssc_cmd) + self.serial_port.check(["+SSL:OK", "AND", "!+SSL:ERROR"]) + + @ssl_handler_wrapper("Target") + def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): + self.serial_port.flush() + self.serial_port.write_line("soc -B -t SSL -i %s -p %s" % (local_ip, local_port)) + self.serial_port.check(["OK", "AND", "!ERROR"]) + self.serial_port.flush() + self.serial_port.write_line("soc -C -s 0 -i %s -p %s" % (remote_ip, remote_port)) + self.serial_port.check(["OK", "AND", "!ERROR"], timeout=30) + self.ssl_id = 0 + pass + + def accept_succeed(self): + self.ssl_id = 1 + + class Accept(threading.Thread): + def __init__(self, serial_port, succeed_cb): + threading.Thread.__init__(self) + self.setDaemon(True) + self.serial_port = serial_port + self.succeed_cb = succeed_cb + self.exit_flag = threading.Event() + + def run(self): + while self.exit_flag.isSet() is False: + try: + self.serial_port.check("+ACCEPT:", timeout=1) + self.succeed_cb() + break + except StandardError: + pass + + def exit(self): + self.exit_flag.set() + + @ssl_handler_wrapper("Target") + def listen(self, local_port=0, local_ip=0): + self.serial_port.flush() + self.serial_port.write_line("soc -B -t SSL -i %s -p %s" % (local_ip, local_port)) + self.serial_port.check(["OK", "AND", "!ERROR"]) + self.serial_port.flush() + self.serial_port.write_line("soc -L -s 0") + self.serial_port.check(["OK", "AND", "!ERROR"]) + self.server_id = 0 + self.accept_thread = self.Accept(self.serial_port, self.accept_succeed) + self.accept_thread.start() + pass + + @ssl_handler_wrapper("Target") + def send(self, size=10, data=None): + if data is not None: + size = len(data) + self.serial_port.flush() + self.serial_port.write_line("soc -S -s %s -l %s" % (self.ssl_id, size)) + self.serial_port.check(["OK", "AND", "!ERROR"]) + pass + + @ssl_handler_wrapper("Target") + def recv(self, length, timeout=SSLHandler.TIMEOUT): + pattern = re.compile("\+RECV:\d+,(\d+)\r\n") + data_len = 0 + data = "" + time1 = time.time() + while time.time() - time1 < timeout: + data += self.serial_port.read_data() + if self.data_validation is True: + if "+DATA_ERROR" in data: + raise SSLHandlerFail("target data validation fail") + while True: + match = pattern.search(data) + if match is None: + break + else: + data_len += int(match.group(1)) + data = data[data.find(match.group())+len(match.group()):] + if data_len >= length: + result = True + break + else: + result = False + if result is False: + raise SSLHandlerFail("Target recv fail") + + def set_data_validation(self, validation): + self.data_validation = validation + self.serial_port.flush() + self.serial_port.write_line("soc -V -s %s -o %s" % (self.ssl_id, 1 if validation is True else 0)) + self.serial_port.check(["OK", "AND", "!ERROR"]) + + @ssl_handler_wrapper("Target") + def close(self): + SSLHandler.close(self) + self.serial_port.flush() + self.serial_port.write_line("ssl -D") + self.serial_port.check(["+SSL:OK", "OR", "+SSL:ERROR"]) + self.serial_port.write_line("soc -T") + self.serial_port.check("+CLOSEALL") + pass + + pass + + +def calc_hash(index): + return (index & 0xffffffff) % 83 + (index & 0xffffffff) % 167 + + +def verify_data(data, start_index): + for i, c in enumerate(data): + if ord(c) != calc_hash(start_index + i): + NativeLog.add_trace_critical("[Data Validation Error] target sent data index %u is error." + " Sent data is %x, should be %x" + % (start_index + i, ord(c), calc_hash(start_index + i))) + return False + return True + + +def make_validation_data(length, start_index): + return bytes().join([chr(calc_hash(start_index + i)) for i in range(length)]) + + +class PCSSLHandler(SSLHandler): + PROTOCOL_MAPPING = { + "SSLv23": ssl.PROTOCOL_SSLv23, + "SSLv23_2": ssl.PROTOCOL_SSLv23, + "SSLv20": ssl.PROTOCOL_SSLv2, + "SSLv30": ssl.PROTOCOL_SSLv3, + "TLSv10": ssl.PROTOCOL_TLSv1, + "TLSv11": ssl.PROTOCOL_TLSv1_1, + "TLSv12": ssl.PROTOCOL_TLSv1_2, + } + CERT_FOLDER = os.path.join(".", "PKI", PKIDict.PKIDict.CERT_FOLDER) + KEY_FOLDER = os.path.join(".", "PKI", PKIDict.PKIDict.KEY_FOLDER) + + def __init__(self, typ, config, serial_port): + SSLHandler.__init__(self, typ, config, serial_port) + self.ssl_context = None + self.ssl = None + self.server_sock = None + self.send_index = 0 + self.recv_index = 0 + + class InitContextThread(threading.Thread): + def __init__(self, handler, version, cipher_suite, ca, cert, key, verify_required, remote_cert): + threading.Thread.__init__(self) + self.setDaemon(True) + self.handler = handler + self.version = version + self.cipher_suite = cipher_suite + self.ca = ca + self.cert = cert + self.key = key + self.verify_required = verify_required + self.remote_cert = remote_cert + pass + + @staticmethod + def handle_cert(cert_file, ca_file): + cert = PKIItem.Certificate() + cert.parse_file(cert_file) + ca = PKIItem.Certificate() + ca.parse_file(ca_file) + if cert.file_encoding == "PEM" and ca.name in cert.cert_chain: + cert_chain_t = cert.cert_chain[1:cert.cert_chain.index(ca.name)] + ret = ["%s.pem" % c for c in cert_chain_t] + else: + ret = [] + return ret + + def run(self): + try: + ssl_context = ssl.SSLContext(self.version) + # cipher suite + ssl_context.set_ciphers(self.cipher_suite) + if self.ca is not None: + ssl_context.load_verify_locations(cafile=os.path.join(self.handler.CERT_FOLDER, self.ca)) + # python ssl can't verify cert chain, don't know why + # need to load cert between cert and ca for pem (pem cert contains cert chain) + if self.remote_cert is not None: + cert_chain = self.handle_cert(self.remote_cert, self.ca) + for c in cert_chain: + NativeLog.add_trace_info("load ca chain %s" % c) + ssl_context.load_verify_locations(cafile=os.path.join(self.handler.CERT_FOLDER, c)) + if self.cert is not None: + cert = os.path.join(self.handler.CERT_FOLDER, self.cert) + key = os.path.join(self.handler.KEY_FOLDER, self.key) + ssl_context.load_cert_chain(cert, keyfile=key) + if self.verify_required is True: + ssl_context.verify_mode = ssl.CERT_REQUIRED + else: + ssl_context.verify_mode = ssl.CERT_NONE + self.handler.ssl_context = ssl_context + except StandardError, e: + NativeLog.add_exception_log(e) + pass + pass + + @ssl_handler_wrapper("PC") + def init_context(self): + if self.type == "client": + version = self.PROTOCOL_MAPPING[self.config["client_version"]] + cipher_suite = Parameter.CIPHER_SUITE[self.config["client_cipher_suite"]] + ca = self.config["client_trust_anchor"] + cert = self.config["client_certificate"] + key = self.config["client_key"] + verify_required = self.config["verify_server"] + remote_cert = self.config["server_certificate"] + else: + version = self.PROTOCOL_MAPPING[self.config["server_version"]] + cipher_suite = Parameter.CIPHER_SUITE[self.config["server_cipher_suite"]] + ca = self.config["server_trust_anchor"] + cert = self.config["server_certificate"] + key = self.config["server_key"] + verify_required = self.config["verify_client"] + remote_cert = self.config["client_certificate"] + + _init_context = self.InitContextThread(self, version, cipher_suite, ca, cert, key, verify_required, remote_cert) + _init_context.start() + _init_context.join(5) + if self.ssl_context is None: + raise StandardError("Init Context Fail") + + pass + + @ssl_handler_wrapper("PC") + def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): + sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + # reuse socket in TIME_WAIT state + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.settimeout(self.timeout) + sock.bind((local_ip, local_port)) + self.ssl = self.ssl_context.wrap_socket(sock) + self.ssl.connect((remote_ip, remote_port)) + pass + + def accept_succeed(self, ssl_new): + ssl_new.settimeout(self.timeout) + self.ssl = ssl_new + + class Accept(threading.Thread): + def __init__(self, server_sock, ssl_context, succeed_cb): + threading.Thread.__init__(self) + self.setDaemon(True) + self.server_sock = server_sock + self.ssl_context = ssl_context + self.succeed_cb = succeed_cb + self.exit_flag = threading.Event() + + def run(self): + while self.exit_flag.isSet() is False: + try: + new_socket, addr = self.server_sock.accept() + ssl_new = self.ssl_context.wrap_socket(new_socket, server_side=True) + self.succeed_cb(ssl_new) + break + except StandardError: + pass + pass + + def exit(self): + self.exit_flag.set() + + @ssl_handler_wrapper("PC") + def listen(self, local_port=0, local_ip=0): + self.server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + # reuse socket in TIME_WAIT state + self.server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + self.server_sock.settimeout(1) + self.server_sock.bind((local_ip, local_port)) + self.server_sock.listen(5) + self.accept_thread = self.Accept(self.server_sock, self.ssl_context, self.accept_succeed) + self.accept_thread.start() + pass + + @ssl_handler_wrapper("PC") + def send(self, size=10, data=None): + if data is None: + self.ssl.send(make_validation_data(size, self.send_index)) + if self.data_validation is True: + self.send_index += size + else: + self.ssl.send(data) + + @ssl_handler_wrapper("PC") + def recv(self, length, timeout=SSLHandler.TIMEOUT, data_validation=False): + time1 = time.time() + data_len = 0 + while time.time() - time1 < timeout: + data = self.ssl.read() + + if data_validation is True and len(data) > 0: + if verify_data(data, self.recv_index) is False: + raise SSLHandlerFail("PC data validation fail, index is %s" % self.recv_index) + self.recv_index += len(data) + data_len += len(data) + if data_len >= length: + result = True + break + else: + result = False + if result is False: + raise SSLHandlerFail("PC recv fail") + + def set_data_validation(self, validation): + self.data_validation = validation + + @ssl_handler_wrapper("PC") + def close(self): + SSLHandler.close(self) + if self.ssl is not None: + self.ssl.close() + self.ssl = None + if self.server_sock is not None: + self.server_sock.close() + self.server_sock = None + del self.ssl_context + + +def main(): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + # cipher suite + ssl_context.set_ciphers("AES256-SHA") + ssl_context.load_cert_chain("D:\workspace\\auto_test_script\PKI\Certificate\\" + "L2CertRSA512sha1_L1CertRSA512sha1_RootCertRSA512sha1.pem", + keyfile="D:\workspace\\auto_test_script\PKI\Key\PrivateKey2RSA512.pem") + ssl_context.verify_mode = ssl.CERT_NONE + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + # reuse socket in TIME_WAIT state + server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + server_sock.settimeout(100) + server_sock.bind(("192.168.111.5", 443)) + server_sock.listen(5) + while True: + try: + new_socket, addr = server_sock.accept() + ssl_new = ssl_context.wrap_socket(new_socket, server_side=True) + print "server connected" + break + except StandardError: + pass + + +pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/SSLHandshake.py b/components/test/TestCaseScript/SSLTest/SSLHandshake.py new file mode 100755 index 0000000000..5eb68c3503 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/SSLHandshake.py @@ -0,0 +1,240 @@ +import os +import random +import time +import re + +from TCAction import TCActionBase +from TCAction import PerformanceTCBase +from NativeLog import NativeLog, HTMLGenerator +from Utility import MakeFolder + +import ConfigUtility +import Capability +import SSLHandler + +LOG_FOLDER = os.path.join("AT_LOG", "TEMP") + +HEAP_SIZE_LIMIT = 30000 + + +class SSLHandshake(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.client_type = None + self.server_type = None + self.client_capability = dict() + self.server_capability = dict() + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + timestamp = time.strftime("%d%H%M%S", time.localtime()) + folder = MakeFolder.make_folder(os.path.join(LOG_FOLDER, "SSLHandshake_%s" % timestamp)) + self.tested_log = os.path.join(folder, "SSLHandshakeTested.log") + self.failed_log = os.path.join(folder, "SSLHandshakeFailed.log") + self.memory_track_log = os.path.join(folder, "SSLHandshakeMemTrack.log") + self.succeed_log = os.path.join(folder, "SSLHandshakeSucceed.log") + # store test result for failed config + self.failed_log2 = os.path.join(folder, "SSLHandshakeFailed2.log") + self.succeed_log2 = os.path.join(folder, "SSLHandshakeSucceed2.log") + + self.heap_size_pattern = re.compile("\+FREEHEAP:(\d+)\r\n") + + @staticmethod + def close(client, server): + try: + client.close() + except StandardError: + pass + try: + server.close() + except StandardError: + pass + + def query_heap_size(self, scenario="idle"): + self.flush_data("SSC1") + self.serial_write_line("SSC1", "ram -H") + match = self.check_regular_expression("SSC1", self.heap_size_pattern) + if match is None: + NativeLog.add_trace_critical("No response for SSC ram command") + else: + heap_size = int(match.group(1)) + self.log_memory("[heap size][%s] %s" % (scenario, heap_size)) + if heap_size < HEAP_SIZE_LIMIT and scenario == "idle": + NativeLog.add_trace_critical("[HeapSize] %s" % heap_size) + + pass + + def prepare_handshake_test(self): + # check if connected + self.flush_data("SSC1") + self.serial_write_line("SSC1", "sta -Q") + if self.check_response("SSC1", "+JAP:CONNECTED,") is False: + ap_ssid = self.get_parameter("ap_ssid") + ap_password = self.get_parameter("ap_password") + self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + self.check_response("SSC1", "+JAP:CONNECTED,") + self.query_heap_size() + + @staticmethod + def log_data_to_file(file_name, data): + with open(file_name, "ab+") as f: + f.write(data+"\r\n") + + def log_test_config(self, data): + # append to log + with self.sync_lock: + _formatted_data = HTMLGenerator.process_one_log_item(data) + self.append_to_log_file(_formatted_data) + self.log_data_to_file(self.tested_log, data) + + def log_memory(self, data): + self.log_data_to_file(self.memory_track_log, data) + + def log_fail(self, data, log_type="succeed"): + print data + if log_type == "succeed": + self.log_data_to_file(self.failed_log, data) + else: + self.log_data_to_file(self.failed_log2, data) + + def log_succeed(self, data, log_type="succeed"): + if log_type == "succeed": + self.log_data_to_file(self.succeed_log, data) + else: + self.log_data_to_file(self.succeed_log2, data) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + # rewrite the following code + if self.client_type == "PC": + client_capability = Capability.PCSSLCapability("PCClient") + client_handler = SSLHandler.PCSSLHandler + client_ip = self.get_parameter("pc_ip") + else: + client_capability = Capability.TargetSSLCapability("TargetClient", **self.client_capability) + client_handler = SSLHandler.TargetSSLHandler + client_ip = self.get_parameter("target_ip") + if self.server_type == "PC": + server_capability = Capability.PCSSLCapability("PCServer") + server_handler = SSLHandler.PCSSLHandler + server_ip = self.get_parameter("pc_ip") + else: + server_capability = Capability.TargetSSLCapability("TargetServer", **self.server_capability) + server_handler = SSLHandler.TargetSSLHandler + server_ip = self.get_parameter("target_ip") + + serial_port = SSLHandler.SerialPort(self, "SSC1") + # generate config + config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) + config_list_dict = config_utility.get_all_test_config() + + # succeed + for config in config_list_dict["succeed"]: + self.prepare_handshake_test() + self.log_test_config("[Succeed config] %s" % config) + port = random.randint(500, 50000) + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + try: + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=port) + client.connect(server_ip, port, local_ip=client_ip) + self.query_heap_size(scenario="connected") + self.log_succeed("[Succeed config] %s" % config) + except SSLHandler.TargetFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[Target][%s]\r\n[Failed][Succeed config] %s" % (e, config)) + except SSLHandler.PCFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[PC][%s]\r\n[Failed][Succeed config] %s" % (e, config)) + + self.close(client, server) + + # init context fail + for config in config_list_dict["context_fail"]: + self.prepare_handshake_test() + port = random.randint(500, 50000) + self.log_test_config("[Init context fail config] %s" % config) + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + try: + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=port) + client.connect(server_ip, port, local_ip=client_ip) + self.log_fail("[Target]\r\n[Failed][Init context fail config] %s" % config, log_type="failed") + except StandardError, e: + NativeLog.add_exception_log(e) + self.log_succeed("[init context fail] %s" % config, log_type="failed") + self.close(client, server) + pass + + # negotiation fail + for config in config_list_dict["negotiation_fail"]: + self.prepare_handshake_test() + self.log_test_config("[negotiation_fail] %s" % config) + port = random.randint(500, 50000) + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + try: + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=port) + except SSLHandler.TargetFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[Target][%s]\r\n[Failed][negotiation fail config] %s" % (e, config), log_type="failed") + self.close(client, server) + continue + except SSLHandler.PCFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[PC][%s]\r\n[Failed][negotiation fail config] %s" % (e, config), log_type="failed") + self.close(client, server) + continue + try: + client.connect(server_ip, port, local_ip=client_ip) + self.log_fail("[Target]\r\n[Failed][negotiation fail config] %s" % config, log_type="failed") + except StandardError, e: + NativeLog.add_exception_log(e) + self.log_succeed("[negotiation fail] %s" % config, log_type="failed") + self.close(client, server) + + # cert key fail + for config in config_list_dict["cert_key_fail"]: + self.prepare_handshake_test() + self.log_test_config("[cert_key_fail] %s" % config) + port = random.randint(500, 50000) + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + try: + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=port) + except SSLHandler.TargetFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[Target][%s]\r\n[Failed][cert_key fail config] %s" % (e, config), log_type="failed") + self.close(client, server) + continue + except SSLHandler.PCFail, e: + NativeLog.add_exception_log(e) + self.log_fail("[PC][%s]\r\n[Failed][cert_key fail config] %s" % (e, config), log_type="failed") + self.close(client, server) + continue + try: + client.connect(server_ip, port, local_ip=client_ip) + self.log_fail("[Target][Failed][cert_key fail config] %s" % config, log_type="failed") + except StandardError, e: + NativeLog.add_exception_log(e) + self.log_succeed("[cert_key_fail] %s" % config, log_type="failed") + self.close(client, server) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/SSLLowMem.py b/components/test/TestCaseScript/SSLTest/SSLLowMem.py new file mode 100644 index 0000000000..fdc058f902 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/SSLLowMem.py @@ -0,0 +1,140 @@ +import os +import random +import time +import re + +from TCAction import TCActionBase +from TCAction import PerformanceTCBase +from NativeLog import NativeLog, HTMLGenerator +from Utility import MakeFolder + +import ConfigUtility +import Capability +import SSLHandler + +LOG_FOLDER = os.path.join("AT_LOG", "TEMP") + +HEAP_SIZE_LIMIT = 30000 + + +class SSLLowMem(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.client_type = None + self.server_type = None + self.client_capability = dict() + self.server_capability = dict() + self.heap_usage_range = (10000, 30000) + self.test_time = 120 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + timestamp = time.strftime("%d%H%M%S", time.localtime()) + self.heap_size_pattern = re.compile("\+FREEHEAP:(\d+)\r\n") + + @staticmethod + def close(client, server): + try: + client.close() + except StandardError: + pass + try: + server.close() + except StandardError: + pass + + def query_heap_size(self, scenario="idle"): + self.flush_data("SSC1") + self.serial_write_line("SSC1", "ram -H") + match = self.check_regular_expression("SSC1", self.heap_size_pattern) + if match is None: + NativeLog.add_trace_critical("No response for SSC ram command") + else: + heap_size = int(match.group(1)) + if heap_size < HEAP_SIZE_LIMIT and scenario == "idle": + NativeLog.add_trace_critical("[HeapSize] %s" % heap_size) + + pass + + def prepare_handshake_test(self): + # check if connected + self.flush_data("SSC1") + self.serial_write_line("SSC1", "sta -Q") + if self.check_response("SSC1", "+JAP:CONNECTED,") is False: + ap_ssid = self.get_parameter("ap_ssid") + ap_password = self.get_parameter("ap_password") + self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + self.check_response("SSC1", "+JAP:CONNECTED,") + # random alloc memory + while True: + memory_size = random.randint(self.heap_usage_range[0], self.heap_usage_range[1]) + self.serial_write_line("SSC1", "soc -M -l %s" % memory_size) + if self.check_response("SSC1", "+SOC_BUFFER:OK", timeout=1) is True: + break + # query size + self.query_heap_size() + + @staticmethod + def log_data_to_file(file_name, data): + with open(file_name, "ab+") as f: + f.write(data+"\r\n") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + # rewrite the following code + if self.client_type == "PC": + client_capability = Capability.PCSSLCapability("PCClient") + client_handler = SSLHandler.PCSSLHandler + client_ip = self.get_parameter("pc_ip") + else: + client_capability = Capability.TargetSSLCapability("TargetClient", **self.client_capability) + client_handler = SSLHandler.TargetSSLHandler + client_ip = self.get_parameter("target_ip") + if self.server_type == "PC": + server_capability = Capability.PCSSLCapability("PCServer") + server_handler = SSLHandler.PCSSLHandler + server_ip = self.get_parameter("pc_ip") + else: + server_capability = Capability.TargetSSLCapability("TargetServer", **self.server_capability) + server_handler = SSLHandler.TargetSSLHandler + server_ip = self.get_parameter("target_ip") + + test_time = self.test_time * 60 # convert test time from minutes to seconds + + serial_port = SSLHandler.SerialPort(self, "SSC1") + # generate config + config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) + config_list_dict = config_utility.get_all_test_config() + + start_time = time.time() + + # succeed + for config in config_list_dict["succeed"]: + if time.time() - start_time > test_time: + break + self.prepare_handshake_test() + port = random.randint(500, 50000) + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + try: + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=port) + client.connect(server_ip, port, local_ip=client_ip) + self.query_heap_size(scenario="connected") + except SSLHandler.TargetFail, e: + NativeLog.add_exception_log(e) + except SSLHandler.PCFail, e: + NativeLog.add_exception_log(e) + self.close(client, server) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/SSLSendRecv.py b/components/test/TestCaseScript/SSLTest/SSLSendRecv.py new file mode 100644 index 0000000000..13fe0b1529 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/SSLSendRecv.py @@ -0,0 +1,147 @@ +import random +import time + +from TCAction import TCActionBase +from TCAction import PerformanceTCBase +from NativeLog import NativeLog +import ConfigUtility +import Capability +import SSLHandler + + +class SSLSendRecv(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.target_role = "Client" + self.max_send_len = 2048 + self.test_time = 120 + self.data_validation = False + + self.target_capability = {"version": ["SSLv23"], + "cipher_suite": ["TLS_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA"], + "fragment_size": [2048], + "verify_server": False, + "verify_client": False, + "key_algorithm": ["RSA2048"], + "key_encoding": ["PEM"], + "pem_encryption": [None], + "certificate_encoding": ["PEM"], + "certificate_digest": ["sha1"], + } + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + @staticmethod + def close(client, server): + try: + client.close() + except StandardError: + pass + try: + server.close() + except StandardError: + pass + + def cleanup(self): + self.serial_write_line("SSC1", "ssl -D") + self.check_response("SSC1", "SSL") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + + target_role = self.target_role + max_send_len = self.max_send_len + test_time = self.test_time * 60 + data_validation = self.data_validation + + ssl_port = random.randint(10000, 50000) + NativeLog.add_prompt_trace("SSL port is %s" % ssl_port) + + # make sure ssl context deinit + self.serial_write_line("SSC1", "ssl -D") + self.check_response("SSC1", "SSL") + + # close all sockets and enlarge send buffer + self.serial_write_line("SSC1", "soc -T") + self.check_response("SSC1", "CLOSEALL") + + self.serial_write_line("SSC1", "soc -M -l %s" % max_send_len) + self.check_response("SSC1", "+SOC_BUFFER:OK") + + # rewrite the following code + if target_role == "Server": + client_capability = Capability.PCSSLCapability("PCClient") + client_handler = SSLHandler.PCSSLHandler + client_ip = self.get_parameter("pc_ip") + server_capability = Capability.TargetSSLCapability("TargetServer", **self.target_capability) + server_handler = SSLHandler.TargetSSLHandler + server_ip = self.get_parameter("target_ip") + elif target_role == "Client": + client_capability = Capability.TargetSSLCapability("TargetClient", **self.target_capability) + client_handler = SSLHandler.TargetSSLHandler + client_ip = self.get_parameter("target_ip") + server_capability = Capability.PCSSLCapability("PCServer") + server_handler = SSLHandler.PCSSLHandler + server_ip = self.get_parameter("pc_ip") + else: + raise StandardError("Unsupported target role %s" % target_role) + + serial_port = SSLHandler.SerialPort(self, "SSC1") + + # generate one succeed config + config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) + config_list_dict = config_utility.get_all_test_config() + + for config in config_list_dict["succeed"]: + try: + # create connection + NativeLog.add_prompt_trace(str(config)) # do print config + client = client_handler("client", config, serial_port) + server = server_handler("server", config, serial_port) + client.init_context() + server.init_context() + server.listen(local_ip=server_ip, local_port=ssl_port) + client.connect(server_ip, ssl_port, local_ip=client_ip) + except StandardError, e: + NativeLog.add_exception_log(e) + return + + # set data validation + client.set_data_validation(data_validation) + server.set_data_validation(data_validation) + + # do send recv + time_start = time.time() + while time.time() - time_start < test_time: + send_len = random.randint(1, max_send_len) + try: + client.send(size=send_len) + client.send(size=send_len) + server.recv(send_len*2) + except StandardError, e: + NativeLog.add_exception_log(e) + NativeLog.add_prompt_trace("client send / server recv fail") + break + try: + # do send twice, try to create a tcp segment with 2 records + server.send(size=send_len) + server.send(size=send_len) + client.recv(send_len*2) + except StandardError, e: + NativeLog.add_exception_log(e) + NativeLog.add_prompt_trace("server send / client recv fail") + break + else: + self.set_result("Succeed") + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SSLTest/__init__.py b/components/test/TestCaseScript/SSLTest/__init__.py new file mode 100755 index 0000000000..98fe3be4a7 --- /dev/null +++ b/components/test/TestCaseScript/SSLTest/__init__.py @@ -0,0 +1 @@ +__all__ = ["Capability", "ConfigUtility", "Parameter", "SSLHandler", "SSLHandshake"] diff --git a/components/test/TestCaseScript/SleepMode/AutoSleep.py b/components/test/TestCaseScript/SleepMode/AutoSleep.py new file mode 100755 index 0000000000..9db70227cf --- /dev/null +++ b/components/test/TestCaseScript/SleepMode/AutoSleep.py @@ -0,0 +1,561 @@ +import random +import os +import time +import string +import re +import threading + +from TCAction import TCActionBase, PerformanceTCBase +from NativeLog import NativeLog +from Utility import MakeFolder +from Utility import MultimeterUtil +from Utility import ShellCmd + +LOG_PATH = os.path.join("AT_LOG", "SLEEP") + +SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] +SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) + +SAMPLE_RATE_SLEEP_MODE_CHANGE = 0.002 +SAMPLE_NUM_SLEEP_MODE_CHANGE = 256 + +SAMPLE_RATE = 0.002 +SAMPLE_NUM = 512 +MAX_VALUE = 1 +Y_AXIS_LABEL = "Current (mA)" +GPIO_EDGE_DELAY = 120 # 20 ms + +NONE_SLEEP_MIN_CUR = 30 +LIGHT_SLEEP_MIN_CUR = 1.5 +MODEM_SLEEP_MIN_CUR = 20 + +GPIO_WAKE_UP = 15 +GPIO_CHIP_RESET = 14 + +SLEEP_WAKEUP_DELAY = 0.01 + + +class AutoSleep(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.test_mode = "mode_change" + self.test_count = 100 + self.sleep_mode = SLEEP_MODE_LIST + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, + "AUTO_SLEEP_%s_%s" % (self.test_mode, + time.strftime("%d%H%M%S", + time.localtime())))) + self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) + + @staticmethod + def find_min_items(item_list, count): + assert count < len(item_list) + min_items = [] + for i in range(count): + min_val = min(item_list) + min_items.append(min_val) + item_list.remove(min_val) + return min_items + + def sleep_mode_change(self, sleep_mode): + result = True + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] %s start" % sleep_mode) + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + # set sleep mode + self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) + self.check_response("SSC1", "+SLEEP_MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] mode set") + time.sleep(6) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE_SLEEP_MODE_CHANGE, + sample_num=SAMPLE_NUM_SLEEP_MODE_CHANGE, + max_value=MAX_VALUE) + # do check measure + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + + NativeLog.add_prompt_trace("[AutoSleep][ModeChange] measure done, average min current %f" % average_val) + + if sleep_mode == "none_sleep": + if average_val < NONE_SLEEP_MIN_CUR: + result = False + elif sleep_mode == "light_sleep": + if average_val > LIGHT_SLEEP_MIN_CUR: + result = False + elif sleep_mode == "modem_sleep": + if average_val > MODEM_SLEEP_MIN_CUR or average_val < LIGHT_SLEEP_MIN_CUR: + result = False + if result is False: + NativeLog.add_trace_critical("[AutoSleep][ModeChange] %s failed" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, "%s_fail" % sleep_mode, Y_AXIS_LABEL) + + time.sleep(5) + return result + + def sleep_current_measure(self, sleep_mode): + result = True + + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] %s start" % sleep_mode) + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + # set sleep mode + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) + self.check_response("SSC1", "+SLEEP_MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] set mode done") + time.sleep(10) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, sleep_mode, Y_AXIS_LABEL) + NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] measure done") + return result + + def light_sleep_wakeup(self): + result = True + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] start") + + time.sleep(1) + self.serial_write_line("SSC1", "") + time.sleep(1) + # check if respond to uart + self.flush_data("SSC1") + for i in range(60): + self.serial_write("SSC1", "a") + time.sleep(0.043) + time.sleep(0.1) + respond_data = self.serial_read_data("SSC1") + if len(respond_data) >= 60: + NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " + "Failed when recving data during sleep, %d" % len(respond_data)) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on sleep mode done") + + self.serial_write_line("SSC1", "") + time.sleep(1) + + # change GPIO to make target wakeup + self.serial_write_line("SSC2", "gpio -L -p %d -t 0" % GPIO_WAKE_UP) + self.check_response("SSC2", "+GPIO_SET:OK") + + self.serial_write_line("SSC1", "") + time.sleep(1) + self.flush_data("SSC1") + for i in range(60): + self.serial_write("SSC1", "a") + time.sleep(0.043) + time.sleep(0.1) + respond_data = self.serial_read_data("SSC1") + if len(respond_data) < 60: + NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " + "Failed when recving data during wakeup, %d" % len(respond_data)) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on wakeup mode done") + self.serial_write_line("SSC1", "") + # restore GPIO level + self.serial_write_line("SSC2", "gpio -L -p %d -t 1" % GPIO_WAKE_UP) + self.check_response("SSC2", "+GPIO_SET:OK") + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) + self.check_response("SSC2", "+GPIO_SET:OK") + time.sleep(2) + return result + + def sleep_exit_enter(self, sleep_mode, ssid, password): + result = True + if sleep_mode == "modem_sleep": + max_current_for_sleep = 20 + elif sleep_mode == "light_sleep": + max_current_for_sleep = 5 + else: + raise StandardError("Not supported mode %s" % sleep_mode) + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] %s start" % sleep_mode) + + ap_ssid = self.get_parameter("ap_ssid") + ap_password = self.get_parameter("ap_password") + + # step A: no STA connect to SoftAP, enter modem sleep mode + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 1") + self.check_response("SSC1", "+MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + self.check_response("SSC2", "+GPIO_SET:OK") + self.check_response("SSC1", "+JAP:CONNECTED") + self.check_response("SSC1", "pm open") + + self.serial_write_line("SSC2", "sta -D") + self.check_response("SSC2", "+QAP") + + time.sleep(5) + + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val > max_current_for_sleep: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] " + "did not enter %s sleep, %d" % (sleep_mode, average_val)) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_A" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step A done") + # step B: STA connect to SoftAP, exit modem sleep mode + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 3") + self.check_response("SSC1", "+MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + time.sleep(1) + self.serial_write_line("SSC2", "sta -C -s %s -p %s" % (ssid, password)) + self.check_response("SSC2", "+JAP:CONNECTED") + # self.check_response("SSC1", "pm close") + time.sleep(10) + + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val < 30: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_B" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step B done") + # step C: target set to STA mode, enter modem sleep + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 1") + self.check_response("SSC1", "+MODE:OK") + + self.check_response("SSC2", "+GPIO_SET:OK") + # self.check_response("SSC1", "pm open") + time.sleep(15) + + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val > max_current_for_sleep: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not enter %s sleep" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_C" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step C done") + # step D: target disconnect, exit modem sleep + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sta -D") + self.check_response("SSC1", "+QAP") + self.check_response("SSC2", "+GPIO_SET:OK") + # self.check_response("SSC1", "pm close") + time.sleep(5) + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val < 30: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_D" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step D done") + # step E: target connect to AP, enter modem sleep + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + self.check_response("SSC2", "+GPIO_SET:OK") + self.check_response("SSC1", "+JAP:CONNECTED") + self.check_response("SSC1", "pm open") + time.sleep(3) + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val > max_current_for_sleep: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not enter %s sleep" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_E" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step E done") + # step F: target set to AP mode, exit modem sleep + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 2") + self.check_response("SSC1", "+MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + # self.check_response("SSC1", "pm close") + time.sleep(5) + + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val < 30: + NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_sleep_exit_enter_fail_F" % sleep_mode, Y_AXIS_LABEL) + result = False + + NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step F done") + return result + + def ping_test(self, sleep_mode): + result = True + NativeLog.add_prompt_trace("[AutoSleep][PingTest] %s start" % sleep_mode) + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + if sleep_mode == "modem_sleep": + max_current_for_sleep = MODEM_SLEEP_MIN_CUR + elif sleep_mode == "light_sleep": + max_current_for_sleep = LIGHT_SLEEP_MIN_CUR + else: + raise StandardError("Not supported mode %s" % sleep_mode) + + self.serial_write_line("SSC1", "op -S -o 1") + self.check_response("SSC1", "+MODE:OK") + + # set sleep mode + self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) + self.check_response("SSC1", "+SLEEP_MODE:OK") + NativeLog.add_prompt_trace("[AutoSleep][PingTest] set mode done") + + # connect to AP + ap_ssid = self.get_parameter("ap_ssid") + ap_password = self.get_parameter("ap_password") + target_ip = self.get_parameter("target_ip") + + self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + self.check_response("SSC1", "+JAP:CONNECTED") + + time.sleep(10) + # measure current, should be in sleep mode + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + + if average_val > max_current_for_sleep: + NativeLog.add_trace_critical("[AutoSleep][PingTest] step A did not enter %s sleep, %f" + % (sleep_mode, average_val)) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_ping_test_fail_not_enter_sleep" % sleep_mode, Y_AXIS_LABEL) + result = False + else: + NativeLog.add_prompt_trace("[AutoSleep][PingTest] step A enter %s sleep, %f" + % (sleep_mode, average_val)) + + class PingThread(threading.Thread): + def __init__(self, ping_ip): + threading.Thread.__init__(self) + self.setDaemon(True) + self.target_ip = ping_ip + self.exit_event = threading.Event() + + def run(self): + while self.exit_event.isSet() is False: + ShellCmd.shell_check_output("ping %s -w 500" % self.target_ip) + time.sleep(0.1) + pass + + def exit(self): + self.exit_event.set() + + NativeLog.add_prompt_trace("[AutoSleep][PingTest] ping start") + ping_thread = PingThread(target_ip) + ping_thread.start() + time.sleep(5) + + # measure current, should not be in sleep mode + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val < 30: + NativeLog.add_trace_critical("[AutoSleep][PingTest] step B did not exit %s sleep, %f" + % (sleep_mode, average_val)) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_ping_test_fail_not_exit_sleep" % sleep_mode, Y_AXIS_LABEL) + result = False + else: + NativeLog.add_prompt_trace("[AutoSleep][PingTest] step B exit %s sleep, %f" + % (sleep_mode, average_val)) + + ping_thread.exit() + ping_thread.join(20) + NativeLog.add_prompt_trace("[AutoSleep][PingTest] ping stop") + time.sleep(10) + + # measure current, should not be in sleep mode + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val > max_current_for_sleep: + NativeLog.add_trace_critical("[AutoSleep][PingTest] step C did not enter %s" % sleep_mode) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "%s_ping_test_fail_not_enter_sleep" % sleep_mode, Y_AXIS_LABEL) + result = False + else: + NativeLog.add_prompt_trace("[AutoSleep][PingTest] step C enter %s sleep" % sleep_mode) + + return result + + def cleanup(self): + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["modem_sleep"]) + self.check_response("SSC1", "OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + + try: + test_mode = self.test_mode + test_count = self.test_count + sleep_mode = self.sleep_mode + except StandardError, e: + return + + # make sure enter modem sleep mode before start test + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["modem_sleep"]) + self.check_response("SSC1", "+SLEEP_MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + self.check_response("SSC1", "pm open", timeout=10) + + self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_WAKE_UP) + self.check_response("SSC1", "+GPIO_GET") + self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_CHIP_RESET) + self.check_response("SSC1", "+GPIO_GET") + + # start test + if "mode_change" in test_mode: + for i in range(test_count): + result = self.sleep_mode_change(random.choice(SLEEP_MODE_LIST)) + + elif "measure_current" in test_mode: + for i in range(test_count): + for mode in sleep_mode: + result = self.sleep_current_measure(mode) + pass + elif "gpio_wakeup" in test_mode: + # change GPIO to make sure target exit sleep mode, so it can process SSC commands + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + # set sleep mode + self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["light_sleep"]) + self.check_response("SSC1", "+SLEEP_MODE:OK") + + self.check_response("SSC2", "+GPIO_SET:OK") + for i in range(test_count): + result = self.light_sleep_wakeup() + pass + elif "sleep_exit_enter" in test_mode: + ssid = "".join([random.choice(string.lowercase) for i in range(10)]) + password = "".join([random.choice(string.lowercase) for i in range(10)]) + self.serial_write_line("SSC2", "sta -D") + self.check_response("SSC2", "+QAP") + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 3") + self.check_response("SSC1", "+MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + self.serial_write_line("SSC1", "ap -S -s %s -p %s -t 3" % (ssid, password)) + self.check_response("SSC1", "+SAP:OK") + self.serial_write_line("SSC2", "op -S -o 1") + self.check_response("SSC2", "+MODE:OK") + + for mode in sleep_mode: + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE[mode]) + self.check_response("SSC1", "+SLEEP_MODE:OK") + self.check_response("SSC2", "+GPIO_SET:OK") + + for i in range(test_count): + result = self.sleep_exit_enter(mode, ssid, password) + elif "ping" in test_mode: + for mode in sleep_mode: + for i in range(test_count): + result = self.ping_test(mode) + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SleepMode/DeepSleep.py b/components/test/TestCaseScript/SleepMode/DeepSleep.py new file mode 100755 index 0000000000..252ebb0758 --- /dev/null +++ b/components/test/TestCaseScript/SleepMode/DeepSleep.py @@ -0,0 +1,259 @@ +import random +import os +import time + +from TCAction import TCActionBase, PerformanceTCBase +from Utility import MakeFolder +from Utility import MultimeterUtil +from NativeLog import NativeLog + +LOG_PATH = os.path.join("AT_LOG", "SLEEP") + +DEEP_SLEEP_OPTION_LIST = ["up_to_bin", "normal", "no_rf_calibrate", "rf_off"] +DEEP_SLEEP_OPTION = { + "up_to_bin": 0, + "normal": 1, + "no_rf_calibrate": 2, + "rf_off": 4, +} + +SAMPLE_RATE = 0.001 +SAMPLE_NUM = 512 +MAX_VALUE = 0.1 +Y_AXIS_LABEL = "Current (mA)" + + +MEASURE_FREQ = 3600 + +GPIO_WAKE_UP = 15 +GPIO_CHIP_RESET = 14 +GPIO_EDGE_DELAY = 100 # 20 ms + + +class DeepSleep(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.test_mode = "mode_change" + self.test_count = 100 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, + "DEEP_SLEEP_%s_%s" % (self.test_mode, + time.strftime("%d%H%M%S", + time.localtime())))) + self.sleep_time_log = os.path.join(self.log_folder, "deep_sleep_wakeup_time.log") + self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) + + def deep_sleep_stable(self): + result = True + RandomTime = random.randint(1, 100) + self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + if self.check_response("SSC1", "ready!!!") is False: + result = False + NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") + else: + NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) + time.sleep(1) + + RandomTime = random.randint(100000, 1000000) + self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + if self.check_response("SSC1", "ready!!!") is False: + result = False + NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") + else: + NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) + time.sleep(1) + return result + + def deep_sleep_current_measure(self): + result = True + self.serial_write_line("SSC1", "") + self.serial_write_line("SSC1", "dsleep -S -t 10000000") + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + time.sleep(3) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + average_current = float(0) + for current in current_line: + average_current += current + average_current /= SAMPLE_NUM + + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "deep_sleep_current", Y_AXIS_LABEL) + + if average_current > 1: + NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] average current %f > 1mA" % average_current) + else: + NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] dsleep current ok, %f" % average_current) + + if self.check_response("SSC1", "ready!!!") is False: + NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] CurrentMeasure wait ready err %f" + % average_current) + result = False + + NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] wait ready ok") + + return result + + ########################################## + # gpio wake up + ########################################## + def deep_sleep_wakeup(self): + result = True + + self.serial_write_line("SSC1", "dsleep -S -t 0") + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + + time.sleep(2) + + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + average_current = float(0) + for current in current_line: + average_current += current + average_current /= SAMPLE_NUM + + if average_current > 1: + NativeLog.add_trace_critical("[DeepSleep][Wakeup] average current %f > 1mA" % average_current) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "deep_sleep_current", Y_AXIS_LABEL) + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) + self.check_response("SSC2", "+GPIO_SET:OK") + if self.check_response("SSC1", "ready!!!") is False: + NativeLog.add_trace_critical("[DeepSleep][Wakeup] target did not wakeup") + result = False + else: + NativeLog.add_trace_critical("[DeepSleep][Wakeup] target wakeup") + + time.sleep(1) + return result + + ######################################### + #test one hour, Verify RTC Clock timer + ######################################### + def deep_sleep_timeout(self): + result = True + Timeout = 3600 + + start_sleep_time = time.time() + self.serial_write_line("SSC1", "") + self.serial_write_line("SSC1", "dsleep -S -t %d" % (Timeout*1000000)) + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + self.check_response("SSC1", "ready!!!", timeout = Timeout*2) + time_escaped = time.time() - start_sleep_time + NativeLog.add_trace_critical("[DeepSleep][timeout] desired sleep timeout is %s, actual sleep timeout is %s" % (Timeout, time_escaped)) + with open(self.sleep_time_log, "ab+") as f: + f.write("[DeepSleep] desired sleep timeout is %s, actual sleep timeout is %s" % (Timeout, time_escaped)) + return result + + ############################################ + # Capture current map, verify the process of power on + # notice: option = "up_to_bin" up to byte108 in init.bin, + ############################################ + def wake_option(self): + result = True + for option in DEEP_SLEEP_OPTION_LIST: + for i in range(8): + self.serial_write_line("SSC1", "dsleep -O -m %s" % DEEP_SLEEP_OPTION[option]) + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + self.serial_write_line("SSC1", "dsleep -S -t 1200000") + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + + # measure current + current_line = self.multimeter.measure_current(sample_rate=0.002, + sample_num=SAMPLE_NUM, + max_value=1) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "deep_sleep_wakeup_option_%s_%d" + % (option, DEEP_SLEEP_OPTION[option]), Y_AXIS_LABEL) + + NativeLog.add_trace_critical("[DeepSleep][wake_option] target wakeup option:%d" + % DEEP_SLEEP_OPTION[option]) + time.sleep(3) + + return result + + def deep_sleep_wakeup_flash_gpio_status(self): + result = True + RandomTime = random.randint(2000000, 2000000) + self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) + if self.check_response("SSC1", "+DSLEEP:OK") is False: + result = False + if self.check_response("SSC1", "ready!!!") is False: + result = False + NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") + else: + NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) + + self.serial_write_line("SSC1", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + self.check_response("SSC1", "+GPIO_SET:OK") + + time.sleep(1) + return result + + def cleanup(self): + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) + self.check_response("SSC2", "+GPIO_SET:OK") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.serial_write_line("SSC2", "sta -D") + self.check_response("SSC2", "+QAP") + self.serial_write_line("SSC1", "sta -D") + self.check_response("SSC1", "+QAP") + try: + test_mode = self.test_mode + test_count = self.test_count + except StandardError, e: + return + + # self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) + # self.check_response("SSC2", "+GPIO_SET:OK") + # time.sleep(1) + + if "stable" in test_mode: + for i in range(test_count): + # result = self.deep_sleep_wakeup_flash_gpio_status() + result = self.deep_sleep_stable() + elif "measure_current" in test_mode: + for i in range(test_count): + result = self.deep_sleep_current_measure() + elif "timeout" in test_mode: + for i in range(test_count): + result = self.deep_sleep_timeout() + elif "wakeup" in test_mode: + for i in range(test_count): + result = self.deep_sleep_wakeup() + elif "wake_option" in test_mode: + for i in range(test_count): + result = self.wake_option() + + self.set_result("Succeed") + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SleepMode/ForceSleep.py b/components/test/TestCaseScript/SleepMode/ForceSleep.py new file mode 100755 index 0000000000..4938a97c2a --- /dev/null +++ b/components/test/TestCaseScript/SleepMode/ForceSleep.py @@ -0,0 +1,254 @@ +import random +import os +import time + +from TCAction import TCActionBase, PerformanceTCBase +from Utility import MakeFolder +from Utility import MultimeterUtil +from NativeLog import NativeLog + +LOG_PATH = os.path.join("AT_LOG", "SLEEP") + +SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] +SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) + +SAMPLE_RATE = 0.002 +SAMPLE_NUM = 512 +MAX_VALUE = 1 +Y_AXIS_LABEL = "Current (mA)" + +MEASURE_FREQ_HOUR = 3600 + +GPIO_WAKE_UP = 15 +GPIO_EDGE_DELAY = 120 # 20 ms +GPIO_CHIP_RESET = 14 +GPIO_CHIP_RESET_DELAY = 100 + +NONE_SLEEP_MIN_CUR = 30 +LIGHT_SLEEP_MIN_CUR = 1.5 +MODEM_SLEEP_MIN_CUR = 20 + +LIGHT_SLEEP_WAKEUP_DELAY = 0.01 + + +class ForceSleep(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.test_mode = "mode_change" + self.test_count = 100 + self.sleep_mode = SLEEP_MODE_LIST + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, + "FORCE_SLEEP_%s_%s" % (self.test_mode, + time.strftime("%d%H%M%S", + time.localtime())))) + self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) + + @staticmethod + def find_min_items(item_list, count): + assert count < len(item_list) + min_items = [] + for i in range(count): + min_val = min(item_list) + min_items.append(min_val) + item_list.remove(min_val) + return min_items + + def sleep_time_boundary_test(self): + result = True + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 0") + self.check_response("SSC2", "+GPIO_SET:OK") + if self.check_response("SSC1", "+MODE:OK") is False: + result = False + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "fsleep -S -t 1") + self.check_response("SSC2", "+GPIO_SET:OK") + if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + result = False + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "fsleep -D -d 0") + self.check_response("SSC2", "+GPIO_SET:OK") + # if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + # result = False + time.sleep(1) + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + min_items = self.find_min_items(current_line, 10) + average_val = float(0) + for val in min_items: + average_val += val + average_val /= 10 + if average_val > LIGHT_SLEEP_MIN_CUR: + NativeLog.add_trace_critical("[ForceSleep][Boundary] did not enter light sleep %d" % average_val) + result = False + return result + else: + NativeLog.add_trace_critical("[ForceSleep][Boundary] enter light sleep") + + for i in range(3): + time.sleep(MEASURE_FREQ_HOUR) + for j in range(3): + time.sleep(10) + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "light_sleep_boundary_%s_%s" % (i, j), Y_AXIS_LABEL) + pass + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + self.check_response("SSC2", "+GPIO_SET:OK") + time.sleep(1) + self.serial_write_line("SSC1", "reboot") + self.check_response("SSC1", "ready!!!") + self.serial_write_line("SSC1", "fsleep -S -t 1") + if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + result = False + self.serial_write_line("SSC1", "") + self.serial_write_line("SSC1", "fsleep -B -t 1") + if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + result = False + time.sleep(MEASURE_FREQ_HOUR) + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET,GPIO_CHIP_RESET_DELAY)) + return result + + def force_sleep_current_measure(self, sleep_mode): + result = True + # choose sleep mode + sleep_mode_enum = SLEEP_MODE[sleep_mode] + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 0") + if self.check_response("SSC1", "+MODE:OK") is False: + result = False + self.check_response("SSC2", "+GPIO_SET:OK") + + # set sleep mode + self.serial_write_line("SSC1", "fsleep -S -t %s" % sleep_mode_enum) + if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + result = False + self.serial_write_line("SSC1", "fsleep -D -d 0") + # if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: + # result = False + + time.sleep(3) + + for i in range(10): + time.sleep(10) + # measure current + current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, + sample_num=SAMPLE_NUM, + max_value=MAX_VALUE) + self.multimeter.draw_graph(current_line, SAMPLE_RATE, + "force_%s_sleep_current_%s" % (sleep_mode, i), Y_AXIS_LABEL) + NativeLog.add_trace_critical("[ForceSleep][current_measure] force_%s_%d"% (sleep_mode,i)) + + # self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP,GPIO_EDGE_DELAY)) + # self.check_response("SSC2", "+GPIO_SET:OK") + # self.serial_write_line("SSC1", "reboot") + # self.check_response("SSC1", "ready!!!") + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_CHIP_RESET_DELAY)) + self.check_response("SSC2", "+GPIO_SET:OK") + if self.check_response("SSC1", "ready!!!") is False: + result = False + time.sleep(1) + return result + + def force_sleep_illegal_enter(self): + result = True + # choose sleep mode + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "op -S -o 2") + if self.check_response("SSC1", "+MODE:OK") is False: + result = False + self.check_response("SSC2", "+GPIO_SET:OK") + + # set sleep mode + self.serial_write_line("SSC1", "fsleep -D -d 0") + if self.check_response("SSC1", "ready!!!", timeout=10) is False: + result = False + time.sleep(5) + return result + + def force_sleep_stable_test(self): + result = True + # choose sleep mode + + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "fsleep -L") + if self.check_response("SSC1", "+MODE:OK") is False: + result = False + self.check_response("SSC2", "+GPIO_SET:OK") + + time.sleep(3600) + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_CHIP_RESET_DELAY)) + time.sleep(5) + return result + + def cleanup(self): + self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) + time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) + self.serial_write_line("SSC1", "reboot") + self.check_response("SSC1", "ready!!!") + self.check_response("SSC2", "+GPIO_SET:OK") + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.serial_write_line("SSC2", "sta -D") + self.check_response("SSC2", "+QAP") + self.serial_write_line("SSC1", "sta -D") + self.check_response("SSC1", "+QAP") + try: + test_mode = self.test_mode + test_count = self.test_count + sleep_mode = self.sleep_mode + except StandardError, e: + return + + # set gpio to input on sleep target + self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_WAKE_UP) + self.check_response("SSC1", "+GPIO_GET") + self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_CHIP_RESET) + self.check_response("SSC1", "+GPIO_GET") + + if test_mode == "boundary_test": + for i in range(test_count): + result = self.sleep_time_boundary_test() + pass + elif test_mode == "measure_current": + for j in range(test_count): + for mode in sleep_mode: + result = self.force_sleep_current_measure(mode) + pass + elif test_mode == "illegal_enter": + for i in range(test_count): + result = self.force_sleep_illegal_enter() + pass + elif test_mode == "stable_test": + for i in range(test_count): + result = self.force_sleep_stable_test() + pass + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/SleepMode/__init__.py b/components/test/TestCaseScript/SleepMode/__init__.py new file mode 100755 index 0000000000..fcd54657f3 --- /dev/null +++ b/components/test/TestCaseScript/SleepMode/__init__.py @@ -0,0 +1 @@ +__all__ = ["AutoSleep", "DeepSleep", "ForceSleep"] diff --git a/components/test/TestCaseScript/StableTest/StableCase1.py b/components/test/TestCaseScript/StableTest/StableCase1.py new file mode 100755 index 0000000000..2554c1499b --- /dev/null +++ b/components/test/TestCaseScript/StableTest/StableCase1.py @@ -0,0 +1,160 @@ +import time +import random +import threading + +from TCAction import TCActionBase +from NativeLog import NativeLog + + +class StableCase1(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.exit_event = threading.Event() + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def check_wifi_status(self, data): + if data.find("+JAP:DISCONNECTED") != -1: + self.exit_event.set() + NativeLog.add_trace_critical("[Wifi] Disconnected") + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + # target role + target_role = self.target_role + # enable tcp send/recv + tcp_enable = self.tcp_enable + # enable udp send/recv + udp_enable = self.udp_enable + # enable ping + ping_enable = self.ping_enable + # delay range + delay_range = self.delay_range + # test time in hours + test_time = self.test_time * 3600 + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + if target_role == "AP": + pc_ip = "" + target_ip = "" + elif target_role == "STA": + pc_ip = "" + target_ip = "" + else: + raise StandardError("target role only support AP or STA") + + # step 1, create UDP socket and TCP server + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t UDP -p "] + fail_string = "Fail, Fail to create UDP socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t TCP -p "] + fail_string = "Fail, Fail to create tcp server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -L -s "] + fail_string = "Fail, Fail to listen" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 2, PC connect to 8266 tcp server, PC create UDP socket + checker_stings = ["R SOC_COM C OK"] + test_action_string = ["SOC SOC1 BIND %s" % pc_ip] + fail_string = "Fail, Fail to create udp socket on PC" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["P SSC1 A :ACCEPT:(\d+),\d+", "P SOC_COM C OK"] + test_action_string = ["SOC SOC2 CONNECT %s 0 %s" % (target_ip, pc_ip)] + fail_string = "Fail, Fail to create tcp socket on PC" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + total_test_count = ping_fail_count = tcp_fail_count = udp_fail_count = 0 + + # step 3, start do tcp/udp/ping + while time.time() - start_time < test_time and self.exit_event.isSet() is False: + total_test_count += 1 + if ping_enable is True: + # do ping + checker_stings = ["P PC_COM RE \+PING:\d+ms"] + test_action_string = ["PING %s -n 1 -w 1000" % target_ip] + fail_string = "Fail, Fail to ping target" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + ping_fail_count += 1 + NativeLog.add_prompt_trace("[ping fail] fail/total = %s/%s" + % (ping_fail_count, total_test_count)) + pass + + data_len = random.randint(1, 1460) + + if tcp_enable is True: + # do tcp send/recv + checker_stings = ["P SSC1 SL +%s" % data_len, "P SOC2 RL %s" % data_len] + test_action_string = ["SSC SSC1 soc -S -s -l %s" % data_len, + "SOC SOC2 SEND %s" % data_len] + fail_string = "Fail, Fail to send/recv tcp" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + tcp_fail_count += 1 + NativeLog.add_prompt_trace("[tcp fail] fail/total = %s/%s" + % (tcp_fail_count, total_test_count)) + # tcp fail, break + self.exit_event.set() + pass + + if udp_enable is True: + # do udp send/recv + checker_stings = ["P SSC1 SL +%s" % data_len, "P SOC1 RL %s" % data_len] + test_action_string = ["SSC SSC1 soc -S -s " + "-i %s -p -l %s" % (pc_ip, data_len), + "SOC SOC1 SENDTO %s %s" % (data_len, target_ip)] + fail_string = "Fail, Fail to sendto/recvfrom udp" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=20) is False: + udp_fail_count += 1 + NativeLog.add_prompt_trace("[udp fail] fail/total = %s/%s" + % (udp_fail_count, total_test_count)) + pass + + # sleep + time.sleep(random.randint(delay_range[0], delay_range[1])) + pass + + # finally, execute done + if self.exit_event.isSet() is False: + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + self.result_cntx.append_data(port_name, data) + if port_name != "SOC1" and port_name != "SOC2": + # socket received data do not need to be logged + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + if port_name == "SSC1": + self.check_wifi_status(data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/StableTest/__init__.py b/components/test/TestCaseScript/StableTest/__init__.py new file mode 100755 index 0000000000..be905f816c --- /dev/null +++ b/components/test/TestCaseScript/StableTest/__init__.py @@ -0,0 +1 @@ +__all__ = ["StableCase1"] diff --git a/components/test/TestCaseScript/TCPIPStress/ARPStress.py b/components/test/TestCaseScript/TCPIPStress/ARPStress.py new file mode 100755 index 0000000000..38dcb8fd8b --- /dev/null +++ b/components/test/TestCaseScript/TCPIPStress/ARPStress.py @@ -0,0 +1,121 @@ +import time + +from NativeLog import NativeLog +from TCAction import TCActionBase +from comm.NIC import Adapter + +WARNING_COUNT = 5 + + +class ARPStress(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.adapter = None + self.target_mode = "STA" + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + self.adapter.close() + del self.adapter + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + test_time = self.test_time * 60 + # test frequency min should be 0.1s, otherwise reply could be missed + test_freq = self.test_freq if self.test_freq > 0.1 else 0.1 + # test softAP or sta + target_mode = self.target_mode + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for ARPStress script, error is %s" % e) + raise StandardError("Error configuration") + + # get parameters + if target_mode == "STA": + target_ip = self.get_parameter("target_ip") + target_mac = self.get_parameter("target_mac") + pc_mac = self.get_parameter("pc_nic_mac") + pc_nic_name = self.get_parameter("pc_nic") + elif target_mode == "SoftAP": + target_ip = self.get_parameter("target_ap_ip") + target_mac = self.get_parameter("target_ap_mac") + pc_mac = self.get_parameter("pc_wifi_nic_mac") + pc_nic_name = self.get_parameter("pc_wifi_nic") + else: + raise StandardError("Unsupported target mode: %s" % target_mode) + + time_start = time.time() + + # open device + self.adapter = Adapter.Adapter(pc_nic_name, "capture+send") + ret = self.adapter.set_filter("arp and ether src %s and ether dst %s" % (target_mac, pc_mac)) + if ret != "LIBPCAP_SUCCEED": + NativeLog.add_trace_critical("ARP Stress test error: %s" % ret) + return + + ret = self.adapter.start_capture() + if ret != "LIBPCAP_SUCCEED": + NativeLog.add_trace_critical("ARP Stress test error: %s" % ret) + return + + arp_pdu = self.adapter.create_pdu("ARP", self.adapter.create_payload(), + arp_op_code="request", arp_target_proto_addr=target_ip, + ethernet_dst_addr="ff:ff:ff:ff:ff:ff") + + data = arp_pdu.to_bytes() + + total_test_count = total_fail_count = successive_fail_count = most_successive_fail_count = 0 + + while (time.time() - time_start) < test_time: + # send arp req + ret = self.adapter.ether_send(data) + if ret != "LIBNET_SUCCEED": + NativeLog.add_prompt_trace("libnet send fail, %s" % ret) + continue + total_test_count += 1 + # wait for reply + time.sleep(test_freq) + # should get one arp reply + pdu_list = self.adapter.get_packets() + + if len(pdu_list) == 0: + # failed to get arp reply + total_fail_count += 1 + successive_fail_count += 1 + if successive_fail_count > WARNING_COUNT: + NativeLog.add_trace_critical("ARP Fail: successive fail %u times, total tested %u times" + % (successive_fail_count, total_test_count)) + else: + most_successive_fail_count = most_successive_fail_count \ + if most_successive_fail_count > successive_fail_count \ + else successive_fail_count + successive_fail_count = 0 + pass + NativeLog.add_trace_critical("ARP stress test, total %s times, failed %s times, most successive fail count %s" + % (total_test_count, total_fail_count, most_successive_fail_count)) + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPIPStress/PingStress.py b/components/test/TestCaseScript/TCPIPStress/PingStress.py new file mode 100755 index 0000000000..71ab91ce5a --- /dev/null +++ b/components/test/TestCaseScript/TCPIPStress/PingStress.py @@ -0,0 +1,122 @@ +import time + +from NativeLog import NativeLog +from TCAction import TCActionBase +from comm.NIC import Adapter + +WARNING_COUNT = 2 + + +class PingStress(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.adapter = None + self.target_mode = "STA" + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + self.adapter.close() + del self.adapter + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + test_time = self.test_time * 60 + # ping data len + ping_len = self.ping_len + # test frequency min should be 0.1s, otherwise reply could be missed + test_freq = self.test_freq if self.test_freq > 0.1 else 0.1 + # target mode + target_mode = self.target_mode + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for PingStress script, error is %s" % e) + raise StandardError("Error configuration") + + if target_mode == "STA": + target_ip = self.get_parameter("target_ip") + target_mac = self.get_parameter("target_mac") + pc_mac = self.get_parameter("pc_nic_mac") + pc_nic_name = self.get_parameter("pc_nic") + elif target_mode == "SoftAP": + target_ip = self.get_parameter("target_ap_ip") + target_mac = self.get_parameter("target_ap_mac") + pc_mac = self.get_parameter("pc_wifi_nic_mac") + pc_nic_name = self.get_parameter("pc_wifi_nic") + else: + raise StandardError("Unsupported target mode: %s" % target_mode) + + time_start = time.time() + # open device + self.adapter = Adapter.Adapter(pc_nic_name, "capture+send") + + ret = self.adapter.set_filter("icmp[icmpcode]=icmp-echoreply and ether src %s and ether dst %s" + % (target_mac, pc_mac)) + if ret != "LIBPCAP_SUCCEED": + NativeLog.add_trace_critical("PING Stress test error: %s" % ret) + return + + ret = self.adapter.start_capture() + if ret != "LIBPCAP_SUCCEED": + NativeLog.add_trace_critical("PING Stress test error: %s" % ret) + return + + total_test_count = total_fail_count = successive_fail_count = most_successive_fail_count = 0 + + while (time.time() - time_start) < test_time: + + ping_pdu = self.adapter.create_pdu("ICMP", self.adapter.create_payload("A" * ping_len), + icmp_type="echo-request", ipv4_protocol="ICMP", + ipv4_dst_ip=target_ip, ethernet_dst_addr=target_mac) + # send ping req + ret = self.adapter.ether_send(ping_pdu.to_bytes()) + if ret != "LIBNET_SUCCEED": + NativeLog.add_prompt_trace("libnet send fail, %s" % ret) + continue + total_test_count += 1 + # wait for reply + time.sleep(test_freq) + # should get one ping reply + pdu_list = self.adapter.get_packets() + + if len(pdu_list) == 0: + # failed to get ping reply + total_fail_count += 1 + successive_fail_count += 1 + if successive_fail_count > WARNING_COUNT: + NativeLog.add_trace_critical("Ping Fail: successive fail %u times, total tested %u times" + % (successive_fail_count, total_test_count)) + pass + else: + most_successive_fail_count = most_successive_fail_count \ + if most_successive_fail_count > successive_fail_count \ + else successive_fail_count + successive_fail_count = 0 + pass + pass + NativeLog.add_trace_critical("Ping stress test, total %s times, failed %s times, most successive fail count %s" + % (total_test_count, total_fail_count, most_successive_fail_count)) + self.result_cntx.set_result("Succeed") + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPIPStress/__init__.py b/components/test/TestCaseScript/TCPIPStress/__init__.py new file mode 100755 index 0000000000..25ae689179 --- /dev/null +++ b/components/test/TestCaseScript/TCPIPStress/__init__.py @@ -0,0 +1 @@ +__all__ = ["ARPStress", "PingStress"] diff --git a/components/test/TestCaseScript/TCPStress/TCPAP4STA.py b/components/test/TestCaseScript/TCPStress/TCPAP4STA.py new file mode 100755 index 0000000000..95be6fbe4f --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPAP4STA.py @@ -0,0 +1,168 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import copy +import time +import random +import string + + +class TCPAP4STAResultCheckCntx(TCActionBase.ResultCheckContext): + + def __init__(self, test_action, test_env, name): + TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) + self.failed_port = [] + pass + + def run(self): + + while True: + exit_flag = self.wait_exit_event(1) + # force exit + if exit_flag is True: + break + try: + self.lock_data() + temp_cache = copy.deepcopy(self.data_cache) + self.data_cache = [] + finally: + self.unlock_data() + + for _cache in temp_cache: + _data = _cache[1] + if _data.find("user_test_tcpclient_recon_cb") != -1 or _data.find("discon") != -1 \ + or _data.find("No heap available") != -1: + self.failed_port.append(_cache[0]) + NativeLog.add_trace_critical("TCPAP4STA failed, failed on %s" % _cache[0]) + pass + if len(self.failed_port) != 0: + # disconnect happen + break + + def get_test_results(self): + return self.failed_port + + +class TCPAP4STA(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len = self.send_len + # test count + test_count = self.test_count + # server port + server_port = self.server_port + # ap ip + ap_ip = self.ap_ip + # server echo + server_echo = self.server_echo + # station number + sta_number = self.sta_number + # pass standard + pass_standard = self.pass_standard + # send delay + send_delay = self.send_delay + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step0 reboot + checker_stings = [] + test_action_string = [] + + for i in range(sta_number+1): + checker_stings.append("P SSC%d C !!!ready!!!" % (i+1)) + test_action_string.append("SSCC SSC%d reboot" % (i+1)) + + fail_string = "Fail, Fail to reboot" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step1 set ap on SSC1, create server + ssid = "".join([random.choice(string.lowercase) for m in range(10)]) + password = "".join([random.choice(string.lowercase) for m in range(10)]) + checker_stings = ["R SSC1 C dhcp%20server%20start"] + test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] + fail_string = "Fail, Fail set ap" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 C server%20starts%20at%20port"] + if server_echo is True: + test_action_string = ["SSCC SSC1 tcp -S -p %s -b 1" % server_port] + else: + test_action_string = ["SSCC SSC1 tcp -S -p %s" % server_port] + fail_string = "Fail, Fail create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 2, 4 SSC target(SSC2 - SSC5) join SSC1 soft AP + checker_stings = [] + test_action_string = [] + + for i in range(sta_number): + checker_stings.append("P SSC%d C ip C mask C gw C get%%20ip%%20of" % (i+2)) + test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i+2, ssid, password)) + + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + + # step 3, create client on SSC2 - SSC5 + checker_stings = [] + test_action_string = [] + + for i in range(sta_number): + checker_stings.append("P SSC%d C tcp%%20client%%20connect%%20with%%20server" % (i+2)) + test_action_string.append("SSCC SSC%d tcp -W -i %s -p %s -c %s -n 1 -l %s -d %d" + % ((i+2), ap_ip, server_port, test_count, send_len, send_delay)) + + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # switch to new result context + self.result_cntx.stop_thread() + self.result_cntx.join() + self.result_cntx = TCPAP4STAResultCheckCntx(self, self.test_env, self.tc_name) + self.result_cntx.start() + + self.result_cntx.join() + + failed_port = self.result_cntx.get_test_results() + if (time.time() - start_time) > pass_standard: + self.result_cntx.set_result("Succeed") + else: + self.result_cntx.set_result("Failed") + NativeLog.add_trace_critical("Failed port: %s" % failed_port) + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py b/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py new file mode 100755 index 0000000000..6c160a9a00 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py @@ -0,0 +1,209 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import time +import random +import string + + +TEST_COUNT_ONE_ROUND = 500 + + +class TCPAPNSTA(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len = self.send_len + # test count + test_count = self.test_count + # server port + server_port = self.server_port + # ap ip + ap_ip = self.ap_ip + # server echo + server_echo = self.server_echo + # station number + sta_number = self.sta_number + # pass standard + pass_standard = self.pass_standard + # send delay + send_delay = self.send_delay + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step0 reboot + checker_stings = [] + test_action_string = [] + + for i in range(sta_number+1): + checker_stings.append("P SSC%d C !!!ready!!!" % (i+1)) + test_action_string.append("SSCC SSC%d reboot" % (i+1)) + + fail_string = "Fail, Fail to reboot" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step1 set ap on SSC1, create server + checker_stings = ["R SSC1 C +MODE:OK"] + test_action_string = ["SSCC SSC1 op -S -o 2"] + fail_string = "Fail, Fail set mode" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + ssid = "".join([random.choice(string.lowercase) for m in range(10)]) + password = "".join([random.choice(string.lowercase) for m in range(10)]) + checker_stings = ["R SSC1 C +SAP:OK"] + test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] + fail_string = "Fail, Fail set ap" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] + fail_string = "Fail, Fail create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -L -s "] + fail_string = "Fail, Fail create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 2, 8 SSC target(SSC2 - SSC9) join SSC1 soft AP + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d C +MODE:OK" % (i+2)) + test_action_string.append("SSCC SSC%d op -S -o 1" % (i+2)) + fail_string = "Fail, Fail set mode" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d C +JAP:CONNECTED,%s" % (i+2, ssid)) + test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i+2, ssid, password)) + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + + # step 3, create client on SSC2 - SSC9 + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i+2, i+2)) + test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i+2)) + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for i in range(sta_number): + checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i+2), + "P SSC1 A :ACCEPT:(\d+),.+" % (i+2)] + test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % + (i+2, i+2, ap_ip, server_port)] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 4, do send/recv + while test_count > 0: + _tmp_count = TEST_COUNT_ONE_ROUND if test_count - TEST_COUNT_ONE_ROUND > 0 else test_count + test_count -= TEST_COUNT_ONE_ROUND + + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d RE \+SEND:\d+,OK NC CLOSED" % (i+2)) + test_action_string.append("SSC SSC%d soc -S -s -l %d -n %d -j %d" % + (i+2, i+2, send_len, _tmp_count, send_delay)) + if server_echo is True: + test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % + (i+2, send_len, _tmp_count, send_delay)) + checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%() NC CLOSED)" % + (i+2)) + + fail_string = "Fail, Failed to send/recv data" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=300) is False: + break + pass + + if (time.time() - start_time) > pass_standard: + self.result_cntx.set_result("Succeed") + else: + checker_stings = [] + test_action_string = [] + for i in range(sta_number + 1): + checker_stings.append("P SSC%d C CLOSEALL" % (i + 1)) + test_action_string.append("SSCC SSC%d soc -T" % (i + 1)) + fail_string = "Fail, Fail to close socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + server_port = random.randint(20000, 30000) + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] + fail_string = "Fail, Fail to bind socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -L -s "] + fail_string = "Fail, Fail to listen" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 2, i + 2)) + test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 2)) + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for i in range(sta_number): + checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 2), + "P SSC1 A :ACCEPT:(\d+),.+" % (i + 2)] + test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % + (i + 2, i + 2, ap_ip, server_port)] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + self.result_cntx.set_result("Failed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py b/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py new file mode 100755 index 0000000000..b04ede6acb --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py @@ -0,0 +1,363 @@ +import random +import re +import sys +import threading +import time + +import TCPConnUtility +from NativeLog import NativeLog +from TCAction import TCActionBase + +reload(sys) +sys.setdefaultencoding('iso-8859-1') # # use encoding that with 1 Byte length and contain 256 chars + + +DEFAULT_MAX_CONN_ALLOWED = 5 + + +# complicated design because I want to make this script applied for all TCP connect/close test scenarios +# basic flow: try to create max connections, send/recv data if possible, close all connections +# connect: +# 1. find available (target_link_id, socket_id) list, +# notice that target_link_id maybe not correct if PC is client +# (during that time, some link may timeout and got disconnected from FIN_WAIT or other state) +# 2. choose one method from method set, try to connect +# 3. update state table: a)check result and destination state, b)find real target_link_id, c)update +# send/recv data: +# 1. find channels that are possible to send data on all connections +# 2. send data on possible channels +# disconnect: +# 1. find available connections +# 2. choose one method from disconnect set, try to disconnect +# 3. update state table (phase 1) +# async process: +# listen on AT UART port, record all "x,CONNECT" and "x,CLOSE" command +# for "x,CONNECT", append them to self.target_link_id_list, used when need to find real target_link_id +# for "x,CLOSE", update state table (phase 2), if matching connection is pending on wait state, +# close them and remove from state table +class TCPConnStressTC(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.__at1_buff = "" + self.max_conn_allowed = test_env.get_variable_by_name("max_conn") + self.enable_log = True + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + # connection_state_dict: {target_link_id: [socket_id, target_state, socket_state, is_closed]} + # is_closed: found "x,CLOSE" in AT UART port + self.connection_state_dict = dict(zip(range(self.max_conn_allowed), [None] * self.max_conn_allowed)) + self.created_link_id_list = [] + + self.__available_soc_id = range(2, 2+self.max_conn_allowed) + self.__available_link_id = range(self.max_conn_allowed) + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + self.utility = TCPConnUtility.TCPConnUtility(self) + self.state_lock = threading.Lock() + self.link_id_lock = threading.Lock() + self.available_id_lock = threading.Lock() + pass + + def __add_log(self, log_str): + if self.enable_log is True: + NativeLog.add_trace_info(log_str) + + def __get_created_target_link_id(self): + self.link_id_lock.acquire() + try: + link_id = self.created_link_id_list[-1] + self.created_link_id_list = [] + finally: + self.link_id_lock.release() + return link_id + pass + + def __set_created_target_link_id(self, link_id): + self.link_id_lock.acquire() + try: + self.created_link_id_list.append(link_id) + finally: + self.link_id_lock.release() + pass + + def __find_channel_list(self): + channel_list = [] # # [(socket_id, able_to_send, link_id, able_to_send), ] + self.state_lock.acquire() + try: + for link_id in self.connection_state_dict: + state = self.connection_state_dict[link_id] + if state is not None: + channel_list.append([state[0], self.utility.is_able_to_send_data(state[2]), + link_id, self.utility.is_able_to_send_data(state[1])]) + finally: + self.state_lock.release() + return channel_list + pass + + def __established_connection_list(self): + conn_list = [] # # [(socket_id, link_id), ] + self.state_lock.acquire() + try: + for link_id in self.connection_state_dict: + state = self.connection_state_dict[link_id] + if state is not None: + if self.utility.is_established_connection([state[1], state[2]]) is True: + conn_list.append([state[0], link_id]) + finally: + self.state_lock.release() + return conn_list + pass + + # find free socket_id, target_link_id pair + def __get_available_id_list(self): + self.available_id_lock.acquire() + try: + id_list = zip(self.__available_soc_id, self.__available_link_id) + finally: + self.available_id_lock.release() + return id_list + pass + + def __update_available_id_list(self, soc_id, link_id, action="ADD"): + self.available_id_lock.acquire() + try: + if action == "ADD": + self.__available_link_id.append(link_id) + self.__available_soc_id.append(soc_id) + self.__add_log("[AVAILABLE ID]soc %d link %d is available" % (soc_id, link_id)) + elif action == "REMOVE": + self.__available_link_id.remove(link_id) + self.__available_soc_id.remove(soc_id) + self.__add_log("[AVAILABLE ID]soc %d link %d is used" % (soc_id, link_id)) + finally: + self.available_id_lock.release() + + def __update_connection_state_item(self, target_link_id, socket_id=None, + target_state=None, socket_state=None, is_closed=None): + self.state_lock.acquire() + try: + state = self.connection_state_dict[target_link_id] + if state is None: + state = [None] * 4 + if socket_id is not None: + state[0] = socket_id + if target_state is not None: + state[1] = target_state + if socket_state is not None: + state[2] = socket_state + if is_closed is not None: + state[3] = is_closed + + # remove closed connections + closed = self.utility.is_closed_state(state[1]) and (state[3] is True) + if closed is True: + self.__update_available_id_list(state[0], target_link_id) + state = None + # if new connection created + if self.connection_state_dict[target_link_id] is None: + created = self.utility.is_created_state(state[1]) + if created is True: + self.__update_available_id_list(state[0], target_link_id, "REMOVE") + else: + # connection did not created, do not add them to connection state table + state = None + + # set new connection_state + self.connection_state_dict[target_link_id] = state + self.__add_log("[STATE] link id is %d, state is %s" % (target_link_id, state)) + except StandardError, e: + pass + finally: + self.state_lock.release() + pass + + # update state table: if result is false, return, if result is true: + # for connect, find real link id, update table according to destination state + # for disconnect, if target in SOC_CLOSE_STATE && catch "x,CLOSE" from AT, remove the item + def update_connection_state_table(self, conn_id, destination_state=None): + if isinstance(conn_id, list) is True or isinstance(conn_id, tuple) is True: + socket_id = conn_id[0] + try: + target_link_id = self.__get_created_target_link_id() + except IndexError: + target_link_id = conn_id[1] + self.__add_log("[STATE]fail to get link id, state is %s, %s" + % (destination_state[0], destination_state[1])) + self.__update_connection_state_item(target_link_id, socket_id, + destination_state[0], destination_state[1]) + pass + else: # # called when recv CLOSED + target_link_id = conn_id + self.__update_connection_state_item(target_link_id, is_closed=True) + pass + pass + + def process_at_data(self, data): + pos1 = 0 + pos2 = 0 + connect = re.compile("\d,CONNECT\r\n") + close = re.compile("\d,CLOSED\r\n") + connect_match = connect.findall(data) + close_match = close.findall(data) + close = re.compile("\d,CONNECT FAIL\r\n") + close_match += close.findall(data) + if len(connect_match) != 0: + pos1 = data.find(connect_match[-1]) + 9 + # append last connected link id + self.__set_created_target_link_id(int(connect_match[-1][:1])) + pass + if len(close_match) != 0: + pos2 = data.find(close_match[-1]) + 7 + # update for all closed links + for close_str in close_match: + self.update_connection_state_table(int(close_str[:1])) + pass + pos = pos1 if pos1 > pos2 else pos2 + + return data[pos:] + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # configurable params + # mandatory params + try: + connect_method_set = self.connect_method_set + test_count = self.test_count + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPConnSingleMode script, error is %s" % e) + raise StandardError("Error configuration") + # optional params + try: + disconn_method_set = self.disconn_method_set + except StandardError: + disconn_method_set = ["D_05"] + pass + try: + delay = self.delay + except StandardError: + delay = 0 + pass + try: + check_data_len = self.check_data_len + except StandardError: + check_data_len = [0, 0] + pass + if isinstance(check_data_len, list) is False: + check_data_len = [check_data_len] * 2 + # configurable params + + # step1 use to create server on both PC and target side + checker_stings = ["SOCP SOC_COM L OK", "ATP AT1 L OK"] + test_action_string = ["SOC SOC1 LISTEN ", "ATC AT1 CIPSERVER 1 "] + fail_string = "Fail, Fail on create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for tested_count in xrange(test_count): + # step2 do connect + available_id_list = self.__get_available_id_list() + + for conn_id in available_id_list: + connect_method = random.choice(connect_method_set) + # ret, destination_state = self.utility.execute_tcp_method(connect_method, conn_id) + try: + self.__add_log("[ACTION]connect method is %s, connect id is %s" + % (connect_method, conn_id)) + ret, destination_state = self.utility.execute_tcp_method(connect_method, conn_id) + except StandardError, e: + NativeLog.add_trace_critical("Error in connect, error is %s" % e) + raise StandardError("Exception happen when connect") + if ret is False: + # connect fail, should terminate TC and mark as fail + return + else: + # succeed, append to table + self.update_connection_state_table(conn_id, destination_state) + if delay != 0: + time.sleep(delay) + + # step 3 send/recv test data + # # [(socket_id, able_to_send, link_id, able_to_send)] + self.__add_log("[ACTION]SEND/RECV data") + channel_list = self.__find_channel_list() + for channel in channel_list: + _check_data_len = [0, 0] + if channel[1] is True: + _check_data_len[0] = check_data_len[0] + if channel[3] is True: + _check_data_len[1] = check_data_len[1] + ret = self.utility.send_test_data(channel[0], + channel[2], + _check_data_len) + if ret is False: + # send/recv fail, should terminate TC and mark as fail + return + if delay != 0: + time.sleep(delay) + + # step 4 close all established connections + # (socket_id, link_id) + conn_list = self.__established_connection_list() + for conn_id in conn_list: + disconn_method = random.choice(disconn_method_set) + try: + self.__add_log("[ACTION]disconnect method is %s, connect id is %s" + % (disconn_method, conn_id)) + ret, destination_state = self.utility.execute_tcp_method(disconn_method, conn_id) + except StandardError, e: + NativeLog.add_trace_critical("Error in disconnect, error is %s" % e) + raise StandardError("Exception happen when disconnect") + if ret is False: + # connect fail, should terminate TC and mark as fail + return + else: + # succeed, append to table + self.update_connection_state_table(conn_id, destination_state) + if delay != 0: + time.sleep(delay) + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + # find "x,CONNECT" and "x,CLOSE" + if port_name.find("AT") != -1: + self.__at1_buff += data + self.__at1_buff = self.process_at_data(self.__at1_buff) + + +def main(): + at1_buff = "" + pos1 = 0 + pos2 = 0 + data = "dafgajglajdfg0,CLOSEjdalghalksdg1,CONNECT\r\n\r\n3,CONNECT4,CLOSEadfaasdf" + at1_buff += data + connect = re.compile("\d,CONNECT") + close = re.compile("\d,CLOSE") + connect_match = connect.findall(at1_buff) + close_match = close.findall(at1_buff) + if len(connect_match) != 0: + pos1 = at1_buff.find(connect_match[-1]) + 9 + pass + if len(close_match) != 0: + pos2 = at1_buff.find(close_match[-1]) + 7 + pass + pos = pos1 if pos1 > pos2 else pos2 + + at1_buff = at1_buff[pos:] + + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/TCPStress/TCPConnUtility.py b/components/test/TestCaseScript/TCPStress/TCPConnUtility.py new file mode 100755 index 0000000000..3059369010 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPConnUtility.py @@ -0,0 +1,273 @@ +from NativeLog import NativeLog + +# make sure target do not listen on this port +ERROR_PORT = 23333 + + +def unused_param(param): + return param + + +class TCPUtilError(StandardError): + pass + + +class TCPConnUtility(object): + METHOD_RESULT = {"C_01": ("ESTABLISHED", "ESTABLISHED"), # target TCP peer state, PC TCP peer state + "C_02": ("SYNC_SENT", "CLOSED"), + "C_03": ("CLOSED", "CLOSED"), + "C_04": ("SYN_RCVD", "ESTABLISHED"), + "C_05": ("ESTABLISHED", "ESTABLISHED"), + "C_06": ("CLOSED", "CLOSED"), + "C_07": ("CLOSED", "CLOSED"), + "C_08": ("CLOSED", "CLOSED"), + "D_01": ("TIME_WAIT", "CLOSED"), + "D_02": ("TIME_WAIT", "TIME_WAIT"), + "D_03": ("FIN_WAIT_2", "CLOSE_WAIT"), + "D_04": ("FIN_WAIT_1", "CLOSE_WAIT"), + "D_05": ("CLOSED", "TIME_WAIT"), + "D_06": ("CLOSED", "CLOSED"), + "D_07": ("CLOSE_WAIT", "FIN_WAIT2"), + "D_08": ("TIME_WAIT", "CLOSED"), } + + SOC_CLOSED_STATE = ("FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT", "LAST_ACK", "CLOSED") + SOC_CREATED_STATE = ("SYNC_RCVD", "SYNC_SENT", "ESTABLISHED") + SOC_SEND_DATA_STATE = ("ESTABLISHED", "CLOSE_WAIT") + SOC_ESTABLISHED_STATE = ("ESTABLISHED", ) + + def __init__(self, tc_action): + self.tc_action = tc_action + self.pc_server_port = "" + self.target_server_port = "" + self.pc_ip = "" + self.target_ip = "" + pass + + def config_parameters(self, pc_server_port=None, target_server_port=None, pc_ip=None, target_ip=None): + if pc_ip is not None: + self.pc_ip = pc_ip + if target_ip is not None: + self.target_ip = target_ip + if pc_server_port is not None: + self.pc_server_port = pc_server_port + if target_server_port is not None: + self.target_server_port = target_server_port + pass + + def __connect_c_01(self, conn_id): + checker_stings = ["SOCR SOC1 C +ACCEPT", "ATR AT1 NC CLOSE L OK"] + test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" %s %s" % + (conn_id[1], self.pc_ip, self.pc_server_port)] + fail_string = "Fail, Target failed on connect to PC server" + ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) + if ret is False: + return ret + + checker_stings = ["SOCR SOC_COM L OK"] + test_action_strings = ["SOC SOC1 ACCEPT SOC%d" % conn_id[0]] + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) + pass + + def __connect_c_02(self, conn_id): + checker_stings = ["ATR AT1 C ERROR"] + test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" %s %s" % + (conn_id[1], self.pc_ip, ERROR_PORT)] + fail_string = "Fail, Target fail on connect to port not listened" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) + pass + + def __connect_c_03(self, conn_id): + pass + + def __connect_c_04(self, conn_id): + pass + + def __connect_c_05(self, conn_id): + checker_stings = ["SOCP SOC_COM OK", "ATP AT1 C CONNECT"] + test_action_strings = ["SOC SOC%d CONNECT %s %s" % + (conn_id[0], self.target_server_port, self.target_ip)] + fail_string = "Fail, PC fail on connect to target server" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + pass + + def __connect_c_06(self, conn_id): + pass + + def __connect_c_07(self, conn_id): + # no checker strings, only try to create + # while connect is a blocking function, will return till target reply RST + checker_stings = ["SOCR SOC_COM C CLOSE"] + test_action_strings = ["SOC SOC%d CONNECT %s %s" % + (conn_id[0], ERROR_PORT, self.target_ip)] + fail_string = "Fail, PC fail on connect to target server" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=2000, check_freq=0.01) + pass + + def __connect_c_08(self, conn_id): + pass + + def __close_d_01(self, conn_id): + checker_stings = ["ATP AT1 C %d,CLOSED" % conn_id[1], "SOCP SOC_COM C CLOSE"] + test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_FIN" % conn_id[0], + "ATS AT1 AT+CIPCLOSE=%d" % conn_id[1]] + fail_string = "Fail, Fail to close socket using D_01" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + pass + + def __close_d_02(self, conn_id): + pass + + def __close_d_03(self, conn_id): + checker_stings = [] + test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT WAIT_TO" % conn_id[0], + "ATS AT1 AT+CIPCLOSE=%d" % conn_id[1]] + fail_string = "Fail, Fail to close socket using D_01" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=500, check_freq=0.01) + pass + + def __close_d_04(self, conn_id): + pass + + def __close_d_05(self, conn_id): + checker_stings = ["ATP AT1 C %d,CLOSED" % conn_id[1]] + test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_FIN" % conn_id[0], + "SOC SOC%d CLOSE" % conn_id[0]] + fail_string = "Fail, Fail to close socket using D_05" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + pass + + def __close_d_06(self, conn_id): + # 1. set PC socket close option, stop calling recv; send in target + checker_stings = ["ATP AT1 C >"] + test_action_strings = ["SOC SOC%d STOPRECV" % conn_id[0], + "SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_RST" % conn_id[0], + "ATS AT1 AT+CIPSEND=%d,5" % conn_id[1]] + fail_string = "Fail, Fail to close socket using D_06" + ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + if ret is False: + return ret + + # 2. send 5 bytes to socket + checker_stings = ["ATP AT1 C OK"] + test_action_strings = ["ATSN AT1 5"] + fail_string = "Fail, Fail to close socket using D_06" + ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + if ret is False: + return ret + + # 3. close socket + checker_stings = ["ATP AT1 OR 2 C %d,CONNECT C %d,CLOSED" % (conn_id[1], conn_id[1])] + test_action_strings = ["SOC SOC%d CLOSE" % conn_id[0]] + fail_string = "Fail, Fail to close socket using D_06" + return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=200, check_freq=0.01) + pass + + def __close_d_07(self, conn_id): + pass + + def __close_d_08(self, conn_id): + pass + + def send_test_data(self, socket_id, target_link_id, check_data_len): + # check_data_len[0] for socket data len, check_data_len[1] for target link data len + fail_string = "Fail, Fail on send and recv data" + + ret = True + + for i in range(1): + if check_data_len[1] != 0: + checker_stings = ["ATP AT1 C >"] + test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (target_link_id, check_data_len[1])] + if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail on target send command for link %d" % target_link_id) + ret = False + break + checker_stings = ["SOCP SOC%d RL %d" % (socket_id, check_data_len[1]), "ATP AT1 C OK"] + test_action_strings = ["ATSN AT1 %d" % check_data_len[1]] + if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % target_link_id) + ret = False + break + + if check_data_len[0] != 0: + checker_stings = ["ATP AT1 DL %d+%d" % (target_link_id, check_data_len[0])] + test_action_strings = ["SOC SOC%d SEND %d" % (socket_id, check_data_len[0])] + + if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, + fail_string, check_time=20) is False: + NativeLog.add_trace_critical("Fail to receive PC SOC%d sent data" % socket_id) + ret = False + break + + # return ret + # for now do not validate data + return True + + TCP_ACTION_DICT = {"C_01": __connect_c_01, + "C_02": __connect_c_02, + "C_03": __connect_c_03, + "C_04": __connect_c_04, + "C_05": __connect_c_05, + "C_06": __connect_c_06, + "C_07": __connect_c_07, + "C_08": __connect_c_08, + "D_01": __close_d_01, + "D_02": __close_d_02, + "D_03": __close_d_03, + "D_04": __close_d_04, + "D_05": __close_d_05, + "D_06": __close_d_06, + "D_07": __close_d_07, + "D_08": __close_d_08, + } + + def get_method_destination_state(self, method): + return self.METHOD_RESULT[method] + + def execute_tcp_method(self, method, conn_id): + if method in self.METHOD_RESULT: + return self.TCP_ACTION_DICT[method](self, conn_id), self.get_method_destination_state(method) + else: + raise TCPUtilError("Not TCP connection method") + pass + + def is_created_state(self, state): + if state in self.SOC_CREATED_STATE: + return True + else: + return False + + def is_closed_state(self, state): + if state in self.SOC_CLOSED_STATE: + return True + else: + return False + + def is_able_to_send_data(self, state): + if state in self.SOC_SEND_DATA_STATE: + return True + else: + return False + + def is_established_connection(self, state): + if state[0] in self.SOC_ESTABLISHED_STATE and state[1] in self.SOC_ESTABLISHED_STATE: + return True + else: + return False + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPConnection.py b/components/test/TestCaseScript/TCPStress/TCPConnection.py new file mode 100755 index 0000000000..8b481c7df8 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPConnection.py @@ -0,0 +1,321 @@ +import random +import re +import socket +import threading +import time + +import TCPConnectionUtility +from NativeLog import NativeLog +from TCAction import PerformanceTCBase + +DELAY_RANGE = [10, 3000] +CONNECTION_STRUCTURE = ("Connection handler", "PC socket", "Target socket id", + "Target port", "PC port", "PC state", "Target state") + + +class CheckerBase(threading.Thread): + + CHECK_ITEM = ("CONDITION", "NOTIFIER", "ID", "DATA") + SLEEP_TIME = 0.1 # sleep 100ms between each check action + + def __init__(self): + threading.Thread.__init__(self) + self.setDaemon(True) + self.exit_event = threading.Event() + self.sync_lock = threading.Lock() + self.check_item_list = [] + self.check_item_id = 0 + + def run(self): + while self.exit_event.isSet() is False: + self.process() + pass + + def process(self): + pass + + def add_check_item(self, condition, notifier): + with self.sync_lock: + check_item_id = self.check_item_id + self.check_item_id += 1 + self.check_item_list.append(dict(zip(self.CHECK_ITEM, (condition, notifier, check_item_id, str())))) + return check_item_id + + def remove_check_item(self, check_item_id): + ret = None + with self.sync_lock: + check_items = filter(lambda x: x["ID"] == check_item_id, self.check_item_list) + if len(check_items) > 0: + self.check_item_list.remove(check_items[0]) + ret = check_items[0]["DATA"] + return ret + + def exit(self): + self.exit_event.set() + pass + + +# check on serial port +class SerialPortChecker(CheckerBase): + def __init__(self, serial_reader): + CheckerBase.__init__(self) + self.serial_reader = serial_reader + pass + + # check condition for serial is compiled regular expression pattern + @staticmethod + def do_check(check_item, data): + match = check_item["CONDITION"].search(data) + if match is not None: + pos = data.find(match.group()) + len(match.group()) + # notify user + check_item["NOTIFIER"]("serial", match) + else: + pos = -1 + return pos + + def process(self): + # do check + with self.sync_lock: + # read data + new_data = self.serial_reader() + # NativeLog.add_trace_info("[debug][read data] %s" % new_data) + # do check each item + for check_item in self.check_item_list: + # NativeLog.add_trace_info("[debug][read data][ID][%s]" % check_item["ID"]) + check_item["DATA"] += new_data + self.do_check(check_item, check_item["DATA"]) + time.sleep(self.SLEEP_TIME) + + +# handle PC TCP server accept and notify user +class TCPServerChecker(CheckerBase): + def __init__(self, server_sock): + CheckerBase.__init__(self) + self.server_sock = server_sock + server_sock.settimeout(self.SLEEP_TIME) + self.accepted_socket_list = [] + + # check condition for tcp accepted sock is tcp source port + @staticmethod + def do_check(check_item, data): + for sock_addr_pair in data: + addr = sock_addr_pair[1] + if addr[1] == check_item["CONDITION"]: + # same port, so this is the socket that matched, notify and remove it from list + check_item["NOTIFIER"]("tcp", sock_addr_pair[0]) + data.remove(sock_addr_pair) + + def process(self): + # do accept + try: + client_sock, addr = self.server_sock.accept() + self.accepted_socket_list.append((client_sock, addr)) + except socket.error: + pass + # do check + with self.sync_lock: + check_item_list = self.check_item_list + for check_item in check_item_list: + self.do_check(check_item, self.accepted_socket_list) + pass + + +# this thread handles one tcp connection. +class ConnectionHandler(threading.Thread): + CHECK_FREQ = CheckerBase.SLEEP_TIME/2 + + def __init__(self, utility, serial_checker, tcp_checker, connect_method, disconnect_method): + threading.Thread.__init__(self) + self.setDaemon(True) + self.utility = utility + self.connect_method = connect_method + self.disconnect_method = disconnect_method + self.exit_event = threading.Event() + # following members are used in communication with checker threads + self.serial_checker = serial_checker + self.tcp_checker = tcp_checker + self.serial_notify_event = threading.Event() + self.tcp_notify_event = threading.Event() + self.serial_result = None + self.tcp_result = None + self.serial_check_item_id = None + self.tcp_check_item_id = None + self.data_cache = None + pass + + def new_connection_structure(self): + connection = dict.fromkeys(CONNECTION_STRUCTURE, None) + connection["Connection handler"] = self + return connection + + def run(self): + while self.exit_event.isSet() is False: + connection = self.new_connection_structure() + # do connect + connect_method_choice = random.choice(self.connect_method) + self.utility.execute_tcp_method(connect_method_choice, connection) + # check if established + if self.utility.is_established_state(connection) is True: + time.sleep(float(random.randint(DELAY_RANGE[0], DELAY_RANGE[1]))/1000) + # do disconnect if established + disconnect_method_choice = random.choice(self.disconnect_method) + self.utility.execute_tcp_method(disconnect_method_choice, connection) + # make sure target socket closed + self.utility.close_connection(connection) + time.sleep(float(random.randint(DELAY_RANGE[0], DELAY_RANGE[1]))/1000) + pass + + # serial_condition: re string + # tcp_condition: target local port + def add_checkers(self, serial_condition=None, tcp_condition=None): + # cleanup + self.serial_result = None + self.tcp_result = None + self.serial_notify_event.clear() + self.tcp_notify_event.clear() + # serial_checker + if serial_condition is not None: + pattern = re.compile(serial_condition) + self.serial_check_item_id = self.serial_checker.add_check_item(pattern, self.notifier) + else: + # set event so that serial check always pass + self.serial_notify_event.set() + if tcp_condition is not None: + self.tcp_check_item_id = self.tcp_checker.add_check_item(tcp_condition, self.notifier) + else: + # set event so that tcp check always pass + self.tcp_notify_event.set() + # NativeLog.add_trace_info("[Debug] add check item %s, connection is %s" % (self.serial_check_item_id, self)) + pass + + def get_checker_results(self, timeout=5): + time1 = time.time() + while time.time() - time1 < timeout: + # if one type of checker is not set, its event will be set in add_checkers + if self.serial_notify_event.isSet() is True and self.tcp_notify_event.isSet() is True: + break + time.sleep(self.CHECK_FREQ) + # do cleanup + # NativeLog.add_trace_info("[Debug] remove check item %s, connection is %s" % (self.serial_check_item_id, self)) + self.data_cache = self.serial_checker.remove_check_item(self.serial_check_item_id) + self.tcp_checker.remove_check_item(self.tcp_check_item_id) + # self.serial_check_item_id = None + # self.tcp_check_item_id = None + return self.serial_result, self.tcp_result + + def notifier(self, typ, result): + if typ == "serial": + self.serial_notify_event.set() + self.serial_result = result + elif typ == "tcp": + self.tcp_notify_event.set() + self.tcp_result = result + + def exit(self): + self.exit_event.set() + pass + + +class TCPConnection(PerformanceTCBase.PerformanceTCBase): + def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.max_connection = 5 + self.execute_time = 120 # execute time default 120 minutes + self.pc_ip = "pc_ip" + self.target_ip = "target_ip" + self.connect_method = ["C_01"] + self.disconnect_method = ["D_05"] + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + self.error_event = threading.Event() + self.serial_lock = threading.Lock() + pass + + def serial_reader(self): + return self.serial_read_data("SSC1") + + def send_ssc_command(self, data): + with self.serial_lock: + time.sleep(0.05) + self.serial_write_line("SSC1", data) + + def error_detected(self): + self.error_event.set() + + def process(self): + # parameters + max_connection = self.max_connection + execute_time = self.execute_time * 60 + pc_ip = self.get_parameter(self.pc_ip) + target_ip = self.get_parameter(self.target_ip) + connect_method = self.connect_method + disconnect_method = self.disconnect_method + server_port = random.randint(30000, 50000) + + # step 1, create TCP server on target and PC + # create TCP server on target + self.serial_write_line("SSC1", "soc -B -t TCP -p %s" % server_port) + match = self.check_regular_expression("SSC1", re.compile("BIND:(\d+),OK")) + if match is None: + NativeLog.add_prompt_trace("Failed to create TCP server on target") + return + target_sock_id = match.group(1) + + self.serial_write_line("SSC1", "soc -L -s %s" % target_sock_id) + if self.check_response("SSC1", "+LISTEN:%s,OK" % target_sock_id) is False: + NativeLog.add_prompt_trace("Failed to create TCP server on target") + return + + # create TCP server on PC + try: + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, server_port)) + server_sock.listen(5) + except StandardError: + NativeLog.add_prompt_trace("Failed to create TCP server on PC") + return + + # step 2, create checker + serial_port_checker = SerialPortChecker(self.serial_reader) + tcp_server_checker = TCPServerChecker(server_sock) + serial_port_checker.start() + tcp_server_checker.start() + + # step 3, create 5 thread and do connection + utility = TCPConnectionUtility.Utility(self, server_port, server_port, pc_ip, target_ip) + work_thread = [] + for i in range(max_connection): + t = ConnectionHandler(utility, serial_port_checker, tcp_server_checker, + connect_method, disconnect_method) + work_thread.append(t) + t.start() + + # step 4, wait and exit + self.error_event.wait(execute_time) + # close all threads + for t in work_thread: + t.exit() + t.join() + serial_port_checker.exit() + tcp_server_checker.exit() + serial_port_checker.join() + tcp_server_checker.join() + + if self.error_event.isSet() is False: + # no error detected + self.set_result("Succeed") + pass + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py b/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py new file mode 100755 index 0000000000..f28218af0b --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py @@ -0,0 +1,251 @@ +import random +import socket +import threading + +from NativeLog import NativeLog + +# from NativeLog import NativeLog + +# make sure target do not listen on this port +ERROR_PORT = 62685 + + +class Utility(object): + METHOD_RESULT = {"C_01": ("ESTABLISHED", "ESTABLISHED"), # target TCP peer state, PC TCP peer state + "C_02": ("SYNC_SENT", "CLOSED"), + "C_03": ("CLOSED", "CLOSED"), + "C_04": ("SYN_RCVD", "ESTABLISHED"), + "C_05": ("ESTABLISHED", "ESTABLISHED"), + "C_06": ("CLOSED", "CLOSED"), + "C_07": ("CLOSED", "CLOSED"), + "C_08": ("CLOSED", "CLOSED"), + "D_01": ("TIME_WAIT", "CLOSED"), + "D_02": ("TIME_WAIT", "TIME_WAIT"), + "D_03": ("FIN_WAIT_2", "CLOSE_WAIT"), + "D_04": ("FIN_WAIT_1", "CLOSE_WAIT"), + "D_05": ("CLOSED", "TIME_WAIT"), + "D_06": ("CLOSED", "CLOSED"), + "D_07": ("CLOSE_WAIT", "FIN_WAIT2"), + "D_08": ("TIME_WAIT", "CLOSED"), } + + SOC_CLOSED_STATE = ("FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT", "LAST_ACK", "CLOSED") + SOC_CREATED_STATE = ("SYNC_RCVD", "ESTABLISHED") + SOC_SEND_DATA_STATE = ("ESTABLISHED", "CLOSE_WAIT") + SOC_ESTABLISHED_STATE = ("ESTABLISHED", ) + + def __init__(self, tc_action, pc_server_port, target_server_port, pc_ip, target_ip): + self.tc_action = tc_action + self.pc_server_port = pc_server_port + self.target_server_port = target_server_port + self.pc_ip = pc_ip + self.target_ip = target_ip + self.pc_close_wait_socket_list = [] + self.sync_lock = threading.Lock() + pass + + # create a tcp socket, return True or False + def __create_tcp_socket(self, connection): + connection_handler = connection["Connection handler"] + connection["Target port"] = random.randint(10000, 60000) + connection_handler.add_checkers("BIND:(\d+),OK,%s,%s" + % (self.target_ip, connection["Target port"])) + self.tc_action.send_ssc_command("soc -B -t TCP -i %s -p %s" % (self.target_ip, connection["Target port"])) + serial_result, tcp_result = connection_handler.get_checker_results() + if serial_result is not None: + connection["Target socket id"] = serial_result.group(1) + return True + else: + return False + + # target do connect, return True or False + def __target_do_connect(self, connection, dest_ip, dest_port, timeout=20): + connection_handler = connection["Connection handler"] + connection_handler.add_checkers("CONNECT:%s,OK" % connection["Target socket id"], + connection["Target port"]) + self.tc_action.send_ssc_command("soc -C -s %s -i %s -p %s" + % (connection["Target socket id"], dest_ip, dest_port)) + serial_result, tcp_result = connection_handler.get_checker_results(timeout) + if serial_result is not None and tcp_result is not None: + connection["PC socket"] = tcp_result + return True + else: + return False + pass + + # pc do connect, return True or False + def __pc_do_connect(self, connection, dest_ip, dest_port, timeout=20): + connection_handler = connection["Connection handler"] + sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + while True: + connection["PC port"] = random.randint(10000, 60000) + try: + sock.bind((self.pc_ip, connection["PC port"])) + break + except socket.error, e: + if e.errno == 10048: # socket port reuse + continue + sock.settimeout(timeout) + connection["PC socket"] = sock + connection_handler.add_checkers("ACCEPT:(\d+),\d+,%s,%s" + % (self.pc_ip, connection["PC port"])) + try: + sock.connect((dest_ip, dest_port)) + except socket.error: + pass + serial_result, tcp_result = connection_handler.get_checker_results() + if serial_result is not None: + connection["Target socket id"] = serial_result.group(1) + return True + else: + return False + pass + + def connect_c_01(self, connection): + if self.__create_tcp_socket(connection) is True: + return self.__target_do_connect(connection, self.pc_ip, self.pc_server_port) + else: + return False + + def connect_c_02(self, connection): + if self.__create_tcp_socket(connection) is True: + return not self.__target_do_connect(connection, self.pc_ip, ERROR_PORT, timeout=5) + else: + return False + + def connect_c_03(self, connection): + return False + + def connect_c_04(self, connection): + return False + + def connect_c_05(self, connection): + return self.__pc_do_connect(connection, self.target_ip, self.target_server_port) + + def connect_c_06(self, connection): + return False + + def connect_c_07(self, connection): + return not self.__pc_do_connect(connection, self.target_ip, ERROR_PORT) + + def connect_c_08(self, connection): + return False + + def __target_socket_close(self, connection): + connection_handler = connection["Connection handler"] + if connection["Target socket id"] is not None: + connection_handler.add_checkers("CLOSE:%s" % connection["Target socket id"]) + self.tc_action.send_ssc_command("soc -T -s %s" % connection["Target socket id"]) + serial_result, tcp_result = connection_handler.get_checker_results() + connection["Target socket id"] = None + else: + serial_result = None + return True if serial_result is not None else False + + @staticmethod + def __pc_socket_close(connection): + connection_handler = connection["Connection handler"] + if connection["PC socket"] is not None: + connection_handler.add_checkers("CLOSED:%s" % connection["Target socket id"]) + connection["PC socket"].close() + serial_result, tcp_result = connection_handler.get_checker_results() + connection["PC socket"] = None + else: + serial_result = None + return True if serial_result is not None else False + + def close_d_01(self, connection): + connection["PC socket"] = None + return self.__target_socket_close(connection) + + def close_d_02(self, connection): + pass + + def close_d_03(self, connection): + with self.sync_lock: + self.pc_close_wait_socket_list.append(connection["PC socket"]) + return self.__target_socket_close(connection) + pass + + def close_d_04(self, connection): + pass + + def close_d_05(self, connection): + return self.__pc_socket_close(connection) + + def close_d_06(self, connection): + # target send data to PC, PC don't recv and close socket + connection_handler = connection["Connection handler"] + connection_handler.add_checkers("SEND:%s,OK" % connection["Target socket id"]) + self.tc_action.send_ssc_command("soc -S -s %s -l 100" % connection["Target socket id"]) + serial_result, tcp_result = connection_handler.get_checker_results() + if serial_result is None: + return False + return self.__pc_socket_close(connection) + + def close_d_07(self, connection): + # PC shutdown WR + result = False + try: + connection["PC socket"].shutdown(socket.SHUT_WR) + result = True + except StandardError: + pass + return result + + def close_d_08(self, connection): + pass + + def close_connection(self, connection): + self.__target_socket_close(connection) + pass + + TCP_ACTION_DICT = {"C_01": connect_c_01, + "C_02": connect_c_02, + "C_03": connect_c_03, + "C_04": connect_c_04, + "C_05": connect_c_05, + "C_06": connect_c_06, + "C_07": connect_c_07, + "C_08": connect_c_08, + "D_01": close_d_01, + "D_02": close_d_02, + "D_03": close_d_03, + "D_04": close_d_04, + "D_05": close_d_05, + "D_06": close_d_06, + "D_07": close_d_07, + "D_08": close_d_08, + } + + def get_method_destination_state(self, method): + return self.METHOD_RESULT[method] + + def execute_tcp_method(self, method, connection): + if method in self.METHOD_RESULT: + result = self.TCP_ACTION_DICT[method](self, connection) + if result is True: + state = self.get_method_destination_state(method) + connection["Target state"] = state[0] + connection["PC state"] = state[1] + else: + NativeLog.add_prompt_trace("[TCPConnection] tcp method %s fail, connection is %s" + % (method, connection)) + NativeLog.add_trace_info("[TCPConnection][data cache][check item %s] %s" + % (connection["Connection handler"].serial_check_item_id, + connection["Connection handler"].data_cache)) + else: + raise StandardError("Not TCP connection method") + return result + + def is_established_state(self, connection): + return True if connection["Target state"] in self.SOC_CREATED_STATE else False + + def is_closed_state(self, connection): + return True if connection["Target state"] in self.SOC_CLOSED_STATE else False + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPDataValidation.py b/components/test/TestCaseScript/TCPStress/TCPDataValidation.py new file mode 100755 index 0000000000..b056af38fa --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPDataValidation.py @@ -0,0 +1,244 @@ +import os +import random +import threading +import socket +import time +import re + +from TCAction import TCActionBase +from TCAction import PerformanceTCBase +from NativeLog import NativeLog + + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") + + +AP_PROP_KEY = ("ssid", "password", "apc") + + +def calc_hash(index): + return (index & 0xffffffff) % 83 + (index & 0xffffffff) % 167 + + +def verify_data(data, start_index): + for i, c in enumerate(data): + if ord(c) != calc_hash(start_index + i): + NativeLog.add_trace_critical("[Data Validation Error] target sent data index %u is error." + " Sent data is %x, should be %x" + % (start_index + i, ord(c), calc_hash(start_index + i))) + return False + return True + + +def make_validation_data(length, start_index): + return bytes().join([chr(calc_hash(start_index + i)) for i in range(length)]) + + +class SendThread(threading.Thread): + def __init__(self, sock, send_len): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.send_len = send_len + self.exit_event = threading.Event() + pass + + def exit(self): + self.exit_event.set() + + def run(self): + index = 0 + while self.exit_event.isSet() is False: + data = make_validation_data(self.send_len, index) + try: + self.sock.send(data) + index += self.send_len + except StandardError: + # pass but not exit thread + time.sleep(1) + continue + pass + + +class RecvThread(threading.Thread): + def __init__(self, sock): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.exit_event = threading.Event() + + def exit(self): + self.exit_event.set() + + def run(self): + index = 0 + while self.exit_event.isSet() is False: + if self.sock is not None: + try: + data = self.sock.recv(8*1024) + except StandardError, e: + NativeLog.add_exception_log(e) + NativeLog.add_trace_critical("recv error, connection closed") + break + if verify_data(data, index) is not True: + break + index += len(data) + else: + time.sleep(1) + pass + + +class ValidationThread(threading.Thread): + def __init__(self, tc_action): + threading.Thread.__init__(self) + self.setDaemon(True) + self.tc_action = tc_action + self.exit_event = threading.Event() + + def exit(self): + self.exit_event.set() + + def run(self): + while self.exit_event.isSet() is False: + if self.tc_action.check_response("SSC1", "DATA_ERROR", 5) is True: + NativeLog.add_trace_critical("[Data Validation Error] target recv data error") + break + pass + + +class TCPDataValidation(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.send_len = 1460 + self.tx_enable = True + self.rx_enable = True + self.conn_num = 1 + self.test_time = 300 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + + try: + # configurable params + send_len = self.send_len + tx_enable = self.tx_enable + rx_enable = self.rx_enable + conn_num = self.conn_num + test_time = self.test_time * 60 # convert minutes to seconds + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) + raise StandardError("Error configuration") + + # init throughput result data + test_item = "" + if tx_enable is True: + test_item += "Tx" + if rx_enable is True: + test_item += "Rx" + if test_item == "": + raise StandardError("no throughput test item") + + pc_ip = self.get_parameter("pc_ip") + tcp_port = random.randint(10000, 50000) + + # disable recv print during throughput test + self.serial_write_line("SSC1", "soc -R -o 0") + if self.check_response("SSC1", "+RECVPRINT", 2) is False: + NativeLog.add_trace_critical("Fail, Fail to disable recv print") + + # create server + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, tcp_port)) + server_sock.settimeout(5) + server_sock.listen(5) + + sock_id_list = [] + send_thread_list = [] + recv_thread_list = [] + + # step 4 create tcp connection + for i in range(conn_num): + self.serial_write_line("SSC1", "soc -B -t TCP") + match = self.check_regular_expression("SSC1", re.compile("\+BIND:(\d+),OK"), 2) + if match is None: + NativeLog.add_trace_critical("Fail, Fail to bind") + return + else: + sock_id_list.append(int(match.group(1))) + + self.serial_write_line("SSC1", "soc -V -s %s -o 3" % sock_id_list[-1]) + if self.check_regular_expression("SSC1", re.compile("\+DATA_VALIDATION:\d+,OK"), 2) is None: + NativeLog.add_trace_critical("Fail, Failed to enable validation") + return + + self.serial_write_line("SSC1", "soc -C -s %s -i %s -p %s" % (sock_id_list[-1], pc_ip, tcp_port)) + try: + sock, addr = server_sock.accept() + except socket.error, e: + NativeLog.add_trace_critical("%s" % e) + raise e + + if self.check_regular_expression("SSC1", re.compile("\+CONNECT:\d+,OK"), 5) is None: + NativeLog.add_trace_critical("Fail, Failed to connect") + return + + sock.settimeout(10) + + send_thread_list.append(SendThread(sock if rx_enable is True else None, send_len)) + recv_thread_list.append(RecvThread(sock if tx_enable is True else None)) + recv_thread_list[-1].start() + + # step 5 do test + validation_thread = ValidationThread(self) + validation_thread.start() + + for send_thread in send_thread_list: + send_thread.start() + + if tx_enable is True: + # do send from target + for sock_id in sock_id_list: + self.serial_write_line("SSC1", "soc -S -s %s -l %s -n 10000000" % (sock_id, send_len)) + + time1 = time.time() + exit_flag = False + + while time.time() - time1 < test_time and exit_flag is False: + for i in sock_id_list: + send_thread_list[i].join(0.5) + recv_thread_list[i].join(0.5) + validation_thread.join(0.5) + if send_thread_list[i].isAlive() is False \ + or recv_thread_list[i].isAlive() is False \ + or validation_thread.isAlive() is False: + NativeLog.add_trace_critical("validation error found") + exit_flag = True + break + else: + self.set_result("Succeed") + + # exit all thread + for i in sock_id_list: + send_thread_list[i].exit() + recv_thread_list[i].exit() + send_thread_list[i].join() + send_thread_list[i].join() + + validation_thread.exit() + validation_thread.join() + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPRandomSend.py b/components/test/TestCaseScript/TCPStress/TCPRandomSend.py new file mode 100755 index 0000000000..5a07a2d965 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPRandomSend.py @@ -0,0 +1,103 @@ +import os +import time +import random +import threading +import socket +from TCAction import TCActionBase +from NativeLog import NativeLog +from NativeLog import ThroughputResult + + +class TCPRandomSend(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.send_len_config = range(1460) + self.delay_config = [0, 0.01, 0.1, 0.5, 1] + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len_config = self.send_len_config + delay_config = self.delay_config + send_count = self.send_count + test_time = self.test_time * 60 + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) + raise StandardError("Error configuration") + + # disable recv print during random send test + checker_stings = ["R SSC1 C +RECVPRINT"] + test_action_string = ["SSC SSC1 soc -R -o 0"] + fail_string = "Fail, Fail to disable recv print" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + pc_ip = self.test_env.get_variable_by_name("pc_ip")[1] + tcp_port = random.randint(50000, 60000) + + # step 0 create tcp connection + + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, tcp_port)) + server_sock.settimeout(1) + server_sock.listen(5) + + checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t TCP"] + fail_string = "Fail, Fail bind" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["P SSC1 RE \+CONNECT:\d+,OK"] + test_action_string = ["SSC SSC1 soc -C -s -i %s -p %s" % (pc_ip, tcp_port)] + fail_string = "Fail, Fail to connect" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + sock, addr = server_sock.accept() + sock.settimeout(10) + # set no delay so that tcp segment will be send as soon as send called + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + + # step 1 start send + start_time = time.time() + while time.time() - start_time < test_time: + for delay in delay_config: + for i in xrange(send_count): + send_len = random.choice(send_len_config) + data = "A" * (send_len+1) + try: + sock.send(data) + except socket.error, e: + NativeLog.add_exception_log(e) + return + pass + time.sleep(delay) + + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPSendRecv.py b/components/test/TestCaseScript/TCPStress/TCPSendRecv.py new file mode 100755 index 0000000000..e14d7f04d4 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPSendRecv.py @@ -0,0 +1,143 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import time +import random +import string + +TEST_COUNT_ONE_ROUND = 1000 + + +class TCPSendRecv(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + # step 0 turn on recv print + checker_stings = ["R SSC1 C +RECVPRINT:1"] + test_action_string = ["SSC SSC1 soc -R -o 1"] + fail_string = "Fail, Fail to turn on recv print" + self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len = self.send_len + test_time = self.test_time * 60 + duplex = self.duplex + conn_num = self.conn_num + send_delay = self.send_delay + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPSendRecv script, error is %s" % e) + raise StandardError("Error configuration") + + ssid = "".join([random.choice(string.lowercase) for m in range(10)]) + password = "".join([random.choice(string.lowercase) for m in range(10)]) + + # step 0 set ap + checker_stings = ["R SSC1 C +SAP:OK"] + test_action_string = ["SSC SSC1 ap -S -s %s -p %s -t 3" % (ssid, password)] + fail_string = "Fail, Fail to set ap" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 1 connect to ap and turn off recv print + checker_stings = ["R SSC2 C +JAP:CONNECTED"] + test_action_string = ["SSC SSC2 sta -C -s %s -p %s" % (ssid, password)] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: + return + + checker_stings = ["P SSC1 C +RECVPRINT:0", "P SSC2 C +RECVPRINT:0"] + test_action_string = ["SSC SSC1 soc -R -o 0", "SSC SSC2 soc -R -o 0"] + fail_string = "Fail, Fail to turn off recv print" + self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: + return + + # step 2 create server on AP + checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t TCP -p "] + fail_string = "Fail, Fail to create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 A :\+LISTEN:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -L -s "] + fail_string = "Fail, Fail to create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 3 create conn_num tcp connections + for i in range(conn_num): + checker_stings = ["R SSC2 A :\+BIND:(\d+),OK" % i] + test_action_string = ["SSC SSC2 soc -B -t TCP"] + fail_string = "Fail, Fail to bind" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["P SSC1 A :\+ACCEPT:(\d+),\d+" % i, + "P SSC2 RE \+CONNECT:\d+,OK"] + test_action_string = ["SSC SSC2 soc -C -s -i -p " % i] + fail_string = "Fail, Fail to connect" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + # step 4, do send/recv + while time.time()-start_time < test_time: + + checker_stings = ["P SSC1 NC ERROR NC CLOSE"] + for i in range(conn_num): + test_action_string = ["SSC SSC2 soc -S -s -l %d -n %d -j %d" % + (i, send_len, TEST_COUNT_ONE_ROUND, send_delay)] + checker_stings.append("P SSC2 RE \"\+SEND:%%%%s,OK\"%%%%() NC ERROR NC CLOSE" % i) + + if duplex is True: + checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%()" % i) + test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % + (i, send_len, TEST_COUNT_ONE_ROUND, send_delay)) + + fail_string = "Fail, Failed on send command" + if self.load_and_exe_one_step([], test_action_string, fail_string) is False: + break + # if self.load_and_exe_one_step([], ["SSC SSC1 ram -H", "SSC SSC2 ram -H"], fail_string) is False: + # break + # time.sleep(0.1) + + fail_string = "Fail, Failed to send/recv data" + if self.load_and_exe_one_step(checker_stings, ["DELAY 0.1"], fail_string, + check_freq=1, check_time=300) is False: + break + pass + + NativeLog.add_prompt_trace("time escape: %s" % (time.time() - start_time)) + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + + diff --git a/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py b/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py new file mode 100644 index 0000000000..de31bacc11 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py @@ -0,0 +1,318 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import time +import random +import string + +TEST_COUNT_ONE_ROUND = 500 + + +class TCPSoftAPSTASendRecv(TCActionBase.CommonTCActionBase): + def __init__(self, name, test_env, cmd_set, timeout=45, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len = self.send_len + # test count + test_count = self.test_count + # server port + server_port = self.server_port + server_port_t = self.server_port_2 + # ap ip + # ap_ip = self.ap_ip + # server echo + server_echo = self.server_echo + # station number + sta_number = self.sta_number + # pass standard + pass_standard = self.pass_standard + # send delay + send_delay = self.send_delay + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) + raise StandardError("Error configuration") + + # step0 reboot + checker_stings = [] + test_action_string = [] + + for i in range(sta_number + 2): + checker_stings.append("P SSC%d C !!!ready!!!" % (i + 1)) + test_action_string.append("SSCC SSC%d reboot" % (i + 1)) + + fail_string = "Fail, Fail to reboot" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step1, set ap/STA mode on all target + for i in range(sta_number + 2): + checker_stings = ["R SSC%d C +MODE:OK" % (i + 1)] + test_action_string = ["SSCC SSC%d op -S -o 3" % (i + 1)] + fail_string = "Fail, Fail to set mode on SSC%d" % (i + 1) + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # set different getway for SSC1 softAP + checker_stings = ["R SSC1 C +DHCP:AP,OK"] + test_action_string = ["SSCC SSC1 dhcp -E -o 2"] + fail_string = "Fail, SSC1 Fail to disable DHCP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 C +IP:OK"] + test_action_string = ["SSCC SSC1 ip -S -o 2 -i 192.168.6.1"] + fail_string = "Fail, SSC1 Fail to set IP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 C +DHCP:AP,OK"] + test_action_string = ["SSCC SSC1 dhcp -S -o 2"] + fail_string = "Fail, SSC1 Fail to enable DHCP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # set different getway for SSC2 softAP + checker_stings = ["R SSC2 C +DHCP:AP,OK"] + test_action_string = ["SSCC SSC2 dhcp -E -o 2"] + fail_string = "Fail, SSC2 Fail to disable DHCP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC2 C +IP:OK"] + test_action_string = ["SSCC SSC2 ip -S -o 2 -i 192.168.5.1"] + fail_string = "Fail, SSC2 Fail to set IP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC2 C +DHCP:AP,OK"] + test_action_string = ["SSCC SSC2 dhcp -S -o 2"] + fail_string = "Fail, SSC2 Fail to enable DHCP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step2, set ssid/password on SSC1 + ssid = "".join([random.choice(string.lowercase) for m in range(10)]) + password = "".join([random.choice(string.lowercase) for m in range(10)]) + checker_stings = ["R SSC1 C +SAP:OK"] + test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] + fail_string = "Fail, Fail to set ssid/password on SSC1" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step3, set ssid/password on SSC2 + ssid_1 = "".join([random.choice(string.lowercase) for m in range(10)]) + password_1 = "".join([random.choice(string.lowercase) for m in range(10)]) + checker_stings = ["R SSC2 C +SAP:OK"] + test_action_string = ["SSCC SSC2 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid_1, password_1)] + fail_string = "Fail, Fail to set ap ssid/password on SSC2" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step4, SSC2 join SSC1(soft AP) + checker_stings = [] + test_action_string = [] + checker_stings.append("P SSC2 C +JAP:CONNECTED,%s" % ssid) + test_action_string.append("SSCC SSC2 ap -C -s %s -p %s" % (ssid, password)) + fail_string = "Fail, Fail to connect to SSC1 SoftAP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + # step5, create server on SSC1 + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] + fail_string = "Fail, Fail to create server on SSC1 while binding" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -L -s "] + fail_string = "Fail, Fail to create server on SSC1 while listening" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step6, create client on SSC2 + checker_stings = [] + test_action_string = [] + checker_stings.append("P SSC2 A :BIND:(\d+),OK") + test_action_string.append("SSCC SSC2 soc -B -t TCP") + fail_string = "Fail, SSC2 Fail to connect to server while binding" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["P SSC2 RE CONNECT:(\d+),OK", "P SSC1 A :ACCEPT:(\d+),.+"] + test_action_string = ["SSCC SSC2 soc -C -s -i %s -p %s" % ("192.168.6.1", server_port)] + fail_string = "Fail, SSC2 Fail to connect to server while connecting" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step7, SSC3 - SSC5 join SSC2 + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d C +JAP:CONNECTED,%s" % (i + 3, ssid_1)) + test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i + 3, ssid_1, password_1)) + fail_string = "Fail, SSC%d Fail to connect to SSC2" % (i + 3) + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=450) is False: + return + + # step8, create server on SSC2 + checker_stings = ["R SSC2 A :BIND:(\d+),OK"] + test_action_string = ["SSCC SSC2 soc -B -t TCP -p %s -i 192.168.5.1" % server_port_t] + fail_string = "Fail, Fail to create server one SSC2 while binding" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC2 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC2 soc -L -s "] + fail_string = "Fail, Fail to create server one SSC2 while listening" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step9, create client on SSC3 - SSC5 + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 3, i + 3)) + test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 3)) + fail_string = "Fail, Fail to connect to SSC2 server while binding" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for i in range(sta_number): + checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 3), + "P SSC2 A :ACCEPT:(\d+),.+" % (i + 3)] + test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % + (i + 3, i + 3, "192.168.5.1", server_port_t)] + fail_string = "Fail, Fail to connect to SSC2 server while connecting" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + # step 10, do send/recv + while test_count > 0: + _tmp_count = TEST_COUNT_ONE_ROUND if test_count - TEST_COUNT_ONE_ROUND > 0 else test_count + test_count -= TEST_COUNT_ONE_ROUND + + checker_stings = [] + test_action_string = [] + if server_echo is True: + test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % + (send_len, _tmp_count, send_delay)) + checker_stings.append("P SSC1 RE \+SEND:\d+,OK NC CLOSED") + test_action_string.append("SSC SSC2 soc -S -s -l %d -n %d -j %d" % + (send_len, _tmp_count, send_delay)) + checker_stings.append("P SSC2 RE \+SEND:\d+,OK NC CLOSED") + + for i in range(sta_number): + checker_stings.append("P SSC%d RE \+SEND:\d+,OK NC CLOSED" % (i + 3)) + test_action_string.append("SSC SSC%d soc -S -s -l %d -n %d -j %d" % + (i + 3, i + 3, send_len, _tmp_count, send_delay)) + for i in range(sta_number): + test_action_string.append("SSC SSC2 soc -S -s -l %d -n %d -j %d" % + (i + 3, send_len, _tmp_count, send_delay)) + checker_stings.append("P SSC2 RE \+SEND:\d+,OK NC CLOSED") + + fail_string = "Fail, Failed to send/recv data" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=300) is False: + break + pass + + if (time.time() - start_time) > pass_standard: + self.result_cntx.set_result("Succeed") + else: + checker_stings = [] + test_action_string = [] + for i in range(sta_number + 2): + checker_stings.append("P SSC%d C CLOSEALL" % (i + 1)) + test_action_string.append("SSCC SSC%d soc -T" % (i + 1)) + fail_string = "Fail, Fail to close socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + # re-set server on SSC1 + server_port = random.randint(20000, 30000) + checker_stings = ["R SSC1 A :BIND:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] + fail_string = "Fail, Fail to bind socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC1 soc -L -s "] + fail_string = "Fail, Fail to listen" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + # SSC2 connnect SSC1 + checker_stings = [] + test_action_string = [] + checker_stings.append("P SSC2 A :BIND:(\d+),OK") + test_action_string.append("SSCC SSC2 soc -B -t TCP") + fail_string = "Fail, SSC2 Fail to bind sock" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + checker_stings = ["P SSC2 RE CONNECT:(\d+),OK", "P SSC1 A :ACCEPT:(\d+),.+"] + test_action_string = ["SSCC SSC2 soc -C -s -i %s -p %s" % ("192.168.6.1", server_port)] + fail_string = "Fail, SSC2 Fail to connect to SSC1 server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + #create server on SSC2 + checker_stings = [] + test_action_string = [] + checker_stings.append("P SSC2 A :BIND:(\d+),OK") + test_action_string.append("SSCC SSC2 soc -B -t TCP -p %s -i 192.168.5.1" % server_port_t) + fail_string = "Fail, SSC2 Fail to bind" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + checker_stings = ["R SSC2 RE LISTEN:(\d+),OK"] + test_action_string = ["SSCC SSC2 soc -L -s "] + fail_string = "Fail, SSC2 Fail to listen" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + #create client on SSC3-SSC5 + checker_stings = [] + test_action_string = [] + for i in range(sta_number): + checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 3, i + 3)) + test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 3)) + fail_string = "Fail, Fail to connect to SSC2 server while binding" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for i in range(sta_number): + checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 3), + "P SSC2 A :ACCEPT:(\d+),.+" % (i + 3)] + test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % + (i + 3, i + 3, "192.168.5.1", server_port_t)] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + self.result_cntx.set_result("Failed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/TCPThroughput.py b/components/test/TestCaseScript/TCPStress/TCPThroughput.py new file mode 100755 index 0000000000..0c40603e37 --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/TCPThroughput.py @@ -0,0 +1,315 @@ +import os +import time +import random +import threading +import socket + +from TCAction import TCActionBase +from NativeLog import NativeLog +from NativeLog import ThroughputResult +from Utility import RSSICalibrator +from Utility import MakeFolder + + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") + + +AP_PROP_KEY = ("ssid", "password", "apc") + + +class SendThread(threading.Thread): + def __init__(self, sock, send_len): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.send_len = send_len + self.exit_event = threading.Event() + self.calc_event = threading.Event() + self.bytes_sent = 0 + pass + + def start_calc(self): + self.calc_event.set() + + def stop_calc(self): + self.calc_event.clear() + self.exit_event.set() + + def run(self): + data = "A" * self.send_len + if self.sock is None: + return + while True: + if self.exit_event.isSet() is True: + break + try: + self.sock.send(data) + except StandardError: + break + if self.calc_event.isSet() is True: + self.bytes_sent += self.send_len + + def get_bytes_sent(self): + return self.bytes_sent + pass + + +class RecvThread(threading.Thread): + def __init__(self, sock): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.exit_event = threading.Event() + self.calc_event = threading.Event() + self.bytes_recv = 0 + + def start_calc(self): + self.calc_event.set() + + def stop_calc(self): + self.calc_event.clear() + self.exit_event.set() + + def run(self): + if self.sock is None: + return + while True: + if self.exit_event.isSet() is True: + break + try: + data = self.sock.recv(8*1024) + except StandardError: + break + if self.calc_event.isSet() is True: + self.bytes_recv += len(data) + + def get_bytes_recv(self): + return self.bytes_recv + pass + + +class TCPThroughput(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.att_test_list = range(60) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # read AP list + self.ap_list = [] + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + ap_list = self.ap_list + send_len = self.send_len + att_test_list = self.att_test_list + tx_enable = self.tx_enable + rx_enable = self.rx_enable + measure_period = self.measure_period + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) + raise StandardError("Error configuration") + + # find local ip and generate local port + local_ip_list = socket.gethostbyname_ex(socket.gethostname())[2] + for local_ip in local_ip_list: + if local_ip.find("192.168.1.") != -1: + pc_ip = local_ip + break + else: + raise StandardError("Can't find local IP.") + + tcp_port = random.randint(40000, 50000) + + # init throughput result data + test_item = "" + if tx_enable is True: + test_item += "Tx" + if rx_enable is True: + test_item += "Rx" + if test_item == "": + raise StandardError("no throughput test item") + + folder_path = MakeFolder.make_folder(LOG_FOLDER) + file_name = os.path.join(folder_path, + "TCPThroughput_%s_%s" % (test_item, time.strftime("%d%H%M%S", time.localtime()))) + + result = ThroughputResult.ThroughputResult(file_name, standard_required=True) + + # restart before executing throughput + checker_stings = ["R SSC1 C !!!ready!!!"] + test_action_string = ["SSC SSC1 reboot"] + fail_string = "Fail, Fail to reboot" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # disable recv print during throughput test + checker_stings = ["R SSC1 C +RECVPRINT"] + test_action_string = ["SSC SSC1 soc -R -o 0"] + fail_string = "Fail, Fail to disable recv print" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for ap_prop in ap_list: + if ap_prop["password"] == "": + # set a default string for open ap + ap_prop["password"] = "1" + + # switch off all outlet, switch on AP outlet + outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") + outlet_config_dict[ap_prop["apc"]] = "ON" + apc_cmd = "APC " + for outlet in outlet_config_dict: + apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) + checker_stings = ["P PC_COM L OK"] + fail_string = "Fail, Fail to switch apc" + if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: + return + + # wait AP ready + time.sleep(20) + + # create server + server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) + server_sock.bind((pc_ip, tcp_port)) + server_sock.settimeout(5) + server_sock.listen(5) + + if tx_enable is True: + result.add_test_item(ap_prop["ssid"] + "_tx") + if rx_enable is True: + result.add_test_item(ap_prop["ssid"] + "_rx") + + # create RSSI Calibrator + calibrator = RSSICalibrator.Calibrator() + + for att_value in att_test_list: + # step 0 set att value + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT %s" % att_value] + fail_string = "Fail, Fail to set att value" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + # step 1 connect to AP + checker_stings = ["R SSC1 C +JAP:CONNECTED"] + test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] + fail_string = "Fail, Fail to JAP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=30) is False: + continue + # step 2 get AP RSSI + checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)" % ap_prop["ssid"]] + test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] + fail_string = "Fail, Fail to scan" + rssi = scan_count = 0 + for i in range(3): + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + rssi += int(self.test_env.get_variable_by_name("rssi")[1]) + scan_count += 1 + + rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) + + # step 3 close all connections + checker_stings = ["R SSC1 C +CLOSEALL"] + test_action_string = ["SSC SSC1 soc -T"] + fail_string = "Fail, Fail to create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + # step 4 create tcp connection + + checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t TCP"] + fail_string = "Fail, Fail bind" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + checker_stings = ["P SSC1 RE \+CONNECT:\d+,OK"] + test_action_string = ["SSC SSC1 soc -C -s -i %s -p %s" % (pc_ip, tcp_port)] + fail_string = "Fail, Fail to connect" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + try: + sock, addr = server_sock.accept() + except socket.error, e: + NativeLog.add_trace_critical("%s" % e) + continue + sock.settimeout(measure_period) + + # step 5 do throughput test + send_thread = SendThread(sock if rx_enable is True else None, send_len) + send_thread.start() + + recv_thread = RecvThread(sock if tx_enable is True else None) + recv_thread.start() + + if tx_enable is True: + # do send from target + test_action_string = ["SSC SSC1 soc -S -s -l %s -n 10000000" % send_len] + fail_string = "Fail, Fail to send" + if self.load_and_exe_one_step([], test_action_string, fail_string) is False: + pass + + # start throughput calculate + send_thread.start_calc() + recv_thread.start_calc() + + # sleep for measure period + time.sleep(measure_period) + + # stop throughput calculate + send_thread.stop_calc() + recv_thread.stop_calc() + + send_thread.join() + recv_thread.join() + + sock.close() + + # output throughput result + # in Mbps + if send_thread.get_bytes_sent() > 0: + result.log_throughput(ap_prop["ssid"] + "_rx", rssi, att_value, + float(send_thread.get_bytes_sent() * 8) / (measure_period * 1000000)) + + if recv_thread.get_bytes_recv() > 0: + result.log_throughput(ap_prop["ssid"] + "_tx", rssi, att_value, + float(recv_thread.get_bytes_recv() * 8) / (measure_period * 1000000)) + + result.output_to_file() + pass + + server_sock.close() + + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/TCPStress/__init__.py b/components/test/TestCaseScript/TCPStress/__init__.py new file mode 100755 index 0000000000..049c1b961f --- /dev/null +++ b/components/test/TestCaseScript/TCPStress/__init__.py @@ -0,0 +1 @@ +__all__ = ["TCPConnUtility", "TCPConnSingleMode", "TCPConnMixedMode"] \ No newline at end of file diff --git a/components/test/TestCaseScript/UDPStress/UDPSendRecv.py b/components/test/TestCaseScript/UDPStress/UDPSendRecv.py new file mode 100755 index 0000000000..3a528c6ba7 --- /dev/null +++ b/components/test/TestCaseScript/UDPStress/UDPSendRecv.py @@ -0,0 +1,130 @@ +from TCAction import TCActionBase +from NativeLog import NativeLog +import time +import random +import string + +TEST_COUNT_ONE_ROUND = 1000 + + +class UDPSendRecv(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def cleanup(self): + # step 0 turn on recv print + checker_stings = ["R SSC1 C +RECVPRINT:1"] + test_action_string = ["SSC SSC1 soc -R -o 1"] + fail_string = "Fail, Fail to turn on recv print" + self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + send_len = self.send_len + test_time = self.test_time * 60 + duplex = self.duplex + conn_num = self.conn_num + send_delay = self.send_delay + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for UDPSendRecv script, error is %s" % e) + raise StandardError("Error configuration") + + ssid = "".join([random.choice(string.lowercase) for m in range(10)]) + password = "".join([random.choice(string.lowercase) for m in range(10)]) + + # step 0 set ap + checker_stings = ["R SSC1 C +SAP:OK"] + test_action_string = ["SSC SSC1 ap -S -s %s -p %s -t 3" % (ssid, password)] + fail_string = "Fail, Fail to set ap" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # step 1 connect to ap and turn off recv print + checker_stings = ["R SSC2 C +JAP:CONNECTED"] + test_action_string = ["SSC SSC2 sta -C -s %s -p %s" % (ssid, password)] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: + return + + checker_stings = ["R SSC2 A :\+STAIP:(\d+\.\d+\.\d+\.\d+)\r"] + test_action_string = ["SSC SSC2 ip -Q -o 1"] + fail_string = "Fail, Fail to connect to server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: + return + + checker_stings = ["P SSC1 C +RECVPRINT:0", "P SSC2 C +RECVPRINT:0"] + test_action_string = ["SSC SSC1 soc -R -o 0", "SSC SSC2 soc -R -o 0"] + fail_string = "Fail, Fail to turn off recv print" + self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: + return + + # step 2 create conn_num udp socket + for i in range(1, conn_num+1): + checker_stings = ["R SSC1 A :\+BIND:(\d+),OK" % i, + "R SSC2 A :\+BIND:(\d+),OK" % i] + test_action_string = ["SSC SSC1 soc -B -t UDP -p " % i, + "SSC SSC2 soc -B -t UDP -p " % i] + fail_string = "Fail, Fail to create socket" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + start_time = time.time() + # step 3, do send/recv + while time.time()-start_time < test_time: + + checker_stings = ["P SSC1 NC ERROR NC CLOSE"] + for i in range(1, conn_num+1): + test_action_string = ["SSC SSC2 soc -S -s -l %d -n %d -j %d " + "-i -p " % + (i, send_len, TEST_COUNT_ONE_ROUND, send_delay, i)] + checker_stings.append("P SSC2 RE \"\+SEND:%%%%s,OK\"%%%%() NC ERROR NC CLOSE" % i) + if duplex is True: + test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" + " -i -p " % + (i, send_len, TEST_COUNT_ONE_ROUND, send_delay, i)) + checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%()" % i) + + fail_string = "Fail, Failed on send command" + if self.load_and_exe_one_step([], test_action_string, fail_string) is False: + break + time.sleep(1) + + fail_string = "Fail, Failed to send/recv data" + if self.load_and_exe_one_step(checker_stings, ["DELAY 0.1"], fail_string, + check_freq=1, check_time=300) is False: + break + pass + + NativeLog.add_prompt_trace("time escape: %s" % (time.time() - start_time)) + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() + + diff --git a/components/test/TestCaseScript/UDPStress/UDPThroughput.py b/components/test/TestCaseScript/UDPStress/UDPThroughput.py new file mode 100755 index 0000000000..dac7c2206b --- /dev/null +++ b/components/test/TestCaseScript/UDPStress/UDPThroughput.py @@ -0,0 +1,305 @@ +import os +import time +import random +import threading +import socket + +from TCAction import TCActionBase +from NativeLog import NativeLog +from NativeLog import ThroughputResult +from Utility import RSSICalibrator +from Utility import MakeFolder + + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") + + +AP_PROP_KEY = ("ssid", "password", "apc") + + +class SendThread(threading.Thread): + def __init__(self, sock, send_len, target_addr): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.send_len = send_len + self.target_addr = target_addr + self.exit_event = threading.Event() + pass + + def exit(self): + self.exit_event.set() + + def run(self): + data = "A" * self.send_len + if self.sock is None: + return + while True: + if self.exit_event.isSet() is True: + break + try: + self.sock.sendto(data, self.target_addr) + except StandardError: + break + pass + + +class RecvThread(threading.Thread): + def __init__(self, sock): + threading.Thread.__init__(self) + self.setDaemon(True) + self.sock = sock + self.exit_event = threading.Event() + self.calc_event = threading.Event() + self.bytes_recv = 0 + + def start_calc(self): + self.calc_event.set() + + def stop_calc(self): + self.calc_event.clear() + self.exit_event.set() + + def run(self): + if self.sock is None: + return + while True: + if self.exit_event.isSet() is True: + break + try: + data, addr = self.sock.recvfrom(65535) + except StandardError: + break + if self.calc_event.isSet() is True: + self.bytes_recv += len(data) + + def get_bytes_recv(self): + return self.bytes_recv + pass + + +class UDPThroughput(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.att_test_list = range(60) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # read AP list + self.ap_list = [] + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" + exec cmd_string + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + ap_list = self.ap_list + send_len = self.send_len + att_test_list = self.att_test_list + tx_enable = self.tx_enable + rx_enable = self.rx_enable + measure_period = self.measure_period + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) + raise StandardError("Error configuration") + + # find local ip and generate local port + local_ip_list = socket.gethostbyname_ex(socket.gethostname())[2] + for local_ip in local_ip_list: + if local_ip.find("192.168.1.") != -1: + pc_ip = local_ip + break + else: + raise StandardError("Can't find local IP.") + + udp_port = random.randint(40000, 50000) + + # init throughput result data + test_item = "" + if tx_enable is True: + test_item += "Tx" + if rx_enable is True: + test_item += "Rx" + if test_item == "": + raise StandardError("no throughput test item") + + folder_path = MakeFolder.make_folder(LOG_FOLDER) + file_name = os.path.join(folder_path, + "UDPThroughput_%s_%s" % (test_item, time.strftime("%d%H%M%S", time.localtime()))) + + result = ThroughputResult.ThroughputResult(file_name) + + # restart before executing throughput + checker_stings = ["R SSC1 C !!!ready!!!"] + test_action_string = ["SSC SSC1 reboot"] + fail_string = "Fail, Fail to reboot" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + # disable recv print during throughput test + checker_stings = ["R SSC1 C +RECVPRINT"] + test_action_string = ["SSC SSC1 soc -R -o 0"] + fail_string = "Fail, Fail to disable recv print" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + return + + for ap_prop in ap_list: + if ap_prop["password"] == "": + # set a default string for open ap + ap_prop["password"] = "1" + + # switch off all outlet, switch on AP outlet + outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") + outlet_config_dict[ap_prop["apc"]] = "ON" + apc_cmd = "APC " + for outlet in outlet_config_dict: + apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) + checker_stings = ["P PC_COM L OK"] + fail_string = "Fail, Fail to switch apc" + if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: + return + + # wait AP ready + time.sleep(20) + + # create server + udp_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) + udp_sock.bind((pc_ip, udp_port)) + udp_sock.settimeout(1) + + if tx_enable is True: + result.add_test_item(ap_prop["ssid"] + "_tx") + if rx_enable is True: + result.add_test_item(ap_prop["ssid"] + "_rx") + + # create RSSI Calibrator + calibrator = RSSICalibrator.Calibrator() + + for att_value in att_test_list: + # step 0 set att value + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT %s" % att_value] + fail_string = "Fail, Fail to set att value" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + # step 1 connect to AP + checker_stings = ["R SSC1 C +JAP:CONNECTED"] + test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] + fail_string = "Fail, Fail to JAP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=30) is False: + continue + checker_stings = ["R SSC1 A :STAIP:(\d+\.\d+\.\d+\.\d+)"] + test_action_string = ["SSC SSC1 ip -Q"] + fail_string = "Fail, Fail to get ip" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=30) is False: + continue + target_ip = self.get_parameter("target_ip") + # step 2 get AP RSSI + checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)\r" % ap_prop["ssid"]] + test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] + fail_string = "Fail, Fail to scan" + rssi = scan_count = 0 + for i in range(3): + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + rssi += int(self.test_env.get_variable_by_name("rssi")[1]) + scan_count += 1 + + rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) + + # step 3 close all connections + checker_stings = ["R SSC1 C +CLOSEALL"] + test_action_string = ["SSC SSC1 soc -T"] + fail_string = "Fail, Fail to create server" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + # step 4 create UDP socket + checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] + test_action_string = ["SSC SSC1 soc -B -t UDP -i %s -p %s" % (target_ip, udp_port)] + fail_string = "Fail, Fail bind" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + # step 5 do throughput test + send_thread = SendThread(udp_sock if rx_enable is True else None, + send_len, (target_ip, udp_port)) + send_thread.start() + + recv_thread = RecvThread(udp_sock if tx_enable is True else None) + recv_thread.start() + + if tx_enable is True: + # do send from target + test_action_string = ["SSC SSC1 soc -S -s -l %s -n 10000000 -i %s -p %s" + % (send_len, pc_ip, udp_port)] + fail_string = "Fail, Fail to send" + if self.load_and_exe_one_step([], test_action_string, fail_string) is False: + pass + + # start throughput calculate + recv_thread.start_calc() + + # sleep for measure period + time.sleep(measure_period) + + # stop throughput calculate + recv_thread.stop_calc() + send_thread.exit() + + send_thread.join() + recv_thread.join() + + # output throughput result + # in Mbps + if rx_enable is True: + # get received data len from PC + self.load_and_exe_one_step(["R SSC1 A :RECVLEN:(\d+)"], + ["SSC SSC1 soc -Q -s -o 1"], + "Fail, Fail to get recv data len") + try: + rx_data_len = int(self.get_parameter("recv_len")) + except StandardError: + rx_data_len = 0 + + result.log_throughput(ap_prop["ssid"] + "_rx", rssi, att_value, + float(rx_data_len * 8) / (measure_period * 1000000)) + + if recv_thread.get_bytes_recv() > 0: + result.log_throughput(ap_prop["ssid"] + "_tx", rssi, att_value, + float(recv_thread.get_bytes_recv() * 8) / (measure_period * 1000000)) + + result.output_to_file() + pass + + udp_sock.close() + + self.result_cntx.set_result("Succeed") + + # finally, execute done + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/UDPStress/__init__.py b/components/test/TestCaseScript/UDPStress/__init__.py new file mode 100755 index 0000000000..d29ee405a4 --- /dev/null +++ b/components/test/TestCaseScript/UDPStress/__init__.py @@ -0,0 +1 @@ +__all__ = ["UDPSendRecv", ] diff --git a/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py b/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py new file mode 100755 index 0000000000..70a1169f20 --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py @@ -0,0 +1,178 @@ +import random +import time +import string +import threading + +from TCAction import TCActionBase +from NativeLog import NativeLog +from TCAction import PerformanceTCBase +from Utility import Encoding + + +class STAJAPThread(threading.Thread): + def __init__(self, test_action, port_name, ssid, password, delay1, delay2, change_mac): + threading.Thread.__init__(self) + self.setDaemon(True) + self.test_action = test_action + self.port_name = port_name + self.ssid = ssid + self.password = password + self.delay1 = delay1 + self.delay2 = delay2 + self.change_mac = change_mac + self.exit_flag = threading.Event() + pass + + def exit(self): + self.exit_flag.set() + pass + + def run(self): + total_test_count = 0 + fail_count = 0 + while self.exit_flag.isSet() is False: + # change mac + if self.change_mac is True: + mac = Encoding.generate_random_mac() + self.test_action.serial_write_line(self.port_name, "mac -S -o 1 -m %s" % mac) + self.test_action.check_response(self.port_name, "+MAC:STA,OK") + + time.sleep(1) + + # JAP + total_test_count += 1 + # flush current port data + self.test_action.flush_data(self.port_name) + self.test_action.serial_write_line(self.port_name, "sta -C -s %s -p %s" % (self.ssid, self.password)) + if self.test_action.check_response(self.port_name, "+JAP:CONNECTED", 45) is False: + fail_count += 1 + NativeLog.add_trace_critical("[%s] Failed to JAP, Failed/Total : %d/%d" + % (self.port_name, fail_count, total_test_count)) + continue + time.sleep(random.randint(self.delay1[0], self.delay1[1])) + + # QAP + self.test_action.serial_write_line(self.port_name, "sta -D") + if self.test_action.check_response(self.port_name, "+QAP:OK", 5) is False: + NativeLog.add_trace_critical("[%s] Failed to QAP" % self.port_name) + time.sleep(random.randint(self.delay2[0], self.delay2[1])) + + # make sure quit AP + self.test_action.serial_write_line(self.port_name, "sta -D") + pass + pass + + +class SoftAPNSTA(PerformanceTCBase.PerformanceTCBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.sta_num = 0 + self.max_sta = 4 + self.test_time = 60 + self.delay1 = [5, 30] + self.delay2 = [5, 10] + self.change_mac = True + self.channel = 11 + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + pass + + def process(self): + # configurable parameters + try: + sta_num = self.sta_num + max_sta = self.max_sta + test_time = self.test_time + # delay between JAP succeed and QAP + delay1 = self.delay1 + # delay between QAP and JAP + delay2 = self.delay2 + # if change mac each time before JAP + change_mac = self.change_mac + # channel + channel = self.channel + except StandardError, e: + raise StandardError("miss mandatory parameters") + + # step 0, set op mode and enable dhcp + self.serial_write_line("SSC1", "op -S -o 2") + if self.check_response("SSC1", "+MODE:OK", 2) is False: + NativeLog.add_trace_critical("Failed to set ap mode") + return + self.serial_write_line("SSC1", "dhcp -E -o 2") + if self.check_response("SSC1", "+DHCP:AP,OK", 2) is False: + NativeLog.add_trace_critical("Failed to enable ap dhcp") + return + self.serial_write_line("SSC1", "dhcp -L -s 192.168.4.2 -e 192.168.4.100 -t 1") + if self.check_response("SSC1", "+DHCP:LEASE,OK", 2) is False: + NativeLog.add_trace_critical("Failed to enable ap dhcp") + return + self.serial_write_line("SSC1", "dhcp -S -o 2") + if self.check_response("SSC1", "+DHCP:AP,OK", 2) is False: + NativeLog.add_trace_critical("Failed to enable ap dhcp") + return + + for i in range(sta_num): + self.serial_write_line("SSC%d" % (i+2), "op -S -o 1") + if self.check_response("SSC%d" % (i+2), "+MODE:OK", 2) is False: + NativeLog.add_trace_critical("Failed to set sta mode") + return + self.serial_write_line("SSC%d" % (i+2), "dhcp -S -o 1") + if self.check_response("SSC%d" % (i+2), "+DHCP:STA,OK", 2) is False: + NativeLog.add_trace_critical("Failed to enable sta dhcp") + + # step 1, set ap config and load + ap_ssid = "".join([random.choice(string.uppercase) for m in range(15)]) + ap_password = "".join([random.choice(string.lowercase) for m in range(15)]) + + self.serial_write_line("SSC1", "ap -S -s %s -p %s -t 3 -m %s -n %s" + % (ap_ssid, ap_password, max_sta, channel)) + if self.check_response("SSC1", "+SAP:OK", 2) is False: + NativeLog.add_trace_critical("Failed to set AP") + return + + # step 2, start thread to let STA JAP + sta_thread_list = [] + for i in range(sta_num): + sta_thread_list.append(STAJAPThread(self, "SSC%d" % (i+2), + ap_ssid, ap_password, delay1, delay2, change_mac)) + for sta_thread in sta_thread_list: + sta_thread.start() + + # step 3, sleep for test time + for i in range(test_time): + self.flush_data("SSC1") + time.sleep(60) + + # step 4, close all thread, will disconnect when exit thread + for sta_thread in sta_thread_list: + sta_thread.exit() + for sta_thread in sta_thread_list: + sta_thread.join() + # wait and make sure disconnect done + time.sleep(1) + + # step 5, join AP and check + sta_num_temp = max_sta if sta_num > max_sta else sta_num + + for i in range(sta_num_temp): + self.serial_write_line("SSC%d" % (i+2), "sta -C -s %s -p %s" % (ap_ssid, ap_password)) + if self.check_response("SSC%d" % (i+2), "+JAP:CONNECTED", 45) is False: + self.set_result("Fail") + break + pass + else: + self.set_result("Succeed") + + +def main(): + pass + +if __name__ == '__main__': + main() + diff --git a/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py b/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py new file mode 100755 index 0000000000..24702bfc8d --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py @@ -0,0 +1,240 @@ +from NativeLog import NativeLog +import time +import random + + +ERROR_AP_PROP = {"ssid": "123456789012345678901234567890", + "ssid_len": 30, + "pwd": "12345678901234567890", + "pwd_len": 20, + "channel": 10, + "enc": 3, + "apc": 9, # invalid apc count + } + + +class WifiConnUtilError(StandardError): + pass + + +class WifiConnUtility(object): + + def __init__(self, tc_action): + self.tc_action = tc_action + self.target_type = tc_action.target_type + pass + + def set_mode(self, mode): + ret = True + fail_string = "set mode fail" + cmd = [] + checker_stings = [] + for i in range(2): + if self.target_type[0] == "SSC": + cmd.append("SSCC SSC%d op -S -o %d" % (i+1, mode[i])) + checker_stings.append("SSCP SSC%d C +MODE:OK" % (i+1)) + pass + else: + cmd.append("ATC AT%d CWMODE %d" % (i+1, mode[i])) + checker_stings.append("ATP AT%d L OK" % (i+1)) + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Failed to set mode") + ret = False + return ret + pass + + def _apc_switch(self, outlet_list, action_list): + checker_stings = ["R PC_COM C OK"] + switch_cmd = "APC " + fail_string = "Error when switching APC" + ret = True + + for [_outlet, _action] in zip(action_list, outlet_list): + switch_cmd += " %s %d" % (_action, _outlet) + + if self.tc_action.load_and_exe_one_step(checker_stings, [switch_cmd], + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("Error when switching APC") + ret = False + return ret + pass + + def _set_target_ap(self, ap_prop): + ret = True + fail_string = "set target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + if self.target_type[1] == "SSC": + if ap_prop["pwd"] == "": + cmd = ["SSCC SSC2 ap -S -s %s -t %d" % (ap_prop["ssid"], + ap_prop["enc"]) + ] + else: + cmd = ["SSCC SSC2 ap -S -s %s -p %s -t %d" % (ap_prop["ssid"], + ap_prop["pwd"], + ap_prop["enc"]) + ] + checker_stings = ["SSCP SSC2 C +SAP:OK"] + pass + else: + cmd = ["ATC AT2 CWSAP \"%s\" \"%s\" %d %d" % (ap_prop["ssid"], + ap_prop["pwd"], + ap_prop["channel"], + ap_prop["enc"]) + ] + checker_stings = ["ATR AT2 L OK"] + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical("set target ap fail") + ret = False + return ret + pass + + def setup_ap(self, ap_type, ap_prop): + if ap_type == "target": + ret = self._set_target_ap(ap_prop) + pass + else: + ret = self._apc_switch(["ON"], [ap_prop["apc"]]) + # delay for 5 seconds, wait AP ready + time.sleep(5) + pass + return ret + + def do_scan(self, ap_prop): + fail_string = "Scan fail" + ret = True + # do not check if the set AP can be scanned + if self.target_type[1] == "SSC": + cmd = ["SSCC SSC1 sta -S"] + checker_stings = ["SSCR SSC1 C +SCANDONE"] + pass + else: + cmd = ["ATS AT1 AT+CWLAP"] + checker_stings = ["ATR AT1 L OK"] + pass + if self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=100) is False: + NativeLog.add_trace_critical("Scan fail") + ret = False + return ret + pass + + def _switch_off_target_ap(self, delay): + time.sleep(delay) + self._set_target_ap(ERROR_AP_PROP) + pass + + def _switch_on_target_ap(self, ap_prop, delay): + time.sleep(delay) + self._set_target_ap(ap_prop) + pass + + def _switch_off_ap(self, ap_type, ap_prop, delay_range): + delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 + if ap_type == "target": + self._switch_off_target_ap(delay) + else: + delay -= 1.5 + time.sleep(delay if delay > 0 else 0) + self._apc_switch(["OFF"], [ap_prop["apc"]]) + pass + + def _switch_on_ap(self, ap_type, ap_prop, delay_range): + delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 + if ap_type == "target": + self._switch_on_target_ap(ap_prop, delay) + else: + delay -= 1.5 + time.sleep(delay if delay > 0 else 0) + self._apc_switch(["ON"], [ap_prop["apc"]]) + pass + + def _join_ap(self, ap_prop, test_method): + fail_string = "join target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + if self.target_type[1] == "SSC": + cmd = ["SSCC SSC1 ap -C -s %s -p %s" % (ap_prop["ssid"], + ap_prop["pwd"],) + ] + checker_stings = ["SSCR SSC1 C +JAP:CONNECTED"] + pass + else: + cmd = ["ATC AT1 CWJAP \"%s\" \"%s\"" % (ap_prop["ssid"], + ap_prop["pwd"]) + ] + checker_stings = ["ATR AT1 NC ERROR NC FAIL L OK"] + pass + if test_method == "Normal": + ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_freq=0.1, check_time=350) + if ret is not False: + ret *= 0.1 + else: + ret = self.tc_action.load_and_exe_one_step([], cmd, fail_string) + return ret + pass + + def _check_join_ap_result(self, ap_prop): + ret = False + fail_string = "join ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) + + if self.target_type[1] == "SSC": + checker_stings = ["SSCR SSC1 C +JAP:CONNECTED"] + ret = self.tc_action.load_and_exe_one_step(checker_stings, ["DELAY 0"], + fail_string, check_freq=1, check_time=120) + pass + else: + cmd = ["ATS AT1 AT+CWJAP?"] + checker_stings = ["ATR AT1 NC busy NC No%20AP C +CWJAP"] + for i in range(3): + ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_freq=1, check_time=2) + if ret is not False: + break + time.sleep(15) + + return ret + pass + + def join_ap(self, join_test_method, ap_type, ap_prop, delay): + + if join_test_method == "WRONG_PROP": + _prop = ERROR_AP_PROP + else: + _prop = ap_prop + + ret = self._join_ap(_prop, join_test_method) + + if join_test_method == "OFF_ON": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + self._switch_on_ap(ap_type, ap_prop, delay[1]) + ret = self._check_join_ap_result(_prop) + pass + elif join_test_method == "OFF": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + time.sleep(25) + pass + + return ret + pass + + def do_reconnect(self, reconnect_test_method, ap_type, ap_prop, delay): + ret = True + if reconnect_test_method == "OFF_ON": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + self._switch_on_ap(ap_type, ap_prop, delay[1]) + ret = self._check_join_ap_result(ap_prop) + pass + elif reconnect_test_method == "OFF": + self._switch_off_ap(ap_type, ap_prop, delay[0]) + pass + return ret + pass + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiJAP.py b/components/test/TestCaseScript/WiFiStress/WifiJAP.py new file mode 100755 index 0000000000..20dd28041e --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/WifiJAP.py @@ -0,0 +1,218 @@ +import os +import random +import time + +import WifiConnUtility +from NativeLog import NativeLog +from TCAction import TCActionBase +from Utility import Encoding +from Utility import MakeFolder + +STEPS = {"SCAN1": 0x01, "JAP": 0x02, "SCAN2": 0x04, "RECONNECT": 0x08} + +AP_PROP = ("ssid", "ssid_len", "pwd", + "pwd_len", "channel", "enc", "apc") + +JAP_TEST_METHOD = ("Normal", "OFF_ON", "OFF", "WRONG_PROP") + +RECONNECT_TEST_METHOD = ("OFF_ON", "OFF") + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") + + +SSID_LEN_RANGE = (1, 32) # in bytes +ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP +PWD_RANGE = {0: [0, 0], + 1: [5, 5], + 2: [8, 63], + 3: [8, 63], + 4: [8, 63], + } + + +class WifiJAP(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # default value for optional configurable params + self.pwd_len = [8, 64] + self.step_config = [0x03, 0x01, 0x02, 0x0B, 0x0F] + self.join_test_method = ["Normal"] + self.join_delay = [[1.5, 5], [1.5, 5]] + self.reconnect_test_method = ["OFF_ON"] + self.reconnect_delay = [[1.5, 5], [1.5, 6]] + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # read AP list + self.ap_list = [] + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROP, " + cmd_set[i][1][j] + ")))" + exec cmd_string + + folder_path = MakeFolder.make_folder(LOG_FOLDER) + file_name = "JAP_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) + self._performance_log_file = os.path.join(folder_path, file_name) + + # test statistics + self._succeed_count = self._fail_count = self._time_cost_count = 0 + self._total_time = self._longest_time = 0 + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + # get target type "SSC" or "AT" + self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] + self.target_type.append("SSC" if test_env.get_port_by_name("AT2") is None else "AT") + self._utility = WifiConnUtility.WifiConnUtility(self) + pass + + def _generate_random_ap_prop(self): + ap_prop = dict.fromkeys(AP_PROP) + # generate target ap_value + ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) + ap_prop["channel"] = random.choice(range(1, 14)) + ap_prop["enc"] = random.choice(ENC_TYPE) + ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) + # generate string + if self.target_type[0] == self.target_type[1] == "AT": + ap_prop["ssid"] = Encoding.generate_random_utf8_str(ap_prop["ssid_len"]) + ap_prop["pwd"] = Encoding.generate_random_utf8_str(ap_prop["pwd_len"]) + # NativeLog.add_trace_info("ssid hex is : %x" % ap_prop["ssid"]) + # NativeLog.add_trace_info("pwd hex is : %x" % ap_prop["pwd"]) + else: + ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) + ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) + + return ap_prop + + def _logging_performance(self, ssid, join_method="Normal", time_cost=0): + # log performance to performance log file + with open(self._performance_log_file, "ab+") as f: + # log time and ssid + f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % + (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) + if join_method == "Normal" or join_method == "OFF_ON": + if time_cost is not False: + self._succeed_count += 1 + if join_method == "Normal": + f.write("[Succeed][%f]\r\n" % time_cost) + self._longest_time = (time_cost > self._longest_time and + [time_cost] or [self._longest_time])[0] + self._time_cost_count += 1 + self._total_time += time_cost + else: + f.write("[Succeed][%s]\r\n" % join_method) + else: + self._fail_count += 1 + f.write("[Fail][%s]\r\n" % join_method) + pass + + def _logging_fail_step(self, ssid, step): + with open(self._performance_log_file, "ab+") as f: + f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % + (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) + f.write("[Fail][%s]\r\n" % step) + pass + + def _generate_performance_report(self): + with open(self._performance_log_file, "ab+") as f: + f.write("[Test report] Succeed: %d\r\n" % self._succeed_count) + f.write("[Test report] Failed: %d\r\n" % self._fail_count) + if self._succeed_count > 0 or self._fail_count > 0: + f.write("[Test report] Pass Rate: %f\r\n" % + (self._succeed_count/(self._fail_count+self._succeed_count))) + if self._time_cost_count > 0: + f.write("[Test report] Average time: %f\r\n" % (self._total_time/self._time_cost_count)) + f.write("[Test report] Longest time: %f\r\n" % self._longest_time) + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # mandatory configurable params + try: + target_ap_num = self.target_ap_num + test_count = self.test_count + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) + raise StandardError("Error configuration") + + # prepare ap list + _ap_list = [["target", None]] * target_ap_num + for _ap_prop in self.ap_list: + _ap_list.append(["AP", _ap_prop]) + + # set to correct mode first + self._utility.set_mode([1, 2]) + + for i in xrange(test_count): + _ap = random.choice(_ap_list) + # arrange ap + _ap_type = _ap[0] + _ap_prop = _ap[1] + if _ap_type == "target": + _ap_prop = self._generate_random_ap_prop() + pass + + # step 1 : mandatory step, set up AP + if self._utility.setup_ap(_ap_type, _ap_prop) is False: + self._logging_fail_step(_ap_prop["ssid"], "Set AP") + NativeLog.add_prompt_trace("[Step1] setup AP Fail") + continue + step_config = random.choice(self.step_config) + NativeLog.add_prompt_trace("[Step1] setup AP succeed") + + # step 2 : optional step, do scan before connect + if step_config & STEPS["SCAN1"] != 0: # check option + if self._utility.do_scan(_ap_prop) is False: + self._logging_fail_step(_ap_prop["ssid"], "Scan before JAP") + NativeLog.add_prompt_trace("[Step2] Scan Done") + + # step 3 : mandatory step, join AP + if step_config & STEPS["JAP"] != 0: # check option + _join_test_method = random.choice(self.join_test_method) + time_cost = self._utility.join_ap(_join_test_method, _ap_type, _ap_prop, self.join_delay) + # log performance to performance log file + self._logging_performance(_ap_prop["ssid"], _join_test_method, time_cost) + if time_cost is False: + # do scan once to check if AP exist + self._utility.do_scan(_ap_prop) + continue + NativeLog.add_prompt_trace("[Step3] Join AP done") + + # step 4 : optional step, scan after join AP + if step_config & STEPS["SCAN2"] != 0: # check option + if self._utility.do_scan(_ap_prop) is False: + self._logging_fail_step(_ap_prop["ssid"], "Scan after JAP") + NativeLog.add_prompt_trace("[Step4] Scan done") + + # step 5 : optional step, reconnect test + if step_config & STEPS["RECONNECT"] != 0: # check option + _reconnect_test_method = random.choice(self.reconnect_test_method) + if self._utility.do_reconnect(_reconnect_test_method, + _ap_type, _ap_prop, self.reconnect_delay) is False: + self._logging_fail_step(_ap_prop["ssid"], "Reconnect") + + NativeLog.add_prompt_trace("[Step5] Reconnect done") + # continue to next loop + NativeLog.add_prompt_trace("[WifiJAP] Test count %d done" % i) + + # generate report and cleanup + self._generate_performance_report() + + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py b/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py new file mode 100755 index 0000000000..2c2eadc79d --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py @@ -0,0 +1,173 @@ +import os +import time +from TCAction import TCActionBase +from NativeLog import NativeLog +from Utility import RSSICalibrator +from Utility import MakeFolder + +MAX_RSSI = 0 +MIN_RSSI = -110 +MAX_ATT = 60 +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") +AP_PROP_KEY = ("ssid", "password", "apc") + + +class Performance(object): + def __init__(self): + self.succeed_rssi = dict.fromkeys(range(MIN_RSSI, MAX_RSSI), 0) + self.failed_rssi = dict.fromkeys(range(MIN_RSSI, MAX_RSSI), 0) + self.failed_att = dict.fromkeys(range(MAX_ATT), 0) + pass + + def log_performance(self, result, att, rssi): + if result == "Succeed": + self.succeed_rssi[rssi] += 1 + else: + if rssi == 0: + self.failed_att[att] += 1 + else: + self.failed_rssi[rssi] += 1 + pass + + def __str__(self): + data = "Succeed:\r\n" + for rssi in self.succeed_rssi: + if self.succeed_rssi[rssi] > 0: + data += "\tRSSI%4d: %2d times\r\n" % (rssi, self.succeed_rssi[rssi]) + + data += "Failed during scan:\r\n" + for att in self.failed_att: + if self.failed_att[att] > 0: + data += "\tATT%3d: %2d times\r\n" % (att, self.failed_att[att]) + + data += "Failed during JAP:\r\n" + for rssi in self.failed_rssi: + if self.failed_rssi[rssi] > 0: + data += "\tRSSI%4d: %2d times\r\n" % (rssi, self.failed_rssi[rssi]) + + return data + pass + + +class WifiJAPAtt(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + self.att_test_list = range(60) + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + # read AP list + self.ap_list = [] + for i in range(1, len(cmd_set)): + for j in range(len(cmd_set[i][1])): + if cmd_set[i][1][j] != "": + cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" + exec cmd_string + + self.performance = dict([(ap_prop["ssid"], Performance()) for ap_prop in self.ap_list]) + # create log file + folder_path = MakeFolder.make_folder(LOG_FOLDER) + self.performance_log = os.path.join(folder_path, + "JAP_Att_%s.log" % time.strftime("%d%H%M%S", time.localtime())) + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def log_performance(self, att, rssi, ssid, result): + NativeLog.add_prompt_trace("[%s][ssid %s] [att %s] [rssi %s]" % (result, ssid, att, rssi)) + data = "" + self.performance[ssid].log_performance(result, att, rssi) + for _ssid in self.performance: + data += "[ssid] %s\r\n%s\r\n" % (_ssid, self.performance[_ssid]) + with open(self.performance_log, "wb+") as f: + f.write(data) + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + try: + # configurable params + ap_list = self.ap_list + att_test_list = self.att_test_list + test_count = self.test_count + # configurable params + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for JAPAtt script, error is %s" % e) + raise StandardError("Error configuration") + + for x in xrange(test_count): + for ap_prop in ap_list: + if ap_prop["password"] == "": + # set a default string for open ap + ap_prop["password"] = "1" + + # switch off all outlet, switch on AP outlet + outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") + outlet_config_dict[ap_prop["apc"]] = "ON" + apc_cmd = "APC " + for outlet in outlet_config_dict: + apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) + checker_stings = ["P PC_COM L OK"] + fail_string = "Fail, Fail to switch apc" + if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: + return + + # wait AP ready + time.sleep(20) + + # create RSSI Calibrator + calibrator = RSSICalibrator.Calibrator() + + for att_value in att_test_list: + # step 0 set att value + checker_stings = ["R PC_COM L OK"] + test_action_string = ["ATT %s" % att_value] + fail_string = "Fail, Fail to set att value" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: + continue + + # step 1 get AP RSSI + checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)" % ap_prop["ssid"]] + test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] + fail_string = "Fail, Fail to scan" + rssi = scan_count = 0 + for i in range(3): + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=5) is False: + self.log_performance(att_value, 0, ap_prop["ssid"], "Failed to measure RSSI") + continue + rssi += int(self.test_env.get_variable_by_name("rssi")[1]) + scan_count += 1 + + rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) + + # step 2 connect to AP + checker_stings = ["R SSC1 C +JAP:CONNECTED"] + test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] + fail_string = "Fail, Fail to JAP" + if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, + check_freq=1, check_time=45) is False: + self.log_performance(att_value, rssi, ap_prop["ssid"], "Failed to JAP") + continue + + self.log_performance(att_value, rssi, ap_prop["ssid"], "Succeed") + + # finally, execute done + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py b/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py new file mode 100755 index 0000000000..3a95a920fb --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py @@ -0,0 +1,273 @@ +import random +import os +import time +import copy + +from TCAction import TCActionBase +from NativeLog import NativeLog +from Utility import Encoding +from Utility import MakeFolder + +AP_PROP = ("ssid", "ssid_len", "pwd", + "pwd_len", "channel", "enc", "apc") + +SMART_TYPE = ("esp-touch", "airkiss") + +TEST_METHOD = ("ssid_broadcast", "ssid_hidden") + +HT = ("ht20", "ht40") + +TEST_STAT = ("total count", "fail count", "total time", "longest time") + +_TEST_STAT_INIT_DICT = {"total count": 0, + "fail count": 0, + "total time": 0, + "longest time": 0, + } + +LOG_FOLDER = os.path.join("AT_LOG", "Performance", "SmartConfig") + + +SSID_LEN_RANGE = (1, 32) # in bytes +ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP +PWD_RANGE = {0: [0, 0], + 1: [5, 5], + 2: [8, 32], + 3: [8, 32], + 4: [8, 32], + } + + +class WifiSmartConfig(TCActionBase.CommonTCActionBase): + + def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): + TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, + timeout=timeout, log_path=log_path) + # default value for optional configurable params + self.test_method = ["ssid_hidden", "ssid_broadcast"] + self.bssid = "ff:ff:ff:ff:ff:ff" + self.ht_ap = dict(zip(HT, [("", ""), + ("", "")])) + self.ap_channel = {"ht20": 1, "ht40": 1} + self.delay_time = 3 # default 3s, wait for scan done + # load param from excel + for i in range(1, len(cmd_set)): + if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": + cmd_string = "self." + cmd_set[i][0] + exec cmd_string + + folder_path = MakeFolder.make_folder(LOG_FOLDER) + file_name = "SmartConfig_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) + self._performance_log_file = os.path.join(folder_path, file_name) + + # type + self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] + self.target_type.append("SSC" if test_env.get_port_by_name("AT2") is None else "AT") + + # test statistics + # better ways to create? + _test_stat = dict.fromkeys(TEST_STAT, 0) + _test_method = dict.fromkeys(TEST_METHOD) + _test_ht = dict.fromkeys(HT) + self.test_stat = dict.fromkeys(SMART_TYPE) + for i in SMART_TYPE: + self.test_stat[i] = copy.deepcopy(_test_ht) + for j in HT: + self.test_stat[i][j] = copy.deepcopy(_test_method) + for k in TEST_METHOD: + self.test_stat[i][j][k] = copy.deepcopy(_test_stat) + + self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) + pass + + def _generate_random_ap_prop(self, ht_type): + ap_prop = dict.fromkeys(AP_PROP) + # generate target ap_value + ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) + ap_prop["channel"] = self.ap_channel[ht_type] + ap_prop["enc"] = random.choice(ENC_TYPE) + ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) + ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) + ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) + + return ap_prop + + def _logging_performance(self, time_cost, ssid, password, smart_type, test_method, ht_type): + # update test statistics + stat = self.test_stat[smart_type][ht_type][test_method] + stat["total count"] += 1 + # log performance to performance log file + with open(self._performance_log_file, "ab+") as f: + # log time and ssid + if time_cost is not False: + time_tmp = float(time_cost)/10 + f.write("\r\n[%s]:\r\n[Succeed] [%.2f]\r\n" % + (time.strftime("%m-%d %H:%M:%S", time.localtime()), time_tmp)) + stat["total time"] += time_tmp + stat["longest time"] = time_tmp if time_tmp > stat["longest time"] else stat["longest time"] + else: + f.write("\r\n[%s]:\r\n[Fail]\r\n" % + time.strftime("%m-%d %H:%M:%S", time.localtime())) + stat["fail count"] += 1 + + f.write("[%s] [%s] [%s]\r\n" % + (smart_type, test_method, ht_type)) + f.write("[ssid] %s \r\n[password] %s\r\n" % + (ssid, password)) + pass + + def _generate_performance_report(self): + with open(self._performance_log_file, "ab+") as f: + for i in SMART_TYPE: + for j in HT: + for k in TEST_METHOD: + stat = self.test_stat[i][j][k] + f.write("\r\n[Test report] [%s] [%s] [%s]\r\n" % (i, j, k)) + if stat["total count"] > 0: + f.write("[Total]: %d\r\n" % stat["total count"]) + f.write("[Failed]: %d\r\n" % stat["fail count"]) + f.write("[Fail ratio]: %.2f%%\r\n" % + (float(stat["fail count"])/stat["total count"] * 100)) + f.write("[Longest time cost]: %.2f\r\n" % stat["longest time"]) + if (stat["total count"] - stat["fail count"]) > 0: + f.write("[Average time cost]: %.2f\r\n" % + (stat["total time"]/(stat["total count"]-stat["fail count"]))) + + @staticmethod + def cmd_exception_catcher(e): + raise e + pass + + def execute(self): + TCActionBase.TCActionBase.execute(self) + self.result_cntx.start() + + # mandatory configurable params + try: + test_count = self.test_count + delay_time = self.delay_time + except StandardError, e: + NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) + raise StandardError("Error configuration") + + # step 0 : set AT1 mode + fail_string = "Fail to restore init condition" + if self.target_type[0] == "AT": + cmd = ["ATS AT1 AT+CWMODE=1"] + checker_stings = ["R AT1 L OK"] + else: + cmd = ["SSC SSC1 op -S -o 1"] + checker_stings = ["R SSC1 C +MODE:OK"] + if self.target_type[1] == "AT": + cmd.append("ATS AT2 AT+CWMODE=2") + checker_stings.append("R AT2 L OK") + else: + cmd.append("SSC SSC2 op -S -o 2") + checker_stings.append("R SSC2 C +MODE:OK") + + if self.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=150) is False: + NativeLog.add_trace_critical(fail_string) + return + + for i in xrange(test_count): + _method = random.choice(self.test_method) + _ht = random.choice(self.ht) + _ap_prop = self._generate_random_ap_prop(_ht) + _smart_type = random.choice(self.smart_type) + _ht_ap = self.ht_ap[_ht] + is_hidden = 0 if _method == "ssid_broadcast" else 1 + # get ip and + + # step 1 : restore init condition + fail_string = "Fail to restore init condition" + if self.target_type[0] == "AT": + cmd = ["ATS AT1 AT+CWSTOPSMART", "WIFI CONN %s %s " % (_ht_ap[0], _ht_ap[1])] + checker_stings = ["P AT1 L OK", "P PC_COM L OK"] + else: + cmd = ["SSC SSC1 smart -E", "WIFI CONN %s %s " % (_ht_ap[0], _ht_ap[1])] + checker_stings = ["P SSC1 C +SC:OK", "P PC_COM L OK"] + + if self.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=200) is False: + NativeLog.add_trace_critical(fail_string) + continue + NativeLog.add_prompt_trace("Step1 Done") + + # step 2 : test method is ssid_broadcast, then set AP on target 2 + if _method == "ssid_broadcast": + fail_string = "Fail to set AP" + if self.target_type[1] == "AT": + cmd = ["ATS AT2 AT+CWSAP=\"%s\",\"%s\",%d,%d" % (_ap_prop["ssid"], _ap_prop["pwd"], + _ap_prop["channel"], _ap_prop["enc"])] + checker_stings = ["R AT2 L OK"] + else: + cmd = ["SSC SSC2 ap -S -s %s -p %s -n %d -t %d" % (_ap_prop["ssid"], _ap_prop["pwd"], + _ap_prop["channel"], _ap_prop["enc"])] + checker_stings = ["R SSC2 C +SAP:OK"] + + if self.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical(fail_string) + continue + NativeLog.add_prompt_trace("Step2 Done") + + # step 3 : start SMART + fail_string = "Fail to start smart config" + if self.target_type[0] == "AT": + cmd = ["ATS AT1 AT+CWSTARTSMART"] + checker_stings = ["R AT1 L OK"] + else: + cmd = ["SSC SSC1 smart -S -a 0"] + checker_stings = ["R SSC1 C +SC:OK"] + + if self.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=50) is False: + NativeLog.add_trace_critical(fail_string) + continue + # sleep for delay_time seconds to wait scan done or simulate delay config situation + time.sleep(delay_time) + NativeLog.add_prompt_trace("Step3 Done") + + # step 4 : do smart config + fail_string = "Fail in smart config" + cmd = ["SMART %s %s %s %s %d" + % (_smart_type, _ap_prop["ssid"], _ap_prop["pwd"], self.bssid, is_hidden)] + if self.target_type[0] == "AT": + checker_stings = ["P AT1 C Smart%20get%20wifi%20info", + "P LOG1 C %s C %s" % (_ap_prop["ssid"], _ap_prop["pwd"])] + else: + checker_stings = ["P SSC1 C %s C %s" % (_ap_prop["ssid"], _ap_prop["pwd"])] + + try: + time_cost = self.load_and_exe_one_step(checker_stings, cmd, + fail_string, check_time=400, + cmd_exception_catcher=self.cmd_exception_catcher) + except StandardError: + NativeLog.add_prompt_trace("Exception occurred during executing cmd") + continue + pass + self._logging_performance(time_cost, _ap_prop["ssid"], _ap_prop["pwd"], + _smart_type, _method, _ht) + if time_cost is False: + NativeLog.add_prompt_trace(fail_string) + continue + + # continue to next loop + NativeLog.add_prompt_trace("[WifiSmartConfig] Test count %d done" % i) + + # generate report and cleanup + self._generate_performance_report() + + self.result_cntx.set_result("Succeed") + + def result_check(self, port_name, data): + TCActionBase.CommonTCActionBase.result_check(self, port_name, data) + self.result_cntx.append_data(port_name, data) + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/components/test/TestCaseScript/WiFiStress/__init__.py b/components/test/TestCaseScript/WiFiStress/__init__.py new file mode 100755 index 0000000000..7960a3ce80 --- /dev/null +++ b/components/test/TestCaseScript/WiFiStress/__init__.py @@ -0,0 +1 @@ +__all__ = ["WifiJAP", ] \ No newline at end of file diff --git a/components/test/TestCaseScript/__init__.py b/components/test/TestCaseScript/__init__.py new file mode 100755 index 0000000000..0cc319da70 --- /dev/null +++ b/components/test/TestCaseScript/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['ATFunc', "ATStress", "IOT", "MeshStress", "StableTest", "TCPIPStress" + "TCPStress", "UDPStress", "WiFiStress"] diff --git a/components/test/TestEnvAll.yml b/components/test/TestEnvAll.yml new file mode 100644 index 0000000000..703fafcb60 --- /dev/null +++ b/components/test/TestEnvAll.yml @@ -0,0 +1,275 @@ +test environment: +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_SmartConfig, + test environment detail: '2 SSC target connect with PC by UART. + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_SmartConfig, + test environment detail: '2 AT target connect with PC by UART (AT and LOG port). + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_IOT1, + test environment detail: 'PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART. + + AP todo IOT test are placed near SSC1.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO3, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266之间需要测试的Target_GPIO相连', + test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_1, + test environment detail: 'Web Server target connect with PC by UART. + + PC has 1 wired NIC connected to switch. + + APC, AP also connect with swtich. + + All devices connected with switch use same IP subnet. + + APC control AP power supply.', test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_2, + test environment detail: 'Web Server target connect with PC by UART. + + 4 PC with WiFi NIC placed near WebServer1.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO1, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_6相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_Enterprise, + test environment detail: "AP use WPA2-Etherprise is placed near SSC1. \n1 SSC target\ + \ connect with PC by UART.", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO2, test environment detail: '[TBD] 1. 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_15通过面包板相连 + + 2. 可借助面包板, 将GPIO_15, 以及中断函数被打开的8266板的GPIO_2 相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_HighSpeedUART, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 AT target connect with PC by high speed UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_ShieldBox, + test environment detail: '2 SSC target connect with PC by UART. + + Put them to Shield box.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_3, + test environment detail: 'Able to access WAN after connect to AP. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_2, + test environment detail: 'PC has 1 WiFi NIC. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: UART_T1_2, test environment detail: '[TBD] ESP_8266通过UART_0通过USB, UART_1 TXD + 通过 TTLcable 连到PC', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: UART_T1_1, test environment detail: '[TBD] + 将ESP_8266通过UART连到PC', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_ADC, + test environment detail: 'PC has 1 wired NIC connected to AP. + + Analog input connect to AT1 TOUT. + + Multimeter connect to input, able to measure input voltage. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_WEP, + test environment detail: '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ADC, + test environment detail: 'PC has 1 wired NIC connected to AP. + + Analog input connect to SSC1 TOUT. + + Multimeter connect to input, able to measure input voltage. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_APC, + test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ + \ connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with PC by UART.", + test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_8089, + test environment detail: 'PC has 1 wired NIC connected to AP. + + 1 8089 tablet able to run iperf test placed near SSC1. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T1_InitData, + test environment detail: '2 SSC target connect with PC by UART. + + SSC1 use 40M crystal oscillator. + + SSC2 use normal 26M crystal oscillator. + + SSC2 GPIO connect to SSC1 power control pin.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: SSC_T1_Timer, test environment detail: '[TBD] + 通过串口工具调节Timer, 将GPIO_13端口连接到逻辑分析仪', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 3.0, script path: EnvBase.py, tag: SSC_T3_PhyMode, + test environment detail: '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_JAP, + test environment detail: "Several AP are placed near AT target.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC).\nAPC control\ + \ power supply for all APs. \n2 AT target connect with PC by UART (AT and LOG\ + \ port).", test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_PhyMode, + test environment detail: '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ShieldBox, + test environment detail: 'refer to figure. + + All APs and APC should be set to the same IP subnet. + + PC wired NIC should set static IP address within the same subnet with AP. + + Must use onboard wired NIC.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: TempSensor_T1_1, + test environment detail: 'Tempeture sensor target connect with PC by UART. + + AP support DTIM placed with AT target. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of TempSensor1. + + PC has 1 wired NIC connected to switch. + + APC, AP also connect with swtich. + + All devices connected with switch use the same IP subnet. + + APC control AP power supply.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_SmartConfigIOT, + test environment detail: '1 AT target connect with PC by UART (AT and LOG port). + + PC has 1 wired NIC connect to Common AP. + + Several AP are placed near AT target. + + Several smart phone installed test APK are placed near AT target.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_Sleep, + test environment detail: 'AP support DTIM placed with AT target. + + 2 AT target connect with PC by UART (AT and LOG port). + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of AT1. + + AT1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO.', + test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 5.0, script path: EnvBase.py, tag: SSC_T5_1, + test environment detail: 5 SSC target connect with PC by UART., test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_TempBox, + test environment detail: '1 SSC target connect with PC by UART. + + Put SSC target to temperature box.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_1, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T6_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 6 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: IR_T2_1, test environment detail: '[TBD] 本测试为非自动测试, 红外能够做到数据收发吻合即可通过', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_VDD33, + test environment detail: '1 SSC target connect with PC by UART. + + Multimeter connect to VDD33, able to measure voltage.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: PWM_T1_1, test environment detail: "[TBD]\ + \ 1. PWM OS SDK 以及 Non-OS SDK的测试建议分开进行, 放在不同的文件夹, 防止文件命名混淆\n2. 分析CSV文件的Python脚本只能分析单个channel\ + \ \n3. 如果Init脚本打印\"Network Error\" 检查TCP Server是不是正常发送data", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: NVS_T1_1, + test environment detail: '1 NVS target connect with PC by UART. + + 1 SSC target connect with PC by UART. + + SSC2 GPIO connect to NVS1 power control pin.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep2, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s RSTB pin connect with AT2''s GPIO.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep1, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO. + + SSC1''s XPD connect with RSTB.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_1, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_2, + test environment detail: 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC2, + test environment detail: "Able to access WAN after connect to AP.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply.\nPC has 1 WiFi NIC.\n1 AT target connect with PC by UART (AT\ + \ and LOG port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC1, + test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ + \ connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply. \nPC has 1 WiFi NIC. \n1 AT target connect with PC by UART\ + \ (AT and LOG port).", test script: EnvBase} From 2fe759ce1d9595e4b273d10b1dc39e782a3eb5b7 Mon Sep 17 00:00:00 2001 From: Yinling Date: Mon, 26 Sep 2016 14:32:58 +0800 Subject: [PATCH 156/179] update CI config file: 1. add night job define (need to set variable in trigger to run night jobs) 2. move auto generated part to the end of file 3. add auto generated CI jobs --- .gitlab-ci.yml | 201 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 162 insertions(+), 39 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0cea70fa7..0945795753 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -106,46 +106,8 @@ test_build_system: - ./make/test_build_system.sh - -# template for test jobs -.test_template: &test_template - stage: test - when: on_success - only: - - master - - triggers - - variables: - # need user to set SDK_NAME and CONFIG_FILE (may need to set BIN_PATH and APP_NAME later) in before_script - SCRIPT_PATH: /home/gitlab-runner/auto_test_script - BIN_PATH: ${CI_PROJECT_DIR}/SSC/build/ - APP_NAME: ssc - LOG_PATH: $CI_PROJECT_DIR/$CI_BUILD_REF - - artifacts: - when: always - paths: - - $LOG_PATH - expire_in: 6 mos - - script: - - cd $SCRIPT_PATH - - python CIRunner.py -l $LOG_PATH -c $SDK_NAME/$CONFIG_FILE bin_path $APP_NAME $BIN_PATH - -sanity_test: - <<: *test_template - tags: - - ESP32 - - SSC_T1_1 - - SSC_T2_1 - - SSC_T1_WAN - before_script: - - SDK_NAME=ESP32_IDF - - CONFIG_FILE=sanity_test.yml - - push_master_to_github: - before_script: + before_script: - echo "Not setting up GitLab key, not fetching submodules" stage: deploy only: @@ -165,3 +127,164 @@ push_master_to_github: - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - git remote add github git@github.com:espressif/esp-idf.git - git push --follow-tags github HEAD:master + + +# AUTO GENERATED PART START, DO NOT MODIFY CONTENT BELOW +# template for test jobs +.test_template: &test_template + stage: test + when: on_success + only: + - master + - triggers + + variables: + LOCAL_ENV_CONFIG_PATH: "/home/gitlab-runner/LocalConfig/ESP32" + BIN_PATH: "$CI_PROJECT_DIR/SSC/build/" + APP_NAME: "ssc" + LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" + # assume it's tests are put in "components/test" + TEST_CASE_FILE_PATH: "components/test" + # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary + CONFIG_FILE: "jobs must set this variable" + + artifacts: + when: always + paths: + - $LOG_PATH + expire_in: 6 mos + + script: + # assume that auto_test_script is a sub-module of SDK, otherwise add as submodule here + - git submodule update --init --recursive + - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH + + +# template for overnight test jobs +.test_template_night: &test_template_night + <<: *test_template + only: + # can only be triggered + - triggers + script: + # must be night build triggers, otherwise exit without test + - test $NIGHT_BUILD != "Yes" || exit + # assume that auto_test_script is a sub-module of SDK + - git submodule update --init --recursive + - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH + +Function_SYS_01: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_SYS_01.yml + +Function_WIFI_01: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_APC + - SSC_T1_1 + - SSC_T1_WEP + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_WIFI_01.yml + +Function_WIFI_02: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_APC + - SSC_T1_1 + - SSC_T1_WEP + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_WIFI_02.yml + +Function_TCPIP_01: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_01.yml + +Function_TCPIP_02: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_02.yml + +Function_TCPIP_03: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_03.yml + +Function_TCPIP_04: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_04.yml + +Function_TCPIP_05: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_05.yml + +Function_TCPIP_06: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T2_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_06.yml + +Function_TCPIP_07: + <<: *test_template_night + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - SDK_NAME=ESP32_IDF + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=Function_TCPIP_07.yml + From e2dd6ebcf08334c6d4bf16f8a3e3056afb3967d3 Mon Sep 17 00:00:00 2001 From: Yinling Date: Mon, 26 Sep 2016 19:24:51 +0800 Subject: [PATCH 157/179] revise .gitlab-ci.yml: 1. remove duplicated code 2. fix path error for config file --- .gitlab-ci.yml | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0945795753..a0e59d62f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,14 +139,13 @@ push_master_to_github: - triggers variables: - LOCAL_ENV_CONFIG_PATH: "/home/gitlab-runner/LocalConfig/ESP32" + # LOCAL_ENV_CONFIG_PATH: define LOCAL_ENV_CONFIG in jobs because this variable may need complicated logic to generate BIN_PATH: "$CI_PROJECT_DIR/SSC/build/" APP_NAME: "ssc" LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" - # assume it's tests are put in "components/test" - TEST_CASE_FILE_PATH: "components/test" + # assume tests are put in "components/test" + TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/test" # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary - CONFIG_FILE: "jobs must set this variable" artifacts: when: always @@ -179,9 +178,8 @@ Function_SYS_01: - ESP32_IDF - SSC_T1_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_SYS_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_SYS_01.yml Function_WIFI_01: <<: *test_template @@ -192,9 +190,8 @@ Function_WIFI_01: - SSC_T1_WEP - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_WIFI_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_01.yml Function_WIFI_02: <<: *test_template @@ -205,9 +202,8 @@ Function_WIFI_02: - SSC_T1_WEP - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_WIFI_02.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_02.yml Function_TCPIP_01: <<: *test_template @@ -217,9 +213,8 @@ Function_TCPIP_01: - SSC_T1_2 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_01.yml Function_TCPIP_02: <<: *test_template @@ -228,9 +223,8 @@ Function_TCPIP_02: - SSC_T1_1 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_02.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_02.yml Function_TCPIP_03: <<: *test_template @@ -239,9 +233,8 @@ Function_TCPIP_03: - SSC_T1_1 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_03.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_03.yml Function_TCPIP_04: <<: *test_template @@ -251,9 +244,8 @@ Function_TCPIP_04: - SSC_T1_2 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_04.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_04.yml Function_TCPIP_05: <<: *test_template @@ -263,9 +255,8 @@ Function_TCPIP_05: - SSC_T1_2 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_05.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_05.yml Function_TCPIP_06: <<: *test_template @@ -274,9 +265,8 @@ Function_TCPIP_06: - SSC_T1_1 - SSC_T2_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_06.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_06.yml Function_TCPIP_07: <<: *test_template_night @@ -284,7 +274,6 @@ Function_TCPIP_07: - ESP32_IDF - SSC_T1_1 before_script: - - SDK_NAME=ESP32_IDF - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=Function_TCPIP_07.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_07.yml From 99ebc93abb14ee2a6b509bdf8442138472a4ef32 Mon Sep 17 00:00:00 2001 From: Yinling Date: Mon, 26 Sep 2016 19:26:53 +0800 Subject: [PATCH 158/179] modify document to add how to run test locally --- components/test/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/test/README.md b/components/test/README.md index 0e4172d62c..3267e47caf 100644 --- a/components/test/README.md +++ b/components/test/README.md @@ -33,3 +33,15 @@ test --- CIConfigs --- sanity_test1.yml (Runner config files) 2. use [auto_test_script](https://gitlab.espressif.cn:6688/yinling/auto_test_script) to load the modified case and verify the modification 3. create a merge request and assign to HYL (or add comment @yinling for merging test). After review it will be merged to SDK and will be The cases will be synced to database in auto_test_script. + + +## Run test case locally + +1. clone auto_test_script (ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git) from gitlab +2. create test environment: + 1. search test case (search test case ID in components/test/TestCaseAll.yml, get the "test environment" value + 2. goto [test environment list](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Documents/TestEnvList.md), find the link and goto the environment detail page + 3. create test environment according to figure and description + 4. [config test environment](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestEnvConfig.DesignNote.md). All parameters in table "Parameters require config before use" MUST be configured. +3. run test cases with [CIRunner.py](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/RunnerConfigs.DesignNote.md) + From 745ecef2630c468507de04b88d5422bc1bc5264c Mon Sep 17 00:00:00 2001 From: Yinling Date: Tue, 27 Sep 2016 16:22:18 +0800 Subject: [PATCH 159/179] auto_test_script will be cloned from gitlab --- .gitlab-ci.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0e59d62f4..730e72686b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,8 +154,8 @@ push_master_to_github: expire_in: 6 mos script: - # assume that auto_test_script is a sub-module of SDK, otherwise add as submodule here - - git submodule update --init --recursive + - git clone ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git + - cd auto_test_script - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH @@ -168,8 +168,8 @@ push_master_to_github: script: # must be night build triggers, otherwise exit without test - test $NIGHT_BUILD != "Yes" || exit - # assume that auto_test_script is a sub-module of SDK - - git submodule update --init --recursive + - git clone ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git + - cd auto_test_script - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH Function_SYS_01: @@ -185,7 +185,6 @@ Function_WIFI_01: <<: *test_template tags: - ESP32_IDF - - SSC_T1_APC - SSC_T1_1 - SSC_T1_WEP - SSC_T2_1 @@ -197,7 +196,6 @@ Function_WIFI_02: <<: *test_template tags: - ESP32_IDF - - SSC_T1_APC - SSC_T1_1 - SSC_T1_WEP - SSC_T2_1 @@ -277,3 +275,12 @@ Function_TCPIP_07: - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_07.yml +Function_WIFI_03: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_APC + before_script: + - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml + From 4de2054541e9705fbd069676baffd8ad9c146b6c Mon Sep 17 00:00:00 2001 From: Yinling Date: Tue, 27 Sep 2016 16:22:51 +0800 Subject: [PATCH 160/179] fix bugs in config files: 1. filter name is "Add" not "ADD" 2. SSC_T1_APC is special environment 3. remove "debug mode" from config as it will implemented with other ways --- components/test/CIConfigs/Function_SYS_01.yml | 4 +- .../test/CIConfigs/Function_TCPIP_01.yml | 4 +- .../test/CIConfigs/Function_TCPIP_02.yml | 4 +- .../test/CIConfigs/Function_TCPIP_03.yml | 4 +- .../test/CIConfigs/Function_TCPIP_04.yml | 4 +- .../test/CIConfigs/Function_TCPIP_05.yml | 4 +- .../test/CIConfigs/Function_TCPIP_06.yml | 4 +- .../test/CIConfigs/Function_TCPIP_07.yml | 4 +- .../test/CIConfigs/Function_WIFI_01.yml | 14 +- .../test/CIConfigs/Function_WIFI_02.yml | 13 +- .../test/CIConfigs/Function_WIFI_03.yml | 5 + components/test/TestCaseAll.yml | 196 ------------------ components/test/TestEnvAll.yml | 2 +- 13 files changed, 35 insertions(+), 227 deletions(-) create mode 100644 components/test/CIConfigs/Function_WIFI_03.yml diff --git a/components/test/CIConfigs/Function_SYS_01.yml b/components/test/CIConfigs/Function_SYS_01.yml index 501f15f6ba..51a6899029 100644 --- a/components/test/CIConfigs/Function_SYS_01.yml +++ b/components/test/CIConfigs/Function_SYS_01.yml @@ -1,5 +1,5 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: -- ADD: +- Add: ID: [SYS_MISC_0101, SYS_MISC_0201] diff --git a/components/test/CIConfigs/Function_TCPIP_01.yml b/components/test/CIConfigs/Function_TCPIP_01.yml index 9b43ab589b..7eb46ef552 100644 --- a/components/test/CIConfigs/Function_TCPIP_01.yml +++ b/components/test/CIConfigs/Function_TCPIP_01.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [TCPIP_ICMP_0101, TCPIP_ARP_0202, ^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, TCPIP_DHCP_0302, TCPIP_DHCP_0301, TCPIP_ARP_0204, TCPIP_TCP_0412, TCPIP_TCP_0403, TCPIP_TCP_0402, TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, TCPIP_TCP_0404, diff --git a/components/test/CIConfigs/Function_TCPIP_02.yml b/components/test/CIConfigs/Function_TCPIP_02.yml index 7e0a3ead43..0cafa781b9 100644 --- a/components/test/CIConfigs/Function_TCPIP_02.yml +++ b/components/test/CIConfigs/Function_TCPIP_02.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [^TCPIP_IGMP_0104, ^TCPIP_UDP_0110, TCPIP_IGMP_0104, TCPIP_IGMP_0103, TCPIP_IGMP_0102, TCPIP_IGMP_0101, ^TCPIP_UDP_0201, ^TCPIP_ICMP_0101, TCPIP_UDP_0108, TCPIP_UDP_0109, TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0104, TCPIP_UDP_0105, TCPIP_UDP_0102, diff --git a/components/test/CIConfigs/Function_TCPIP_03.yml b/components/test/CIConfigs/Function_TCPIP_03.yml index 33dcd14bea..cdaad25869 100644 --- a/components/test/CIConfigs/Function_TCPIP_03.yml +++ b/components/test/CIConfigs/Function_TCPIP_03.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [^TCPIP_UDP_0305, ^TCPIP_UDP_0304, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0102, ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, diff --git a/components/test/CIConfigs/Function_TCPIP_04.yml b/components/test/CIConfigs/Function_TCPIP_04.yml index af2cc7d22f..3476bb7069 100644 --- a/components/test/CIConfigs/Function_TCPIP_04.yml +++ b/components/test/CIConfigs/Function_TCPIP_04.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, TCPIP_UDP_0114, TCPIP_UDP_0111, TCPIP_UDP_0110, TCPIP_UDP_0113, TCPIP_UDP_0112, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, ^TCPIP_TCP_0207, TCPIP_TCP_0501, ^TCPIP_DNS_0101, ^TCPIP_DNS_0103, ^TCPIP_DNS_0102, diff --git a/components/test/CIConfigs/Function_TCPIP_05.yml b/components/test/CIConfigs/Function_TCPIP_05.yml index a89ece34cc..85b6e72d8b 100644 --- a/components/test/CIConfigs/Function_TCPIP_05.yml +++ b/components/test/CIConfigs/Function_TCPIP_05.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [TCPIP_UDP_0305, TCPIP_UDP_0306, TCPIP_UDP_0307, TCPIP_UDP_0301, TCPIP_UDP_0302, TCPIP_UDP_0303, ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, diff --git a/components/test/CIConfigs/Function_TCPIP_06.yml b/components/test/CIConfigs/Function_TCPIP_06.yml index 929aafd13e..1aceda2b73 100644 --- a/components/test/CIConfigs/Function_TCPIP_06.yml +++ b/components/test/CIConfigs/Function_TCPIP_06.yml @@ -1,7 +1,7 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [TCPIP_DHCP_0201, ^TCPIP_TCP_0208, TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, ^TCPIP_TCP_0411, TCPIP_ARP_0203, ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, TCPIP_ARP_0201, TCPIP_TCP_0115, TCPIP_TCP_0114, diff --git a/components/test/CIConfigs/Function_TCPIP_07.yml b/components/test/CIConfigs/Function_TCPIP_07.yml index d42b5902ad..7cf6279995 100644 --- a/components/test/CIConfigs/Function_TCPIP_07.yml +++ b/components/test/CIConfigs/Function_TCPIP_07.yml @@ -1,5 +1,5 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: -- ADD: +- Add: ID: [TCPIP_TCP_0405, ^TCPIP_TCP_0405] diff --git a/components/test/CIConfigs/Function_WIFI_01.yml b/components/test/CIConfigs/Function_WIFI_01.yml index 594a1fc212..4a6b3e0c17 100644 --- a/components/test/CIConfigs/Function_WIFI_01.yml +++ b/components/test/CIConfigs/Function_WIFI_01.yml @@ -1,11 +1,11 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: +- Add: ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, ^WIFI_CONN_0903, WIFI_SCAN_0103, WIFI_SCAN_0102, WIFI_SCAN_0101, WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0702, - WIFI_CONN_0703, WIFI_CONN_0701, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0701, - ^WIFI_CONN_0703, ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, - ^WIFI_ADDR_0102, WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, - WIFI_CONN_0301, ^WIFI_CONN_0801, WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, - WIFI_CONN_0502] + WIFI_CONN_0703, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0703, ^WIFI_SCAN_0102, + ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, ^WIFI_ADDR_0102, WIFI_CONN_0401, + ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_CONN_0301, ^WIFI_CONN_0801, + WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, ^WIFI_CONN_0401, + WIFI_MODE_0101] diff --git a/components/test/CIConfigs/Function_WIFI_02.yml b/components/test/CIConfigs/Function_WIFI_02.yml index 30735791b7..78ef087b59 100644 --- a/components/test/CIConfigs/Function_WIFI_02.yml +++ b/components/test/CIConfigs/Function_WIFI_02.yml @@ -1,9 +1,8 @@ -Config: {debug mode: false, execute count: 1, execute order: in order} +Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: -- ADD: - ID: [^WIFI_CONN_0401, WIFI_MODE_0101, WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, - ^WIFI_CONN_0902, ^WIFI_CONN_0901, WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0902, - WIFI_CONN_0903, WIFI_CONN_0503, ^WIFI_CONN_0104, WIFI_CONN_0101, WIFI_CONN_0102, - WIFI_CONN_0103, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, ^WIFI_CONN_0503, - ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] +- Add: + ID: [WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, ^WIFI_CONN_0901, WIFI_CONN_0601, + WIFI_CONN_0901, WIFI_CONN_0903, WIFI_CONN_0503, ^WIFI_CONN_0104, WIFI_CONN_0101, + WIFI_CONN_0102, WIFI_CONN_0103, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, + ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] diff --git a/components/test/CIConfigs/Function_WIFI_03.yml b/components/test/CIConfigs/Function_WIFI_03.yml new file mode 100644 index 0000000000..1ac97dece3 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_03.yml @@ -0,0 +1,5 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [WIFI_CONN_0701, ^WIFI_CONN_0701, ^WIFI_CONN_0902, WIFI_CONN_0902] diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml index c5e10b794a..cf634005dd 100644 --- a/components/test/TestCaseAll.yml +++ b/components/test/TestCaseAll.yml @@ -2065,64 +2065,6 @@ test cases: test point 1: basic function test point 2: wifi connect status check version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0701 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - [R SSC1 C QAP] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:0'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:1', 'R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:5'] - - - APC OFF - - [P PC_COM L OK, P SSC1 C bcn_timout] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:4'] - - - APC ON - - [P PC_COM L OK] - comment: '' - execution time: 0.0 - expected result: '1. idle state - - 2. connecting state - - 3. got IP state - - 4. connect fail state' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. sta disconnected, query status - - 2. sta connect to AP, query status - - 3. got IP, query status - - 4. AP power off, query status when beacon timeout' - sub module: WIFI Connect - summary: check wifi status idle, connecting, got ip and connect fail - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0102 SDK: '8266_NonOS @@ -2603,64 +2545,6 @@ test cases: test point 1: basic function test point 2: IGMP API parameter check version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0701 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - [R SSC1 C QAP] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:0'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:1', 'R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:5'] - - - APC OFF - - [P PC_COM L OK, P SSC1 C bcn_timout] - - - SSC SSC1 sta -Q - - ['R SSC1 C +STA_STATUS:4'] - - - APC ON - - [P PC_COM L OK] - comment: '' - execution time: 0.0 - expected result: '1. idle state - - 2. connecting state - - 3. got IP state - - 4. connect fail state' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1. sta disconnected, query status - - 2. sta connect to AP, query status - - 3. got IP, query status - - 4. AP power off, query status when beacon timeout' - sub module: WIFI Connect - summary: check wifi status idle, connecting, got ip and connect fail - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0703 SDK: '8266_NonOS @@ -7985,46 +7869,6 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0902 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - APC OFF - - [P PC_COM L OK, 'R SSC1 C +JAP:DISCONNECTED,1,200'] - - - APC ON - - [P PC_COM L OK] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. disconnect event REASON_BEACON_TIMEOUT' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1. connect to AP - - 2. AP power off' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_BEACON_TIMEOUT - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0901 SDK: '8266_NonOS @@ -12218,46 +12062,6 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0902 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - APC OFF - - [P PC_COM L OK, 'R SSC1 C +JAP:DISCONNECTED,1,200'] - - - APC ON - - [P PC_COM L OK] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. disconnect event REASON_BEACON_TIMEOUT' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. connect to AP - - 2. AP power off' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_BEACON_TIMEOUT - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_ARP_0203 SDK: '8266_NonOS diff --git a/components/test/TestEnvAll.yml b/components/test/TestEnvAll.yml index 703fafcb60..a978f5f73a 100644 --- a/components/test/TestEnvAll.yml +++ b/components/test/TestEnvAll.yml @@ -97,7 +97,7 @@ test environment: Multimeter connect to input, able to measure input voltage. 1 SSC target connect with PC by UART.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_APC, +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_APC, test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ \ connected to APC (static IP within the same subnet with APC). \nAPC control\ \ AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with PC by UART.", From 024a1ce26060a28d72ec09503d71f60506dafe9a Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 28 Sep 2016 19:43:45 +0800 Subject: [PATCH 161/179] add KnownIssues file to test: add known issues to this file so that they will be exculded in CI results --- components/test/KnownIssues | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 components/test/KnownIssues diff --git a/components/test/KnownIssues b/components/test/KnownIssues new file mode 100644 index 0000000000..e69de29bb2 From 59b35eb16ac06f561555c73f2962e70ba257b459 Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 28 Sep 2016 19:48:38 +0800 Subject: [PATCH 162/179] sync several changes from auto_test_script: 1. use variable for gitlab server 2. add LOCAL_ENV_CONFIG_PATH to template 2. update jobs with feature "allow fail" --- .gitlab-ci.yml | 142 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 113 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 730e72686b..ad6db4169a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,7 +139,8 @@ push_master_to_github: - triggers variables: - # LOCAL_ENV_CONFIG_PATH: define LOCAL_ENV_CONFIG in jobs because this variable may need complicated logic to generate + # LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required + LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF BIN_PATH: "$CI_PROJECT_DIR/SSC/build/" APP_NAME: "ssc" LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" @@ -154,7 +155,7 @@ push_master_to_github: expire_in: 6 mos script: - - git clone ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git + - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH @@ -168,7 +169,7 @@ push_master_to_github: script: # must be night build triggers, otherwise exit without test - test $NIGHT_BUILD != "Yes" || exit - - git clone ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git + - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH @@ -178,18 +179,18 @@ Function_SYS_01: - ESP32_IDF - SSC_T1_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_SYS_01.yml Function_WIFI_01: <<: *test_template tags: - ESP32_IDF + - SSC_T3_PhyMode - SSC_T1_1 - SSC_T1_WEP + - SSC_T2_PhyMode - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_01.yml Function_WIFI_02: @@ -198,20 +199,28 @@ Function_WIFI_02: - ESP32_IDF - SSC_T1_1 - SSC_T1_WEP + - SSC_T2_PhyMode - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_02.yml +Function_WIFI_03: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T3_PhyMode + - SSC_T1_1 + - SSC_T2_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml + Function_TCPIP_01: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - - SSC_T1_2 - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_01.yml Function_TCPIP_02: @@ -221,7 +230,6 @@ Function_TCPIP_02: - SSC_T1_1 - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_02.yml Function_TCPIP_03: @@ -231,7 +239,6 @@ Function_TCPIP_03: - SSC_T1_1 - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_03.yml Function_TCPIP_04: @@ -239,10 +246,8 @@ Function_TCPIP_04: tags: - ESP32_IDF - SSC_T1_1 - - SSC_T1_2 - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_04.yml Function_TCPIP_05: @@ -250,37 +255,116 @@ Function_TCPIP_05: tags: - ESP32_IDF - SSC_T1_1 - - SSC_T1_2 - SSC_T2_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_05.yml Function_TCPIP_06: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T1_1 - - SSC_T2_1 - before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_06.yml - -Function_TCPIP_07: <<: *test_template_night tags: - ESP32_IDF - SSC_T1_1 before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_07.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_06.yml -Function_WIFI_03: +Function_WIFI_04: <<: *test_template tags: - ESP32_IDF - SSC_T1_APC before_script: - - LOCAL_ENV_CONFIG_PATH=/home/gitlab-runner/LocalConfig/ESP32_IDF - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_04.yml + +Function_WIFI_05: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_05.yml + +Function_WIFI_06: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_06.yml + +Function_WIFI_07: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_07.yml + +Function_WIFI_08: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_08.yml + +Function_WIFI_09: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_09.yml + +Function_TCPIP_07: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_07.yml + +Function_TCPIP_08: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T2_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_08.yml + +Function_TCPIP_09: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_09.yml + +Function_TCPIP_10: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + - SSC_T2_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_10.yml + +Function_TCPIP_11: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_11.yml + +Function_TCPIP_12: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_12.yml From d695d4019659927e9afc37e33b4cd656cc6bea2e Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 28 Sep 2016 19:52:04 +0800 Subject: [PATCH 163/179] add note that test folder is for internal use. Will move data in readme to wiki except first two notes. --- components/test/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/components/test/README.md b/components/test/README.md index 3267e47caf..f23153bca6 100644 --- a/components/test/README.md +++ b/components/test/README.md @@ -1,4 +1,7 @@ -# The test folder in SDK + +# Note: The test cases in this folder are for Espressif internal use. + +# Goto internal project wiki Testing page for detail about this folder. ## File Structure @@ -45,3 +48,14 @@ After review it will be merged to SDK and will be The cases will be synced to da 4. [config test environment](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestEnvConfig.DesignNote.md). All parameters in table "Parameters require config before use" MUST be configured. 3. run test cases with [CIRunner.py](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/RunnerConfigs.DesignNote.md) + + +## exclude known issues for CI +the test cases listed in file "KnownIssues" will be excluded by CI when calculating results + +Editing KnownIssues file is very simple, one single line for the ID for each case. +``` +TCPIP_TCP_0101 +TCPIP_TCP_0201 +... +``` \ No newline at end of file From 5fab6c36c887feef3119c635c55b8b46e3b26073 Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 28 Sep 2016 19:54:43 +0800 Subject: [PATCH 164/179] update job configs for allow case fail feature --- .../test/CIConfigs/Function_TCPIP_01.yml | 13 +- .../test/CIConfigs/Function_TCPIP_02.yml | 13 +- .../test/CIConfigs/Function_TCPIP_03.yml | 13 +- .../test/CIConfigs/Function_TCPIP_04.yml | 13 +- .../test/CIConfigs/Function_TCPIP_05.yml | 12 +- .../test/CIConfigs/Function_TCPIP_06.yml | 7 +- .../test/CIConfigs/Function_TCPIP_07.yml | 7 +- .../test/CIConfigs/Function_TCPIP_08.yml | 10 + .../test/CIConfigs/Function_TCPIP_09.yml | 10 + .../test/CIConfigs/Function_TCPIP_10.yml | 10 + .../test/CIConfigs/Function_TCPIP_11.yml | 10 + .../test/CIConfigs/Function_TCPIP_12.yml | 6 + .../test/CIConfigs/Function_WIFI_01.yml | 11 +- .../test/CIConfigs/Function_WIFI_02.yml | 10 +- .../test/CIConfigs/Function_WIFI_03.yml | 5 +- .../test/CIConfigs/Function_WIFI_04.yml | 5 + .../test/CIConfigs/Function_WIFI_05.yml | 10 + .../test/CIConfigs/Function_WIFI_06.yml | 10 + .../test/CIConfigs/Function_WIFI_07.yml | 10 + .../test/CIConfigs/Function_WIFI_08.yml | 10 + .../test/CIConfigs/Function_WIFI_09.yml | 10 + components/test/TestCaseAll.yml | 3877 +++++++++++++++++ 22 files changed, 4029 insertions(+), 53 deletions(-) create mode 100644 components/test/CIConfigs/Function_TCPIP_08.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_09.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_10.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_11.yml create mode 100644 components/test/CIConfigs/Function_TCPIP_12.yml create mode 100644 components/test/CIConfigs/Function_WIFI_04.yml create mode 100644 components/test/CIConfigs/Function_WIFI_05.yml create mode 100644 components/test/CIConfigs/Function_WIFI_06.yml create mode 100644 components/test/CIConfigs/Function_WIFI_07.yml create mode 100644 components/test/CIConfigs/Function_WIFI_08.yml create mode 100644 components/test/CIConfigs/Function_WIFI_09.yml diff --git a/components/test/CIConfigs/Function_TCPIP_01.yml b/components/test/CIConfigs/Function_TCPIP_01.yml index 7eb46ef552..29542e9fe3 100644 --- a/components/test/CIConfigs/Function_TCPIP_01.yml +++ b/components/test/CIConfigs/Function_TCPIP_01.yml @@ -2,10 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [TCPIP_ICMP_0101, TCPIP_ARP_0202, ^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, - TCPIP_DHCP_0302, TCPIP_DHCP_0301, TCPIP_ARP_0204, TCPIP_TCP_0412, TCPIP_TCP_0403, - TCPIP_TCP_0402, TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, TCPIP_TCP_0404, - TCPIP_TCP_0408, ^TCPIP_TCP_0202, TCPIP_TCP_0110, ^TCPIP_TCP_0203, TCPIP_DHCP_0101, - TCPIP_DHCP_0103, TCPIP_DHCP_0102, ^TCPIP_UDP_0303, ^TCPIP_UDP_0302, ^TCPIP_UDP_0301, - TCPIP_DNS_0102, TCPIP_DNS_0101, TCPIP_IP_0101, TCPIP_IP_0102, ^TCPIP_IGMP_0102, - ^TCPIP_IGMP_0101] + ID: [TCPIP_ARP_0202, ^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, TCPIP_DHCP_0302, + TCPIP_DHCP_0301, TCPIP_ARP_0204, TCPIP_TCP_0412, TCPIP_TCP_0403, TCPIP_TCP_0402, + TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, TCPIP_TCP_0404, TCPIP_TCP_0408, + ^TCPIP_TCP_0202, TCPIP_TCP_0110, ^TCPIP_TCP_0203, TCPIP_DHCP_0101, TCPIP_DHCP_0103, + TCPIP_DHCP_0102, TCPIP_IP_0101, TCPIP_IP_0102, ^TCPIP_IGMP_0102, ^TCPIP_IGMP_0101, + ^TCPIP_IGMP_0104, TCPIP_IGMP_0104, TCPIP_IGMP_0103, TCPIP_IGMP_0102, TCPIP_IGMP_0101] diff --git a/components/test/CIConfigs/Function_TCPIP_02.yml b/components/test/CIConfigs/Function_TCPIP_02.yml index 0cafa781b9..e40f69db59 100644 --- a/components/test/CIConfigs/Function_TCPIP_02.yml +++ b/components/test/CIConfigs/Function_TCPIP_02.yml @@ -2,10 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_IGMP_0104, ^TCPIP_UDP_0110, TCPIP_IGMP_0104, TCPIP_IGMP_0103, TCPIP_IGMP_0102, - TCPIP_IGMP_0101, ^TCPIP_UDP_0201, ^TCPIP_ICMP_0101, TCPIP_UDP_0108, TCPIP_UDP_0109, - TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0104, TCPIP_UDP_0105, TCPIP_UDP_0102, - TCPIP_UDP_0103, TCPIP_UDP_0101, TCPIP_IGMP_0204, TCPIP_IGMP_0201, TCPIP_IGMP_0202, - TCPIP_IGMP_0203, ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, - ^TCPIP_TCP_0402, ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, TCPIP_UDP_0201, ^TCPIP_UDP_0307, - ^TCPIP_UDP_0306] + ID: [^TCPIP_UDP_0201, TCPIP_UDP_0108, TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0105, + TCPIP_UDP_0101, TCPIP_IGMP_0204, TCPIP_IGMP_0201, TCPIP_IGMP_0202, TCPIP_IGMP_0203, + ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, ^TCPIP_TCP_0402, + ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, TCPIP_UDP_0201, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, + ^TCPIP_TCP_0102, ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, + ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210] diff --git a/components/test/CIConfigs/Function_TCPIP_03.yml b/components/test/CIConfigs/Function_TCPIP_03.yml index cdaad25869..79107aca8c 100644 --- a/components/test/CIConfigs/Function_TCPIP_03.yml +++ b/components/test/CIConfigs/Function_TCPIP_03.yml @@ -2,10 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_UDP_0305, ^TCPIP_UDP_0304, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0102, - ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, - ^TCPIP_DHCP_0211, TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, - TCPIP_DHCP_0211, TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, ^TCPIP_IP_0102, - ^TCPIP_UDP_0105, ^TCPIP_UDP_0104, ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, - ^TCPIP_UDP_0103, ^TCPIP_UDP_0102, ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, ^TCPIP_UDP_0108, - ^TCPIP_IGMP_0201] + ID: [^TCPIP_TCP_0212, TCPIP_DHCP_0211, TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, + ^TCPIP_IP_0102, ^TCPIP_UDP_0105, ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, + ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, ^TCPIP_UDP_0108, ^TCPIP_IGMP_0201, ^TCPIP_IGMP_0203, + ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, TCPIP_UDP_0114, TCPIP_UDP_0113, TCPIP_UDP_0112, + ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, ^TCPIP_TCP_0207, TCPIP_TCP_0501, TCPIP_TCP_0106, + TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, TCPIP_TCP_0102, TCPIP_TCP_0103] diff --git a/components/test/CIConfigs/Function_TCPIP_04.yml b/components/test/CIConfigs/Function_TCPIP_04.yml index 3476bb7069..8d20569c1d 100644 --- a/components/test/CIConfigs/Function_TCPIP_04.yml +++ b/components/test/CIConfigs/Function_TCPIP_04.yml @@ -2,10 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, TCPIP_UDP_0114, TCPIP_UDP_0111, - TCPIP_UDP_0110, TCPIP_UDP_0113, TCPIP_UDP_0112, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, - ^TCPIP_TCP_0207, TCPIP_TCP_0501, ^TCPIP_DNS_0101, ^TCPIP_DNS_0103, ^TCPIP_DNS_0102, - TCPIP_TCP_0106, TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, TCPIP_TCP_0102, - TCPIP_TCP_0103, TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114, ^TCPIP_TCP_0115, - ^TCPIP_TCP_0112, ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, TCPIP_ARP_0101, - TCPIP_UDP_0304] + ID: [TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114, ^TCPIP_TCP_0115, ^TCPIP_TCP_0112, + ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, TCPIP_ARP_0101, ^TCPIP_DHCP_0209, + ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, + ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, TCPIP_TCP_0204, TCPIP_TCP_0207, + TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, TCPIP_TCP_0203, TCPIP_TCP_0202, + TCPIP_TCP_0208, TCPIP_DHCP_0206, TCPIP_DHCP_0207, TCPIP_DHCP_0204, TCPIP_DHCP_0205] diff --git a/components/test/CIConfigs/Function_TCPIP_05.yml b/components/test/CIConfigs/Function_TCPIP_05.yml index 85b6e72d8b..7ff1bbf8ce 100644 --- a/components/test/CIConfigs/Function_TCPIP_05.yml +++ b/components/test/CIConfigs/Function_TCPIP_05.yml @@ -2,10 +2,8 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [TCPIP_UDP_0305, TCPIP_UDP_0306, TCPIP_UDP_0307, TCPIP_UDP_0301, TCPIP_UDP_0302, - TCPIP_UDP_0303, ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, - ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, - TCPIP_TCP_0204, TCPIP_TCP_0207, TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, - TCPIP_TCP_0203, TCPIP_TCP_0202, TCPIP_TCP_0208, TCPIP_DNS_0103, TCPIP_DHCP_0206, - TCPIP_DHCP_0207, TCPIP_DHCP_0204, TCPIP_DHCP_0205, TCPIP_DHCP_0202, TCPIP_DHCP_0203, - ^TCPIP_TCP_0204] + ID: [TCPIP_DHCP_0202, TCPIP_DHCP_0203, ^TCPIP_TCP_0204, TCPIP_DHCP_0201, ^TCPIP_TCP_0208, + TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, ^TCPIP_TCP_0411, TCPIP_ARP_0203, + ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, + TCPIP_ARP_0201, TCPIP_TCP_0115, TCPIP_TCP_0114, TCPIP_TCP_0116, TCPIP_TCP_0111, + TCPIP_TCP_0113, TCPIP_TCP_0112] diff --git a/components/test/CIConfigs/Function_TCPIP_06.yml b/components/test/CIConfigs/Function_TCPIP_06.yml index 1aceda2b73..7cf6279995 100644 --- a/components/test/CIConfigs/Function_TCPIP_06.yml +++ b/components/test/CIConfigs/Function_TCPIP_06.yml @@ -1,8 +1,5 @@ Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] +DUT: [SSC1] Filter: - Add: - ID: [TCPIP_DHCP_0201, ^TCPIP_TCP_0208, TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, - ^TCPIP_TCP_0411, TCPIP_ARP_0203, ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, - ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, TCPIP_ARP_0201, TCPIP_TCP_0115, TCPIP_TCP_0114, - TCPIP_TCP_0116, TCPIP_TCP_0111, TCPIP_TCP_0113, TCPIP_TCP_0112] + ID: [TCPIP_TCP_0405, ^TCPIP_TCP_0405] diff --git a/components/test/CIConfigs/Function_TCPIP_07.yml b/components/test/CIConfigs/Function_TCPIP_07.yml index 7cf6279995..2a047b8e16 100644 --- a/components/test/CIConfigs/Function_TCPIP_07.yml +++ b/components/test/CIConfigs/Function_TCPIP_07.yml @@ -2,4 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: - Add: - ID: [TCPIP_TCP_0405, ^TCPIP_TCP_0405] + ID: [TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, + ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, + ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, + ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, + TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, + TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101] diff --git a/components/test/CIConfigs/Function_TCPIP_08.yml b/components/test/CIConfigs/Function_TCPIP_08.yml new file mode 100644 index 0000000000..4ada8f3eee --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_08.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, + ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, + TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, + TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, + TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, + TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103] diff --git a/components/test/CIConfigs/Function_TCPIP_09.yml b/components/test/CIConfigs/Function_TCPIP_09.yml new file mode 100644 index 0000000000..a4c1a51638 --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_09.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, + ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, + ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, + ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, + ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, + ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103] diff --git a/components/test/CIConfigs/Function_TCPIP_10.yml b/components/test/CIConfigs/Function_TCPIP_10.yml new file mode 100644 index 0000000000..201f95eea0 --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_10.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, + TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, + TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, + ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, + ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, + ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102] diff --git a/components/test/CIConfigs/Function_TCPIP_11.yml b/components/test/CIConfigs/Function_TCPIP_11.yml new file mode 100644 index 0000000000..1d083887c3 --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_11.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, + TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, + TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, + TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, + TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, + TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302] diff --git a/components/test/CIConfigs/Function_TCPIP_12.yml b/components/test/CIConfigs/Function_TCPIP_12.yml new file mode 100644 index 0000000000..e9f5b72a51 --- /dev/null +++ b/components/test/CIConfigs/Function_TCPIP_12.yml @@ -0,0 +1,6 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, + TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103] diff --git a/components/test/CIConfigs/Function_WIFI_01.yml b/components/test/CIConfigs/Function_WIFI_01.yml index 4a6b3e0c17..9d177e5ee1 100644 --- a/components/test/CIConfigs/Function_WIFI_01.yml +++ b/components/test/CIConfigs/Function_WIFI_01.yml @@ -1,11 +1,10 @@ Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] +DUT: [SSC3, SSC2, SSC1] Filter: - Add: ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, ^WIFI_CONN_0903, WIFI_SCAN_0103, WIFI_SCAN_0102, WIFI_SCAN_0101, WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0702, - WIFI_CONN_0703, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0703, ^WIFI_SCAN_0102, - ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, ^WIFI_ADDR_0102, WIFI_CONN_0401, - ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_CONN_0301, ^WIFI_CONN_0801, - WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, ^WIFI_CONN_0401, - WIFI_MODE_0101] + WIFI_CONN_0703, WIFI_PHY_0403, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0703, + ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, ^WIFI_ADDR_0102, + WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_PHY_0502, + WIFI_PHY_0503, WIFI_PHY_0501, WIFI_PHY_0506, WIFI_PHY_0505, WIFI_CONN_0301] diff --git a/components/test/CIConfigs/Function_WIFI_02.yml b/components/test/CIConfigs/Function_WIFI_02.yml index 78ef087b59..c684454880 100644 --- a/components/test/CIConfigs/Function_WIFI_02.yml +++ b/components/test/CIConfigs/Function_WIFI_02.yml @@ -2,7 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, ^WIFI_CONN_0901, WIFI_CONN_0601, - WIFI_CONN_0901, WIFI_CONN_0903, WIFI_CONN_0503, ^WIFI_CONN_0104, WIFI_CONN_0101, - WIFI_CONN_0102, WIFI_CONN_0103, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, - ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] + ID: [WIFI_SCAN_0301, WIFI_SCAN_0303, ^WIFI_CONN_0801, WIFI_SCAN_0304, WIFI_CONN_0104, + ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, ^WIFI_CONN_0401, WIFI_MODE_0101, + WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, ^WIFI_CONN_0901, WIFI_SCAN_0302, + WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0903, WIFI_SCAN_0201, WIFI_CONN_0503, + WIFI_PHY_0402, WIFI_PHY_0401, WIFI_PHY_0407, WIFI_PHY_0406, WIFI_PHY_0405, WIFI_PHY_0404, + WIFI_PHY_0408, ^WIFI_CONN_0104, WIFI_CONN_0101, WIFI_CONN_0102] diff --git a/components/test/CIConfigs/Function_WIFI_03.yml b/components/test/CIConfigs/Function_WIFI_03.yml index 1ac97dece3..72a9db2deb 100644 --- a/components/test/CIConfigs/Function_WIFI_03.yml +++ b/components/test/CIConfigs/Function_WIFI_03.yml @@ -1,5 +1,6 @@ Config: {execute count: 1, execute order: in order} -DUT: [SSC1] +DUT: [SSC3, SSC2, SSC1] Filter: - Add: - ID: [WIFI_CONN_0701, ^WIFI_CONN_0701, ^WIFI_CONN_0902, WIFI_CONN_0902] + ID: [WIFI_CONN_0103, WIFI_PHY_0504, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, + ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] diff --git a/components/test/CIConfigs/Function_WIFI_04.yml b/components/test/CIConfigs/Function_WIFI_04.yml new file mode 100644 index 0000000000..1ac97dece3 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_04.yml @@ -0,0 +1,5 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [WIFI_CONN_0701, ^WIFI_CONN_0701, ^WIFI_CONN_0902, WIFI_CONN_0902] diff --git a/components/test/CIConfigs/Function_WIFI_05.yml b/components/test/CIConfigs/Function_WIFI_05.yml new file mode 100644 index 0000000000..22840fa7af --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_05.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0102, WIFI_PHY_0102, + WIFI_PHY_0102, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0101, WIFI_PHY_0101, + WIFI_PHY_0101, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0312, WIFI_PHY_0312, + WIFI_PHY_0312, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0310, WIFI_PHY_0310, + WIFI_PHY_0310, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0315, WIFI_PHY_0315, + WIFI_PHY_0315] diff --git a/components/test/CIConfigs/Function_WIFI_06.yml b/components/test/CIConfigs/Function_WIFI_06.yml new file mode 100644 index 0000000000..640330233a --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_06.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0308, WIFI_PHY_0308, + WIFI_PHY_0308, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0304, WIFI_PHY_0304, + WIFI_PHY_0304, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0306, WIFI_PHY_0306, + WIFI_PHY_0306, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0301, WIFI_PHY_0301, + WIFI_PHY_0301, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0110, WIFI_PHY_0110, + WIFI_PHY_0110] diff --git a/components/test/CIConfigs/Function_WIFI_07.yml b/components/test/CIConfigs/Function_WIFI_07.yml new file mode 100644 index 0000000000..a51560fd60 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_07.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0120, WIFI_PHY_0120, + WIFI_PHY_0120, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0118, WIFI_PHY_0118, + WIFI_PHY_0118, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0114, WIFI_PHY_0114, + WIFI_PHY_0114, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0111, WIFI_PHY_0111, + WIFI_PHY_0111, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0205, WIFI_PHY_0205, + WIFI_PHY_0205] diff --git a/components/test/CIConfigs/Function_WIFI_08.yml b/components/test/CIConfigs/Function_WIFI_08.yml new file mode 100644 index 0000000000..f143efb3b0 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_08.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0207, WIFI_PHY_0207, + WIFI_PHY_0207, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0201, WIFI_PHY_0201, + WIFI_PHY_0201, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0202, WIFI_PHY_0202, + WIFI_PHY_0202, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0208, WIFI_PHY_0208, + WIFI_PHY_0208, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0303, WIFI_PHY_0303, + WIFI_PHY_0303] diff --git a/components/test/CIConfigs/Function_WIFI_09.yml b/components/test/CIConfigs/Function_WIFI_09.yml new file mode 100644 index 0000000000..f4adf0d2e6 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_09.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0109, WIFI_PHY_0109, + WIFI_PHY_0109, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0107, WIFI_PHY_0107, + WIFI_PHY_0107, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0212, WIFI_PHY_0212, + WIFI_PHY_0212, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0210, WIFI_PHY_0210, + WIFI_PHY_0210, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0104, WIFI_PHY_0104, + WIFI_PHY_0104] diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml index cf634005dd..5e72da0f40 100644 --- a/components/test/TestCaseAll.yml +++ b/components/test/TestCaseAll.yml @@ -1,4 +1,151 @@ test cases: +- CI ready: 'Yes' + ID: WIFI_PHY_0105 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in [1/2/5/5/11]' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. ht40 STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11b, ht40 STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0102 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in [1/2/5/5/11]' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. 11b STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11b, 11b STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0103 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in [1/2/5/5/11]' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. 11bg STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11b, 11g STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0601 SDK: '8266_NonOS @@ -7,6 +154,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -50,6 +198,438 @@ test cases: test point 1: basic function test point 2: list SoftAP connected station version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0101 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK', 'R CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")'] + comment: '' + execution time: 0.0 + expected result: 1. beacon has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: 1. target set to PHY mode 11b, capture beacon + sub module: Phy Mode + summary: SoftAP set as 11b, check beacon + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0313 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP ht40, STA 11b + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP ht40, STA 11b, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0312 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bgn, STA ht40 + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bgn, STA ht40, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0311 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bgn, STA 11bgn + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bgn, STA 11bgn, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0310 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bgn, STA 11bg + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bgn, STA 11bg, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0316 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP ht40, STA ht40 + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP ht40, STA ht40, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0315 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP ht40, STA 11bgn + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP ht40, STA 11bgn, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0314 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP ht40, STA 11bg + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP ht40, STA 11bg, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_ICMP_0101 SDK: '8266_NonOS @@ -58,6 +638,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -97,6 +678,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -129,6 +711,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -181,6 +764,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -247,6 +831,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -306,6 +891,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -363,6 +949,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -430,6 +1017,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -489,6 +1077,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -525,6 +1114,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -566,6 +1156,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -635,6 +1226,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -690,6 +1282,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -753,6 +1346,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -816,6 +1410,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -870,6 +1465,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -933,6 +1529,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -987,6 +1584,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1042,6 +1640,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1073,6 +1672,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1136,6 +1736,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1217,6 +1818,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1280,6 +1882,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1361,6 +1964,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1410,6 +2014,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1479,6 +2084,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1524,6 +2130,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -1575,6 +2182,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1626,6 +2234,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1665,6 +2274,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1710,6 +2320,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1773,6 +2384,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -1836,6 +2448,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -1893,6 +2506,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -1950,6 +2564,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2001,6 +2616,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2042,6 +2658,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2065,6 +2682,340 @@ test cases: test point 1: basic function test point 2: wifi connect status check version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0308 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bg, STA ht40 + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bg, STA ht40, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0309 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bgn, STA 11b + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bgn, STA 11b, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0304 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11b, STA ht40 + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11b, STA ht40, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0305 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bg, STA 11b + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bg, STA 11b, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0306 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bg, STA 11bg + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bg, STA 11bg, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0307 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11bg, STA 11bgn + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11bg, STA 11bgn, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0102 SDK: '8266_NonOS @@ -2073,6 +3024,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -2112,6 +3064,116 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0301 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11b, STA 11b + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11b, STA 11b, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0302 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11b, STA 11bg + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11b, STA 11bg, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0101 SDK: '8266_NonOS @@ -2120,6 +3182,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -2143,6 +3206,52 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0403 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0904 SDK: '8266_NonOS @@ -2151,6 +3260,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2221,6 +3331,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2278,6 +3389,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2333,6 +3445,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2376,6 +3489,55 @@ test cases: test point 1: basic function test point 2: query JAP status version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0110 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. beacon has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates and xrates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. ht40 STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bg, ht40 STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IGMP_0102 SDK: '8266_NonOS @@ -2384,6 +3546,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2441,6 +3604,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2488,6 +3652,55 @@ test cases: test point 1: basic function test point 2: IGMP API parameter check version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0113 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. 11bg STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bgn, 11g STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IGMP_0104 SDK: '8266_NonOS @@ -2496,6 +3709,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2553,6 +3767,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2584,6 +3799,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -2648,6 +3864,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2686,6 +3903,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2736,6 +3954,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2798,6 +4017,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2860,6 +4080,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2917,6 +4138,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -2972,6 +4194,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3029,6 +4252,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3084,6 +4308,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3159,6 +4384,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -3198,6 +4424,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3265,6 +4492,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3316,6 +4544,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -3382,6 +4611,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3439,6 +4669,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3478,6 +4709,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -3547,6 +4779,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3586,6 +4819,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -3643,6 +4877,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -3706,6 +4941,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3757,6 +4993,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3804,6 +5041,57 @@ test cases: test point 1: basic function test point 2: IGMP send/recv test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0120 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed, + + 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=2,sta_channel_width=1, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates/msc0-7' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode ht40 + + 2. ht40 STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as ht40, ht40 STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_IGMP_0201 SDK: '8266_NonOS @@ -3812,6 +5100,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3861,6 +5150,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3918,6 +5208,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -3967,6 +5258,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4038,6 +5330,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4093,6 +5386,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4147,6 +5441,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4210,6 +5505,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4273,6 +5569,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4336,6 +5633,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4391,6 +5689,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4454,6 +5753,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4529,6 +5829,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -4588,6 +5889,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -4647,6 +5949,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -4698,6 +6001,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -4749,6 +6053,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4807,6 +6112,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4870,6 +6176,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4945,6 +6252,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -4996,6 +6304,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5090,6 +6399,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5177,6 +6487,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5237,6 +6548,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5330,6 +6642,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5391,6 +6704,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5453,6 +6767,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5536,6 +6851,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5605,6 +6921,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5672,6 +6989,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5755,6 +7073,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5818,6 +7137,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5880,6 +7200,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5935,6 +7256,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -5995,6 +7317,257 @@ test cases: test point 1: basic function test point 2: mac address function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0119 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed, + + 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates/msc0-7' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode ht40 + + 2. 11bgn STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as ht40, 11n STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0118 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode ht40 + + 2. 11bg STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as ht40, 11g STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0115 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed, + + 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates/msc0-7' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. ht40 STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bgn, ht40 STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0114 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed, + + 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates/xrates/msc0-7' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. 11bgn STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bgn, 11n STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0117 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in rates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode ht40 + + 2. 11b STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as ht40, 11b STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_UDP_0202 SDK: '8266_NonOS @@ -6003,6 +7576,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6070,6 +7644,92 @@ test cases: test point 1: abnormal/special use test point 2: use UDP SAP (socket/espconn API) in different state version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0111 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] + comment: '' + execution time: 0.0 + expected result: 1. beacon has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: 1. target set to PHY mode 11bgn, capture beacon + sub module: Phy Mode + summary: SoftAP set as 11bgn, check beacon + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0112 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in rates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. 11b STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bgn, 11b STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0411 SDK: '8266_NonOS @@ -6078,6 +7738,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6139,6 +7800,281 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0502 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0503 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0501 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0506 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0505 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M ,SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0301 SDK: '8266_NonOS @@ -6147,6 +8083,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6191,6 +8128,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6245,6 +8183,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6284,6 +8223,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -6353,6 +8293,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6392,6 +8333,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6449,6 +8391,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6500,6 +8443,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -6563,6 +8507,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -6612,6 +8557,310 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0205 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. target connect to 11g AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bg, join 11g external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0204 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + assoc-req has no erp/ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. target connect to 11b AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bg, join 11b external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0207 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates/ht, cap.short_slot_time=1,rates=[1/2/5.5/11/24/36/48/54]; + + assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. target connect to 11b AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn, join 11b external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0206 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. target connect to 11n AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bg, join 11n external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0201 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. target connect to 11b AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11b, join 11b external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DHCP_0102 SDK: '8266_NonOS @@ -6620,6 +8869,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6656,6 +8906,126 @@ test cases: test point 1: basic function test point 2: DHCP client function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0203 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-reqhas no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. target connect to 11n AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11b, join 11b external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0202 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-reqhas no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. target connect to 11g AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11b, join 11g external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DHCP_0103 SDK: '8266_NonOS @@ -6664,6 +9034,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6725,6 +9096,216 @@ test cases: test point 1: basic function test point 2: DHCP client function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0209 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates or msc0-7' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. target connect to 11n AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn, join 11n external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0208 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + assoc-req has xrates no ht, cap.short_slot_time=1,rates=[1/2/5.5/11], xrates=[24/36/48/54]; + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. target connect to 11g AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn, join 11g external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0301 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANFAIL, 'P SSC1 P +SCAN:', R SSC1 C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1. second scan failed + + 2. first scan succeed' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. do all channel scan + + 2. do scan before scan finished' + sub module: WIFI Scan + summary: reject scan request before scan finished + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0303 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 1 STA join AP + + 2. target 1 STA scan before JAP succeed + + 3. target 1 quite AP + + 4. target 1 scan + + 5. target 1 JAP before scan succeed' + sub module: WIFI Scan + summary: scan during JAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0801 SDK: '8266_NonOS @@ -6733,6 +9314,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6787,6 +9369,55 @@ test cases: test point 1: basic function test point 2: wifi auth changed event test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0304 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC2 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 2 STA join target 1 SoftAP + + 2. target 1 STA scan before target 2 JAP succeed + + 3. target 2 STA QAP + + 4. target 1 STA scan + + 5. target 2 STA JAP before target 1 STA scan succeed' + sub module: WIFI Scan + summary: scan during ext STA join SoftAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0108 SDK: '8266_NonOS @@ -6795,6 +9426,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6846,6 +9478,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6899,6 +9532,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6948,6 +9582,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -6997,6 +9632,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7054,6 +9690,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7108,6 +9745,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7147,6 +9785,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7186,6 +9825,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -7260,6 +9900,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -7324,6 +9965,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7381,6 +10023,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7420,6 +10063,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7497,6 +10141,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7566,6 +10211,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7637,6 +10283,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7700,6 +10347,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7757,6 +10405,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7808,6 +10457,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7877,6 +10527,7 @@ test cases: ESP32_IDF' Test App: basic function + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -7925,6 +10576,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8024,6 +10676,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8107,6 +10760,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8206,6 +10860,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8242,6 +10897,43 @@ test cases: test point 1: abnormal/special use test point 2: TCP connect and disconnect abnormal case version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0116 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK', 'R CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] + comment: '' + execution time: 0.0 + expected result: 1. beacon has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=3,sta_channel_width=1, + rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: 1. target set to PHY mode ht40, capture beacon + sub module: Phy Mode + summary: SoftAP set as ht40, check beacon + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DNS_0101 SDK: '8266_NonOS @@ -8250,6 +10942,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -8281,6 +10974,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -8324,6 +11018,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -8371,6 +11066,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8464,6 +11160,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8525,6 +11222,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8612,6 +11310,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8706,6 +11405,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8757,6 +11457,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8832,6 +11533,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8895,6 +11597,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -8955,6 +11658,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9049,6 +11753,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9142,6 +11847,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9217,6 +11923,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9304,6 +12011,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9367,6 +12075,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9410,6 +12119,61 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0302 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -n 1000000 -j 5 + - [''] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: 3. target 2 able to scan AP + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 1 connect to AP + + 2. target 1 start sending UDP packets + + 3. target 2 scan in AP channel in 11b.g,n,ht40 mode' + sub module: WIFI Scan + summary: scan in congest channel + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_ARP_0101 SDK: '8266_NonOS @@ -9418,6 +12182,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9457,6 +12222,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9508,6 +12274,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9559,6 +12326,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9618,6 +12386,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9677,6 +12446,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9734,6 +12504,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9793,6 +12564,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: @@ -9844,6 +12616,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9896,6 +12669,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -9958,6 +12732,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10022,6 +12797,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10094,6 +12870,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10156,6 +12933,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10204,6 +12982,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10284,6 +13063,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10352,6 +13132,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10410,6 +13191,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10467,6 +13249,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10538,6 +13321,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10637,6 +13421,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10720,6 +13505,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10819,6 +13605,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10868,6 +13655,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -10949,6 +13737,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11030,6 +13819,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11111,6 +13901,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: @@ -11146,6 +13937,62 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0303 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s + + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. check STA packet + + 3. check SoftAP packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. set softAP 11b, STA 11bgn + + 2. STA connect to ext AP + + 3. ext STA connect to SoftAP' + sub module: Phy Mode + summary: SoftAP 11b, STA 11bgn, get connected and join AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DHCP_0206 SDK: '8266_NonOS @@ -11154,6 +14001,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11217,6 +14065,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11290,6 +14139,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11371,6 +14221,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11420,6 +14271,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11479,6 +14331,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11548,6 +14401,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11617,6 +14471,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11675,6 +14530,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11756,6 +14612,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11821,6 +14678,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11884,6 +14742,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -11953,6 +14812,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12022,6 +14882,7 @@ test cases: ESP32_IDF' Test App: basic function + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12070,6 +14931,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12116,6 +14978,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12139,6 +15002,257 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0108 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates and xrates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. 11bg STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bg, 11g STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0109 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates and xrates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. 11bgn STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bg, 11n STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0106 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] + comment: '' + execution time: 0.0 + expected result: 1. beacon has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: 1. target set to PHY mode 11bg, capture beacon + sub module: Phy Mode + summary: SoftAP set as 11bg, check beacon + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0107 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.supported_rates=""1/","2/","5.5/","11/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 3. radiotap rates in rates' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bg + + 2. 11b STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11bg, 11b STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0201 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + comment: '' + execution time: 0.0 + expected result: '3. find all 3 ext APs + + 5. find all 3 ext APs + + 7. find all 3 ext APs + + 9. find all 3 ext APs' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. 3 ext APs in 11b, 11g, 11n mode + + 2. STA in 11b mode + + 3. do all channel scan + + 4. STA in 11g mode + + 5. do all channel scan + + 6. STA in 11n ht20 mode + + 7. do all channel scan + + 8. STA in 11n ht40 mode + + 9. do all channel scan' + sub module: WIFI Scan + summary: STA in differnt PHY mode to scan AP in different PHY mode + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: Scan in different mode and channel + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0503 SDK: '8266_NonOS @@ -12147,6 +15261,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12196,6 +15311,285 @@ test cases: test point 1: basic function test point 2: reconnect policy test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0402 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0401 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0407 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0406 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0405 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0404 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0112 SDK: '8266_NonOS @@ -12204,6 +15598,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12235,6 +15630,53 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0408 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0114 SDK: '8266_NonOS @@ -12243,6 +15685,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12274,6 +15717,315 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0214 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + 4. 40M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn ht40 + + 2. target connect to 11n ht40 AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn ht40,join ht40 external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0212 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + assoc-req has xrates no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn ht40 + + 2. target connect to 11g AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn ht40, join 11g external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0213 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn ht40 + + 2. target connect to 11n AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn ht40, join 11n external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0210 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', + 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") + PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req and assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in rates or xrates or msc0-7' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn + + 2. target connect to 11n ht40 AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn, join ht40 external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0211 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC1 sta -C -s -p + - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; + + assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] + + 4. 20M + + 5. succeed + + 6. data rate in radiotap is in [1/2/5.5/11]' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. target set to PHY mode 11bgn ht40 + + 2. target connect to 11b AP + + 3. capture probe-req and assoc-req in step2 + + 4. check if config bandwidth correct + + 5. send data from target + + 6. capture data in step5' + sub module: Phy Mode + summary: target STA set as 11bgn ht40, join 11b external AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0104 SDK: '8266_NonOS @@ -12282,6 +16034,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12334,6 +16087,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12409,6 +16163,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12464,6 +16219,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12527,6 +16283,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12590,6 +16347,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12641,6 +16399,61 @@ test cases: test point 1: basic function test point 2: SAP/JAP with different config version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0504 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IP_0101 SDK: '8266_NonOS @@ -12649,6 +16462,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12706,6 +16520,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12745,6 +16560,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12808,6 +16624,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12870,6 +16687,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12916,6 +16734,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -12971,6 +16790,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13039,6 +16859,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13115,6 +16936,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13208,6 +17030,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13252,6 +17075,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13346,6 +17170,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13407,6 +17232,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13450,6 +17276,55 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0104 + SDK: ESP32_IDF + Test App: SSC + allow fail: 2/3 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 2 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - STRING wlan%20addr2%20%%s + - [R PC_COM C OK] + - - 'NIC CAP START wlan_capture ' + - ['R PC_COM C +NIC_START:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', + 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] + + 3. radiotap rates in [1/2/5/5/11]' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + module: WIFI MAC + steps: '1. target set to PHY mode 11b + + 2. 11bgn STA connect to SoftAP, capture assoc response + + 3. ping, capture Data' + sub module: Phy Mode + summary: SoftAP set as 11b, 11n STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: SoftAP PHY mode test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0113 SDK: '8266_NonOS @@ -13458,6 +17333,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: @@ -13545,6 +17421,7 @@ test cases: ESP32_IDF' Test App: SSC + allow fail: '' auto test: 'Yes' category: Function cmd set: From 5ba6c1b1b7118bfdb637aea14475f59b56e320cd Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 12:07:35 +0800 Subject: [PATCH 165/179] sync test config from test bench: 1. night jobs should exit without error if not triggered 2. remove get wifi connect status cases from IDF 3. use Env tag to check if test environment is special --- .gitlab-ci.yml | 108 +- .../test/CIConfigs/Function_WIFI_01.yml | 12 +- .../test/CIConfigs/Function_WIFI_02.yml | 9 +- .../test/CIConfigs/Function_WIFI_03.yml | 4 +- .../test/CIConfigs/Function_WIFI_04.yml | 2 +- .../test/CIConfigs/Function_WIFI_05.yml | 9 +- .../test/CIConfigs/Function_WIFI_06.yml | 9 +- .../test/CIConfigs/Function_WIFI_07.yml | 12 +- .../test/CIConfigs/Function_WIFI_08.yml | 12 +- .../test/CIConfigs/Function_WIFI_09.yml | 12 +- .../test/CIConfigs/Function_WIFI_10.yml | 10 + .../test/CIConfigs/Function_WIFI_11.yml | 10 + components/test/TestCaseAll.yml | 3885 +---------------- 13 files changed, 116 insertions(+), 3978 deletions(-) create mode 100644 components/test/CIConfigs/Function_WIFI_10.yml create mode 100644 components/test/CIConfigs/Function_WIFI_11.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad6db4169a..f422f9f250 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,28 +64,10 @@ build_ssc: script: - git clone ssh://git@gitlab.espressif.cn:27227/yinling/SSC.git - cd SSC - - git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..." - make defconfig - chmod +x gen_misc_ng.sh - ./gen_misc_ng.sh -build_examples: - <<: *build_template - artifacts: - paths: - - build_examples/*/*/build/*.bin - - build_examples/*/*/build/*.elf - - build_examples/*/*/build/*.map - - build_examples/*/*/build/bootloader/*.bin - expire_in: 6 mos - - script: - # it's not possible to build 100% out-of-tree and have the "artifacts" - # mechanism work, but this is the next best thing - - mkdir build_examples - - cd build_examples - - ${IDF_PATH}/make/build_examples.sh - test_nvs_on_host: stage: test image: espressif/esp32-ci-env @@ -168,7 +150,7 @@ push_master_to_github: - triggers script: # must be night build triggers, otherwise exit without test - - test $NIGHT_BUILD != "Yes" || exit + - test $NIGHT_BUILD != "Yes" || exit 0 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH @@ -185,10 +167,7 @@ Function_WIFI_01: <<: *test_template tags: - ESP32_IDF - - SSC_T3_PhyMode - SSC_T1_1 - - SSC_T1_WEP - - SSC_T2_PhyMode - SSC_T2_1 before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_01.yml @@ -198,22 +177,10 @@ Function_WIFI_02: tags: - ESP32_IDF - SSC_T1_1 - - SSC_T1_WEP - - SSC_T2_PhyMode - SSC_T2_1 before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_02.yml -Function_WIFI_03: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T3_PhyMode - - SSC_T1_1 - - SSC_T2_1 - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml - Function_TCPIP_01: <<: *test_template tags: @@ -267,6 +234,14 @@ Function_TCPIP_06: before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_06.yml +Function_WIFI_03: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T3_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml + Function_WIFI_04: <<: *test_template tags: @@ -279,7 +254,7 @@ Function_WIFI_05: <<: *test_template tags: - ESP32_IDF - - SSC_T2_PhyMode + - SSC_T1_WEP before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_05.yml @@ -291,30 +266,6 @@ Function_WIFI_06: before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_06.yml -Function_WIFI_07: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_07.yml - -Function_WIFI_08: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_08.yml - -Function_WIFI_09: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_09.yml - Function_TCPIP_07: <<: *test_template tags: @@ -368,3 +319,42 @@ Function_TCPIP_12: before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_12.yml +Function_WIFI_07: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_07.yml + +Function_WIFI_08: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_08.yml + +Function_WIFI_09: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_09.yml + +Function_WIFI_10: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_10.yml + +Function_WIFI_11: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T2_PhyMode + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_11.yml diff --git a/components/test/CIConfigs/Function_WIFI_01.yml b/components/test/CIConfigs/Function_WIFI_01.yml index 9d177e5ee1..da9bfecd5d 100644 --- a/components/test/CIConfigs/Function_WIFI_01.yml +++ b/components/test/CIConfigs/Function_WIFI_01.yml @@ -1,10 +1,10 @@ Config: {execute count: 1, execute order: in order} -DUT: [SSC3, SSC2, SSC1] +DUT: [SSC2, SSC1] Filter: - Add: - ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, ^WIFI_CONN_0903, WIFI_SCAN_0103, WIFI_SCAN_0102, - WIFI_SCAN_0101, WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0702, - WIFI_CONN_0703, WIFI_PHY_0403, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_CONN_0703, + ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, WIFI_SCAN_0103, WIFI_SCAN_0102, WIFI_SCAN_0101, + WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0904, ^WIFI_CONN_0201, ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, ^WIFI_ADDR_0102, - WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_PHY_0502, - WIFI_PHY_0503, WIFI_PHY_0501, WIFI_PHY_0506, WIFI_PHY_0505, WIFI_CONN_0301] + WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_CONN_0301, + ^WIFI_CONN_0801, WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, + ^WIFI_CONN_0401, WIFI_MODE_0101, WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904] diff --git a/components/test/CIConfigs/Function_WIFI_02.yml b/components/test/CIConfigs/Function_WIFI_02.yml index c684454880..e1b61a20e9 100644 --- a/components/test/CIConfigs/Function_WIFI_02.yml +++ b/components/test/CIConfigs/Function_WIFI_02.yml @@ -2,9 +2,6 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_SCAN_0301, WIFI_SCAN_0303, ^WIFI_CONN_0801, WIFI_SCAN_0304, WIFI_CONN_0104, - ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, ^WIFI_CONN_0401, WIFI_MODE_0101, - WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904, ^WIFI_CONN_0901, WIFI_SCAN_0302, - WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0903, WIFI_SCAN_0201, WIFI_CONN_0503, - WIFI_PHY_0402, WIFI_PHY_0401, WIFI_PHY_0407, WIFI_PHY_0406, WIFI_PHY_0405, WIFI_PHY_0404, - WIFI_PHY_0408, ^WIFI_CONN_0104, WIFI_CONN_0101, WIFI_CONN_0102] + ID: [^WIFI_CONN_0901, WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0503, ^WIFI_CONN_0104, + WIFI_CONN_0101, WIFI_CONN_0102, WIFI_CONN_0103, WIFI_CONN_0801, ^WIFI_CONN_0101, + ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] diff --git a/components/test/CIConfigs/Function_WIFI_03.yml b/components/test/CIConfigs/Function_WIFI_03.yml index 72a9db2deb..0f0b4bbaad 100644 --- a/components/test/CIConfigs/Function_WIFI_03.yml +++ b/components/test/CIConfigs/Function_WIFI_03.yml @@ -2,5 +2,5 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC3, SSC2, SSC1] Filter: - Add: - ID: [WIFI_CONN_0103, WIFI_PHY_0504, ^WIFI_CONN_0702, WIFI_CONN_0801, ^WIFI_CONN_0101, - ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] + ID: [WIFI_PHY_0502, WIFI_PHY_0503, WIFI_PHY_0501, WIFI_PHY_0506, WIFI_PHY_0505, + WIFI_PHY_0504] diff --git a/components/test/CIConfigs/Function_WIFI_04.yml b/components/test/CIConfigs/Function_WIFI_04.yml index 1ac97dece3..50f8707c72 100644 --- a/components/test/CIConfigs/Function_WIFI_04.yml +++ b/components/test/CIConfigs/Function_WIFI_04.yml @@ -2,4 +2,4 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: - Add: - ID: [WIFI_CONN_0701, ^WIFI_CONN_0701, ^WIFI_CONN_0902, WIFI_CONN_0902] + ID: [^WIFI_CONN_0902, WIFI_CONN_0902] diff --git a/components/test/CIConfigs/Function_WIFI_05.yml b/components/test/CIConfigs/Function_WIFI_05.yml index 22840fa7af..3694a698b7 100644 --- a/components/test/CIConfigs/Function_WIFI_05.yml +++ b/components/test/CIConfigs/Function_WIFI_05.yml @@ -1,10 +1,5 @@ Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] +DUT: [SSC1] Filter: - Add: - ID: [WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0102, WIFI_PHY_0102, - WIFI_PHY_0102, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0101, WIFI_PHY_0101, - WIFI_PHY_0101, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0312, WIFI_PHY_0312, - WIFI_PHY_0312, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0310, WIFI_PHY_0310, - WIFI_PHY_0310, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0315, WIFI_PHY_0315, - WIFI_PHY_0315] + ID: [^WIFI_CONN_0903, WIFI_CONN_0903] diff --git a/components/test/CIConfigs/Function_WIFI_06.yml b/components/test/CIConfigs/Function_WIFI_06.yml index 640330233a..f3db504c9f 100644 --- a/components/test/CIConfigs/Function_WIFI_06.yml +++ b/components/test/CIConfigs/Function_WIFI_06.yml @@ -2,9 +2,6 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0308, WIFI_PHY_0308, - WIFI_PHY_0308, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0304, WIFI_PHY_0304, - WIFI_PHY_0304, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0306, WIFI_PHY_0306, - WIFI_PHY_0306, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0301, WIFI_PHY_0301, - WIFI_PHY_0301, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0110, WIFI_PHY_0110, - WIFI_PHY_0110] + ID: [WIFI_PHY_0403, WIFI_SCAN_0301, WIFI_SCAN_0303, WIFI_SCAN_0304, WIFI_SCAN_0302, + WIFI_SCAN_0201, WIFI_PHY_0402, WIFI_PHY_0401, WIFI_PHY_0407, WIFI_PHY_0406, + WIFI_PHY_0405, WIFI_PHY_0404, WIFI_PHY_0408] diff --git a/components/test/CIConfigs/Function_WIFI_07.yml b/components/test/CIConfigs/Function_WIFI_07.yml index a51560fd60..22840fa7af 100644 --- a/components/test/CIConfigs/Function_WIFI_07.yml +++ b/components/test/CIConfigs/Function_WIFI_07.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0120, WIFI_PHY_0120, - WIFI_PHY_0120, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0118, WIFI_PHY_0118, - WIFI_PHY_0118, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0114, WIFI_PHY_0114, - WIFI_PHY_0114, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0111, WIFI_PHY_0111, - WIFI_PHY_0111, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0205, WIFI_PHY_0205, - WIFI_PHY_0205] + ID: [WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0102, WIFI_PHY_0102, + WIFI_PHY_0102, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0101, WIFI_PHY_0101, + WIFI_PHY_0101, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0312, WIFI_PHY_0312, + WIFI_PHY_0312, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0310, WIFI_PHY_0310, + WIFI_PHY_0310, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0315, WIFI_PHY_0315, + WIFI_PHY_0315] diff --git a/components/test/CIConfigs/Function_WIFI_08.yml b/components/test/CIConfigs/Function_WIFI_08.yml index f143efb3b0..640330233a 100644 --- a/components/test/CIConfigs/Function_WIFI_08.yml +++ b/components/test/CIConfigs/Function_WIFI_08.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0207, WIFI_PHY_0207, - WIFI_PHY_0207, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0201, WIFI_PHY_0201, - WIFI_PHY_0201, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0202, WIFI_PHY_0202, - WIFI_PHY_0202, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0208, WIFI_PHY_0208, - WIFI_PHY_0208, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0303, WIFI_PHY_0303, - WIFI_PHY_0303] + ID: [WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0308, WIFI_PHY_0308, + WIFI_PHY_0308, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0304, WIFI_PHY_0304, + WIFI_PHY_0304, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0306, WIFI_PHY_0306, + WIFI_PHY_0306, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0301, WIFI_PHY_0301, + WIFI_PHY_0301, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0110, WIFI_PHY_0110, + WIFI_PHY_0110] diff --git a/components/test/CIConfigs/Function_WIFI_09.yml b/components/test/CIConfigs/Function_WIFI_09.yml index f4adf0d2e6..a51560fd60 100644 --- a/components/test/CIConfigs/Function_WIFI_09.yml +++ b/components/test/CIConfigs/Function_WIFI_09.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0109, WIFI_PHY_0109, - WIFI_PHY_0109, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0107, WIFI_PHY_0107, - WIFI_PHY_0107, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0212, WIFI_PHY_0212, - WIFI_PHY_0212, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0210, WIFI_PHY_0210, - WIFI_PHY_0210, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0104, WIFI_PHY_0104, - WIFI_PHY_0104] + ID: [WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0120, WIFI_PHY_0120, + WIFI_PHY_0120, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0118, WIFI_PHY_0118, + WIFI_PHY_0118, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0114, WIFI_PHY_0114, + WIFI_PHY_0114, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0111, WIFI_PHY_0111, + WIFI_PHY_0111, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0205, WIFI_PHY_0205, + WIFI_PHY_0205] diff --git a/components/test/CIConfigs/Function_WIFI_10.yml b/components/test/CIConfigs/Function_WIFI_10.yml new file mode 100644 index 0000000000..f143efb3b0 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_10.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0207, WIFI_PHY_0207, + WIFI_PHY_0207, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0201, WIFI_PHY_0201, + WIFI_PHY_0201, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0202, WIFI_PHY_0202, + WIFI_PHY_0202, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0208, WIFI_PHY_0208, + WIFI_PHY_0208, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0303, WIFI_PHY_0303, + WIFI_PHY_0303] diff --git a/components/test/CIConfigs/Function_WIFI_11.yml b/components/test/CIConfigs/Function_WIFI_11.yml new file mode 100644 index 0000000000..f4adf0d2e6 --- /dev/null +++ b/components/test/CIConfigs/Function_WIFI_11.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0109, WIFI_PHY_0109, + WIFI_PHY_0109, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0107, WIFI_PHY_0107, + WIFI_PHY_0107, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0212, WIFI_PHY_0212, + WIFI_PHY_0212, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0210, WIFI_PHY_0210, + WIFI_PHY_0210, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0104, WIFI_PHY_0104, + WIFI_PHY_0104] diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml index 5e72da0f40..d787017591 100644 --- a/components/test/TestCaseAll.yml +++ b/components/test/TestCaseAll.yml @@ -1,151 +1,4 @@ test cases: -- CI ready: 'Yes' - ID: WIFI_PHY_0105 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in [1/2/5/5/11]' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. ht40 STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11b, ht40 STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0102 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in [1/2/5/5/11]' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. 11b STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11b, 11b STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0103 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in [1/2/5/5/11]' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. 11bg STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11b, 11g STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0601 SDK: '8266_NonOS @@ -198,438 +51,6 @@ test cases: test point 1: basic function test point 2: list SoftAP connected station version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0101 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK', 'R CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")'] - comment: '' - execution time: 0.0 - expected result: 1. beacon has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: 1. target set to PHY mode 11b, capture beacon - sub module: Phy Mode - summary: SoftAP set as 11b, check beacon - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0313 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP ht40, STA 11b - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP ht40, STA 11b, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0312 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bgn, STA ht40 - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bgn, STA ht40, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0311 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bgn, STA 11bgn - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bgn, STA 11bgn, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0310 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bgn, STA 11bg - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bgn, STA 11bg, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0316 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP ht40, STA ht40 - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP ht40, STA ht40, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0315 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP ht40, STA 11bgn - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP ht40, STA 11bgn, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0314 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP ht40, STA 11bg - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP ht40, STA 11bg, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_ICMP_0101 SDK: '8266_NonOS @@ -1632,38 +1053,6 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0903 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 C +JAP:DISCONNECTED,4,2'] - comment: '' - execution time: 0.0 - expected result: 1. disconect event reason REASON_AUTH_EXPIRE - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_AUTH_EXPIRE - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. - - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0408 SDK: '8266_NonOS @@ -2608,414 +1997,6 @@ test cases: test point 1: basic function test point 2: query JAP status version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0702 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,3'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,2'] - comment: '' - execution time: 0.0 - expected result: '1. get status AP not exist in disconnect event - - 2. get status wrong password in disconnect event' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. sta connect to ap not exist - - 2. sta connect to ap with wrong password - - ' - sub module: WIFI Connect - summary: check wifi status wrong password, no ap found - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0703 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 C +JAP:DISCONNECTED,4,2'] - comment: '' - execution time: 0.0 - expected result: 1. connect status connect fail in disconnect evnet - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: check wifi status connect fail - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. - - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0308 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bg, STA ht40 - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bg, STA ht40, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0309 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bgn, STA 11b - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bgn, STA 11b, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0304 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11b, STA ht40 - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11b, STA ht40, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0305 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bg, STA 11b - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bg, STA 11b, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0306 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bg, STA 11bg - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bg, STA 11bg, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0307 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11bg, STA 11bgn - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11bg, STA 11bgn, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0102 SDK: '8266_NonOS @@ -3064,116 +2045,6 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0301 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11b, STA 11b - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11b, STA 11b, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0302 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11b, STA 11bg - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11b, STA 11bg, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0101 SDK: '8266_NonOS @@ -3206,52 +2077,6 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0403 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 - - 2. STA connect to ext AP - - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, STA connect - to AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0904 SDK: '8266_NonOS @@ -3268,17 +2093,17 @@ test cases: - - SSC SSC1 ap -S -s -p -t 3 -m 1 - ['R SSC1 C +SAP:OK'] - - SSC SSC2 sta -C -s -p 1234567890 - - ['R SSC2 C +JAP:DISCONNECTED,1,204'] + - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] - - SSC SSC2 sta -D - ['R SSC2 C +QAP:OK'] - - WIFI CONN - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:DISCONNECTED,1,5'] + - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] - - WIFI DISCONN - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:DISCONNECTED,5,4'] + - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] comment: '' execution time: 0.0 expected result: '1. succeed @@ -3489,55 +2314,6 @@ test cases: test point 1: basic function test point 2: query JAP status version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0110 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. beacon has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates and xrates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. ht40 STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bg, ht40 STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IGMP_0102 SDK: '8266_NonOS @@ -3652,55 +2428,6 @@ test cases: test point 1: basic function test point 2: IGMP API parameter check version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0113 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. 11bg STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bgn, 11g STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IGMP_0104 SDK: '8266_NonOS @@ -3759,38 +2486,6 @@ test cases: test point 1: basic function test point 2: IGMP API parameter check version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0703 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 C +JAP:DISCONNECTED,4,2'] - comment: '' - execution time: 0.0 - expected result: 1. connect status connect fail in disconnect evnet - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: check wifi status connect fail - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. - - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0110 SDK: '8266_NonOS @@ -5041,57 +3736,6 @@ test cases: test point 1: basic function test point 2: IGMP send/recv test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0120 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed, - - 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=2,sta_channel_width=1, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates/msc0-7' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode ht40 - - 2. ht40 STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as ht40, ht40 STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_IGMP_0201 SDK: '8266_NonOS @@ -7317,257 +5961,6 @@ test cases: test point 1: basic function test point 2: mac address function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0119 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed, - - 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates/msc0-7' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode ht40 - - 2. 11bgn STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as ht40, 11n STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0118 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode ht40 - - 2. 11bg STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as ht40, 11g STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0115 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed, - - 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates/msc0-7' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. ht40 STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bgn, ht40 STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0114 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed, - - 2. assoc response has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates/xrates/msc0-7' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. 11bgn STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bgn, 11n STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0117 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in rates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode ht40 - - 2. 11b STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as ht40, 11b STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_UDP_0202 SDK: '8266_NonOS @@ -7644,92 +6037,6 @@ test cases: test point 1: abnormal/special use test point 2: use UDP SAP (socket/espconn API) in different state version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0111 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_operation.second_channel_offset="0")(Wlan.ie_list.ht_operation.sta_channel_width="0")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] - comment: '' - execution time: 0.0 - expected result: 1. beacon has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=0,sta_channel_width=0, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: 1. target set to PHY mode 11bgn, capture beacon - sub module: Phy Mode - summary: SoftAP set as 11bgn, check beacon - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0112 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in rates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. 11b STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bgn, 11b STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0411 SDK: '8266_NonOS @@ -7800,281 +6107,6 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0502 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2; SoftAP in 20M, STA in 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M, SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_20 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_40' - sub module: Phy Mode - summary: SoftAP STA in channel1 20M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0503 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M, SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0501 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_20 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1 20M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0506 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 40M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_40' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0505 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2; SoftAP in 20M, STA in 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M ,SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0301 SDK: '8266_NonOS @@ -8557,310 +6589,6 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0205 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. target connect to 11g AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bg, join 11g external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0204 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - assoc-req has no erp/ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. target connect to 11b AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bg, join 11b external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0207 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates/ht, cap.short_slot_time=1,rates=[1/2/5.5/11/24/36/48/54]; - - assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. target connect to 11b AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn, join 11b external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0206 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has xrates, no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. target connect to 11n AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bg, join 11n external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0201 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. target connect to 11b AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11b, join 11b external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DHCP_0102 SDK: '8266_NonOS @@ -8906,126 +6634,6 @@ test cases: test point 1: basic function test point 2: DHCP client function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0203 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-reqhas no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. target connect to 11n AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11b, join 11b external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0202 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-reqhas no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. target connect to 11g AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11b, join 11g external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DHCP_0103 SDK: '8266_NonOS @@ -9096,216 +6704,6 @@ test cases: test point 1: basic function test point 2: DHCP client function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0209 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates or msc0-7' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. target connect to 11n AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn, join 11n external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0208 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - assoc-req has xrates no ht, cap.short_slot_time=1,rates=[1/2/5.5/11], xrates=[24/36/48/54]; - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. target connect to 11g AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn, join 11g external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0301 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -S - - [''] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANFAIL, 'P SSC1 P +SCAN:', R SSC1 C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1. second scan failed - - 2. first scan succeed' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. do all channel scan - - 2. do scan before scan finished' - sub module: WIFI Scan - summary: reject scan request before scan finished - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0303 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK'] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:OK'] - - - SSC SSC1 sta -S - - [''] - - - SSC SSC1 sta -C -s -p - - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '2. scan succeed, JAP succeed - - 5. JAP succeed, scan succeed' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 1 STA join AP - - 2. target 1 STA scan before JAP succeed - - 3. target 1 quite AP - - 4. target 1 scan - - 5. target 1 JAP before scan succeed' - sub module: WIFI Scan - summary: scan during JAP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0801 SDK: '8266_NonOS @@ -9369,55 +6767,6 @@ test cases: test point 1: basic function test point 2: wifi auth changed event test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0304 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:OK'] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC1 sta -S - - [''] - - - SSC SSC2 sta -C -s -p - - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '2. scan succeed, JAP succeed - - 5. JAP succeed, scan succeed' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 2 STA join target 1 SoftAP - - 2. target 1 STA scan before target 2 JAP succeed - - 3. target 2 STA QAP - - 4. target 1 STA scan - - 5. target 2 STA JAP before target 1 STA scan succeed' - sub module: WIFI Scan - summary: scan during ext STA join SoftAP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0108 SDK: '8266_NonOS @@ -10465,17 +7814,17 @@ test cases: - - SSC SSC1 ap -S -s -p -t 3 -m 1 - ['R SSC1 C +SAP:OK'] - - SSC SSC2 sta -C -s -p 1234567890 - - ['R SSC2 C +JAP:DISCONNECTED,1,204'] + - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] - - SSC SSC2 sta -D - ['R SSC2 C +QAP:OK'] - - WIFI CONN - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:DISCONNECTED,1,5'] + - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] - - WIFI DISCONN - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:DISCONNECTED,5,4'] + - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] comment: '' execution time: 0.0 expected result: '1. succeed @@ -10535,11 +7884,11 @@ test cases: - - SSC SSC1 sta -C -s -p - ['R SSC1 C +JAP:CONNECTED'] - - SSC SSC1 sta -D - - ['R SSC1 C +JAP:DISCONNECTED,0,8'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:DISCONNECTED,2,15'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:DISCONNECTED,1,201'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] comment: '' execution time: 0.0 expected result: '1. disconnect event reason REASON_ASSOC_LEAVE @@ -10897,43 +8246,6 @@ test cases: test point 1: abnormal/special use test point 2: TCP connect and disconnect abnormal case version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0116 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK', 'R CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.ht_operation.second_channel_offset!="0","2")(Wlan.ie_list.ht_operation.sta_channel_width="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] - comment: '' - execution time: 0.0 - expected result: 1. beacon has erp/ht/xrates, cap.short_slot_time=1, ht_info.2nd_channel_offset=3,sta_channel_width=1, - rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: 1. target set to PHY mode ht40, capture beacon - sub module: Phy Mode - summary: SoftAP set as ht40, check beacon - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DNS_0101 SDK: '8266_NonOS @@ -12119,61 +9431,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0302 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -n 1000000 -j 5 - - [''] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - comment: '' - execution time: 0.0 - expected result: 3. target 2 able to scan AP - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 1 connect to AP - - 2. target 1 start sending UDP packets - - 3. target 2 scan in AP channel in 11b.g,n,ht40 mode' - sub module: WIFI Scan - summary: scan in congest channel - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_ARP_0101 SDK: '8266_NonOS @@ -13937,62 +11194,6 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0303 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s%20or%20wlan%20addr2%20%%s - - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. check STA packet - - 3. check SoftAP packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set softAP 11b, STA 11bgn - - 2. STA connect to ext AP - - 3. ext STA connect to SoftAP' - sub module: Phy Mode - summary: SoftAP 11b, STA 11bgn, get connected and join AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_DHCP_0206 SDK: '8266_NonOS @@ -14890,11 +12091,11 @@ test cases: - - SSC SSC1 sta -C -s -p - ['R SSC1 C +JAP:CONNECTED'] - - SSC SSC1 sta -D - - ['R SSC1 C +JAP:DISCONNECTED,0,8'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:DISCONNECTED,2,15'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:DISCONNECTED,1,201'] + - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] comment: '' execution time: 0.0 expected result: '1. disconnect event reason REASON_ASSOC_LEAVE @@ -14970,289 +12171,6 @@ test cases: test point 1: abnormal/special use test point 2: handling ARP request version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0903 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 C +JAP:DISCONNECTED,4,2'] - comment: '' - execution time: 0.0 - expected result: 1. disconect event reason REASON_AUTH_EXPIRE - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_AUTH_EXPIRE - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. - - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0108 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates and xrates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. 11bg STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bg, 11g STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0109 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates and xrates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. 11bgn STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bg, 11n STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0106 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-Beacon")(Wlan.ie_list.erp="")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")'] - comment: '' - execution time: 0.0 - expected result: 1. beacon has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: 1. target set to PHY mode 11bg, capture beacon - sub module: Phy Mode - summary: SoftAP set as 11bg, check beacon - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0107 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.supported_rates=""1/","2/","5.5/","11/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has erp/xrates, no ht, cap.short_slot_time=1, rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 3. radiotap rates in rates' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bg - - 2. 11b STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11bg, 11b STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0201 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - comment: '' - execution time: 0.0 - expected result: '3. find all 3 ext APs - - 5. find all 3 ext APs - - 7. find all 3 ext APs - - 9. find all 3 ext APs' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. 3 ext APs in 11b, 11g, 11n mode - - 2. STA in 11b mode - - 3. do all channel scan - - 4. STA in 11g mode - - 5. do all channel scan - - 6. STA in 11n ht20 mode - - 7. do all channel scan - - 8. STA in 11n ht40 mode - - 9. do all channel scan' - sub module: WIFI Scan - summary: STA in differnt PHY mode to scan AP in different PHY mode - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: Scan in different mode and channel - version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0503 SDK: '8266_NonOS @@ -15311,285 +12229,6 @@ test cases: test point 1: basic function test point 2: reconnect policy test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0402 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, SoftAP not get - disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 - - 2. AP get connected - - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 20M, Softap get connected - than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0401 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 - - 2. STA connect to ext AP - - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 20M, STA connect to - AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0407 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 - - 2. STA connect to ext AP - - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, STA connect - to AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0406 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, SoftAP not get - disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 - - 2. AP get connected - - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 40M, Softap get connected - than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0405 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 - - 2. STA connect to ext AP - - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 40M, STA connect to - AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0404 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, SoftAP not - get disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 - - 2. AP get connected - - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, Softap get - connected than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0112 SDK: '8266_NonOS @@ -15630,53 +12269,6 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0408 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, SoftAP not - get disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 - - 2. AP get connected - - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, Softap get - connected than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0114 SDK: '8266_NonOS @@ -15717,315 +12309,6 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0214 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities.short_gi_for_40="1")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - 4. 40M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn ht40 - - 2. target connect to 11n ht40 AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn ht40,join ht40 external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0212 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - assoc-req has xrates no ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn ht40 - - 2. target connect to 11g AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn ht40, join 11g external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0213 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn ht40 - - 2. target connect to 11n AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn ht40, join 11n external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0210 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities="")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")(Wlan.capability.short_slot_time="1")', - 'P CAP OR 2 PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M") - PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.msc="")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req and assoc-req has xrates/ht, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in rates or xrates or msc0-7' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn - - 2. target connect to 11n ht40 AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn, join ht40 external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0211 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 sta -C -s -p - - ['P SSC1 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-ProbeReq")(Wlan.ie_list.extended_supported_rates+Wlan.ie_list.supported_rates="24/","36/","48/","54/","1/","2/","5.5/","11/","6/","9/","12/","18/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocReq")(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. probe-req has xrates/ht, ht_cap.short_gi40=1, 40width=1, cap.short_slot_time=1,rates+xrates=[1/2/5.5/11/6/9/12/18/24/36/48/54]; - - assoc-req has no ht/xrates, cap.short_slot_time=1,rates=[1/2/5.5/11] - - 4. 20M - - 5. succeed - - 6. data rate in radiotap is in [1/2/5.5/11]' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. target set to PHY mode 11bgn ht40 - - 2. target connect to 11b AP - - 3. capture probe-req and assoc-req in step2 - - 4. check if config bandwidth correct - - 5. send data from target - - 6. capture data in step5' - sub module: Phy Mode - summary: target STA set as 11bgn ht40, join 11b external AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0104 SDK: '8266_NonOS @@ -16399,61 +12682,6 @@ test cases: test point 1: basic function test point 2: SAP/JAP with different config version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0504 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 40M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IP_0101 SDK: '8266_NonOS @@ -16512,46 +12740,6 @@ test cases: test point 1: basic function test point 2: set and query static IP version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0702 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,3'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 C +JAP:DISCONNECTED,2'] - comment: '' - execution time: 0.0 - expected result: '1. get status AP not exist in disconnect event - - 2. get status wrong password in disconnect event' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1. sta connect to ap not exist - - 2. sta connect to ap with wrong password' - sub module: WIFI Connect - summary: check wifi status wrong password, no ap found - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi connect status check - version: v1 (2016-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0801 SDK: '8266_NonOS @@ -17276,55 +13464,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0104 - SDK: ESP32_IDF - Test App: SSC - allow fail: 2/3 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 2 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - STRING wlan%20addr2%20%%s - - [R PC_COM C OK] - - - 'NIC CAP START wlan_capture ' - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED', 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Management-AssocRes")(Wlan.ie_list.erp!)(Wlan.ie_list.ht_capabilities!)(Wlan.ie_list.extended_supported_rates!)(Wlan.capability.short_slot_time="1")(Wlan.ie_list.supported_rates="1/","2/","5.5/","11/")', - 'P CAP PDU (Wlan.frame_ctrl.type_subtype="Data")(Wlan.radiotap.rate<"1M","2M","5.5M","11M")'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. assoc response has no erp/xrates/ht, cap.short_slot_time=1, rates=[1/2/5/5/11] - - 3. radiotap rates in [1/2/5/5/11]' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target set to PHY mode 11b - - 2. 11bgn STA connect to SoftAP, capture assoc response - - 3. ping, capture Data' - sub module: Phy Mode - summary: SoftAP set as 11b, 11n STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: SoftAP PHY mode test - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0113 SDK: '8266_NonOS From d7db3e6a35f3877577ed7eb53c028b321bb59dcc Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Wed, 28 Sep 2016 20:11:42 +0800 Subject: [PATCH 166/179] build SSC should also use variable for server name --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f422f9f250..a258da418a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,7 +62,7 @@ build_ssc: expire_in: 6 mos script: - - git clone ssh://git@gitlab.espressif.cn:27227/yinling/SSC.git + - git clone $GITLAB_SSH_SERVER/yinling/SSC.git - cd SSC - make defconfig - chmod +x gen_misc_ng.sh From 4929534448cbcc711bb180ce29d3ecc8a4df37e4 Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 13:38:29 +0800 Subject: [PATCH 167/179] add gitlab key in test template job --- .gitlab-ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a258da418a..952cba7d78 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,7 @@ build_ssc: script: - git clone $GITLAB_SSH_SERVER/yinling/SSC.git - cd SSC + - git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..." - make defconfig - chmod +x gen_misc_ng.sh - ./gen_misc_ng.sh @@ -137,8 +138,17 @@ push_master_to_github: expire_in: 6 mos script: + # add gitlab ssh key + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64 + - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + # clone test bench - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script + # run test - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH @@ -151,8 +161,17 @@ push_master_to_github: script: # must be night build triggers, otherwise exit without test - test $NIGHT_BUILD != "Yes" || exit 0 + # add gitlab ssh key + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64 + - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + # clone test bench - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script + # run test - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH Function_SYS_01: From 9b72441b450a0320c0ebe5d21e5ffe3c1fd97bc2 Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 14:14:19 +0800 Subject: [PATCH 168/179] Test cases use libpcap or libnet are not CI ready now: 1. It need rebuild native lib 2. require root permission --- .gitlab-ci.yml | 40 --- .../test/CIConfigs/Function_TCPIP_01.yml | 12 +- .../test/CIConfigs/Function_TCPIP_02.yml | 12 +- .../test/CIConfigs/Function_TCPIP_03.yml | 12 +- .../test/CIConfigs/Function_TCPIP_04.yml | 12 +- .../test/CIConfigs/Function_TCPIP_05.yml | 7 +- .../test/CIConfigs/Function_WIFI_07.yml | 10 - .../test/CIConfigs/Function_WIFI_08.yml | 10 - .../test/CIConfigs/Function_WIFI_09.yml | 10 - .../test/CIConfigs/Function_WIFI_10.yml | 10 - .../test/CIConfigs/Function_WIFI_11.yml | 10 - components/test/TestCaseAll.yml | 274 ------------------ 12 files changed, 27 insertions(+), 392 deletions(-) delete mode 100644 components/test/CIConfigs/Function_WIFI_07.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_08.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_09.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_10.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_11.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 952cba7d78..89269aa425 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -337,43 +337,3 @@ Function_TCPIP_12: - SSC_T1_2 before_script: - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_12.yml - -Function_WIFI_07: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_07.yml - -Function_WIFI_08: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_08.yml - -Function_WIFI_09: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_09.yml - -Function_WIFI_10: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_10.yml - -Function_WIFI_11: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T2_PhyMode - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_11.yml diff --git a/components/test/CIConfigs/Function_TCPIP_01.yml b/components/test/CIConfigs/Function_TCPIP_01.yml index 29542e9fe3..e947b0c5c7 100644 --- a/components/test/CIConfigs/Function_TCPIP_01.yml +++ b/components/test/CIConfigs/Function_TCPIP_01.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [TCPIP_ARP_0202, ^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, TCPIP_DHCP_0302, - TCPIP_DHCP_0301, TCPIP_ARP_0204, TCPIP_TCP_0412, TCPIP_TCP_0403, TCPIP_TCP_0402, - TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, TCPIP_TCP_0404, TCPIP_TCP_0408, - ^TCPIP_TCP_0202, TCPIP_TCP_0110, ^TCPIP_TCP_0203, TCPIP_DHCP_0101, TCPIP_DHCP_0103, - TCPIP_DHCP_0102, TCPIP_IP_0101, TCPIP_IP_0102, ^TCPIP_IGMP_0102, ^TCPIP_IGMP_0101, - ^TCPIP_IGMP_0104, TCPIP_IGMP_0104, TCPIP_IGMP_0103, TCPIP_IGMP_0102, TCPIP_IGMP_0101] + ID: [^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, TCPIP_DHCP_0302, TCPIP_DHCP_0301, + TCPIP_TCP_0412, TCPIP_TCP_0403, TCPIP_TCP_0402, TCPIP_TCP_0401, TCPIP_TCP_0407, + TCPIP_TCP_0406, TCPIP_TCP_0404, TCPIP_TCP_0408, ^TCPIP_TCP_0202, TCPIP_TCP_0110, + ^TCPIP_TCP_0203, TCPIP_DHCP_0101, TCPIP_DHCP_0103, TCPIP_DHCP_0102, TCPIP_IP_0101, + TCPIP_IP_0102, ^TCPIP_IGMP_0102, ^TCPIP_IGMP_0101, ^TCPIP_IGMP_0104, TCPIP_IGMP_0104, + TCPIP_IGMP_0103, TCPIP_IGMP_0102, TCPIP_IGMP_0101, ^TCPIP_UDP_0201, TCPIP_UDP_0108] diff --git a/components/test/CIConfigs/Function_TCPIP_02.yml b/components/test/CIConfigs/Function_TCPIP_02.yml index e40f69db59..6a3cb08d6d 100644 --- a/components/test/CIConfigs/Function_TCPIP_02.yml +++ b/components/test/CIConfigs/Function_TCPIP_02.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_UDP_0201, TCPIP_UDP_0108, TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0105, - TCPIP_UDP_0101, TCPIP_IGMP_0204, TCPIP_IGMP_0201, TCPIP_IGMP_0202, TCPIP_IGMP_0203, - ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, ^TCPIP_TCP_0402, - ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, TCPIP_UDP_0201, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, - ^TCPIP_TCP_0102, ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, - ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210] + ID: [TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0105, TCPIP_UDP_0101, TCPIP_IGMP_0204, + TCPIP_IGMP_0201, TCPIP_IGMP_0202, TCPIP_IGMP_0203, ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, + ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, ^TCPIP_TCP_0402, ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, + TCPIP_UDP_0201, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0102, ^TCPIP_TCP_0105, + ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, + TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, TCPIP_DHCP_0211] diff --git a/components/test/CIConfigs/Function_TCPIP_03.yml b/components/test/CIConfigs/Function_TCPIP_03.yml index 79107aca8c..0c4ac37524 100644 --- a/components/test/CIConfigs/Function_TCPIP_03.yml +++ b/components/test/CIConfigs/Function_TCPIP_03.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_TCP_0212, TCPIP_DHCP_0211, TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, - ^TCPIP_IP_0102, ^TCPIP_UDP_0105, ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, - ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, ^TCPIP_UDP_0108, ^TCPIP_IGMP_0201, ^TCPIP_IGMP_0203, - ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, TCPIP_UDP_0114, TCPIP_UDP_0113, TCPIP_UDP_0112, - ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, ^TCPIP_TCP_0207, TCPIP_TCP_0501, TCPIP_TCP_0106, - TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, TCPIP_TCP_0102, TCPIP_TCP_0103] + ID: [TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, ^TCPIP_IP_0102, ^TCPIP_UDP_0105, + ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, + ^TCPIP_UDP_0108, ^TCPIP_IGMP_0201, ^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, + TCPIP_UDP_0114, TCPIP_UDP_0113, TCPIP_UDP_0112, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, + ^TCPIP_TCP_0207, TCPIP_TCP_0106, TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, + TCPIP_TCP_0102, TCPIP_TCP_0103, TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114] diff --git a/components/test/CIConfigs/Function_TCPIP_04.yml b/components/test/CIConfigs/Function_TCPIP_04.yml index 8d20569c1d..f8bdb264b9 100644 --- a/components/test/CIConfigs/Function_TCPIP_04.yml +++ b/components/test/CIConfigs/Function_TCPIP_04.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114, ^TCPIP_TCP_0115, ^TCPIP_TCP_0112, - ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, TCPIP_ARP_0101, ^TCPIP_DHCP_0209, - ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, - ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, TCPIP_TCP_0204, TCPIP_TCP_0207, - TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, TCPIP_TCP_0203, TCPIP_TCP_0202, - TCPIP_TCP_0208, TCPIP_DHCP_0206, TCPIP_DHCP_0207, TCPIP_DHCP_0204, TCPIP_DHCP_0205] + ID: [^TCPIP_TCP_0115, ^TCPIP_TCP_0112, ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, + ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, + ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, TCPIP_TCP_0204, + TCPIP_TCP_0207, TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, TCPIP_TCP_0203, + TCPIP_TCP_0202, TCPIP_TCP_0208, TCPIP_DHCP_0206, TCPIP_DHCP_0207, TCPIP_DHCP_0204, + TCPIP_DHCP_0205, TCPIP_DHCP_0202, TCPIP_DHCP_0203, ^TCPIP_TCP_0204, TCPIP_DHCP_0201] diff --git a/components/test/CIConfigs/Function_TCPIP_05.yml b/components/test/CIConfigs/Function_TCPIP_05.yml index 7ff1bbf8ce..21b3b7a6d8 100644 --- a/components/test/CIConfigs/Function_TCPIP_05.yml +++ b/components/test/CIConfigs/Function_TCPIP_05.yml @@ -2,8 +2,7 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [TCPIP_DHCP_0202, TCPIP_DHCP_0203, ^TCPIP_TCP_0204, TCPIP_DHCP_0201, ^TCPIP_TCP_0208, - TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, ^TCPIP_TCP_0411, TCPIP_ARP_0203, + ID: [^TCPIP_TCP_0208, TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, ^TCPIP_TCP_0411, ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, - TCPIP_ARP_0201, TCPIP_TCP_0115, TCPIP_TCP_0114, TCPIP_TCP_0116, TCPIP_TCP_0111, - TCPIP_TCP_0113, TCPIP_TCP_0112] + TCPIP_TCP_0115, TCPIP_TCP_0114, TCPIP_TCP_0116, TCPIP_TCP_0111, TCPIP_TCP_0113, + TCPIP_TCP_0112] diff --git a/components/test/CIConfigs/Function_WIFI_07.yml b/components/test/CIConfigs/Function_WIFI_07.yml deleted file mode 100644 index 22840fa7af..0000000000 --- a/components/test/CIConfigs/Function_WIFI_07.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0105, WIFI_PHY_0102, WIFI_PHY_0102, - WIFI_PHY_0102, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0103, WIFI_PHY_0101, WIFI_PHY_0101, - WIFI_PHY_0101, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0313, WIFI_PHY_0312, WIFI_PHY_0312, - WIFI_PHY_0312, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0311, WIFI_PHY_0310, WIFI_PHY_0310, - WIFI_PHY_0310, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0316, WIFI_PHY_0315, WIFI_PHY_0315, - WIFI_PHY_0315] diff --git a/components/test/CIConfigs/Function_WIFI_08.yml b/components/test/CIConfigs/Function_WIFI_08.yml deleted file mode 100644 index 640330233a..0000000000 --- a/components/test/CIConfigs/Function_WIFI_08.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0314, WIFI_PHY_0308, WIFI_PHY_0308, - WIFI_PHY_0308, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0309, WIFI_PHY_0304, WIFI_PHY_0304, - WIFI_PHY_0304, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0305, WIFI_PHY_0306, WIFI_PHY_0306, - WIFI_PHY_0306, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0307, WIFI_PHY_0301, WIFI_PHY_0301, - WIFI_PHY_0301, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0302, WIFI_PHY_0110, WIFI_PHY_0110, - WIFI_PHY_0110] diff --git a/components/test/CIConfigs/Function_WIFI_09.yml b/components/test/CIConfigs/Function_WIFI_09.yml deleted file mode 100644 index a51560fd60..0000000000 --- a/components/test/CIConfigs/Function_WIFI_09.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0113, WIFI_PHY_0120, WIFI_PHY_0120, - WIFI_PHY_0120, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0119, WIFI_PHY_0118, WIFI_PHY_0118, - WIFI_PHY_0118, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0115, WIFI_PHY_0114, WIFI_PHY_0114, - WIFI_PHY_0114, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0117, WIFI_PHY_0111, WIFI_PHY_0111, - WIFI_PHY_0111, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0112, WIFI_PHY_0205, WIFI_PHY_0205, - WIFI_PHY_0205] diff --git a/components/test/CIConfigs/Function_WIFI_10.yml b/components/test/CIConfigs/Function_WIFI_10.yml deleted file mode 100644 index f143efb3b0..0000000000 --- a/components/test/CIConfigs/Function_WIFI_10.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0204, WIFI_PHY_0207, WIFI_PHY_0207, - WIFI_PHY_0207, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0206, WIFI_PHY_0201, WIFI_PHY_0201, - WIFI_PHY_0201, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0203, WIFI_PHY_0202, WIFI_PHY_0202, - WIFI_PHY_0202, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0209, WIFI_PHY_0208, WIFI_PHY_0208, - WIFI_PHY_0208, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0116, WIFI_PHY_0303, WIFI_PHY_0303, - WIFI_PHY_0303] diff --git a/components/test/CIConfigs/Function_WIFI_11.yml b/components/test/CIConfigs/Function_WIFI_11.yml deleted file mode 100644 index f4adf0d2e6..0000000000 --- a/components/test/CIConfigs/Function_WIFI_11.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0108, WIFI_PHY_0109, WIFI_PHY_0109, - WIFI_PHY_0109, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0106, WIFI_PHY_0107, WIFI_PHY_0107, - WIFI_PHY_0107, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0214, WIFI_PHY_0212, WIFI_PHY_0212, - WIFI_PHY_0212, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0213, WIFI_PHY_0210, WIFI_PHY_0210, - WIFI_PHY_0210, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0211, WIFI_PHY_0104, WIFI_PHY_0104, - WIFI_PHY_0104] diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml index d787017591..40d1891715 100644 --- a/components/test/TestCaseAll.yml +++ b/components/test/TestCaseAll.yml @@ -124,59 +124,6 @@ test cases: test point 1: basic function test point 2: sw reboot version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ARP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+send+block_arp_ip - - ['R PC_COM C +NIC_START:OK'] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr "192.168.11.240" - ethernet_len_type "ARP" ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_sender_hw_addr - "18:18:18:18:18:18" ethernet_len_type "ARP" ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_sender_proto_addr - ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - comment: '' - execution time: 0.0 - expected result: 1. PC can't recv ARP reply from target - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: 1. PC send ARP req with target_hw_addr, sender_hw_addr and sender_proto_addr - not correct - sub module: ARP - summary: PC send invalid ARP request to target 2 - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: handling ARP request - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DHCP_0302 SDK: '8266_NonOS @@ -527,48 +474,6 @@ test cases: test point 1: basic function test point 2: 'get heap size ' version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ARP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+send+block_arp_ip - - ['R PC_COM C +NIC_START:OK'] - - - NIC NIC1 SEND ARP arp_op_code 0xFF arp_target_proto_addr ethernet_dst_addr - "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - comment: '' - execution time: 0.0 - expected result: 1. PC can't recv ARP reply from target - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: 1. PC send ARP with error op_code - sub module: ARP - summary: PC send invalid ARP request to target 4 - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: handling ARP request - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0412 SDK: '8266_NonOS @@ -8201,51 +8106,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0501 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+block_ip - - ['R PC_COM C +NIC_START:OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - [''] - - - DELAY 10 - - ['R SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: 2. connect failed, no exception - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. PC do not reply any IP packet on NIC - - 2. target try to connect to TCP server with PC NIC IP' - sub module: TCP - summary: PC do not reply TCP SYN of target - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP connect and disconnect abnormal case - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_DNS_0101 SDK: '8266_NonOS @@ -9431,46 +9291,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ARP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+send+block_arp_ip - - ['R PC_COM C +NIC_START:OK'] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr ethernet_dst_addr - "ff:ff:ff:ff:ff:ff" - - ['P PC_COM C +NIC_SEND:OK', P NIC1 PDU (Ethernet.dst_addr=)(ARP.hw_type="Ethernet")(ARP.protocol="IPv4")(ARP.hw_len="6")(ARP.proto_len="4")(ARP.op_code="reply")(ARP.sender_hw_addr=)(ARP.sender_proto_addr=)(ARP.target_hw_addr=)(ARP.target_proto_addr=)] - comment: '' - execution time: 0.0 - expected result: 1. PC recv target valid ARP reply - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: 1. PC send ARP req to target - sub module: ARP - summary: PC send valid ARP request to target - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: handling ARP request - version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_UDP_0304 SDK: '8266_NonOS @@ -12124,53 +11944,6 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ARP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+send+block_arp_ip - - ['R PC_COM C +NIC_START:OK'] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_hw_len - 10 ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_target_proto_addr arp_proto_len - 10 ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - comment: '' - execution time: 0.0 - expected result: 1. PC can't recv ARP reply from target - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: 1. PC send ARP req with hw_addr_len and proto_addr_len not correct - sub module: ARP - summary: PC send invalid ARP request to target 3 - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: handling ARP request - version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0503 SDK: '8266_NonOS @@ -12867,53 +12640,6 @@ test cases: test point 1: basic function test point 2: SAP/JAP with different config version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ARP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - STRING ether%20src%20%%s%20or%20ether%20dst%20%%s - - - [R PC_COM C OK] - - - NIC NIC1 START capture+send+block_arp_ip - - ['R PC_COM C +NIC_START:OK'] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_hw_type 0xF1F1 arp_target_proto_addr - ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - - - NIC NIC1 SEND ARP arp_op_code "request" arp_proto_type 0xF1F1 arp_target_proto_addr - ethernet_dst_addr "ff:ff:ff:ff:ff:ff" - - [''] - - - DELAY 2 - - [P PC_COM C +DELAYDONE, P NIC1 NPDU (Ethernet.dst_addr=)(Ethernet.len_type="ARP")] - comment: '' - execution time: 0.0 - expected result: 1. PC can't recv ARP reply from target - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: 1. PC send ARP req with unsupported hw type and protocol type - sub module: ARP - summary: PC send invalid ARP request to target 1 - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: handling ARP request - version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0503 SDK: '8266_NonOS From 547fb6ed6ca0dc9dd6da222f16762ea26903b54c Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 20:20:40 +0800 Subject: [PATCH 169/179] update current known issue for ESP32 IDF test --- components/test/KnownIssues | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/components/test/KnownIssues b/components/test/KnownIssues index e69de29bb2..08bc48f185 100644 --- a/components/test/KnownIssues +++ b/components/test/KnownIssues @@ -0,0 +1,66 @@ + +# NOT SUPPORT + +# ICMP send Ping not supported +TCPIP_ICMP_0101 +^TCPIP_ICMP_0101 + +# IGMP cases are not supported for now +TCPIP_IGMP_0101 +TCPIP_IGMP_0102 +TCPIP_IGMP_0103 +TCPIP_IGMP_0104 +TCPIP_IGMP_0201 +TCPIP_IGMP_0202 +TCPIP_IGMP_0203 +TCPIP_IGMP_0204 +^TCPIP_IGMP_0101 +^TCPIP_IGMP_0102 +^TCPIP_IGMP_0103 +^TCPIP_IGMP_0104 +^TCPIP_IGMP_0201 +^TCPIP_IGMP_0202 +^TCPIP_IGMP_0203 +^TCPIP_IGMP_0204 + +# BUG + +# auth change event +WIFI_CONN_0801 + +# disconnect reason +WIFI_CONN_0904 +^WIFI_CONN_0904 +WIFI_CONN_0901 +^WIFI_CONN_0901 + +# Wifi connect issue +WIFI_CONN_0104 +^WIFI_CONN_0104 + +# DHCP issues +^TCPIP_DHCP_0301 +TCPIP_DHCP_0301 +TCPIP_DHCP_0101 +TCPIP_DHCP_0207 +^TCPIP_DHCP_0207 +TCPIP_DHCP_0208 +^TCPIP_DHCP_0208 + +# TCP issue +TCPIP_TCP_0402 +^TCPIP_TCP_0406 +^TCPIP_TCP_0401 +TCPIP_TCP_0210 +^TCPIP_TCP_0210 +TCPIP_TCP_0103 + + +# UDP issue +TCPIP_UDP_0103 +^TCPIP_UDP_0103 +TCPIP_UDP_0110 +^TCPIP_UDP_0110 + + + From 12fa7472ea1bfa3759a47b219054ffce2997c546 Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 20:21:33 +0800 Subject: [PATCH 170/179] night jobs should exit succeed if no need to run --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89269aa425..2b421e77a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -160,7 +160,7 @@ push_master_to_github: - triggers script: # must be night build triggers, otherwise exit without test - - test $NIGHT_BUILD != "Yes" || exit 0 + - test $NIGHT_BUILD = "Yes" || exit 0 # add gitlab ssh key - mkdir -p ~/.ssh - chmod 700 ~/.ssh From 64426013333f01838babe444307ddc7511afff8d Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 20:22:33 +0800 Subject: [PATCH 171/179] add some missing cases caused by autogen bug --- components/test/TestCaseAll.yml | 1239 +++++++++++++++++++++++++++++++ 1 file changed, 1239 insertions(+) diff --git a/components/test/TestCaseAll.yml b/components/test/TestCaseAll.yml index 40d1891715..7112c87936 100644 --- a/components/test/TestCaseAll.yml +++ b/components/test/TestCaseAll.yml @@ -902,6 +902,72 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0405 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -S -s -l 1 + - [''] + - - DELAY 5400 + - ['P SSC1 RE CLOSED:\d+,0'] + comment: '' + execution time: 1.5 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.TCP连接断开' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.PC 网卡 disable + + 6.target1上使用socket1发送数据,等待 90 分钟' + sub module: TCP + summary: do TCP send after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0404 SDK: '8266_NonOS @@ -958,6 +1024,38 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0408 SDK: '8266_NonOS @@ -1982,6 +2080,52 @@ test cases: test point 1: basic function test point 2: DNS function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0403 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0904 SDK: '8266_NonOS @@ -3927,6 +4071,72 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0405 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -S -s -l 1 + - [''] + - - DELAY 5400 + - ['P SSC1 RE CLOSED:\d+,0'] + comment: '' + execution time: 1.5 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.TCP连接断开' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.PC 网卡 disable + + 6.target1上使用socket1发送数据,等待 90 分钟' + sub module: TCP + summary: do TCP send after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_TCP_0406 SDK: '8266_NonOS @@ -6012,6 +6222,281 @@ test cases: test point 1: abnormal/special use test point 2: TCP handling abnormal event version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0502 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0503 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0501 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0506 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0505 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA set to 40M ,SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0301 SDK: '8266_NonOS @@ -6609,6 +7094,93 @@ test cases: test point 1: basic function test point 2: DHCP client function test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0301 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANFAIL, 'P SSC1 P +SCAN:', R SSC1 C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1. second scan failed + + 2. first scan succeed' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. do all channel scan + + 2. do scan before scan finished' + sub module: WIFI Scan + summary: reject scan request before scan finished + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0303 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 1 STA join AP + + 2. target 1 STA scan before JAP succeed + + 3. target 1 quite AP + + 4. target 1 scan + + 5. target 1 JAP before scan succeed' + sub module: WIFI Scan + summary: scan during JAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0801 SDK: '8266_NonOS @@ -6672,6 +7244,55 @@ test cases: test point 1: basic function test point 2: wifi auth changed event test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0304 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC2 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 2 STA join target 1 SoftAP + + 2. target 1 STA scan before target 2 JAP succeed + + 3. target 2 STA QAP + + 4. target 1 STA scan + + 5. target 2 STA JAP before target 1 STA scan succeed' + sub module: WIFI Scan + summary: scan during ext STA join SoftAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0108 SDK: '8266_NonOS @@ -7773,6 +8394,47 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0901 SDK: '8266_NonOS @@ -9291,6 +9953,61 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0302 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -n 1000000 -j 5 + - [''] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: 3. target 2 able to scan AP + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. target 1 connect to AP + + 2. target 1 start sending UDP packets + + 3. target 2 scan in AP channel in 11b.g,n,ht40 mode' + sub module: WIFI Scan + summary: scan in congest channel + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) - CI ready: 'Yes' ID: TCPIP_UDP_0304 SDK: '8266_NonOS @@ -11944,6 +12661,147 @@ test cases: test point 1: basic function test point 2: wifi disconnect reason test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0201 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + comment: '' + execution time: 0.0 + expected result: '3. find all 3 ext APs + + 5. find all 3 ext APs + + 7. find all 3 ext APs + + 9. find all 3 ext APs' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + module: WIFI MAC + steps: '1. 3 ext APs in 11b, 11g, 11n mode + + 2. STA in 11b mode + + 3. do all channel scan + + 4. STA in 11g mode + + 5. do all channel scan + + 6. STA in 11n ht20 mode + + 7. do all channel scan + + 8. STA in 11n ht40 mode + + 9. do all channel scan' + sub module: WIFI Scan + summary: STA in differnt PHY mode to scan AP in different PHY mode + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: Scan in different mode and channel + version: v1 (2015-8-15) - CI ready: 'Yes' ID: WIFI_CONN_0503 SDK: '8266_NonOS @@ -12002,6 +12860,285 @@ test cases: test point 1: basic function test point 2: reconnect policy test version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0402 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0401 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0407 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0406 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0405 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0404 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0112 SDK: '8266_NonOS @@ -12042,6 +13179,53 @@ test cases: test point 1: basic function test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0408 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0114 SDK: '8266_NonOS @@ -12455,6 +13639,61 @@ test cases: test point 1: basic function test point 2: SAP/JAP with different config version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0504 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) - CI ready: 'Yes' ID: ^TCPIP_IP_0101 SDK: '8266_NonOS From fbb654fa686ccce365af7317a1cf76db578b921e Mon Sep 17 00:00:00 2001 From: Yinling Date: Thu, 29 Sep 2016 20:47:31 +0800 Subject: [PATCH 172/179] move content from readme to wiki --- components/test/README.md | 57 --------------------------------------- 1 file changed, 57 deletions(-) diff --git a/components/test/README.md b/components/test/README.md index f23153bca6..1d0c4cfbd1 100644 --- a/components/test/README.md +++ b/components/test/README.md @@ -2,60 +2,3 @@ # Note: The test cases in this folder are for Espressif internal use. # Goto internal project wiki Testing page for detail about this folder. - -## File Structure - -``` -test --- CIConfigs --- sanity_test1.yml (Runner config files) - | |-- stress_test1.yml - |-- TestCaseAll.yml (TestCaseFiles) - |-- TestEnvAll.yml (TestCaseFiles) - |-- InitialConditionAll.yml (TestCaseFiles) - |-- TestCaseScript --- ... (Test case scripts) -``` - -1. CIConfigs folder - * config for CI config files are put in this folder - * CI config files configs the cases and some other options for the CI job with same name -1. Test case files - * TestCaseAll.yml (test cases) - * InitialConditionAll.yml (initial conditions) - * TestEnvAll.yml (test environments) - * [how to modify test cases](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestCaseFiles.DesignNote.md) -1. Test case scripts - * some cases are implemented by specified script. those scripts are put in this folder. - - -## Modify test cases - -1. check if the "SDK" of the test case only contain the current SDK - * if Yes, then just modify the test case behavior - * if No: - 1. then remove current SDK name from "SDK" of the test case - 2. Add a new test case, and set "SDK" only support current SDK name -2. use [auto_test_script](https://gitlab.espressif.cn:6688/yinling/auto_test_script) to load the modified case and verify the modification -3. create a merge request and assign to HYL (or add comment @yinling for merging test). -After review it will be merged to SDK and will be The cases will be synced to database in auto_test_script. - - -## Run test case locally - -1. clone auto_test_script (ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git) from gitlab -2. create test environment: - 1. search test case (search test case ID in components/test/TestCaseAll.yml, get the "test environment" value - 2. goto [test environment list](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Documents/TestEnvList.md), find the link and goto the environment detail page - 3. create test environment according to figure and description - 4. [config test environment](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestEnvConfig.DesignNote.md). All parameters in table "Parameters require config before use" MUST be configured. -3. run test cases with [CIRunner.py](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/RunnerConfigs.DesignNote.md) - - - -## exclude known issues for CI -the test cases listed in file "KnownIssues" will be excluded by CI when calculating results - -Editing KnownIssues file is very simple, one single line for the ID for each case. -``` -TCPIP_TCP_0101 -TCPIP_TCP_0201 -... -``` \ No newline at end of file From 19ca66c96824d3205fb178021064093b61f43972 Mon Sep 17 00:00:00 2001 From: Yinling Date: Fri, 30 Sep 2016 13:58:02 +0800 Subject: [PATCH 173/179] add job to generate test report --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b421e77a0..bd6e3ce5a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -88,6 +88,30 @@ test_build_system: script: - ./make/test_build_system.sh +test_report: + stage: deploy + only: + - master + - triggers + tags: + - test_report + variables: + LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" + TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/test" + REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report" + artifacts: + when: always + paths: + - $REPORT_PATH + expire_in: 6 mos + script: + - ls $LOG_PATH + # clone test bench + - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git + - cd auto_test_script + # generate report + - python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH + push_master_to_github: before_script: From e5b8854d96ee155c7509ed5edffa2139b33467f6 Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Fri, 30 Sep 2016 15:34:17 +0800 Subject: [PATCH 174/179] can not put test report to deploy stage, otherwise if test fails it won't generate test report. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd6e3ce5a4..775a13b476 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -89,7 +89,7 @@ test_build_system: - ./make/test_build_system.sh test_report: - stage: deploy + stage: test only: - master - triggers From 1447cd4136f251099cec0fe60a98d1a9881e21fe Mon Sep 17 00:00:00 2001 From: Yinling Date: Fri, 30 Sep 2016 16:11:24 +0800 Subject: [PATCH 175/179] fix issue on test report job: 1. test report job should be put to deploy stage, otherwise it can't get logs from test stage 2. allow test fail so that test report job will be executed for failed test --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 775a13b476..ef28489077 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -89,12 +89,13 @@ test_build_system: - ./make/test_build_system.sh test_report: - stage: test + stage: deploy only: - master - triggers tags: - test_report + allow_failure: true variables: LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/test" @@ -144,6 +145,7 @@ push_master_to_github: only: - master - triggers + allow_failure: true variables: # LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required From 685c1084ba276e4ff9e39e28fe796ed0a347eac0 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 11 Oct 2016 16:41:05 +1100 Subject: [PATCH 176/179] Reinstate build_examples gitlab CI case Had been removed in 42e31116 --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef28489077..7834707fef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,6 +69,23 @@ build_ssc: - chmod +x gen_misc_ng.sh - ./gen_misc_ng.sh +build_examples: + <<: *build_template + artifacts: + paths: + - build_examples/*/*/build/*.bin + - build_examples/*/*/build/*.elf + - build_examples/*/*/build/*.map + - build_examples/*/*/build/bootloader/*.bin + expire_in: 6 mos + + script: + # it's not possible to build 100% out-of-tree and have the "artifacts" + # mechanism work, but this is the next best thing + - mkdir build_examples + - cd build_examples + - ${IDF_PATH}/make/build_examples.sh + test_nvs_on_host: stage: test image: espressif/esp32-ci-env From b72d22041ca922792c3648806e5abdc187055ba8 Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 12 Oct 2016 11:17:56 +0800 Subject: [PATCH 177/179] rename components/test to idf_test: 1. test will be categorized by test level 2. add test level as attribute to test cases 3. will select TestCaseScript by the test cases added to CI (currently no test case uses test case script) 4. adding test level to test jobs 5. update .gitlab-ci.yml, each job need to set its test case file path 6. update .gitlab-ci.yml, test case path for test report is changed to idf_test --- .gitlab-ci.yml | 141 +- components/idf_test/README.md | 61 + .../CIConfigs/IT_Function_SYS_01.yml} | 0 .../CIConfigs/IT_Function_TCPIP_01.yml | 10 + .../CIConfigs/IT_Function_TCPIP_02.yml | 10 + .../CIConfigs/IT_Function_TCPIP_03.yml | 10 + .../CIConfigs/IT_Function_TCPIP_04.yml | 10 + .../CIConfigs/IT_Function_TCPIP_05.yml | 8 + .../CIConfigs/IT_Function_TCPIP_06.yml} | 0 .../CIConfigs/IT_Function_TCPIP_07.yml} | 8 +- .../CIConfigs/IT_Function_TCPIP_08.yml} | 8 +- .../CIConfigs/IT_Function_TCPIP_09.yml | 10 + .../CIConfigs/IT_Function_TCPIP_10.yml} | 6 +- .../CIConfigs/IT_Function_TCPIP_11.yml} | 6 +- .../CIConfigs/IT_Function_TCPIP_12.yml | 6 + .../CIConfigs/IT_Function_WIFI_01.yml | 10 + .../CIConfigs/IT_Function_WIFI_02.yml | 7 + .../CIConfigs/IT_Function_WIFI_03.yml} | 0 .../CIConfigs/IT_Function_WIFI_04.yml} | 0 .../CIConfigs/IT_Function_WIFI_05.yml} | 0 .../CIConfigs/IT_Function_WIFI_06.yml | 7 + .../integration_test}/InitialConditionAll.yml | 3650 +-- .../integration_test}/KnownIssues | 0 .../integration_test}/TestCaseAll.yml | 24339 ++++++++-------- .../integration_test}/TestEnvAll.yml | 388 +- .../uint_test/InitialConditionAll.yml | 2935 ++ components/idf_test/uint_test/TestCaseAll.yml | 1 + components/idf_test/uint_test/TestEnvAll.yml | 275 + .../test/CIConfigs/Function_TCPIP_01.yml | 10 - .../test/CIConfigs/Function_TCPIP_02.yml | 10 - .../test/CIConfigs/Function_TCPIP_03.yml | 10 - .../test/CIConfigs/Function_TCPIP_04.yml | 10 - .../test/CIConfigs/Function_TCPIP_05.yml | 8 - .../test/CIConfigs/Function_TCPIP_07.yml | 10 - .../test/CIConfigs/Function_TCPIP_12.yml | 6 - .../test/CIConfigs/Function_WIFI_01.yml | 10 - .../test/CIConfigs/Function_WIFI_02.yml | 7 - .../test/CIConfigs/Function_WIFI_06.yml | 7 - components/test/README.md | 4 - .../TestCaseScript/ATFunc/CmdInterruptTest.py | 130 - components/test/TestCaseScript/ATFunc/LAP.py | 64 - .../ATFunc/SendDataValidation.py | 161 - .../test/TestCaseScript/ATFunc/UARTTest.py | 164 - .../test/TestCaseScript/ATFunc/__init__.py | 2 - .../TestCaseScript/ATStress/ATPassThrough.py | 179 - .../test/TestCaseScript/ATStress/ATSleep.py | 251 - .../TestCaseScript/ATStress/SoftAPServer.py | 308 - .../TestCaseScript/ATStress/TCPClientMulti.py | 116 - .../ATStress/TCPClientSingle.py | 123 - .../TestCaseScript/ATStress/TCPSendPerf.py | 148 - .../TestCaseScript/ATStress/TCPServerMulti.py | 126 - .../TestCaseScript/ATStress/TCPTransparent.py | 280 - .../test/TestCaseScript/ATStress/UDPMulti.py | 113 - .../test/TestCaseScript/ATStress/UDPSingle.py | 105 - .../TestCaseScript/ATStress/UDPTransparent.py | 262 - .../test/TestCaseScript/ATStress/__init__.py | 2 - components/test/TestCaseScript/IOT/SCIOT.py | 357 - .../test/TestCaseScript/IOT/SCUDPServer.py | 378 - .../TestCaseScript/IOT/WifiConnUtility.py | 244 - components/test/TestCaseScript/IOT/WifiJAP.py | 183 - .../test/TestCaseScript/IOT/__init__.py | 1 - .../TestCaseScript/MeshStress/MeshSendRecv.py | 525 - .../TestCaseScript/MeshStress/__init__.py | 1 - .../test/TestCaseScript/SSLTest/Capability.py | 90 - .../TestCaseScript/SSLTest/ConfigUtility.py | 333 - .../test/TestCaseScript/SSLTest/Parameter.py | 56 - .../test/TestCaseScript/SSLTest/SSLHandler.py | 498 - .../TestCaseScript/SSLTest/SSLHandshake.py | 240 - .../test/TestCaseScript/SSLTest/SSLLowMem.py | 140 - .../TestCaseScript/SSLTest/SSLSendRecv.py | 147 - .../test/TestCaseScript/SSLTest/__init__.py | 1 - .../TestCaseScript/SleepMode/AutoSleep.py | 561 - .../TestCaseScript/SleepMode/DeepSleep.py | 259 - .../TestCaseScript/SleepMode/ForceSleep.py | 254 - .../test/TestCaseScript/SleepMode/__init__.py | 1 - .../TestCaseScript/StableTest/StableCase1.py | 160 - .../TestCaseScript/StableTest/__init__.py | 1 - .../TestCaseScript/TCPIPStress/ARPStress.py | 121 - .../TestCaseScript/TCPIPStress/PingStress.py | 122 - .../TestCaseScript/TCPIPStress/__init__.py | 1 - .../TestCaseScript/TCPStress/TCPAP4STA.py | 168 - .../TestCaseScript/TCPStress/TCPAPNSTA.py | 209 - .../TCPStress/TCPConnStressTC.py | 363 - .../TCPStress/TCPConnUtility.py | 273 - .../TestCaseScript/TCPStress/TCPConnection.py | 321 - .../TCPStress/TCPConnectionUtility.py | 251 - .../TCPStress/TCPDataValidation.py | 244 - .../TestCaseScript/TCPStress/TCPRandomSend.py | 103 - .../TestCaseScript/TCPStress/TCPSendRecv.py | 143 - .../TCPStress/TCPSoftAPSTASendRecv.py | 318 - .../TestCaseScript/TCPStress/TCPThroughput.py | 315 - .../test/TestCaseScript/TCPStress/__init__.py | 1 - .../TestCaseScript/UDPStress/UDPSendRecv.py | 130 - .../TestCaseScript/UDPStress/UDPThroughput.py | 305 - .../test/TestCaseScript/UDPStress/__init__.py | 1 - .../TestCaseScript/WiFiStress/SoftAPNSTA.py | 178 - .../WiFiStress/WifiConnUtility.py | 240 - .../test/TestCaseScript/WiFiStress/WifiJAP.py | 218 - .../TestCaseScript/WiFiStress/WifiJAPAtt.py | 173 - .../WiFiStress/WifiSmartConfig.py | 273 - .../TestCaseScript/WiFiStress/__init__.py | 1 - components/test/TestCaseScript/__init__.py | 2 - 102 files changed, 17710 insertions(+), 25726 deletions(-) create mode 100644 components/idf_test/README.md rename components/{test/CIConfigs/Function_SYS_01.yml => idf_test/integration_test/CIConfigs/IT_Function_SYS_01.yml} (100%) create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_01.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_02.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_03.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_04.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_05.yml rename components/{test/CIConfigs/Function_TCPIP_06.yml => idf_test/integration_test/CIConfigs/IT_Function_TCPIP_06.yml} (100%) rename components/{test/CIConfigs/Function_TCPIP_08.yml => idf_test/integration_test/CIConfigs/IT_Function_TCPIP_07.yml} (53%) rename components/{test/CIConfigs/Function_TCPIP_09.yml => idf_test/integration_test/CIConfigs/IT_Function_TCPIP_08.yml} (51%) create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_09.yml rename components/{test/CIConfigs/Function_TCPIP_10.yml => idf_test/integration_test/CIConfigs/IT_Function_TCPIP_10.yml} (66%) rename components/{test/CIConfigs/Function_TCPIP_11.yml => idf_test/integration_test/CIConfigs/IT_Function_TCPIP_11.yml} (67%) create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_12.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_01.yml create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_02.yml rename components/{test/CIConfigs/Function_WIFI_03.yml => idf_test/integration_test/CIConfigs/IT_Function_WIFI_03.yml} (100%) rename components/{test/CIConfigs/Function_WIFI_04.yml => idf_test/integration_test/CIConfigs/IT_Function_WIFI_04.yml} (100%) rename components/{test/CIConfigs/Function_WIFI_05.yml => idf_test/integration_test/CIConfigs/IT_Function_WIFI_05.yml} (100%) create mode 100644 components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_06.yml rename components/{test => idf_test/integration_test}/InitialConditionAll.yml (96%) rename components/{test => idf_test/integration_test}/KnownIssues (100%) rename components/{test => idf_test/integration_test}/TestCaseAll.yml (98%) rename components/{test => idf_test/integration_test}/TestEnvAll.yml (100%) create mode 100644 components/idf_test/uint_test/InitialConditionAll.yml create mode 100644 components/idf_test/uint_test/TestCaseAll.yml create mode 100644 components/idf_test/uint_test/TestEnvAll.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_01.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_02.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_03.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_04.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_05.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_07.yml delete mode 100644 components/test/CIConfigs/Function_TCPIP_12.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_01.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_02.yml delete mode 100644 components/test/CIConfigs/Function_WIFI_06.yml delete mode 100644 components/test/README.md delete mode 100755 components/test/TestCaseScript/ATFunc/CmdInterruptTest.py delete mode 100644 components/test/TestCaseScript/ATFunc/LAP.py delete mode 100755 components/test/TestCaseScript/ATFunc/SendDataValidation.py delete mode 100644 components/test/TestCaseScript/ATFunc/UARTTest.py delete mode 100755 components/test/TestCaseScript/ATFunc/__init__.py delete mode 100755 components/test/TestCaseScript/ATStress/ATPassThrough.py delete mode 100644 components/test/TestCaseScript/ATStress/ATSleep.py delete mode 100755 components/test/TestCaseScript/ATStress/SoftAPServer.py delete mode 100755 components/test/TestCaseScript/ATStress/TCPClientMulti.py delete mode 100755 components/test/TestCaseScript/ATStress/TCPClientSingle.py delete mode 100755 components/test/TestCaseScript/ATStress/TCPSendPerf.py delete mode 100755 components/test/TestCaseScript/ATStress/TCPServerMulti.py delete mode 100755 components/test/TestCaseScript/ATStress/TCPTransparent.py delete mode 100755 components/test/TestCaseScript/ATStress/UDPMulti.py delete mode 100755 components/test/TestCaseScript/ATStress/UDPSingle.py delete mode 100755 components/test/TestCaseScript/ATStress/UDPTransparent.py delete mode 100755 components/test/TestCaseScript/ATStress/__init__.py delete mode 100755 components/test/TestCaseScript/IOT/SCIOT.py delete mode 100755 components/test/TestCaseScript/IOT/SCUDPServer.py delete mode 100755 components/test/TestCaseScript/IOT/WifiConnUtility.py delete mode 100755 components/test/TestCaseScript/IOT/WifiJAP.py delete mode 100755 components/test/TestCaseScript/IOT/__init__.py delete mode 100755 components/test/TestCaseScript/MeshStress/MeshSendRecv.py delete mode 100755 components/test/TestCaseScript/MeshStress/__init__.py delete mode 100755 components/test/TestCaseScript/SSLTest/Capability.py delete mode 100755 components/test/TestCaseScript/SSLTest/ConfigUtility.py delete mode 100755 components/test/TestCaseScript/SSLTest/Parameter.py delete mode 100644 components/test/TestCaseScript/SSLTest/SSLHandler.py delete mode 100755 components/test/TestCaseScript/SSLTest/SSLHandshake.py delete mode 100644 components/test/TestCaseScript/SSLTest/SSLLowMem.py delete mode 100644 components/test/TestCaseScript/SSLTest/SSLSendRecv.py delete mode 100755 components/test/TestCaseScript/SSLTest/__init__.py delete mode 100755 components/test/TestCaseScript/SleepMode/AutoSleep.py delete mode 100755 components/test/TestCaseScript/SleepMode/DeepSleep.py delete mode 100755 components/test/TestCaseScript/SleepMode/ForceSleep.py delete mode 100755 components/test/TestCaseScript/SleepMode/__init__.py delete mode 100755 components/test/TestCaseScript/StableTest/StableCase1.py delete mode 100755 components/test/TestCaseScript/StableTest/__init__.py delete mode 100755 components/test/TestCaseScript/TCPIPStress/ARPStress.py delete mode 100755 components/test/TestCaseScript/TCPIPStress/PingStress.py delete mode 100755 components/test/TestCaseScript/TCPIPStress/__init__.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPAP4STA.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPAPNSTA.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPConnStressTC.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPConnUtility.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPConnection.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPDataValidation.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPRandomSend.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPSendRecv.py delete mode 100644 components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py delete mode 100755 components/test/TestCaseScript/TCPStress/TCPThroughput.py delete mode 100755 components/test/TestCaseScript/TCPStress/__init__.py delete mode 100755 components/test/TestCaseScript/UDPStress/UDPSendRecv.py delete mode 100755 components/test/TestCaseScript/UDPStress/UDPThroughput.py delete mode 100755 components/test/TestCaseScript/UDPStress/__init__.py delete mode 100755 components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py delete mode 100755 components/test/TestCaseScript/WiFiStress/WifiConnUtility.py delete mode 100755 components/test/TestCaseScript/WiFiStress/WifiJAP.py delete mode 100755 components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py delete mode 100755 components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py delete mode 100755 components/test/TestCaseScript/WiFiStress/__init__.py delete mode 100755 components/test/TestCaseScript/__init__.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7834707fef..42dc78e9ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -115,7 +115,7 @@ test_report: allow_failure: true variables: LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" - TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/test" + TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test" REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report" artifacts: when: always @@ -170,8 +170,8 @@ push_master_to_github: BIN_PATH: "$CI_PROJECT_DIR/SSC/build/" APP_NAME: "ssc" LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF" - # assume tests are put in "components/test" - TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/test" + # append test level folder to TEST_CASE_FILE_PATH in before_script of test job + TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test" # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary artifacts: @@ -217,144 +217,131 @@ push_master_to_github: # run test - python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH -Function_SYS_01: +IT_Function_SYS_01: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_SYS_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_01: +IT_Function_WIFI_01: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_02: +IT_Function_WIFI_02: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_02.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_01: +IT_Function_TCPIP_01: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_01.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_02: +IT_Function_TCPIP_02: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_02.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_03: +IT_Function_TCPIP_03: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_03.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_04: +IT_Function_TCPIP_04: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_04.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_05: +IT_Function_TCPIP_05: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_05.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_06: +IT_Function_TCPIP_06: <<: *test_template_night tags: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_06.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_03: +IT_Function_WIFI_03: <<: *test_template tags: - ESP32_IDF - SSC_T3_PhyMode before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_03.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_04: +IT_Function_WIFI_04: <<: *test_template tags: - ESP32_IDF - SSC_T1_APC before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_04.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_05: +IT_Function_WIFI_05: <<: *test_template tags: - ESP32_IDF - SSC_T1_WEP before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_05.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_WIFI_06: +IT_Function_WIFI_06: <<: *test_template tags: - ESP32_IDF - SSC_T2_PhyMode before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_WIFI_06.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_07: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T1_1 - - SSC_T1_2 - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_07.yml - -Function_TCPIP_08: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T1_1 - - SSC_T2_1 - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_08.yml - -Function_TCPIP_09: - <<: *test_template - tags: - - ESP32_IDF - - SSC_T1_1 - before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_09.yml - -Function_TCPIP_10: +IT_Function_TCPIP_07: <<: *test_template tags: - ESP32_IDF @@ -362,21 +349,53 @@ Function_TCPIP_10: - SSC_T1_2 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_10.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_11: +IT_Function_TCPIP_08: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_11.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test -Function_TCPIP_12: +IT_Function_TCPIP_09: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + +IT_Function_TCPIP_10: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + - SSC_T1_2 + - SSC_T2_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + +IT_Function_TCPIP_11: + <<: *test_template + tags: + - ESP32_IDF + - SSC_T1_1 + before_script: + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + +IT_Function_TCPIP_12: <<: *test_template tags: - ESP32_IDF - SSC_T1_1 - SSC_T1_2 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/Function_TCPIP_12.yml + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml + - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test diff --git a/components/idf_test/README.md b/components/idf_test/README.md new file mode 100644 index 0000000000..f23153bca6 --- /dev/null +++ b/components/idf_test/README.md @@ -0,0 +1,61 @@ + +# Note: The test cases in this folder are for Espressif internal use. + +# Goto internal project wiki Testing page for detail about this folder. + +## File Structure + +``` +test --- CIConfigs --- sanity_test1.yml (Runner config files) + | |-- stress_test1.yml + |-- TestCaseAll.yml (TestCaseFiles) + |-- TestEnvAll.yml (TestCaseFiles) + |-- InitialConditionAll.yml (TestCaseFiles) + |-- TestCaseScript --- ... (Test case scripts) +``` + +1. CIConfigs folder + * config for CI config files are put in this folder + * CI config files configs the cases and some other options for the CI job with same name +1. Test case files + * TestCaseAll.yml (test cases) + * InitialConditionAll.yml (initial conditions) + * TestEnvAll.yml (test environments) + * [how to modify test cases](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestCaseFiles.DesignNote.md) +1. Test case scripts + * some cases are implemented by specified script. those scripts are put in this folder. + + +## Modify test cases + +1. check if the "SDK" of the test case only contain the current SDK + * if Yes, then just modify the test case behavior + * if No: + 1. then remove current SDK name from "SDK" of the test case + 2. Add a new test case, and set "SDK" only support current SDK name +2. use [auto_test_script](https://gitlab.espressif.cn:6688/yinling/auto_test_script) to load the modified case and verify the modification +3. create a merge request and assign to HYL (or add comment @yinling for merging test). +After review it will be merged to SDK and will be The cases will be synced to database in auto_test_script. + + +## Run test case locally + +1. clone auto_test_script (ssh://git@gitlab.espressif.cn:27227/yinling/auto_test_script.git) from gitlab +2. create test environment: + 1. search test case (search test case ID in components/test/TestCaseAll.yml, get the "test environment" value + 2. goto [test environment list](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Documents/TestEnvList.md), find the link and goto the environment detail page + 3. create test environment according to figure and description + 4. [config test environment](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/TestEnvConfig.DesignNote.md). All parameters in table "Parameters require config before use" MUST be configured. +3. run test cases with [CIRunner.py](https://gitlab.espressif.cn:6688/yinling/auto_test_script/blob/master/public/Design/RunnerConfigs.DesignNote.md) + + + +## exclude known issues for CI +the test cases listed in file "KnownIssues" will be excluded by CI when calculating results + +Editing KnownIssues file is very simple, one single line for the ID for each case. +``` +TCPIP_TCP_0101 +TCPIP_TCP_0201 +... +``` \ No newline at end of file diff --git a/components/test/CIConfigs/Function_SYS_01.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_SYS_01.yml similarity index 100% rename from components/test/CIConfigs/Function_SYS_01.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_SYS_01.yml diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_01.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_01.yml new file mode 100644 index 0000000000..25a3ccda99 --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_01.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_DHCP_0302, TCPIP_DHCP_0302, TCPIP_DHCP_0301, TCPIP_TCP_0403, TCPIP_TCP_0402, + TCPIP_TCP_0401, TCPIP_TCP_0407, TCPIP_TCP_0406, ^TCPIP_TCP_0411, TCPIP_TCP_0404, + TCPIP_TCP_0408, TCPIP_TCP_0110, TCPIP_TCP_0115, TCPIP_IP_0101, TCPIP_IP_0102, + ^TCPIP_IGMP_0102, ^TCPIP_IGMP_0101, ^TCPIP_IGMP_0104, TCPIP_IGMP_0104, TCPIP_IGMP_0103, + TCPIP_IGMP_0102, TCPIP_IGMP_0101, TCPIP_UDP_0108, TCPIP_UDP_0106, TCPIP_UDP_0107, + TCPIP_UDP_0105, TCPIP_UDP_0101, TCPIP_IGMP_0204, TCPIP_IGMP_0201, TCPIP_IGMP_0202] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_02.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_02.yml new file mode 100644 index 0000000000..61adea9821 --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_02.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [TCPIP_IGMP_0203, ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, TCPIP_UDP_0201, TCPIP_UDP_0202, + ^TCPIP_DHCP_0301, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0105, ^TCPIP_TCP_0104, + ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, ^TCPIP_TCP_0404, + TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0406, ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, + ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, TCPIP_DHCP_0211, TCPIP_DHCP_0210, TCPIP_DHCP_0101, + TCPIP_DHCP_0103, TCPIP_DHCP_0102, TCPIP_DHCP_0206, TCPIP_DHCP_0207, ^TCPIP_IP_0102] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_03.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_03.yml new file mode 100644 index 0000000000..9d64630e9c --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_03.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_UDP_0105, ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, TCPIP_TCP_0203, + TCPIP_TCP_0202, ^TCPIP_UDP_0108, ^TCPIP_IGMP_0201, ^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, + ^TCPIP_IGMP_0103, TCPIP_UDP_0114, TCPIP_UDP_0113, TCPIP_UDP_0112, TCPIP_DHCP_0205, + TCPIP_DHCP_0202, TCPIP_DHCP_0203, ^TCPIP_TCP_0102, TCPIP_TCP_0106, TCPIP_TCP_0107, + TCPIP_TCP_0104, TCPIP_TCP_0105, TCPIP_TCP_0102, TCPIP_TCP_0103, TCPIP_TCP_0101, + ^TCPIP_TCP_0116, ^TCPIP_TCP_0114, ^TCPIP_TCP_0115, ^TCPIP_TCP_0112, ^TCPIP_TCP_0113] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_04.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_04.yml new file mode 100644 index 0000000000..6be01f698c --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_04.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_TCP_0110, ^TCPIP_TCP_0111, TCPIP_DHCP_0209, ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0207, + ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, + ^TCPIP_DHCP_0201, TCPIP_TCP_0204, TCPIP_TCP_0207, TCPIP_TCP_0206, TCPIP_TCP_0201, + ^TCPIP_DHCP_0101, ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, ^TCPIP_DHCP_0208, TCPIP_TCP_0208, + ^TCPIP_TCP_0202, ^TCPIP_TCP_0203, TCPIP_DHCP_0204, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, + ^TCPIP_TCP_0207, ^TCPIP_TCP_0204, TCPIP_DHCP_0201, ^TCPIP_TCP_0208, TCPIP_DHCP_0208] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_05.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_05.yml new file mode 100644 index 0000000000..627d67c408 --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_05.yml @@ -0,0 +1,8 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^TCPIP_IGMP_0204, ^TCPIP_TCP_0412, TCPIP_TCP_0411, TCPIP_TCP_0412, ^TCPIP_UDP_0112, + ^TCPIP_UDP_0113, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, ^TCPIP_UDP_0201, ^TCPIP_IP_0101, + ^TCPIP_TCP_0402, TCPIP_TCP_0114, TCPIP_TCP_0116, TCPIP_TCP_0111, TCPIP_TCP_0113, + TCPIP_TCP_0112] diff --git a/components/test/CIConfigs/Function_TCPIP_06.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_06.yml similarity index 100% rename from components/test/CIConfigs/Function_TCPIP_06.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_06.yml diff --git a/components/test/CIConfigs/Function_TCPIP_08.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_07.yml similarity index 53% rename from components/test/CIConfigs/Function_TCPIP_08.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_07.yml index 4ada8f3eee..9b3d943fed 100644 --- a/components/test/CIConfigs/Function_TCPIP_08.yml +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_07.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, + ID: [TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, + TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, + TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, ^TCPIP_ICMP_0101, TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, TCPIP_UDP_0109, - TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, - TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, - TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103] + TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104, TCPIP_UDP_0104] diff --git a/components/test/CIConfigs/Function_TCPIP_09.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_08.yml similarity index 51% rename from components/test/CIConfigs/Function_TCPIP_09.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_08.yml index a4c1a51638..a2f8f0df07 100644 --- a/components/test/CIConfigs/Function_TCPIP_09.yml +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_08.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: - Add: - ID: [^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, + ID: [TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, TCPIP_UDP_0102, + TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, TCPIP_UDP_0103, + ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0307, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0306, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, ^TCPIP_UDP_0305, - ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, - ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, - ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103] + ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304, ^TCPIP_UDP_0304] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_09.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_09.yml new file mode 100644 index 0000000000..146b98cf7d --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_09.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, + ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, + ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, + ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, ^TCPIP_UDP_0104, + ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, ^TCPIP_UDP_0103, + ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102] diff --git a/components/test/CIConfigs/Function_TCPIP_10.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_10.yml similarity index 66% rename from components/test/CIConfigs/Function_TCPIP_10.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_10.yml index 201f95eea0..44b7bd1893 100644 --- a/components/test/CIConfigs/Function_TCPIP_10.yml +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_10.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC2, SSC1] Filter: - Add: - ID: [^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, ^TCPIP_UDP_0102, - TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, + ID: [TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0111, TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, TCPIP_UDP_0110, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0101, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, ^TCPIP_DNS_0103, - ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102] + ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, ^TCPIP_DNS_0102, + TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304] diff --git a/components/test/CIConfigs/Function_TCPIP_11.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_11.yml similarity index 67% rename from components/test/CIConfigs/Function_TCPIP_11.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_11.yml index 1d083887c3..86690db67c 100644 --- a/components/test/CIConfigs/Function_TCPIP_11.yml +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_11.yml @@ -2,9 +2,9 @@ Config: {execute count: 1, execute order: in order} DUT: [SSC1] Filter: - Add: - ID: [TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, TCPIP_UDP_0304, - TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, + ID: [TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0305, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0306, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0307, TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, TCPIP_UDP_0301, - TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302] + TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, TCPIP_UDP_0302, + TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_12.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_12.yml new file mode 100644 index 0000000000..4e0495e44d --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_TCPIP_12.yml @@ -0,0 +1,6 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC1] +Filter: +- Add: + ID: [TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, + ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110, ^TCPIP_UDP_0110] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_01.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_01.yml new file mode 100644 index 0000000000..c22bc59bd8 --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_01.yml @@ -0,0 +1,10 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, WIFI_SCAN_0103, WIFI_SCAN_0102, WIFI_SCAN_0101, + WIFI_SCAN_0105, WIFI_SCAN_0104, ^WIFI_CONN_0103, WIFI_CONN_0201, WIFI_CONN_0904, + ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, WIFI_CONN_0401, + WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_CONN_0301, ^WIFI_CONN_0801, ^WIFI_CONN_0301, + WIFI_CONN_0501, WIFI_CONN_0502, ^WIFI_CONN_0401, WIFI_MODE_0101, WIFI_MODE_0103, + WIFI_MODE_0102, ^WIFI_CONN_0904, ^WIFI_CONN_0901, WIFI_CONN_0601, ^WIFI_CONN_0201] diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_02.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_02.yml new file mode 100644 index 0000000000..049054dbac --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_02.yml @@ -0,0 +1,7 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [^WIFI_ADDR_0102, WIFI_CONN_0901, WIFI_CONN_0801, ^WIFI_CONN_0104, WIFI_CONN_0104, + WIFI_CONN_0101, WIFI_CONN_0102, WIFI_CONN_0103, ^WIFI_SCAN_0101, ^WIFI_CONN_0101, + ^WIFI_CONN_0502, ^WIFI_CONN_0501] diff --git a/components/test/CIConfigs/Function_WIFI_03.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_03.yml similarity index 100% rename from components/test/CIConfigs/Function_WIFI_03.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_03.yml diff --git a/components/test/CIConfigs/Function_WIFI_04.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_04.yml similarity index 100% rename from components/test/CIConfigs/Function_WIFI_04.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_04.yml diff --git a/components/test/CIConfigs/Function_WIFI_05.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_05.yml similarity index 100% rename from components/test/CIConfigs/Function_WIFI_05.yml rename to components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_05.yml diff --git a/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_06.yml b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_06.yml new file mode 100644 index 0000000000..9d639f9121 --- /dev/null +++ b/components/idf_test/integration_test/CIConfigs/IT_Function_WIFI_06.yml @@ -0,0 +1,7 @@ +Config: {execute count: 1, execute order: in order} +DUT: [SSC2, SSC1] +Filter: +- Add: + ID: [WIFI_SCAN_0301, WIFI_SCAN_0303, WIFI_SCAN_0304, WIFI_SCAN_0302, WIFI_SCAN_0201, + WIFI_PHY_0403, WIFI_PHY_0402, WIFI_PHY_0401, WIFI_PHY_0407, WIFI_PHY_0406, WIFI_PHY_0405, + WIFI_PHY_0404, WIFI_PHY_0408] diff --git a/components/test/InitialConditionAll.yml b/components/idf_test/integration_test/InitialConditionAll.yml similarity index 96% rename from components/test/InitialConditionAll.yml rename to components/idf_test/integration_test/InitialConditionAll.yml index 797ccad550..ba06af9f87 100644 --- a/components/test/InitialConditionAll.yml +++ b/components/idf_test/integration_test/InitialConditionAll.yml @@ -1,135 +1,195 @@ initial condition: - check cmd set: - '' - - - ASSERT - - [dummy] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] force restore cmd set: - '' - - - SSC SSC[1-] reboot - - ['P SSC[1-] C !!!ready!!!'] - - - SSC SSC[1-] mesh -I -g -a 4 -k -i - -p -h 5 - - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] - - - SSC SSC1 mesh -A -s -k - - ['P SSC1 C +MESHINIT:AP,OK'] - - - SSC SSC1 mesh -E -o 1 -t 1 - - ['P SSC1 C +MESH:ENABLED'] - - - SSC SSC[2-] mesh -E -o 1 -t 2 - - [''] - - - DELAY 60 - - ['P SSC[2-] C +MESH:ENABLED'] - - - SSC SSC[1-] mesh -C - - ['P SSC[1-] C +MESH:CONNECTED'] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] - initial condition detail: root as LOCAL, rest node as ONLINE, mesh network established + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, DHCP on, will autogen a TC with initial condition + APSTA1 restore cmd set: - '' - - - SSC SSC[1-] mesh -E -o 0 - - ['P SSC[1-] C +MESH:DISABLED'] - - - SSC SSC[1-] mesh -I -g -a 4 -k -i - -p -h 5 - - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] - - - SSC SSC1 mesh -A -s -k - - ['P SSC1 C +MESHINIT:AP,OK'] - - - SSC SSC1 mesh -E -o 1 -t 1 - - ['P SSC1 C +MESH:ENABLED'] - - - SSC SSC[2-] mesh -E -o 1 -t 2 - - [''] - - - DELAY 60 - - ['P SSC[2-] C +MESH:ENABLED'] - - - SSC SSC[1-] mesh -C - - ['P SSC[1-] C +MESH:CONNECTED'] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] restore post cmd set: - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py - start: 24.0 - tag: ENABLED_2 + start: 31.0 + tag: APM1 test script: InitCondBase - check cmd set: - '' - - - ASSERT - - [dummy] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] force restore cmd set: - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC[1-] mesh -E -o 0 - - ['P SSC[1-] C +MESH:DISABLED'] - - - SSC SSC[1-] mesh -I -g -a 4 -k -i - -p -h 5 - - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] - - - SSC SSC[1-] mesh -A -s -k - - ['P SSC[1-] C +MESHINIT:AP,OK'] - - - SSC SSC1 mesh -E -o 1 -t 2 - - ['P SSC1 C +MESH:ENABLED'] - - - SOC SOC1 MACCEPT GSOC1 - - [R SOC_COM L OK] - - - SSC SSC[2-] mesh -E -o 1 -t 2 - - ['P SSC[2-] C +MESH:ENABLED'] - - - DELAY 60 - - [''] - - - SSC SSC[1-] mesh -C - - ['P SSC[1-] C +MESH:CONNECTED'] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] - - - SSC SSC[1-] mesh -O -t 1 -o 1 - - ['P SSC[1-] C +MESH:OK'] - initial condition detail: all mesh node enabled as ONLINE, mesh network established + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, PC join AP, DHCP on, will autogen a TC with initial + condition APSTA2 restore cmd set: - '' - - - SSC SSC[1-] reboot - - ['P SSC[1-] C !!!ready!!!'] - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC[1-] mesh -E -o 0 - - ['P SSC[1-] C +MESH:DISABLED'] - - - SSC SSC[1-] mesh -I -g -a 4 -k -i - -p -h 5 - - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] - - - SSC SSC[1-] mesh -A -s -k - - ['P SSC[1-] C +MESHINIT:AP,OK'] - - - SSC SSC1 mesh -E -o 1 -t 2 - - ['P SSC1 C +MESH:ENABLED'] - - - SOC SOC1 MACCEPT GSOC1 - - [R SOC_COM L OK] - - - SSC SSC[2-] mesh -E -o 1 -t 2 - - ['P SSC[2-] C +MESH:ENABLED'] - - - DELAY 60 - - [''] - - - SSC SSC[1-] mesh -C - - ['P SSC[1-] C +MESH:CONNECTED'] - - - SSC SSC[1-] mesh -Q -t 4 - - ['R SSC[1-] T '] - - - MESHTREE - - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] - - - SSC SSC[1-] mesh -O -t 1 -o 1 - - ['P SSC[1-] C +MESH:OK'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] restore post cmd set: - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py - start: 17.0 - tag: ENABLED_1 + start: 38.0 + tag: APM2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 31.0 + tag: APO1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 38.0 + tag: APO2 test script: InitCondBase - check cmd set: - '' @@ -137,17 +197,13 @@ initial condition: - ['R SSC1 C BIN_ID,0'] - - SSC SSC1 upgrade -Q -t 2 -b 0 - ['R SSC1 C BIN_INFO,0'] - - - SSC SSC1 op -S -o 3 + - - SSC SSC1 op -S -o 2 - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] force restore cmd set: - '' - - SSC SSC1 upgrade -R -r 1 -s - [R SSC1 NC ERROR C !!!ready!!!] - - - SSC SSC1 op -S -o 3 + - - SSC SSC1 op -S -o 1 - ['R SSC1 C +MODE:OK'] - - SSC SSC1 dhcp -S -o 1 - [R SSC1 C +DHCP] @@ -163,24 +219,17 @@ initial condition: - ['P SSC1 C +UPGRADE:SUCCEED'] - - SSC SSC1 upgrade -R -b 0 - [R SSC1 C !!!ready!!!] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - initial condition detail: APSTA mode, connected to AP, running BIN0 (located on - flash id 0) + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + initial condition detail: AP only mode, running BIN0 (located on flash id 0) restore cmd set: - '' - - SSC SSC1 upgrade -Q -t 2 -b 0 - ['R SSC1 C BIN_INFO,0'] - - SSC SSC1 upgrade -R -b 0 - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 3 + - - SSC SSC1 op -S -o 2 - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] restore post cmd set: - '' - - SSC SSC1 upgrade -D @@ -188,8 +237,51 @@ initial condition: - - SSC SSC1 ram - ['R SSC1 A :(\d+)'] script path: InitCondBase.py - start: 24.0 - tag: STAAPBIN0 + start: 31.0 + tag: APOBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: testing ap on sta + ap mode (autogen by APM1) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 59.0 + tag: APSTA1 test script: InitCondBase - check cmd set: - '' @@ -209,204 +301,46 @@ initial condition: - [R SSC1 C !!!ready!!!] - - SSC SSC1 op -S -o 3 - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - SSC SSC1 mac -S -o 2 -m - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] - initial condition detail: testing ap on sta + ap mode, PC join AP (autogen) + initial condition detail: testing ap on sta + ap mode, PC join AP (autogen by APM2) restore cmd set: - '' - - SSC SSC1 op -S -o 3 - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - SSC SSC1 mac -S -o 2 -m - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] restore post cmd set: - '' - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py start: 66.0 tag: APSTA2 test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:3'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 C +DHCP:AP,STARTED'] - - - SSC SSC1 mac -Q -o 2 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - initial condition detail: testing ap on sta + ap mode (autogen) - restore cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 59.0 - tag: APSTA1 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:3'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - initial condition detail: testing sta on sta + ap mode, quit AP (autogen) - restore cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 45.0 - tag: STAAP1 - test script: InitCondBase -- check cmd set: - - '' - - - DELAY 0.1 - - [dummy] - force restore cmd set: - - '' - - - DELAY 0.1 - - [dummy] - initial condition detail: none 2 - restore cmd set: - - '' - - - DELAY 0.1 - - [dummy] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 108.0 - tag: ATNone2 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:3'] - - - SSC SSC1 sta -Q - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - initial condition detail: testing sta on sta + ap mode, join AP, DHCP on (autogen) - restore cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 52.0 - tag: STAAP2 - test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:1'] - - - ATS AT1 AT+CWDHCP_CUR? - - ['R AT1 C DHCP:3'] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 - [R AT1 R *] force restore cmd set: - '' @@ -414,23 +348,18 @@ initial condition: - [R AT1 C ready] - - ATS AT1 AT+CWMODE_DEF=3 - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - - - ATC AT1 CWJAP_DEF + - - DELAY 5 + - [''] + - - ATC AT1 CWSAP_DEF - [R AT1 L OK] - - ATS AT1 AT+CWDHCP_DEF=2,1 - [R AT1 R *] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - initial condition detail: StationSoftAP mode, connected to AP, multi link, use dhcp + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + initial condition detail: StationSoftAP mode restore cmd set: - '' - - ATSO AT1 +++ @@ -441,20 +370,10 @@ initial condition: - [R AT1 R *] - - ATS AT1 AT+CWMODE_DEF=3 - [R AT1 L OK] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] - - ATS AT1 AT+CWDHCP_DEF=2,1 - [R AT1 R *] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] restore post cmd set: - '' - - ATS AT1 AT+CWSTOPSMART @@ -464,50 +383,8 @@ initial condition: - - AT+SYSRAM - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 94.0 - tag: ATAPSTA3 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 C +CWMODE_CUR:2 C OK'] - - - ATS AT2 AT+CWMODE_CUR? - - ['R AT2 C +CWMODE_CUR:3 C OK'] - - - ATS AT1 AT+CWJAP_CUR? - - [R AT1 NC OK L ERROR] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATS AT2 AT+CWMODE_DEF=3 - - [R AT2 L OK] - initial condition detail: Target 1 in SoftAP mode, Target 2 in StationSoftAP mode, - use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATS AT2 AT+CWMODE_DEF=3 - - [R AT2 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 80.0 - tag: ATT2_2 + start: 24.0 + tag: ATAP1 test script: InitCondBase - check cmd set: - '' @@ -586,82 +463,6 @@ initial condition: start: 31.0 tag: ATAP3 test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:1'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - initial condition detail: sta mode, quit AP, will NOT autogen a TC with initial - condition STAAP1 - restore cmd set: - - '' - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 17.0 - tag: STAO1 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT - - [R AT1 L OK] - - - ATS AT1 AT - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+RST - - [R AT1 L OK] - initial condition detail: StationSoftAP mode, both PC join Target AP, single link, - use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 3.0 - tag: ATAP5 - test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? @@ -739,6 +540,38 @@ initial condition: start: 45.0 tag: ATAP4 test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, both PC join Target AP, single link, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAP5 + test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT @@ -773,138 +606,190 @@ initial condition: test script: InitCondBase - check cmd set: - '' - - - SSC SSC1 upgrade -Q -t 1 - - ['R SSC1 C BIN_ID,0'] - - - SSC SSC1 upgrade -Q -t 2 -b 0 - - ['R SSC1 C BIN_INFO,0'] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:2'] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] force restore cmd set: - '' - - - SSC SSC1 upgrade -R -r 1 -s - - [R SSC1 NC ERROR C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SOC SOC1 ULISTEN - - [R SOC_COM L OK] - - - SOC SOC1 SETOPT REPLY BIN - - [R SOC_COM C OK] - - - SSC SSC1 upgrade -I -b 0 -f 0 - - ['P SSC1 C +UPGRADE:OK'] - - - SSC SSC1 upgrade -U -i -p -u - - ['P SSC1 C +UPGRADE:SUCCEED'] - - - SSC SSC1 upgrade -R -b 0 - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - initial condition detail: AP only mode, running BIN0 (located on flash id 0) + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, use dhcp restore cmd set: - '' - - - SSC SSC1 upgrade -Q -t 2 -b 0 - - ['R SSC1 C BIN_INFO,0'] - - - SSC SSC1 upgrade -R -b 0 - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] restore post cmd set: - '' - - - SSC SSC1 upgrade -D - - ['R SSC1 C +UPGRADE:OK'] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 31.0 - tag: APOBIN0 + start: 59.0 + tag: ATAPO1 test script: InitCondBase - check cmd set: - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:1'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] force restore cmd set: - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - initial condition detail: sta mode, quit AP, DHCP on + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, multi link, use dhcp restore cmd set: - '' - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 R *] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] restore post cmd set: - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 17.0 - tag: STAM1 + start: 66.0 + tag: ATAPO3 test script: InitCondBase - check cmd set: - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:1'] - - - SSC SSC1 sta -Q - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] force restore cmd set: - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - initial condition detail: sta mode, join AP, DHCP on + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, single link, use dhcp restore cmd set: - '' - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] restore post cmd set: - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 24.0 - tag: STAM2 + start: 73.0 + tag: ATAPO4 test script: InitCondBase - check cmd set: - '' @@ -918,7 +803,8 @@ initial condition: - [R AT1 C ready] - - ATS AT1 AT+RST - [R AT1 L OK] - initial condition detail: none + initial condition detail: SoftAP mode, both PC join Target AP, single link, use + dhcp restore cmd set: - '' - - ATSO AT1 +++ @@ -935,7 +821,193 @@ initial condition: - ['R AT1 A :(\d+)'] script path: InitCondBase.py start: 3.0 - tag: ATNone + tag: ATAPO5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: SoftAP mode, both PC join Target AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAPO6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, DHCP client on + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 94.0 + tag: ATAPSTA3 test script: InitCondBase - check cmd set: - '' @@ -1009,6 +1081,278 @@ initial condition: start: 101.0 tag: ATAPSTA4 test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 129.0 + tag: ATAPSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, single link, use + static ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 136.0 + tag: ATAPSTA6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + initial condition detail: 'first time usage. Use restore function. ' + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 143.0 + tag: ATFTU + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: none + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATNone + test script: InitCondBase +- check cmd set: + - '' + - - DELAY 0.1 + - [dummy] + force restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + initial condition detail: none 2 + restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 108.0 + tag: ATNone2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: same as STA1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATOSTA1 + test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? @@ -1078,6 +1422,51 @@ initial condition: start: 17.0 tag: ATOSTA4 test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:1 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + initial condition detail: same as OT2_1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: ATOT2_1 + test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? @@ -1092,7 +1481,7 @@ initial condition: - [R AT1 L OK] - - ATS AT1 AT+CWDHCP_DEF=1,1 - [R AT1 L OK] - initial condition detail: same as STA1, but will not autogen STA+AP STA test case + initial condition detail: station mode, use dhcp restore cmd set: - '' - - ATSO AT1 +++ @@ -1115,34 +1504,23 @@ initial condition: - ['R AT1 A :(\d+)'] script path: InitCondBase.py start: 10.0 - tag: ATOSTA1 + tag: ATSTA1 test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] force restore cmd set: - '' - - ATS AT1 AT+RST - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 + - - ATS AT1 AT+CWMODE_DEF=1 - [R AT1 L OK] - - - DELAY 5 - - [''] - - - ATC AT1 CWSAP_DEF + - - ATS AT1 AT+CWDHCP_DEF=1,1 - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - - - WIFI CONN - - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - initial condition detail: StationSoftAP mode + initial condition detail: station mode, DHCP client on, use dhcp restore cmd set: - '' - - ATSO AT1 +++ @@ -1151,12 +1529,10 @@ initial condition: - [R AT1 R *] - - ATS AT1 AT+SAVETRANSLINK=0 - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 - [R AT1 L OK] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] restore post cmd set: - '' - - ATS AT1 AT+CWSTOPSMART @@ -1166,45 +1542,42 @@ initial condition: - - AT+SYSRAM - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 24.0 - tag: ATAP1 - test script: InitCondBase -- check cmd set: - - '' - - - DELAY 0.1 - - [dummy] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - initial condition detail: none - restore cmd set: - - '' - - - DELAY 0.1 - - [dummy] - restore post cmd set: - - '' - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py start: 10.0 - tag: None + tag: ATSTA2 test script: InitCondBase - check cmd set: - '' - - - ATS AT1 AT - - [R AT1 L OK] - - - ATS AT1 AT+RESTORE - - [R AT1 L OK, R AT1 C ready] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] force restore cmd set: - '' - - ATS AT1 AT+RST - [R AT1 C ready] - - - ATS AT1 AT + - - ATS AT1 AT+CWMODE_DEF=1 - [R AT1 L OK] - - - ATS AT1 AT+RESTORE - - [R AT1 L OK, R AT1 C ready] - initial condition detail: 'first time usage. Use restore function. ' + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, multi link, use dhcp restore cmd set: - '' - - ATSO AT1 +++ @@ -1213,39 +1586,21 @@ initial condition: - [R AT1 R *] - - ATS AT1 AT+SAVETRANSLINK=0 - [R AT1 R *] - - - ATS AT1 AT+RESTORE - - [R AT1 L OK, R AT1 C ready] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 143.0 - tag: ATFTU - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT + - - ATS AT1 AT+CWMODE_DEF=1 - [R AT1 L OK] - - - ATS AT1 AT + - - ATS AT1 AT+CWDHCP_DEF=1,1 - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+RST + - - ATC AT1 CWJAP_DEF - [R AT1 L OK] - initial condition detail: SoftAP mode, both PC join Target AP, single link, use - dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT+SAVETRANSLINK=0 + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE - [R AT1 R *] restore post cmd set: - '' @@ -1256,83 +1611,217 @@ initial condition: - - AT+SYSRAM - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 3.0 - tag: ATAPO5 + start: 38.0 + tag: ATSTA3 test script: InitCondBase - check cmd set: - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:1'] - - - SSC SSC1 sta -Q - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED'] - - - SSC SSC1 mac -Q -o 1 - - [R SSC1 P ] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] force restore cmd set: - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - initial condition detail: sta mode, join AP, DHCP on, will NOT autogen a TC with - initial condition STAAP2 + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, single link, use dhcp restore cmd set: - '' - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] restore post cmd set: - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 24.0 - tag: STAO2 + start: 17.0 + tag: ATSTA4 test script: InitCondBase - check cmd set: - '' - - - ASSERT - - [dummy] + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] force restore cmd set: - '' - - - SSC SSC[1-] reboot - - ['P SSC[1-] C !!!ready!!!'] - - - SSC SSC[1-] mesh -E -o 0 - - ['P SSC[1-] C +MESH:DISABLED'] - - - SSC SSC[1-] op -S -o 1 - - ['P SSC[1-] C +MODE:OK'] - - - SSC SSC[1-] sta -D - - ['P SSC[1-] C +QAP:OK'] - initial condition detail: all mesh node disabled + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, multi link, use static + ip restore cmd set: - '' - - - SSC SSC[1-] mesh -E -o 0 - - ['P SSC[1-] C +MESH:DISABLED'] - - - SSC SSC[1-] op -S -o 1 - - ['P SSC[1-] C +MODE:OK'] - - - SSC SSC[1-] sta -D - - ['P SSC[1-] C +QAP:OK'] + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] restore post cmd set: - '' - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 31.0 - tag: DISABLED + start: 115.0 + tag: ATSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, single link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 122.0 + tag: ATSTA6 test script: InitCondBase - check cmd set: - '' @@ -1380,138 +1869,24 @@ initial condition: start: 52.0 tag: ATT2_1 test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:2'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] - - - SSC SSC1 ap -L - - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 C +DHCP:AP,STARTED'] - - - SSC SSC1 mac -Q -o 2 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - initial condition detail: AP mode, will NOT autogen a TC with initial condition - APSTA2 - restore cmd set: - - '' - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 38.0 - tag: APO2 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:2'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 C +DHCP:AP,STARTED'] - - - SSC SSC1 mac -Q -o 2 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - initial condition detail: AP mode, will NOT autogen a TC with initial condition - APSTA1 - restore cmd set: - - '' - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 31.0 - tag: APO1 - test script: InitCondBase - check cmd set: - '' - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 C +CWMODE_CUR:2 L OK'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:1'] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] + - ['R AT1 C +CWMODE_CUR:2 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:3 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] force restore cmd set: - '' - - ATS AT1 AT+RST - [R AT1 C ready] - - ATS AT1 AT+CWMODE_DEF=2 - [R AT1 L OK] - - - ATC AT1 CWSAP_DEF - - [R AT1 L OK] - - - WIFI CONN - - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] - initial condition detail: SoftAP mode, PC join Target AP, multi link, use dhcp + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] + initial condition detail: Target 1 in SoftAP mode, Target 2 in StationSoftAP mode, + use dhcp restore cmd set: - '' - - ATSO AT1 +++ @@ -1522,20 +1897,8 @@ initial condition: - [R AT1 R *] - - ATS AT1 AT+CWMODE_DEF=2 - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 R *] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] restore post cmd set: - '' - - ATS AT1 AT+CWSTOPSMART @@ -1545,8 +1908,171 @@ initial condition: - - AT+SYSRAM - ['R AT1 A :(\d+)'] script path: InitCondBase.py - start: 66.0 - tag: ATAPO3 + start: 80.0 + tag: ATT2_2 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + initial condition detail: all mesh node disabled + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: DISABLED + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + initial condition detail: all mesh node enabled as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ENABLED_1 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + initial condition detail: root as LOCAL, rest node as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: ENABLED_2 test script: InitCondBase - check cmd set: - '' @@ -1641,77 +2167,24 @@ initial condition: test script: InitCondBase - check cmd set: - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 C +CWMODE_CUR:2 L OK'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:0'] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] + - - DELAY 0.1 + - [dummy] force restore cmd set: - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATC AT1 CWSAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] - - - WIFI CONN - - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - initial condition detail: SoftAP mode, PC join Target AP, single link, use dhcp + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + initial condition detail: none restore cmd set: - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CWLIF - - [R AT1 P ] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] + - - DELAY 0.1 + - [dummy] restore post cmd set: - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] + - - DELAY 0.1 + - [dummy] script path: InitCondBase.py - start: 73.0 - tag: ATAPO4 + start: 10.0 + tag: None test script: InitCondBase - check cmd set: - '' @@ -1734,83 +2207,6 @@ initial condition: start: 31.0 tag: PAIR1 test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT - - [R AT1 L OK] - - - ATS AT1 AT - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+RST - - [R AT1 L OK] - initial condition detail: SoftAP mode, both PC join Target AP, multi link, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 3.0 - tag: ATAPO6 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC[1,2] op -Q - - ['R SSC[1,2] C +MODE:[3,3]'] - - - SSC SSC[1,2] mac -Q -o 3 - - ['R SSC[1,2] P P '] - - - SSC SSC[1,2] sp -D - - ['R SSC[1,2] C +SP:OK'] - - - SSC SSC[1,2] sp -I - - ['R SSC[1,2] C +SP:OK'] - force restore cmd set: - - '' - - - SSC SSC[1,2] reboot - - ['R SSC[1,2] C !!!ready!!!'] - - - SSC SSC[1,2] op -S -o [3,3] - - ['R SSC[1,2] C +MODE:OK'] - - - SSC SSC[1,2] mac -S -m -o 2 - - ['R SSC[1,2] C +MAC:AP,OK'] - - - SSC SSC[1,2] mac -S -m -o 1 - - ['R SSC[1,2] C +MAC:STA,OK'] - - - SSC SSC[1,2] sp -D - - ['R SSC[1,2] C +SP:OK'] - - - SSC SSC[1,2] sp -I - - ['R SSC[1,2] C +SP:OK'] - initial condition detail: target1 and target2 in STA+AP mode, two targets de-init - and init simple pair - restore cmd set: - - '' - - - SSC SSC[1,2] op -S -o [3,3] - - ['R SSC[1,2] C +MODE:OK'] - - - SSC SSC[1,2] mac -S -m -o 2 - - ['R SSC[1,2] C +MAC:AP,OK'] - - - SSC SSC[1,2] mac -S -m -o 1 - - ['R SSC[1,2] C +MAC:STA,OK'] - - - SSC SSC[1,2] sp -D - - ['R SSC[1,2] C +SP:OK'] - - - SSC SSC[1,2] sp -I - - ['R SSC[1,2] C +SP:OK'] - restore post cmd set: - - '' - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 45.0 - tag: PAIR3 - test script: InitCondBase - check cmd set: - '' - - SSC SSC[1,2] op -Q @@ -1861,6 +2257,435 @@ initial condition: start: 38.0 tag: PAIR2 test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1,2] op -Q + - ['R SSC[1,2] C +MODE:[3,3]'] + - - SSC SSC[1,2] mac -Q -o 3 + - ['R SSC[1,2] P P '] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC[1,2] reboot + - ['R SSC[1,2] C !!!ready!!!'] + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + initial condition detail: target1 and target2 in STA+AP mode, two targets de-init + and init simple pair + restore cmd set: + - '' + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: PAIR3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: testing sta on sta + ap mode, quit AP (autogen by STAM1) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 45.0 + tag: STAAP1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: testing sta on sta + ap mode, join AP, DHCP on (autogen + by STAM2) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 52.0 + tag: STAAP2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: APSTA mode, connected to AP, running BIN0 (located on + flash id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: STAAPBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, DHCP on, will autogen a TC with initial + condition STAAP1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 17.0 + tag: STAM1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on, will autogen a TC with initial + condition STAAP2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 24.0 + tag: STAM2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: STA mode, connected to AP, running BIN0 (located on flash + id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: STAMBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, will NOT autogen a TC with initial + condition STAAP1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 17.0 + tag: STAO1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on, will NOT autogen a TC with + initial condition STAAP2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 24.0 + tag: STAO2 + test script: InitCondBase - check cmd set: - '' - - SSC SSC1 op -Q @@ -1926,93 +2751,11 @@ initial condition: - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py start: 73.0 tag: T2O_1 test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:2'] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] - initial condition detail: SoftAP mode, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=2 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=0,1 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 59.0 - tag: ATAPO1 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:2'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 C +DHCP:AP,STARTED'] - - - SSC SSC1 mac -Q -o 2 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - initial condition detail: AP mode, DHCP on - restore cmd set: - - '' - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 31.0 - tag: APM1 - test script: InitCondBase - check cmd set: - '' - - SSC SSC1 op -Q @@ -2053,7 +2796,8 @@ initial condition: - ['R SSC1 C +MAC:AP,OK'] - - SSC SSC2 mac -S -o 1 -m - ['R SSC2 C +MAC:STA,OK'] - initial condition detail: target 1 as SoftAP, target 2 as STA + initial condition detail: target 1 as SoftAP, target 2 as STA, will autogen a TC + with initial condition T2_2 restore cmd set: - '' - - SSC SSC1 op -S -o 2 @@ -2077,304 +2821,11 @@ initial condition: - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py start: 73.0 tag: T2_1 test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 C +CWMODE_CUR:3 C OK'] - - - ATS AT2 AT+CWMODE_CUR? - - ['R AT2 C +CWMODE_CUR:1 C OK'] - - - ATS AT1 AT+CWJAP_CUR? - - [R AT1 NC OK L ERROR] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT2 AT+CWMODE_DEF=1 - - [R AT2 L OK] - - - ATS AT1 AT+CWQAP - - [R AT1 L OK] - initial condition detail: same as OT2_1, but will not autogen STA+AP STA test case - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT2 AT+CWMODE_DEF=1 - - [R AT2 L OK] - - - ATS AT1 AT+CWQAP - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 52.0 - tag: ATOT2_1 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:1'] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - initial condition detail: StationSoftAP mode, connected to AP, multi link, use static - ip - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 129.0 - tag: ATAPSTA5 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 upgrade -Q -t 1 - - ['R SSC1 C BIN_ID,0'] - - - SSC SSC1 upgrade -Q -t 2 -b 0 - - ['R SSC1 C BIN_INFO,0'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - force restore cmd set: - - '' - - - SSC SSC1 upgrade -R -r 1 -s - - [R SSC1 NC ERROR C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SOC SOC1 ULISTEN - - [R SOC_COM L OK] - - - SOC SOC1 SETOPT REPLY BIN - - [R SOC_COM C OK] - - - SSC SSC1 upgrade -I -b 0 -f 0 - - ['P SSC1 C +UPGRADE:OK'] - - - SSC SSC1 upgrade -U -i -p -u - - ['P SSC1 C +UPGRADE:SUCCEED'] - - - SSC SSC1 upgrade -R -b 0 - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - initial condition detail: STA mode, connected to AP, running BIN0 (located on flash - id 0) - restore cmd set: - - '' - - - SSC SSC1 upgrade -Q -t 2 -b 0 - - ['R SSC1 C BIN_INFO,0'] - - - SSC SSC1 upgrade -R -b 0 - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - [R SSC1 C +DHCP] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - restore post cmd set: - - '' - - - SSC SSC1 upgrade -D - - ['R SSC1 C +UPGRADE:OK'] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 17.0 - tag: STAMBIN0 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - initial condition detail: station mode, DHCP client on, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 10.0 - tag: ATSTA2 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC[1-3] op -Q - - ['R SSC[1-3] C +CURMODE:3'] - - - SSC SSC[1-3] phy -Q -o 3 - - ['R SSC[1-3] C STA,n,40 C AP,n,40'] - force restore cmd set: - - '' - - - SSC SSC[1-3] reboot - - ['R SSC[1-3] C !!!ready!!!'] - - - SSC SSC[1-3] op -S -o 3 - - ['R SSC[1-3] C +MODE:OK'] - - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 - - ['R SSC[1-3] C +PHY:OK'] - initial condition detail: '1. target 1 and target 2 set to AP+STA mode, target 3 - set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - restore cmd set: - - '' - - - SSC SSC[1-3] op -S -o 3 - - ['R SSC[1-3] C +MODE:OK'] - - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 - - ['R SSC[1-3] C +PHY:OK'] - restore post cmd set: - - '' - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 sta -R -r 1 - - [R SSC1 C OK] - - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] - script path: InitCondBase.py - start: 87.0 - tag: T3_PHY1 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - initial condition detail: StationSoftAP mode, DHCP client on - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 87.0 - tag: ATAPSTA2 - test script: InitCondBase - check cmd set: - '' - - SSC SSC1 op -Q @@ -2439,485 +2890,46 @@ initial condition: - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] - - SSC SSC1 ram - - ['R SSC1 A :(\d+)'] + - ['R SSC1 C +FREEHEAP:'] script path: InitCondBase.py start: 80.0 tag: T2_2 test script: InitCondBase - check cmd set: - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:0'] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] + - - SSC SSC[1-3] op -Q + - ['R SSC[1-3] C +CURMODE:3'] + - - SSC SSC[1-3] phy -Q -o 3 + - ['R SSC[1-3] C STA,n,40 C AP,n,40'] force restore cmd set: - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - initial condition detail: StationSoftAP mode, connected to AP, single link, use - static ip + - - SSC SSC[1-3] reboot + - ['R SSC[1-3] C !!!ready!!!'] + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] + initial condition detail: '1. target 1 and target 2 set to AP+STA mode, target 3 + set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' restore cmd set: - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 136.0 - tag: ATAPSTA6 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:0'] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - initial condition detail: station mode, connected to AP, single link, use static - ip - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 122.0 - tag: ATSTA6 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:1'] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - initial condition detail: station mode, connected to AP, multi link, use static - ip - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATC AT1 CIPSTA_DEF - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 115.0 - tag: ATSTA5 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:0'] - - - ATS AT1 AT+CWDHCP_CUR? - - ['R AT1 C DHCP:3'] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 R *] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - initial condition detail: station mode, connected to AP, single link, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 R *] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=0 - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 17.0 - tag: ATSTA4 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWJAP_CUR? - - ['R AT1 C +CWJAP_CUR:', R AT1 P ] - - - ATS AT1 AT+CIPMUX? - - ['R AT1 L +CIPMUX:1'] - - - ATS AT1 AT+CWDHCP_CUR? - - ['R AT1 C DHCP:3'] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 R *] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - initial condition detail: station mode, connected to AP, multi link, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 R *] - - - ATC AT1 CWJAP_DEF - - [R AT1 L OK] - - - ATS AT1 AT+CIPCLOSE - - [R AT1 R *] - - - ATS AT1 AT+CIPMODE=0 - - [R AT1 R *] - - - ATS AT1 AT+CIPMUX=1 - - [R AT1 L OK] - - - ATS AT1 AT+CIPSERVER=0 - - [R AT1 R *] - - - ATC AT1 CIPCLOSE - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 38.0 - tag: ATSTA3 - test script: InitCondBase -- check cmd set: - - '' - - - SSC SSC1 op -Q - - ['R SSC1 C +CURMODE:2'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] - - - SSC SSC1 ap -L - - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 C +DHCP:AP,STARTED'] - - - SSC SSC1 mac -Q -o 2 - - [R SSC1 P ] - force restore cmd set: - - '' - - - SSC SSC1 reboot - - [R SSC1 C !!!ready!!!] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - initial condition detail: AP mode, PC join AP, DHCP on - restore cmd set: - - '' - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 2 - - [R SSC1 C +DHCP] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] restore post cmd set: - '' - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] + - - SSC SSC1 sta -R -r 1 + - [R SSC1 C OK] - - SSC SSC1 ram - ['R SSC1 A :(\d+)'] script path: InitCondBase.py - start: 38.0 - tag: APM2 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:1'] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - initial condition detail: station mode, use dhcp - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=1 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=1,1 - - [R AT1 L OK] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py - start: 10.0 - tag: ATSTA1 - test script: InitCondBase -- check cmd set: - - '' - - - ATS AT1 AT+CWMODE_CUR? - - ['R AT1 L +CWMODE_CUR:3'] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - force restore cmd set: - - '' - - - ATS AT1 AT+RST - - [R AT1 C ready] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - initial condition detail: StationSoftAP mode - restore cmd set: - - '' - - - ATSO AT1 +++ - - [''] - - - ATS AT1 AT - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - ATS AT1 AT+CWMODE_DEF=3 - - [R AT1 L OK] - - - ATS AT1 AT+CWDHCP_DEF=2,1 - - [R AT1 R *] - restore post cmd set: - - '' - - - ATS AT1 AT+CWSTOPSMART - - [R AT1 R *] - - - ATS AT1 AT+SAVETRANSLINK=0 - - [R AT1 R *] - - - AT+SYSRAM - - ['R AT1 A :(\d+)'] - script path: InitCondBase.py start: 87.0 - tag: ATAPSTA1 + tag: T3_PHY1 test script: InitCondBase diff --git a/components/test/KnownIssues b/components/idf_test/integration_test/KnownIssues similarity index 100% rename from components/test/KnownIssues rename to components/idf_test/integration_test/KnownIssues diff --git a/components/test/TestCaseAll.yml b/components/idf_test/integration_test/TestCaseAll.yml similarity index 98% rename from components/test/TestCaseAll.yml rename to components/idf_test/integration_test/TestCaseAll.yml index 7112c87936..0835c146bd 100644 --- a/components/test/TestCaseAll.yml +++ b/components/idf_test/integration_test/TestCaseAll.yml @@ -1,96 +1,4 @@ test cases: -- CI ready: 'Yes' - ID: ^WIFI_CONN_0601 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN - - - ['R PC_COM C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -L - - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP - - 2.PC WIFI CONNECTED - - 3.target2 jap target 1 - - 4.查询到两个sta 连接到target1 上' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target1下设置ssid 和pwd 加密方式 - - 2.PC WIFI CONNECTED target1 - - 3.target2 jap target 1 - - 4.查询到两个sta 连接到target1 上' - sub module: WIFI Connect - summary: list stations connected to soft ap test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: list SoftAP connected station - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_ICMP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ping -i - - ['R SSC1 C +PING:OK'] - - - SSC SSC1 ping -i -c 2 - - ['R SSC1 C +PING:OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.ping -i - - 2.ping -i -c 2' - sub module: ICMP - summary: ping function test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: ping function test - version: v1 (2016-8-15) - CI ready: 'Yes' ID: SYS_MISC_0101 SDK: '8266_NonOS @@ -111,6 +19,7 @@ test cases: expected result: 重启成功 initial condition: None initial condition description (auto): none + level: Integration module: System steps: 系统重启 sub module: Misc @@ -125,7 +34,7 @@ test cases: test point 2: sw reboot version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_DHCP_0302 + ID: SYS_MISC_0201 SDK: '8266_NonOS 8266_RTOS @@ -137,62 +46,929 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -i 192.168.123.123 -o 2 - - ['R SSC1 C +IP:ERROR'] - - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.10 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 ap -S -s -p -t - - [''] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -i 192.168.4.1 -o 2 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.10 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 ram -H + - ['R SSC1 RE FREEHEAP:\d+\r\n'] comment: '' execution time: 0.0 - expected result: '1.target 1 OK + expected result: ' - 2.target1 ERROR + 可以查询到一个数值 - 3.target1 ERROR + ' + initial condition: None + initial condition description (auto): none + level: Integration + module: System + steps: 查询空闲ram + sub module: Misc + summary: get heap size test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. - 4.target2 jap target1 OK + PC has 1 WiFi NIC. - 5.target1 OK + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: 'get heap size ' + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0101 + SDK: '8266_NonOS - 6.target1 OK + 8266_RTOS - 7.target1 OK - - 8.target2 jap target1 OK' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 0.0.0.0 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -Q + - ['R SSC1 C +STAIP:0.0.0.0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -Q + - ['R SSC1 RE "\+STAIP:%%s"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ + 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration module: TCPIP - steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n3.target1 设置地址池\n\ - 4.target1下设置ssid 和pwd 加密方式\n5.target2 连接target1 \n6.target1 关闭DHCP 2\n7.target1\ - \ 设置softAP ip \n8.target1 设置正确的地址池\n9.target2 连接target1" + steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ + \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" sub module: DHCP - summary: ap dhcp static ip interaction + summary: dhcp client function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ + \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ + 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + sub module: DHCP + summary: dhcp server function test test environment: SSC_T2_1 test environment description (auto): 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. 2 SSC target connect with PC by UART.' - test point 1: interaction - test point 2: static IP and DHCP interaction test + test point 1: basic function + test point 2: DHCP client function test version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_DHCP_0301 + ID: TCPIP_DHCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -E -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.STA&AP STARTED + + 4.STA STARTED + + 5.AP STARTED + + 6.OK + + 7.STA&AP STOPPED' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: TCPIP + steps: '1.target1 设置mode 为sta+softAP mode + + 2.target1 打开DHCP 3 + + 3.target1 查询DHCP 状态 + + 4.target1 查询sta DHCP 状态 + + 5.target1 查询softAP DHCP 状态 + + 6.target1 关闭 DHCP 3 + + 7.target1 查询 DHCP 状态' + sub module: DHCP + summary: dhcp status query + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1 关闭DHCP 2 OK + + 2.target1 设置ip 成功 + + 3.设置dhcp 地址池 OK + + 4.ERROR + + 5.ERROR + + 6.ERROR + + 7.target1 打开DHCP ok' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + level: Integration + module: TCPIP + steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ + 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" + sub module: DHCP + summary: server dhcp lease test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 3 4 "['01','02','03']" "[2,3,4]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3,4: get IP from dhcp pool with correct sequence' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1 + + 3. target change mac, connect to Target1 + + 4. Loop step3' + sub module: DHCP + summary: dhcp server ip pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 2 4 "['01','02']" "[2,3]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - DELAY 20 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:0.0.0.0'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4.1 succeed + + 4.2 failed' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1(.4.2 - .4.3) + + 3. target change mac, connect to Target1 + + 4. Loop step3 twice' + sub module: DHCP + summary: dhcp server ip pool empty + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - DELAY 90 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - DELAY 60 + - [''] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 5. succeed + + 6. succeed + + 8. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP timeout as 1 minute + + 3. target2 connect to target1 + + 4. wait 90 seconds + + 5. check if target2 IP is same + + 6. target2 disconnect + + 7. wait 60s + + 8. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server timeout test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0205 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['P SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. target2 wifi disconnected' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 + + 3. disable DHCP server, do config and enable' + sub module: DHCP + summary: disconnect STA if config dhcp server + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 4. get IP 192.168.4.2 - 192.168.4.4 + + 5. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. target2 change mac, connect to softap, disconnect + + 4. Loop step3 twice + + 5. change to first mac, connect to softap' + sub module: DHCP + summary: dhcp server assign same IP to same MAC when it's not released + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI DISCONN2 + - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 4. succeed + + 5. succeed + + 6. get IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. PC WIFI NIC connect to target1 softap + + 4. target2 connect to target1 softap and disnnect + + 5. PC release IP and disconnected + + 6. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server prefer assign released IP to new client + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. get IP 192.168.4.2 + + 5. can only find target2 with IP 192.168.4.2' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. PC NIC connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. target2 connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig and new client able to get first IP in pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0209 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - DELAY 20 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client and new client able to get IP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI CONN2 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to get IP (discover with requested + IP) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0211 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - DELAY 10 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to renew IP (direct send request) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_DHCP_0301 SDK: '8266_NonOS 8266_RTOS @@ -227,9 +1003,10 @@ test cases: 4.OK 5.等待10s,JAP fail' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration module: TCPIP steps: '1.target1 关闭DHCP 1 @@ -251,64 +1028,6 @@ test cases: test point 1: interaction test point 2: static IP and DHCP interaction test version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0113 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok - - 3.ok - - 4.ok - - 5.ok' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 - - 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 - - 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 - - 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' - sub module: UDP - summary: AP mode, create max udp socket test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_DHCP_0302 SDK: '8266_NonOS @@ -362,6 +1081,7 @@ test cases: initial condition: T2_1 initial condition description (auto): target 1 as SoftAP, target 2 as STA, will autogen a TC with initial condition T2_2 + level: Integration module: TCPIP steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n3.target1 设置地址池\n\ 4.target1下设置ssid 和pwd 加密方式\n5.target2 连接target1 \n6.target1 关闭DHCP 2\n7.target1\ @@ -378,1627 +1098,37 @@ test cases: test point 2: static IP and DHCP interaction test version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_DHCP_0301 + ID: TCPIP_DNS_0101 SDK: '8266_NonOS 8266_RTOS ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 3/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -i 192.168.123.123 -o 1 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 ip -S -i 0.0.0.0 -o 1 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] comment: '' execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.JAP CONNETED - - 4.OK - - 5.等待10s,JAP fail' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: TCPIP - steps: '1.target1 关闭DHCP 1 - - 2.target1 设置sta ip 192.168.123.123 - - 4.target1 jap AP - - 5.target1 设置sta ip 0.0.0.0 - - 6.target1 jap AP' - sub module: DHCP - summary: sta dhcp static ip interaction - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: interaction - test point 2: static IP and DHCP interaction test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: SYS_MISC_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ram -H - - ['R SSC1 RE FREEHEAP:\d+\r\n'] - comment: '' - execution time: 0.0 - expected result: ' - - 可以查询到一个数值 - - ' - initial condition: None - initial condition description (auto): none - module: System - steps: 查询空闲ram - sub module: Misc - summary: get heap size test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: 'get heap size ' - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0412 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK' + expected result: 1.OK initial condition: STAM2 initial condition description (auto): sta mode, join AP, DHCP on, will autogen a TC with initial condition STAAP2 + level: Integration module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.target1上创建TCP socket2 - - 6.关闭socket1 连接 - - 7.关闭socket2连接' - sub module: TCP - summary: close TCP send after socket changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0403 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ - \ \n6.8266往PC上发送5字节数据" - sub module: TCP - summary: do TCP send after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0402 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.断开与AP 连接 - - 6.关闭建立的socket1连接' - sub module: TCP - summary: "close TCP socket after WIFI \ndisconnected" - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0401 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.断开与AP 连接 - - 6.8266往PC上发送5字节数据' - sub module: TCP - summary: do TCP send after WIFI disconnected - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_ADDR_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 mac -Q -o 3 - - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.ok - - 3.ok - - 4.ok - - 5.ok - - 6.ok' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ - \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ - \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac" - sub module: MAC Address - summary: set mac, query mac - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: mac address function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0407 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ - \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" - sub module: TCP - summary: do TCP send after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0406 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0405 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -S -s -l 1 - - [''] - - - DELAY 5400 - - ['P SSC1 RE CLOSED:\d+,0'] - comment: '' - execution time: 1.5 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.TCP连接断开' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.PC 网卡 disable - - 6.target1上使用socket1发送数据,等待 90 分钟' - sub module: TCP - summary: do TCP send after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0404 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ - \ \n6.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0903 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] - comment: '' - execution time: 0.0 - expected result: 1. disconect event reason REASON_AUTH_EXPIRE - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_AUTH_EXPIRE - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. - - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0408 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ - \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -L -s 1000 - - ['R SSC1 RE LISTEN:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.ERROR - - 9.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去建立TCP 监听 - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,去连接 PC的ip, - - 6.target1上使用步骤4创建的socket,创建TCP 监听 - - 7.target1上shutdown 步骤4的socket - - 8.target1上使用步骤4创建的socket,创建TCP 监听 - - 9.target1上使用不存在socket,创建TCP 监听' - sub module: TCP - summary: STA mode, server listen test. use socket in state that can't listen - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. + steps: 1. get host name "espressif.cn" + sub module: DNS + summary: get host by name test + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0110 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i 123.456.678.789 -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.ERROR - - 6.ERROR' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 - - 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 - - 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' - sub module: TCP - summary: AP mode, connect test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -S -s 1000 - - ['R SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK - - 5.ERROR - - 6.OK - - 7.OK - - 8.ERROR - - 9.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket1, - - 3.target1上使用步骤2创建的socket1,去发送数据 - - 4.target1上创建TCP socket2 - - 5.target1上使用步骤4创建的socket2,去发送数据 - - 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 - - 7.target1上shutdown 步骤4的socket2 - - 8.target1往socket2发送错误命令发送数据 - - 9.target1上不指定socket往上发送数据' - sub module: TCP - summary: send test. use socket in state that can't send - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -i 0.0.0.0 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 20 - - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] - - - SSC SSC1 dhcp -S -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -Q - - ['R SSC1 C +STAIP:0.0.0.0'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 ip -Q - - ['R SSC1 RE "\+STAIP:%%s"%%()'] - comment: '' - execution time: 0.0 - expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ - 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: TCPIP - steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ - \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" - sub module: DHCP - summary: dhcp client function test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 3 - - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] - - - SSC SSC1 dhcp -Q -o 3 - - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -E -o 3 - - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] - - - SSC SSC1 dhcp -Q -o 3 - - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.STA&AP STARTED - - 4.STA STARTED - - 5.AP STARTED - - 6.OK - - 7.STA&AP STOPPED' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: TCPIP - steps: '1.target1 设置mode 为sta+softAP mode - - 2.target1 打开DHCP 3 - - 3.target1 查询DHCP 状态 - - 4.target1 查询sta DHCP 状态 - - 5.target1 查询softAP DHCP 状态 - - 6.target1 关闭 DHCP 3 - - 7.target1 查询 DHCP 状态' - sub module: DHCP - summary: dhcp status query - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 20 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ - \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ - 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" - sub module: DHCP - summary: dhcp server function test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0303 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" - sub module: UDP - summary: do UDP send after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -n 5 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -n 6 - - ['R SSC2 C +SCAN:', R SSC2 P ] - comment: '' - execution time: 0.0 - expected result: '1.target1 QAP - - 2. target1 set AP,set channel 6 - - 3.target2 上scan不到 channel 5 - - 4.target2 上查询channel 6的' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target1 断开连接AP - - 2.target1下设置ssid 和pwd 加密方式,set channel 6 - - 3.target2 上scan channel 5 - - 4.target2 上查询channel 6的' - sub module: WIFI Scan - summary: scan with scan config channel - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 - - ['R SSC2 NC +SCAN: C +SCANDONE'] - - - SSC SSC2 sta -S -b - - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] - comment: '' - execution time: 0.0 - expected result: '1.target2 上不能查询到此mac - - 2.target2上查询到' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 - - 2.target2上查询' - sub module: WIFI Scan - summary: scan with scan config bssid - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -S -s .,juhg123 - - ['R SSC2 NC +SCAN: C +SCANDONE'] - - - SSC SSC1 ap -S -s -p 123456789 -t 3 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -s - - ['R SSC2 C +SCAN:', R SSC2 P , 'R SSC2 NC +SCAN: C +SCANDONE'] - comment: '' - execution time: 0.0 - expected result: '1.target 2上不能scan .,juhg123 - - 2.target1 set AP - - 3.target2上查询到' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target 2 scan .,juhg123 - - 2.target1下设置ssid 和pwd 加密方式 - - 3.target2 scan ' - sub module: WIFI Scan - summary: scan with scan config ssid - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0105 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -s -b -n 11 - - [R SSC2 P C +SCANDONE] - - - SSC SSC2 sta -S -s -b -n 11 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 - - [R SSC2 P , R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -s -b -n 10 - - [R SSC2 P , R SSC2 NP C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 QAP - - 2. target1 set AP,set ssid broad cast,set channel 11 - - 3.target2 上查询到 - - 4.target2 上查询不到 - - 5.target2 上查询不到 - - 6.target2 上查询不到' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target1 QAP - - 2. target1 set AP,set ssid broad cast,set channel 11 - - 3.target2 上查询到 - - 4.target2 上查询不到 - - 5.target2 上查询不到 - - 6.target2 上查询不到' - sub module: WIFI Scan - summary: scan with several configs - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 P C +SCANDONE] - - - SSC SSC2 sta -S -h 1 - - [R SSC2 P C +SCANDONE] - - - SSC SSC1 ap -S -s -p 123456789 -h 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -h 1 - - [R SSC2 P C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP,set ssid broad cast - - 2.target 2上scan - - 3.target 2上scan - - 4.target1 set AP,set ssid hidden, - - 5.target 2上不能查询到 - - 6.target 2上查询到' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast - - 2.target 2上scan - - 3.target 2上scan - - 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, - - 5.target 2上查询 - - 6.target 2上查询' - sub module: WIFI Scan - summary: scan with scan config show hidden - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0302 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 - - 4.断开与AP 连接 - - 5.关闭建立的socket1连接' - sub module: UDP - summary: "close UDP socket after WIFI \ndisconnected" - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0301 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -i -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 - - 4.断开与AP 连接 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' - sub module: UDP - summary: do UDP send after WIFI disconnected - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 sta -Q - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:OK'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1.target1 jion AP 成功 - - 2.查询JAP的状态 - - 3.target1 断开AP - - 4.查询target1 JAP 是DISCONN' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1.target1 jion AP 成功 - - 2.查询JAP的状态 - - 3.target1 断开AP - - 4.查询target1 JAP 是DISCONN' - sub module: WIFI Connect - summary: JAP query test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: query JAP status + test point 2: DNS function test version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_DNS_0102 @@ -2033,6 +1163,7 @@ test cases: initial condition: STAM2 initial condition description (auto): sta mode, join AP, DHCP on, will autogen a TC with initial condition STAAP2 + level: Integration module: TCPIP steps: '1. get host name "espressif.cn" @@ -2049,7 +1180,7 @@ test cases: test point 2: DNS function test version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_DNS_0101 + ID: TCPIP_DNS_0103 SDK: '8266_NonOS 8266_RTOS @@ -2062,17 +1193,30 @@ test cases: cmd set: - '' - - SSC SSC1 soc -H -d iot.espressif.cn - - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t UDP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p 9003 -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] comment: '' execution time: 0.0 - expected result: 1.OK + expected result: '1.OK + + 2.OK + + 3.OK' initial condition: STAM2 initial condition description (auto): sta mode, join AP, DHCP on, will autogen a TC with initial condition STAAP2 + level: Integration module: TCPIP - steps: 1. get host name "espressif.cn" + steps: '1. get host name "espressif.cn" + + 2. sendto, recvfrom1. get host name "espressif.cn" + + 2. sendto, recvfrom' sub module: DNS - summary: get host by name test + summary: UDP send to iot.expressif.com test environment: SSC_T1_2 test environment description (auto): 'Able to access WAN after connect to AP. @@ -2081,53 +1225,48 @@ test cases: test point 2: DNS function test version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0403 - SDK: ESP32_IDF + ID: TCPIP_ICMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ping -i + - ['R SSC1 C +PING:OK'] + - - SSC SSC1 ping -i -c 2 + - ['R SSC1 C +PING:OK'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + expected result: '1.ok - 2. STA connect to ext AP + 2.ok' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.ping -i - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, STA connect - to AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 2.ping -i -c 2' + sub module: ICMP + summary: ping function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. - PC has one WiFi NIC support capture wlan packet using libpcap. + PC has 1 WiFi NIC. - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: ping function test + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_CONN_0904 + ID: TCPIP_IGMP_0101 SDK: '8266_NonOS 8266_RTOS @@ -2139,55 +1278,326 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p 1234567890 - - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] - - - WIFI DISCONN - - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: station IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: station IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: softAP IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: softAP IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] comment: '' execution time: 0.0 expected result: '1. succeed - 2. disconnect event REASON_HANDSHAKE_TIMEOUT + 2. succeed + + 3. able to recv packet' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: station IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed 3. succeed - 4. succeed + 4. target1 recv multicast packet' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1. target2 set to sta mode and join AP - 5. disconnect event REASON_ASSOC_TOOMANY + 2. target1 join group and create UDP socket using multicast addr - 6. succeed, target2 connect succeed + 3. target2 create UDP socket - 7. disconnect event REASON_ASSOC_EXPIRE' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1. config target1 softap max sta allowed 1 - - 2. target2 connect to target1 with wrong password - - 3. target2 disconnect - - 4. PC WIFI NIC connect to target1 - - 5. target2 connect to target1 with correct password - - 6. PC WIFI NIC disconnect - - 7. reconfig softap' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, - REASON_ASSOC_EXPIRE + 4. target2 send to multicast addr' + sub module: IGMP + summary: station send multicast packets test environment: SSC_T2_1 test environment description (auto): 'PC has 1 wired NIC connected to AP. @@ -2195,7 +1605,115 @@ test cases: 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: wifi disconnect reason test + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: softAP IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_IGMP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: TCPIP + steps: '1. target2 join SoftAP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: softAP send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_IP_0101 @@ -2234,6 +1752,7 @@ test cases: initial condition: STAM1 initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a TC with initial condition STAAP1 + level: Integration module: TCPIP steps: '1.target1 打开DHCP 1 @@ -2296,6 +1815,7 @@ test cases: initial condition: APM1 initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial condition APSTA1 + level: Integration module: TCPIP steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n4.target1 关闭DHCP\ \ 2\n5.target1 设置softAP ip 192.168.123.123\n6.target1 查询 当前sta ip \n7.target1\ @@ -2312,2559 +1832,7 @@ test cases: test point 2: set and query static IP version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^WIFI_CONN_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 sta -Q - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:OK'] - - - SSC SSC1 sta -Q - - ['R SSC1 C +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1.target1 jion AP 成功 - - 2.查询JAP的状态 - - 3.target1 断开AP - - 4.查询target1 JAP 是DISCONN' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1.target1 jion AP 成功 - - 2.查询JAP的状态 - - 3.target1 断开AP - - 4.查询target1 JAP 是DISCONN' - sub module: WIFI Connect - summary: JAP query test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: query JAP status - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.2 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed - - 5. succeed' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. leave group with correct host addr and wrong multicast addr - - 3. leave group with wrong host addr and correct multicast addr - - 4. leave group with wrong host addr and wrong multicast addr - - 5. leave group with correct host addr and correct multicast addr' - sub module: IGMP - summary: station IGMP leave group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -J -h -m 223.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. join group with correct host addr and wrong multicast addr - - 3. join group with wrong host addr and correct multicast addr - - 4. join group with wrong host addr and wrong multicast addr' - sub module: IGMP - summary: station IGMP join group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.2 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed - - 5. succeed' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. leave group with correct host addr and wrong multicast addr - - 3. leave group with wrong host addr and correct multicast addr - - 4. leave group with wrong host addr and wrong multicast addr - - 5. leave group with correct host addr and correct multicast addr' - sub module: IGMP - summary: softAP IGMP leave group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0110 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] - - - SSC SSC1 soc -S -s -i -p -l 1472 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] - - - SSC SSC1 soc -S -s -i -p -l 1473 - - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] - - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 - -j 20 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没收到UDP包 - - 6.OK' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 - - 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 - - 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' - sub module: UDP - summary: AP mode, sendto test with different length - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_SCAN_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 - - ['R SSC2 NC +SCAN: C +SCANDONE'] - - - SSC SSC2 sta -S -b - - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] - comment: '' - execution time: 0.0 - expected result: '1.target2 上不能查询到此mac - - 2.target2上查询到' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 - - 2.target2上查询' - sub module: WIFI Scan - summary: scan with scan config bssid - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_SCAN_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -n 5 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -n 6 - - ['R SSC2 C +SCAN:', R SSC2 P ] - comment: '' - execution time: 0.0 - expected result: '1.target1 QAP - - 2. target1 set AP,set channel 6 - - 3.target2 上scan不到 channel 5 - - 4.target2 上查询channel 6的' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1.target1 断开连接AP - - 2.target1下设置ssid 和pwd 加密方式,set channel 6 - - 3.target2 上scan channel 5 - - 4.target2 上查询channel 6的' - sub module: WIFI Scan - summary: scan with scan config channel - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_SCAN_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 P C +SCANDONE] - - - SSC SSC2 sta -S -h 1 - - [R SSC2 P C +SCANDONE] - - - SSC SSC1 ap -S -s -p 123456789 -h 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -h 1 - - [R SSC2 P C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP,set ssid broad cast - - 2.target 2上scan - - 3.target 2上scan - - 4.target1 set AP,set ssid hidden, - - 5.target 2上不能查询到 - - 6.target 2上查询到' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast - - 2.target 2上scan - - 3.target 2上scan - - 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, - - 5.target 2上查询 - - 6.target 2上查询' - sub module: WIFI Scan - summary: scan with scan config show hidden - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_SCAN_0105 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:'] - - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -s -b -n 11 - - [R SSC2 P C +SCANDONE] - - - SSC SSC2 sta -S -s -b -n 11 - - [R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 - - [R SSC2 P , R SSC2 NP C +SCANDONE] - - - SSC SSC2 sta -S -s -b -n 10 - - [R SSC2 P , R SSC2 NP C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 QAP - - 2. target1 set AP,set ssid broad cast,set channel 11 - - 3.target2 上查询到 - - 4.target2 上查询不到 - - 5.target2 上查询不到 - - 6.target2 上查询不到' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1.target1 QAP - - 2. target1 set AP,set ssid broad cast,set channel 11 - - 3.target2 上查询到 - - 4.target2 上查询不到 - - 5.target2 上查询不到 - - 6.target2 上查询不到' - sub module: WIFI Scan - summary: scan with several configs - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: scan with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.2 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed - - 5. succeed' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. leave group with correct host addr and wrong multicast addr - - 3. leave group with wrong host addr and correct multicast addr - - 4. leave group with wrong host addr and wrong multicast addr - - 5. leave group with correct host addr and correct multicast addr' - sub module: IGMP - summary: softAP IGMP leave group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -J -h -m 223.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. join group with correct host addr and wrong multicast addr - - 3. join group with wrong host addr and correct multicast addr - - 4. join group with wrong host addr and wrong multicast addr' - sub module: IGMP - summary: softAP IGMP join group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.2 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed - - 5. succeed' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. leave group with correct host addr and wrong multicast addr - - 3. leave group with wrong host addr and correct multicast addr - - 4. leave group with wrong host addr and wrong multicast addr - - 5. leave group with correct host addr and correct multicast addr' - sub module: IGMP - summary: station IGMP leave group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -J -h -m 223.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. join group with correct host addr and wrong multicast addr - - 3. join group with wrong host addr and correct multicast addr - - 4. join group with wrong host addr and wrong multicast addr' - sub module: IGMP - summary: station IGMP join group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.PC OK - - 5.PC OK - - 6.PC OK - - 7.PC OK - - 8.PC OK SOC_CLOSE=SOC1' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上关闭工作线程 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1472字节数据 - - 6.PC往8266上发送1472字节数据 - - 7.PC往8266上发送1472字节数据 - - 8.PC往8266上发送1472字节数据' - sub module: UDP - summary: STA mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: use UDP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_ICMP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ping -i - - ['R SSC1 C +PING:OK'] - - - SSC SSC1 ping -i -c 2 - - ['R SSC1 C +PING:OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.ping -i - - 2.ping -i -c 2' - sub module: ICMP - summary: ping function test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: ping function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_ADDR_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t - - [''] - - - SSC SSC2 sta -S -b 44:55:66:77:88:99 - - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC2 mac -Q -o 1 - - ['R SSC2 A :\+STAMAC:(.+)\r\n'] - - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -L - - ['R SSC1 C +LSTA:22:33:44:55:66:77'] - - - SSC SSC2 mac -S -o 1 -m - - ['R SSC2 C +MAC:STA,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.ok - - 3.ok - - 4.ok - - 5.ok - - 6.ok - - 7.ok - - 8.ok - - 9.ok' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ - 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ - 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ - 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac" - sub module: MAC Address - summary: set mac and do scan/JAP/SAP - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: mac address function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0108 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 C BIND:ERROR'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上创建TCP socket3, target_udp_port1' - sub module: UDP - summary: AP mode, udp bind test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0109 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN - - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC2 ip - - ['R SSC2 A :STAIP:(.+)\r\n'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - [R SOC1 UL 5] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['R SSC2 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.PC上SOC2 UDP传输,bing - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 - - 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' - sub module: UDP - summary: AP mode, sendto test. use different ip, port - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0106 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok - - 3.ok - - 4.ok - - 5.ok' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 - - 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 - - 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 - - 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' - sub module: UDP - summary: STA mode, create max udp socket test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0107 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上查询创建socket信息' - sub module: UDP - summary: STA mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SOC SOC1 SENDTO 1 - - [R SSC1 SL +1] - - - SOC SOC1 SENDTO 1472 - - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] - - - SOC SOC1 SENDTO 1473 - - [P SSC1 NC +RECVFROM, P SOC_COM C OK] - - - SOC SOC2 BIND - - [R SOC_COM L OK] - - - SOC SOC2 SENDTO 1472 - - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没收到UDP包 - - 6.OK - - 7.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.PC往8266上发送1字节数据 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1473字节数据 - - 6.PC上SOC2 UDP传输,bing - - 7.PC往8266上发送1472字节数据' - sub module: UDP - summary: STA mode, recvfrom basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0105 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.关闭socket1' - sub module: UDP - summary: STA mode, close UDP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC2 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 10 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] - - - SSC SSC1 soc -S -s -i -p -l 10 - - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.PC上SOC2 UDP传输,bing - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 - - 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' - sub module: UDP - summary: STA mode, sendto test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] - - - SSC SSC1 soc -S -s -i -p -l 1472 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] - - - SSC SSC1 soc -S -s -i -p -l 1473 - - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] - - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没有到UDP包 - - 6.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 - - 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 - - 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' - sub module: UDP - summary: STA mode, sendto test with different length - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 C BIND:ERROR'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上创建TCP socket3, target_udp_port1' - sub module: UDP - summary: STA mode, udp bind test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. target1 recv multicast packet' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. target2 join SoftAP - - 2. target1 join group and create UDP socket using multicast addr - - 3. target2 create UDP socket - - 4. target2 send to multicast addr' - sub module: IGMP - summary: softAP send multicast packets - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC1 SENDTO 1 224.1.1.1 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. able to recv packet' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. join group - - 2. create UDP socket using multicast addr - - 3. PC send UDP packet to multicast addr' - sub module: IGMP - summary: station IGMP recv packets - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 op -S -o 1 - - ['R SSC2 C +MODE:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. target1 recv multicast packet' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. target2 set to sta mode and join AP - - 2. target1 join group and create UDP socket using multicast addr - - 3. target2 create UDP socket - - 4. target2 send to multicast addr' - sub module: IGMP - summary: station send multicast packets - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_IGMP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC1 SENDTO 1 224.1.1.1 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. able to recv packet' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. join group - - 2. create UDP socket using multicast addr - - 3. PC send UDP packet to multicast addr' - sub module: IGMP - summary: softAP IGMP recv packets - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0401 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -R -a 0 - - ['R SSC1 C +AUTORECONN:OK'] - - - SSC SSC1 sta -R -a 2 - - ['R SSC1 C +AUTORECONN:0'] - - - SSC SSC1 reboot - - [''] - - - DELAY 15 - - [''] - - - SSC SSC1 sta -Q - - ['R SSC1 C JAP:DISCONNECTED'] - - - SSC SSC1 sta -R -a 1 - - ['R SSC1 C +AUTORECONN:OK'] - - - SSC SSC1 sta -R -a 2 - - ['R SSC1 C +AUTORECONN:1'] - - - SSC SSC1 reboot - - ['R SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1.设置autoreconn,关闭 - - 2.查询当前autoreconn状态是否关闭 - - 3.重启系统,等待15s - - 4.查询target1 未自动重连AP - - 5.设置autoreconn,开启 - - 6.查询当前autoreconn状态是否开启 - - 7.系统重启后target1 自动重连AP' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: WIFI MAC - steps: '1.设置autoreconn,关闭 - - 2.查询当前autoreconn状态是否关闭 - - 3.重启系统,等待15s - - 4.查询target1 未自动重连AP - - 5.设置autoreconn,开启 - - 6.查询当前autoreconn状态是否开启 - - 7.系统重启后target1 自动重连AP' - sub module: WIFI Connect - summary: auto reconnect test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: power on auto reconnect test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0404 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ - \ \n6.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0405 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -S -s -l 1 - - [''] - - - DELAY 5400 - - ['P SSC1 RE CLOSED:\d+,0'] - comment: '' - execution time: 1.5 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.TCP连接断开' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.PC 网卡 disable - - 6.target1上使用socket1发送数据,等待 90 分钟' - sub module: TCP - summary: do TCP send after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0406 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0407 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ - \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" - sub module: TCP - summary: do TCP send after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0401 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.断开与AP 连接 - - 6.8266往PC上发送5字节数据' - sub module: TCP - summary: do TCP send after WIFI disconnected - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0402 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.断开与AP 连接 - - 6.关闭建立的socket1连接' - sub module: TCP - summary: "close TCP socket after WIFI \ndisconnected" - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0403 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ - \ \n6.8266往PC上发送5字节数据" - sub module: TCP - summary: do TCP send after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0408 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ - \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" - sub module: TCP - summary: close TCP socket after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.PC OK - - 5.PC OK - - 6.PC OK - - 7.PC OK - - 8.PC OK SOC_CLOSE=SOC1' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上关闭工作线程 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1472字节数据 - - 6.PC往8266上发送1472字节数据 - - 7.PC往8266上发送1472字节数据 - - 8.PC往8266上发送1472字节数据' - sub module: UDP - summary: STA mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: use UDP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0307 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0306 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" - sub module: UDP - summary: do UDP send after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0305 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0304 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t -h - 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 P , R SSC2 C +SCANDONE] - - - SSC SSC1 ap -S -s -p -t -h - 1 - - ['R SSC1 C +SAP:OK'] - - - DELAY 3 - - [''] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 C +SCANDONE] - - - DELAY 3 - - [''] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 NP C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP,set ssid broad cast - - 2.target 2上scan target_ap_mac - - 3.target1 set AP,set ssid hidden, - - 4.target 2上不能scan target_ap_mac' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast - - 2.target 2上scan target_ap_mac - - 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, - - 4.target 2上scan target_ap_mac' - sub module: WIFI Connect - summary: station SAP+JAP test, ssid hidden - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0101 + ID: TCPIP_TCP_0101 SDK: '8266_NonOS 8266_RTOS @@ -4901,9 +1869,10 @@ test cases: 5.ERROR 6.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration module: TCPIP steps: '1.PC上建立TCP 监听 test_tcp_port1 @@ -4928,7 +1897,60 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_TCP_0103 + ID: TCPIP_TCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: STA mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0103 SDK: '8266_NonOS 8266_RTOS @@ -4973,9 +1995,10 @@ test cases: 7.target收到 146000 byte 8.OK,PC 回SOC_RECV=SOC2,RECV_LEN=字节数' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration module: TCPIP steps: '1. PC上建立TCP 监听 test_tcp_port1 @@ -4991,7 +2014,7 @@ test cases: 7. PC send 100 * 1460 data to 8266, - 8.8266 send 100 * 1460 to PC.' + 8.8266 send 100 * 1460 to PC. ' sub module: TCP summary: STA mode, send/recv basic test test environment: SSC_T1_1 @@ -5003,4051 +2026,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC1 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] - - - SOC SOC1 CONNECT - - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.PC TCP client accept - - 4.error' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.target1上创建TCP socket,bind到本地端口 - - 2.target1上使用步骤1创建的socket,创建TCP 监听 - - 3.PC TCP 连接到target1 , - - 4.PC tcp 连接到不存在的port ,' - sub module: TCP - summary: STA mode, server listen test. use different kinds of port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0105 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT - - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK - - 6.OK - - 7.target1关闭socket1 - - 8.target1关闭socket2 - - 9.OK - - 10.OK,pc tcp server accept成功 - - 11.target1关闭socket1 - - 12.OK - - 13.OK,pc tcp server accept成功 - - 14.OK - - 15.target1关闭socket1' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ - 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ - 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ - 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" - sub module: TCP - summary: STA mode, close for different types of TCP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h W - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h R - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept OK - - 4.OK - - 5.OK - - 6.OK,pc tcp server accept OK - - 7.OK - - 8.OK - - 9.OK,pc tcp server accept OK - - 10.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 4.target1 shutdown socket1 B - - 5.target1上创建TCP socket - - 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 7.target1 shutdown socket2 W - - 8.target1上创建TCP socket - - 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 10.target1 shutdown socket3 R' - sub module: TCP - summary: STA mode, shutdown basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0107 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC3 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC4 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC5 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC6 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - comment: '' - execution time: 0.0 - expected result: '1.+BIND:0,OK,0.0.0.0 - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK,pc tcp server accept成功 - - 5.OK,pc tcp server accept成功 - - 6.OK,pc tcp server accept成功 - - 7.OK,pc tcp server accept成功' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ - \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6" - sub module: TCP - summary: STA mode, accept max TCP client by server test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0106 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4 OK - - 5.OK,pc tcp server accept成功 - - 6.OK - - 7.OK,pc tcp server accept成功 - - 8 OK - - 9.OK,pc tcp server accept成功 - - 10.OK - - 11.OK,pc tcp server accept成功' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 4.target1上创建TCP socket2 - - 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 6.target1上创建TCP socket3 - - 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 8.target1上创建TCP socket4 - - 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 10.target1上创建TCP socket5 - - 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' - sub module: TCP - summary: STA mode, create max TCP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0210 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - WIFI CONN2 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. succeed - - 5. find target2 and PC' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client able to get IP (discover with requested - IP) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0211 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - DELAY 10 - - [''] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. succeed - - 5. find target2 and PC' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client able to renew IP (direct send request) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0212 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT 0 - - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', - 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', - 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.OK - - 9.PC OK, target1 +ACCEPT:3,2,,port - - 10.+SOCINFO:,,, - - +SOCINFO:,,, - - +SOCINFO:, - - +SOCINFO:,,, - - +SOCINF0ALL' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ - \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" - sub module: TCP - summary: AP mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0210 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC2 SEND 146000 - - [P SOC_COM R *] - - - SSC SSC1 soc -W -s -o 1 - - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 6.OK - - 7.收到 146000 数据 - - ' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1 创建好TCP 连接,有ACCEPT - - 5.target停止调用recv - - 6.PC send 100 * 1460 data to 8266, - - 7.target重新调用recv' - sub module: TCP - summary: AP mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0210 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC2 SEND 146000 - - [P SOC_COM R *] - - - SSC SSC1 soc -W -s -o 1 - - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 6.OK - - 7.收到 146000 数据' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1 创建好TCP 连接,有ACCEPT - - 5.target停止调用recv - - 6.PC send 100 * 1460 data to 8266, - - 7.target重新调用recv' - sub module: TCP - summary: AP mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0212 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT 0 - - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', - 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', - 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.OK - - 9.PC OK, target1 +ACCEPT:3,2,,port - - 10.+SOCINFO:,,, - - +SOCINFO:,,, - - +SOCINFO:, - - +SOCINFO:,,, - - +SOCINF0ALL' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ - \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" - sub module: TCP - summary: AP mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0211 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - DELAY 10 - - [''] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. succeed - - 5. find target2 and PC' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client able to renew IP (direct send request) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0210 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - WIFI CONN2 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. succeed - - 5. find target2 and PC' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client able to get IP (discover with requested - IP) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_ADDR_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 mac -Q -o 3 - - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] - - - SSC SSC1 mac -S -o 1 -m - - ['R SSC1 C +MAC:STA,OK'] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.ok - - 3.ok - - 4.ok - - 5.ok - - 6.ok' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ - \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ - \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac\n" - sub module: MAC Address - summary: set mac, query mac - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: mac address function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_ADDR_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC1 ap -S -s -p -t - - [''] - - - SSC SSC2 sta -S -b 44:55:66:77:88:99 - - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] - - - SSC SSC1 mac -S -o 2 -m - - ['R SSC1 C +MAC:AP,OK'] - - - SSC SSC2 mac -Q -o 1 - - ['R SSC2 A :\+STAMAC:(.+)\r\n'] - - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -L - - ['R SSC1 C +LSTA:22:33:44:55:66:77'] - - - SSC SSC2 mac -S -o 1 -m - - ['R SSC2 C +MAC:STA,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.ok - - 3.ok - - 4.ok - - 5.ok - - 6.ok - - 7.ok - - 8.ok - - 9.ok' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ - 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ - 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ - 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac\n" - sub module: MAC Address - summary: set mac and do scan/JAP/SAP - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: mac address function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - - - SOC SOC1 SENDTO 1472 - - [''] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.PC OK - - 5.PC OK - - 6.PC OK - - 7.PC OK - - 8.PC OK SOC_CLOSE=SOC1' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上关闭工作线程 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1472字节数据 - - 6.PC往8266上发送1472字节数据 - - 7.PC往8266上发送1472字节数据 - - 8.PC往8266上发送1472字节数据' - sub module: UDP - summary: AP mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: use UDP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0411 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.target1上创建TCP socket2 - - 6.8266往PC socket2上发送5字节数据 - - 7.8266往PC socket1上发送5字节数据' - sub module: TCP - summary: do TCP send after socket changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: TCP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0502 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2; SoftAP in 20M, STA in 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M, SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_20 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_40' - sub module: Phy Mode - summary: SoftAP STA in channel1 20M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0503 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M, SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0501 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_20 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1 20M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0506 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 40M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_40' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0505 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2; SoftAP in 20M, STA in 40M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA set to 40M ,SoftAP set to 20M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 20M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0301 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t -h - 0 -m 8 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] - comment: '' - execution time: 0.0 - expected result: '1. target1 set AP - - 2.target 1上查询到跟设置AP时一致 - - ' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: WIFI MAC - steps: '1. target1 set AP - - 2.target 1上查询到跟设置AP时一致 - - ' - sub module: WIFI Connect - summary: AP config query test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: query AP config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 - - ['R SSC1 C +IP:ERROR'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 2 - - ['R SSC1 C +APIP:192.168.123.123'] - - - SSC SSC1 ip -S -o 2 -i - - ['R SSC1 C +IP:OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.ERROR - - 3.OK - - 4.OK - - 5.APIP:192.168.123.123 - - 6.OK' - initial condition: APSTA1 - initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) - module: TCPIP - steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n4.target1 关闭DHCP\ - \ 2\n5.target1 设置softAP ip 192.168.123.123\n6.target1 查询 当前sta ip \n7.target1\ - \ 设置softAP ip 为target_ap_ip" - sub module: IP - summary: ap set and query static ip test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: set and query static IP - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0105 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.关闭socket1' - sub module: UDP - summary: STA mode, close UDP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SOC SOC1 SENDTO 1 - - [R SSC1 SL +1] - - - SOC SOC1 SENDTO 1472 - - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] - - - SOC SOC1 SENDTO 1473 - - [P SSC1 NC +RECVFROM, P SOC_COM C OK] - - - SOC SOC2 BIND - - [R SOC_COM L OK] - - - SOC SOC2 SENDTO 1472 - - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没收到UDP包 - - 6.OK - - 7.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.PC往8266上发送1字节数据 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1473字节数据 - - 6.PC上SOC2 UDP传输,bing - - 7.PC往8266上发送1472字节数据' - sub module: UDP - summary: STA mode, recvfrom basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0107 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上查询创建socket信息' - sub module: UDP - summary: STA mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0106 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok - - 3.ok - - 4.ok - - 5.ok' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 - - 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 - - 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 - - 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' - sub module: UDP - summary: STA mode, create max udp socket test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 C BIND:ERROR'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上创建TCP socket3, target_udp_port1' - sub module: UDP - summary: STA mode, udp bind test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] - - - SSC SSC1 soc -S -s -i -p -l 1472 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] - - - SSC SSC1 soc -S -s -i -p -l 1473 - - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] - - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没有到UDP包 - - 6.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 - - 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 - - 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' - sub module: UDP - summary: STA mode, sendto test with different length - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC2 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 10 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] - - - SSC SSC1 soc -S -s -i -p -l 10 - - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.PC上SOC2 UDP传输,bing - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 - - 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' - sub module: UDP - summary: STA mode, sendto test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 20 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ - \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ - 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" - sub module: DHCP - summary: dhcp server function test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 3 - - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] - - - SSC SSC1 dhcp -Q -o 3 - - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -Q -o 1 - - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -Q -o 2 - - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] - - - SSC SSC1 dhcp -E -o 3 - - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] - - - SSC SSC1 dhcp -Q -o 3 - - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.STA&AP STARTED - - 4.STA STARTED - - 5.AP STARTED - - 6.OK - - 7.STA&AP STOPPED' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: TCPIP - steps: '1.target1 设置mode 为sta+softAP mode - - 2.target1 打开DHCP 3 - - 3.target1 查询DHCP 状态 - - 4.target1 查询sta DHCP 状态 - - 5.target1 查询softAP DHCP 状态 - - 6.target1 关闭 DHCP 3 - - 7.target1 查询 DHCP 状态' - sub module: DHCP - summary: dhcp status query - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0301 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -S - - [''] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANFAIL, 'P SSC1 P +SCAN:', R SSC1 C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1. second scan failed - - 2. first scan succeed' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. do all channel scan - - 2. do scan before scan finished' - sub module: WIFI Scan - summary: reject scan request before scan finished - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0303 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK'] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:OK'] - - - SSC SSC1 sta -S - - [''] - - - SSC SSC1 sta -C -s -p - - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '2. scan succeed, JAP succeed - - 5. JAP succeed, scan succeed' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 1 STA join AP - - 2. target 1 STA scan before JAP succeed - - 3. target 1 quite AP - - 4. target 1 scan - - 5. target 1 JAP before scan succeed' - sub module: WIFI Scan - summary: scan during JAP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0801 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -S -s -p -t 2 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] - - - SSC SSC1 ap -S -s -p -t 4 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] - - - SSC SSC1 ap -S -s -p -t 0 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. auth change event old mode 0 new mode 2 - - 4. auth change event old mode 2 new mode 3 - - 5. auth change event old mode 3 new mode 4 - - 6. auth change event old mode 4 new mode 0' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. set target1 softap auth mode 0 - - 2. target2 connect to target1 - - 3. set target1 softap auth mode 2, wait sta connected - - 4. set target1 softap auth mode 3, wait sta connected - - 5. set target1 softap auth mode 4, wait sta connected - - 6. set target1 softap auth mode 0, wait sta connected' - sub module: WIFI Connect - summary: test auth change event - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi auth changed event test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0304 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:OK'] - - - SSC SSC1 sta -S - - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC1 sta -S - - [''] - - - SSC SSC2 sta -C -s -p - - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '2. scan succeed, JAP succeed - - 5. JAP succeed, scan succeed' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 2 STA join target 1 SoftAP - - 2. target 1 STA scan before target 2 JAP succeed - - 3. target 2 STA QAP - - 4. target 1 STA scan - - 5. target 2 STA JAP before target 1 STA scan succeed' - sub module: WIFI Scan - summary: scan during ext STA join SoftAP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_UDP_0108 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 C BIND:ERROR'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 - - 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 4.target1上创建TCP socket3, target_udp_port1' - sub module: UDP - summary: AP mode, udp bind test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0104 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t -m - 1 - - ['R SSC1 C +SAP:OK'] - - - WIFI DISCONN - - ['R PC_COM C +WIFIDISCONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - WIFI CONN - - - ['R PC_COM C +WIFICONN:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. target1 set AP,set max allowed sta as 1 - - 2. use PC disconnect, - - 3.target 2 jap succeed - - 4.PC WIFI can not CONN' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 - - 2.use PC disconnect target1 - - 3.target 2 jap target1 - - 4.PC WIFI CONNECT target1' - sub module: WIFI Connect - summary: station SAP test, max allowed sta - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC1 SENDTO 1 224.1.1.1 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. able to recv packet' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. join group - - 2. create UDP socket using multicast addr - - 3. PC send UDP packet to multicast addr' - sub module: IGMP - summary: station IGMP recv packets - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SOC SOC1 SENDTO 1 224.1.1.1 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. able to recv packet' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. join group - - 2. create UDP socket using multicast addr - - 3. PC send UDP packet to multicast addr' - sub module: IGMP - summary: softAP IGMP recv packets - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 op -S -o 1 - - ['R SSC2 C +MODE:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. target1 recv multicast packet' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. target2 set to sta mode and join AP - - 2. target1 join group and create UDP socket using multicast addr - - 3. target2 create UDP socket - - 4. target2 send to multicast addr' - sub module: IGMP - summary: station send multicast packets - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IGMP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :\+BIND:(\d+),OK'] - - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 - - [R SSC1 SL +1] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. target1 recv multicast packet' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. target2 join SoftAP - - 2. target1 join group and create UDP socket using multicast addr - - 3. target2 create UDP socket - - 4. target2 send to multicast addr' - sub module: IGMP - summary: softAP send multicast packets - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP send/recv test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0301 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t -h - 0 -m 8 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 ap -Q - - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] - comment: '' - execution time: 0.0 - expected result: '1. target1 set AP - - 2.target 1上查询到跟设置AP时一致' - initial condition: APSTA1 - initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) - module: WIFI MAC - steps: '1. target1 set AP - - 2.target 1上查询到跟设置AP时一致' - sub module: WIFI Connect - summary: AP config query test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: query AP config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0114 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上查询创建socket信息' - sub module: UDP - summary: AP mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0111 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN - - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC2 ip - - ['R SSC2 A :STAIP:(.+)\r\n'] - - - SSC SSC2 soc -B -t UDP -p - - ['R SSC2 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SOC SOC1 SENDTO 5 - - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] - - - SSC SSC2 soc -S -s -i -p -l 5 - - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没收到UDP包 - - 6.OK - - 7.OK' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.PC往8266上发送1字节数据 - - 4.PC往8266上发送1472字节数据 - - 5.PC往8266上发送1473字节数据 - - 6.PC上SOC2 UDP传输,bing - - 7.PC往8266上发送1472字节数据' - sub module: UDP - summary: AP mode, recvfrom basic test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0110 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] - - - SSC SSC1 soc -S -s -i -p -l 1472 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] - - - SSC SSC1 soc -S -s -i -p -l 1473 - - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] - - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 - -j 20 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK,没收到UDP包 - - 6.OK' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 - - 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 - - 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' - sub module: UDP - summary: AP mode, sendto test with different length - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0113 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 RE BIND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.ok - - 3.ok - - 4.ok - - 5.ok' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 - - 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 - - 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 - - 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' - sub module: UDP - summary: AP mode, create max udp socket test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0112 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 2.关闭socket1' - sub module: UDP - summary: AP mode, close UDP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use UDP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0501 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC2 sta -R -r 1 - - ['R SSC2 C +RECONN:OK'] - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - DELAY 10 - - [''] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - DELAY 15 - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -R -r 0 - - ['R SSC2 C +RECONN:OK'] - - - SSC SSC2 sta -R -r 2 - - ['R SSC2 C +RECONN:0'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - DELAY 10 - - [''] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - DELAY 15 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] - - - SSC SSC2 sta -R -r 1 - - ['R SSC2 C +RECONN:OK'] - comment: '' - execution time: 0.0 - expected result: '1.设置reconn,开启(此功能不需要重启系统) - - 2.target1 set AP - - 3.target2 JAP target1 成功 - - 4.target2 断开target1 连接 - - 5.等待10s,target2 自动重连target1 - - 6.成功 - - 7.查询reconn状态,关闭 - - 8.修改mode 成功 - - 9.等待15s,target2 不会自动重连target1' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: "1.设置reconn,开启(此功能不需要重启系统)\n2.target1下设置ssid 和pwd 加密方式\n3.target2 JAP target1\ - \ \n4.target1 修改mode 为sta mode\n5.等待10s,target1 修改mode 为softAP mode\n6.设置reconn,关闭\n\ - 7.查询reconn状态,关闭\n8.target1 修改mode 为sta mode\n9.等待15s,target1 修改mode 为softAP mode" - sub module: WIFI Connect - summary: reconnect policy test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: reconnect policy test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0502 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -R -r 1 - - ['R SSC2 C +RECONN:OK'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - DELAY 5 - - ['R SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - DELAY 10 - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - DELAY 10 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP - - 2.target2 jap target 1 - - 3.设置reconn,开启(此功能不需要重启系统) - - 4.target2 断开target1 连接 - - 5.等待10s,target2 自动重连target1 - - 6.target2 断开target1 连接' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式 - - 2.target2 jap target 1 - - 3.设置reconn,开启(此功能不需要重启系统) - - 4.target2 断开target1 连接 - - 5.等待10s,target2 自动重连target1 - - 6.target2 断开target1 连接' - sub module: WIFI Connect - summary: will not do reconnect after manually disconnected - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: reconnect policy test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0401 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -R -a 0 - - ['R SSC1 C +AUTORECONN:OK'] - - - SSC SSC1 sta -R -a 2 - - ['R SSC1 C +AUTORECONN:0'] - - - SSC SSC1 reboot - - [''] - - - DELAY 15 - - [''] - - - SSC SSC1 sta -Q - - ['R SSC1 C JAP:DISCONNECTED'] - - - SSC SSC1 sta -R -a 1 - - ['R SSC1 C +AUTORECONN:OK'] - - - SSC SSC1 sta -R -a 2 - - ['R SSC1 C +AUTORECONN:1'] - - - SSC SSC1 reboot - - ['R SSC1 C +JAP:CONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1.设置autoreconn,关闭 - - 2.查询当前autoreconn状态是否关闭 - - 3.重启系统,等待15s - - 4.查询target1 未自动重连AP - - 5.设置autoreconn,开启 - - 6.查询当前autoreconn状态是否开启 - - 7.系统重启后target1 自动重连AP' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: WIFI MAC - steps: '1.设置autoreconn,关闭 - - 2.查询当前autoreconn状态是否关闭 - - 3.重启系统,等待15s - - 4.查询target1 未自动重连AP - - 5.设置autoreconn,开启 - - 6.查询当前autoreconn状态是否开启 - - 7.系统重启后target1 自动重连AP' - sub module: WIFI Connect - summary: auto reconnect test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: power on auto reconnect test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_MODE_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 dhcp -S -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC2 sta -S - - [R SSC2 NP C +SCANDONE] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:OK'] - comment: '' - execution time: 0.0 - expected result: '1.target1下设置ssid 和pwd 、加密方式成功 - - 2.修改target 1的mode 为sta mode - - 3.target1的dhcp打开 - - 4.target1成功连接上AP - - 5.target2上不能查询到target_ssid - - 6.target1断开AP' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式 - - 2.修改target1的mode 为sta mode - - 3.target1的dhcp打开 - - 4.target1连接AP - - 5.target2查询target_ssid - - 6.target1断开AP' - sub module: WIFI Mode - summary: mode switch test (sta mode) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi mode fucntion - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_MODE_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 op -S -o 3 - - ['R SSC1 C +MODE:OK'] - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -S -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC2 sta -S - - [R SSC2 P , R SSC2 C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 change to AP mode - - 2.target1 set AP - - 3.target 1 的dhcp 打开 - - 4.target 1 成功连接上AP - - 5.target 2 上查询到target_ssid' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: WIFI MAC - steps: '1.target1 change to AP mode - - 2.target1下设置ssid 和pwd 加密方式 - - 3.target1 的dhcp 打开 - - 4.target1 连接AP - - 5.target2 上查询target_ssid' - sub module: WIFI Mode - summary: mode switch test (STA+AP mode) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi mode fucntion - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_MODE_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S - - [R SSC2 P , R SSC2 C +SCANDONE] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:ERROR'] - - - SSC SSC1 sta -D - - ['R SSC1 C +QAP:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. target1 set AP - - 2.target 2 上查询到target_ssid - - 3. target1 can''t join AP - - 4. target1 can''t QAP' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式 - - 2.target 2 上查询target_ssid - - 3.target1 join AP - - 4.target1 DISCONN AP' - sub module: WIFI Mode - summary: mode switch test (AP mode) - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi mode fucntion - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0904 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p 1234567890 - - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - WIFI CONN - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] - - - WIFI DISCONN - - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -S -s -p -t 3 -m 1 - - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. disconnect event REASON_HANDSHAKE_TIMEOUT - - 3. succeed - - 4. succeed - - 5. disconnect event REASON_ASSOC_TOOMANY - - 6. succeed, target2 connect succeed - - 7. disconnect event REASON_ASSOC_EXPIRE' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. config target1 softap max sta allowed 1 - - 2. target2 connect to target1 with wrong password - - 3. target2 disconnect - - 4. PC WIFI NIC connect to target1 - - 5. target2 connect to target1 with correct password - - 6. PC WIFI NIC disconnect - - 7. reconfig softap' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, - REASON_ASSOC_EXPIRE - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0902 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - APC OFF - - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] - - - APC ON - - [P PC_COM L OK] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. disconnect event REASON_BEACON_TIMEOUT' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1. connect to AP - - 2. AP power off' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_BEACON_TIMEOUT - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^WIFI_CONN_0901 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: basic function - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -D - - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] - comment: '' - execution time: 0.0 - expected result: '1. disconnect event reason REASON_ASSOC_LEAVE - - 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT - - 3. disconnect event reason REASON_NO_AP_FOUND' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: WIFI MAC - steps: '1. sta connect to AP, and disconnect - - 2. connect to AP with wrong password - - 3. connect to AP not exist' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, - REASON_NO_AP_FOUND - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['P SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2.OK - - 3.ERROR - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.OK - - 9.OK - - 10.OK - - 11.OK - - 12.ERROR' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去连接 PC的ip, - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,创建TCP 监听 - - 6.target1上使用步骤4创建的socket,去连接 PC的ip, - - 7.target1上创建TCP socket - - 8.target1上使用步骤7创建的socket,去连接 PC的ip, - - 9.target1上关闭步骤7创建的socket - - 10.target1上使用步骤7创建的socket,去连接 PC的ip, - - 11.target1上关闭所有创建的socket - - 12.target1上使用步骤2创建的socket,去连接 PC的ip,' - sub module: TCP - summary: STA mode, connect test. use socket in state that can't connect - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0206 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -i - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT - - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] - - - SSC SSC1 soc -I - - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', - 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', - 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK - - 8.OK - - 9.PC OK, target1 +ACCEPT:3,2,,port - - 10.+SOCINFO:,,, - - +SOCINFO:,,, - - +SOCINFO:, - - +SOCINFO:,,, - - +SOCINF0ALL' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ - \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" - sub module: TCP - summary: STA mode, get active socket info test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0207 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['P SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2 OK - - 3.ERROR - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.OK - - 9.OK - - 10.OK - - 11.OK - - 12.ERROR' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去连接 PC的ip, - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,创建TCP 监听 - - 6.target1上使用步骤4创建的socket,去连接 PC的ip, - - 7.target1上创建TCP socket - - 8.target1上使用步骤7创建的socket,去连接 PC的ip, - - 9.target1上关闭步骤7创建的socket - - 10.target1上使用步骤7创建的socket,去连接 PC的ip, - - 11.target1上关闭所有创建的socket - - 12.target1上使用步骤2创建的socket,去连接 PC的ip,' - sub module: TCP - summary: AP mode, connect test. use socket in state that can't connect - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DNS_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 3/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -H -d iot.espressif.cn - - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] - comment: '' - execution time: 0.0 - expected result: 1.OK - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: 1. get host name "espressif.cn" - sub module: DNS - summary: get host by name test - test environment: SSC_T1_2 - test environment description (auto): 'Able to access WAN after connect to AP. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DNS function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DNS_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 3/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -H -d iot.espressif.cn - - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] - - - SSC SSC1 soc -B -t UDP - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p 9003 -l 10 - - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. get host name "espressif.cn" - - 2. sendto, recvfrom1. get host name "espressif.cn" - - 2. sendto, recvfrom' - sub module: DNS - summary: UDP send to iot.expressif.com - test environment: SSC_T1_2 - test environment description (auto): 'Able to access WAN after connect to AP. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DNS function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DNS_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 3/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -H -d iot.espressif.cn - - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p 9001 - - ['R SSC1 RE \+CONNECT:\d+,OK'] - - - SSC SSC1 soc -S -s -l 10 - - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. get host name "espressif.cn" - - 2. connect, send, recv1. get host name "espressif.cn" - - 2. connect, send, recv' - sub module: DNS - summary: TCP connect to iot.espressif.com - test environment: SSC_T1_2 - test environment description (auto): 'Able to access WAN after connect to AP. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DNS function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0106 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4 OK - - 5.OK,pc tcp server accept成功 - - 6.OK - - 7.OK,pc tcp server accept成功 - - 8 OK - - 9.OK,pc tcp server accept成功 - - 10.OK - - 11.OK,pc tcp server accept成功' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 4.target1上创建TCP socket2 - - 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 6.target1上创建TCP socket3 - - 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 8.target1上创建TCP socket4 - - 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 10.target1上创建TCP socket5 - - 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' - sub module: TCP - summary: STA mode, create max TCP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0107 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC3 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC4 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC5 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC6 CONNECT - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - comment: '' - execution time: 0.0 - expected result: '1.+BIND:0,OK,0.0.0.0 - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK,pc tcp server accept成功 - - 5.OK,pc tcp server accept成功 - - 6.OK,pc tcp server accept成功 - - 7.OK,pc tcp server accept成功' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ - \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ - \ " - sub module: TCP - summary: STA mode, accept max TCP client by server test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) - CI ready: 'Yes' ID: TCPIP_TCP_0104 SDK: '8266_NonOS @@ -9105,6 +2083,7 @@ test cases: initial condition: STAM2 initial condition description (auto): sta mode, join AP, DHCP on, will autogen a TC with initial condition STAAP2 + level: Integration module: TCPIP steps: '1. PC上建立TCP 监听 test_tcp_port1 @@ -9213,6 +2192,7 @@ test cases: initial condition: STAM2 initial condition description (auto): sta mode, join AP, DHCP on, will autogen a TC with initial condition STAAP2 + level: Integration module: TCPIP steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ @@ -9232,7 +2212,7704 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0102 + ID: TCPIP_TCP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: STA mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ + \ " + sub module: TCP + summary: STA mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: AP mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT 0 + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: AP mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.target收到5byte数据 + + 6.PC收到5byte数据 + + 7.target收到146000 byte数据 + + 8.OK,PC 收到146000 byte数据' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC. ' + sub module: TCP + summary: AP mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept成功 + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept成功 + + 10.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: AP mode, shutdown basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK,target1上accept 成功 + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: AP mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0115 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: AP mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0116 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + comment: '' + execution time: 0.0 + expected result: '1.+BIND:0,OK,0.0.0.0 + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ + \ " + sub module: TCP + summary: AP mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: STA mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: STA mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s 1000 + - ['R SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.ERROR + + 6.OK + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket1, + + 3.target1上使用步骤2创建的socket1,去发送数据 + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去发送数据 + + 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 + + 7.target1上shutdown 步骤4的socket2 + + 8.target1往socket2发送错误命令发送数据 + + 9.target1上不指定socket往上发送数据' + sub module: TCP + summary: send test. use socket in state that can't send + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc server accept OK + + 4.OK + + 5.OK + + 6.OK + + 7.target收到146000 byte + + ' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target上不进行recv + + 6.PC send 100 * 1460 data to target, + + 7.在target上开始recv' + sub module: TCP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2 OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: AP mode, connect test. use socket in state that can't connect + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4 OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: AP mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 6.OK + + 7.收到 146000 数据 + + ' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.target停止调用recv + + 6.PC send 100 * 1460 data to 8266, + + 7.target重新调用recv' + sub module: TCP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0212 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.8266往PC上发送5字节数据' + sub module: TCP + summary: do TCP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0402 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.关闭建立的socket1连接' + sub module: TCP + summary: "close TCP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0403 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0404 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0405 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -S -s -l 1 + - [''] + - - DELAY 5400 + - ['P SSC1 RE CLOSED:\d+,0'] + comment: '' + execution time: 1.5 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.TCP连接断开' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.PC 网卡 disable + + 6.target1上使用socket1发送数据,等待 90 分钟' + sub module: TCP + summary: do TCP send after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0406 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0407 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0408 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0411 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.8266往PC socket2上发送5字节数据 + + 7.8266往PC socket1上发送5字节数据' + sub module: TCP + summary: do TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_TCP_0412 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.关闭socket1 连接 + + 7.关闭socket2连接' + sub module: TCP + summary: close TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: STA mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.PC上SOC2 UDP传输,bing + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 + + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: STA mode, sendto test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没有到UDP包 + + 6.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: STA mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 1 + - [R SSC1 SL +1] + - - SOC SOC1 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + - - SOC SOC1 SENDTO 1473 + - [P SSC1 NC +RECVFROM, P SOC_COM C OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SOC SOC2 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recvfrom basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: STA mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: STA mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0108 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: AP mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0109 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC2 ip + - ['R SSC2 A :STAIP:(.+)\r\n'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - [R SOC1 UL 5] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['R SSC2 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.PC上SOC2 UDP传输,bing + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 + + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: AP mode, sendto test. use different ip, port + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 + -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: AP mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC2 ip + - ['R SSC2 A :STAIP:(.+)\r\n'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 5 + - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + - - SSC SSC2 soc -S -s -i -p -l 5 + - ['R SSC1 RE "RECVFROM:%%s,5,%%s,%%u"%%(,,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK + + 7.OK' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: AP mode, recvfrom basic test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.关闭socket1' + sub module: UDP + summary: AP mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok + + 3.ok + + 4.ok + + 5.ok' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: AP mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0114 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上查询创建socket信息' + sub module: UDP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.PC OK + + 5.PC OK + + 6.PC OK + + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: APM2 + initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen + a TC with initial condition APSTA2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' + sub module: UDP + summary: do UDP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + ' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.关闭建立的socket1连接' + sub module: UDP + summary: "close UDP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0303 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0304 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0305 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0306 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: TCPIP_UDP_0307 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_ADDR_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 mac -Q -o 3 + - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ + \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ + \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac\n" + sub module: MAC Address + summary: set mac, query mac + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_ADDR_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -S -b 44:55:66:77:88:99 + - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -Q -o 1 + - ['R SSC2 A :\+STAMAC:(.+)\r\n'] + - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:22:33:44:55:66:77'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok + + 7.ok + + 8.ok + + 9.ok' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ + 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ + 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ + 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac\n" + sub module: MAC Address + summary: set mac and do scan/JAP/SAP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -p -t 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + - - SSC SSC1 ap -S -s -p -t 5 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP,open, \n2.target 2 jap succeed\n3.target1 set\ + \ AP,wpa_psk \n4.target 2 jap succeed\n5.target1 set AP, wpa2_psk \n6.target 2\ + \ jap succeed\n7.target1 set AP,wap_wpa2_psk\n8.target 2 jap succeed\n9.target1\ + \ set AP,加密方式为t 1\n10.target 2 上查询到target_ssid\n11.target1 set AP,加密方式为t 5\n12.target\ + \ 2 上查询到target_ssid" + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: "1.target1下设置ssid 和pwd,加密方式 open\n2.target2 jap target1\n3.target1下设置ssid\ + \ 和pwd,加密方式 wpa_psk \n4.target2 jap target1\n5.target1下设置ssid 和pwd,加密方式 wpa2_psk\ + \ \n6.target 2 jap target1\n7.target1下设置ssid 和pwd,加密方式 wap_wpa2_psk\n8.target2\ + \ jap target1\n9.target1下设置ssid 和pwd,加密方式 wep \n10.target2上查询target_ssid\n11.target1下设置ssid\ + \ 和pwd,加密方式 t 5 错误的加密方式\n12.target2上查询 target_ssid" + sub module: WIFI Connect + summary: station SAP+JAP test, different encryption + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -t 0 -n 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -t 0 -n 13 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 ap -S -s -n 15 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - ['R SSC2 RE "\+SCAN:%%s,.+,\d+,1"%%()'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set channel 1 + + 2.target 2 jap succeed + + 3.target1 set AP,set channel 10 + + 4.target 2 jap succeed + + 5.target1 set AP,set channel 15 + + 6.target 2 上查询到target_ssid' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set channel 1 + + 2.target2 jap target 1 + + 3.target1下设置ssid 和pwd 加密方式,set channel 10 + + 4.target2 jap target 1 + + 5.target1下设置ssid 和pwd 加密方式,set channel 15 + + 6.target 2 上查询target_ssid' + sub module: WIFI Connect + summary: station SAP+JAP test, different channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 ap -S -s -p -t -h + 1 + - ['R SSC1 C +SAP:OK'] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 C +SCANDONE] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3.target1 set AP,set ssid hidden, + + 4.target 2上不能scan target_ap_mac' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 4.target 2上scan target_ap_mac' + sub module: WIFI Connect + summary: station SAP+JAP test, ssid hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -m + 1 + - ['R SSC1 C +SAP:OK'] + - - WIFI DISCONN + - ['R PC_COM C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set max allowed sta as 1 + + 2. use PC disconnect, + + 3.target 2 jap succeed + + 4.PC WIFI can not CONN' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 + + 2.use PC disconnect target1 + + 3.target 2 jap target1 + + 4.PC WIFI CONNECT target1' + sub module: WIFI Connect + summary: station SAP test, max allowed sta + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' + sub module: WIFI Connect + summary: JAP query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query JAP status + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -h + 0 -m 8 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致 + + ' + initial condition: APM1 + initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial + condition APSTA1 + level: Integration + module: WIFI MAC + steps: '1. target1 set AP + + 2.target 1上查询到跟设置AP时一致 + + ' + sub module: WIFI Connect + summary: AP config query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query AP config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -a 0 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:0'] + - - SSC SSC1 reboot + - [''] + - - DELAY 15 + - [''] + - - SSC SSC1 sta -Q + - ['R SSC1 C JAP:DISCONNECTED'] + - - SSC SSC1 sta -R -a 1 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:1'] + - - SSC SSC1 reboot + - ['R SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + initial condition: STAM2 + initial condition description (auto): sta mode, join AP, DHCP on, will autogen a + TC with initial condition STAAP2 + level: Integration + module: WIFI MAC + steps: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + sub module: WIFI Connect + summary: auto reconnect test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: power on auto reconnect test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0501 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 0 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC2 sta -R -r 2 + - ['R SSC2 C +RECONN:0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - [''] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 15 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + comment: '' + execution time: 0.0 + expected result: '1.设置reconn,开启(此功能不需要重启系统) + + 2.target1 set AP + + 3.target2 JAP target1 成功 + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.成功 + + 7.查询reconn状态,关闭 + + 8.修改mode 成功 + + 9.等待15s,target2 不会自动重连target1' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: "1.设置reconn,开启(此功能不需要重启系统)\n2.target1下设置ssid 和pwd 加密方式\n3.target2 JAP target1\ + \ \n4.target1 修改mode 为sta mode\n5.等待10s,target1 修改mode 为softAP mode\n6.设置reconn,关闭\n\ + 7.查询reconn状态,关闭\n8.target1 修改mode 为sta mode\n9.等待15s,target1 修改mode 为softAP mode" + sub module: WIFI Connect + summary: reconnect policy test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0502 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 5 + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.target2 jap target 1 + + 3.设置reconn,开启(此功能不需要重启系统) + + 4.target2 断开target1 连接 + + 5.等待10s,target2 自动重连target1 + + 6.target2 断开target1 连接' + sub module: WIFI Connect + summary: will not do reconnect after manually disconnected + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0601 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP + + 2.PC WIFI CONNECTED + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式 + + 2.PC WIFI CONNECTED target1 + + 3.target2 jap target 1 + + 4.查询到两个sta 连接到target1 上' + sub module: WIFI Connect + summary: list stations connected to soft ap test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: list SoftAP connected station + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0801 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] + - - SSC SSC1 ap -S -s -p -t 0 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. auth change event old mode 0 new mode 2 + + 4. auth change event old mode 2 new mode 3 + + 5. auth change event old mode 3 new mode 4 + + 6. auth change event old mode 4 new mode 0' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1. set target1 softap auth mode 0 + + 2. target2 connect to target1 + + 3. set target1 softap auth mode 2, wait sta connected + + 4. set target1 softap auth mode 3, wait sta connected + + 5. set target1 softap auth mode 4, wait sta connected + + 6. set target1 softap auth mode 0, wait sta connected' + sub module: WIFI Connect + summary: test auth change event + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi auth changed event test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0901 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: basic function + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] + comment: '' + execution time: 0.0 + expected result: '1. disconnect event reason REASON_ASSOC_LEAVE + + 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT + + 3. disconnect event reason REASON_NO_AP_FOUND' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: '1. sta connect to AP, and disconnect + + 2. connect to AP with wrong password + + 3. connect to AP not exist' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, + REASON_NO_AP_FOUND + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_CONN_0904 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p 1234567890 + - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] + - - WIFI DISCONN + - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_HANDSHAKE_TIMEOUT + + 3. succeed + + 4. succeed + + 5. disconnect event REASON_ASSOC_TOOMANY + + 6. succeed, target2 connect succeed + + 7. disconnect event REASON_ASSOC_EXPIRE' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1. config target1 softap max sta allowed 1 + + 2. target2 connect to target1 with wrong password + + 3. target2 disconnect + + 4. PC WIFI NIC connect to target1 + + 5. target2 connect to target1 with correct password + + 6. PC WIFI NIC disconnect + + 7. reconfig softap' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, + REASON_ASSOC_EXPIRE + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC2 sta -S + - [R SSC2 NP C +SCANDONE] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1下设置ssid 和pwd 、加密方式成功 + + 2.修改target 1的mode 为sta mode + + 3.target1的dhcp打开 + + 4.target1成功连接上AP + + 5.target2上不能查询到target_ssid + + 6.target1断开AP' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.修改target1的mode 为sta mode + + 3.target1的dhcp打开 + + 4.target1连接AP + + 5.target2查询target_ssid + + 6.target1断开AP' + sub module: WIFI Mode + summary: mode switch test (sta mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:ERROR'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP + + 2.target 2 上查询到target_ssid + + 3. target1 can''t join AP + + 4. target1 can''t QAP' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 + + 2.target 2 上查询target_ssid + + 3.target1 join AP + + 4.target1 DISCONN AP' + sub module: WIFI Mode + summary: mode switch test (AP mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_MODE_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC2 sta -S + - [R SSC2 P , R SSC2 C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 change to AP mode + + 2.target1 set AP + + 3.target 1 的dhcp 打开 + + 4.target 1 成功连接上AP + + 5.target 2 上查询到target_ssid' + initial condition: T2O_1 + initial condition description (auto): same as T2_1 but will NOT autogen a TC with + initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1 change to AP mode + + 2.target1下设置ssid 和pwd 加密方式 + + 3.target1 的dhcp 打开 + + 4.target1 连接AP + + 5.target2 上查询target_ssid' + sub module: WIFI Mode + summary: mode switch test (STA+AP mode) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi mode fucntion + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0401 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0402 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 20M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0403 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0404 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0405 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, STA connect to + AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0406 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, SoftAP not get + disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, both bandwidth 40M, Softap get connected + than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0407 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, STA not disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. STA connect to ext AP + + 3. AP get connected' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, STA connect + to AP then Softap get connected + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0408 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, SoftAP not + get disconnected + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + + 2. AP get connected + + 3. STA connect to ext AP' + sub module: Phy Mode + summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, Softap get + connected than STA connect to AP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP initial channel test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0501 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0502 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_20 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1 20M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0503 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA set to 40M, SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0504 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 20M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0505 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2; SoftAP in 20M, STA in 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA set to 40M ,SoftAP set to 20M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_20' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 20M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_PHY_0506 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 phy -S -o 2 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC3 sta -C -s -p + - ['R SSC3 C +JAP:CONNECTED'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in + channel2 40M + initial condition: T3_PHY1 + initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, + target 3 set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + level: Integration + module: WIFI MAC + steps: '1. target 1 STA and SoftAP set to 40M + + 2. target 2 STA connect to ap_channel1_40 + + 3. target 1/3 STA connect to target 2/1 SoftAP + + 4. target 2 STA connect to ap_channel2_40' + sub module: Phy Mode + summary: SoftAP STA in channel1, SoftAP 40M, STA 40M, STA changed to channel2 40M + test environment: SSC_T3_PhyMode + test environment description (auto): '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: STA+SoftAP dynamic channel switch test + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -s .,juhg123 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s + - ['R SSC2 C +SCAN:', R SSC2 P , 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target 2上不能scan .,juhg123 + + 2.target1 set AP + + 3.target2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target 2 scan .,juhg123 + + 2.target1下设置ssid 和pwd 加密方式 + + 3.target2 scan ' + sub module: WIFI Scan + summary: scan with scan config ssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC2 sta -S -b + - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] + comment: '' + execution time: 0.0 + expected result: '1.target2 上不能查询到此mac + + 2.target2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 + + 2.target2上查询' + sub module: WIFI Scan + summary: scan with scan config bssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -n 5 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -n 6 + - ['R SSC2 C +SCAN:', R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set channel 6 + + 3.target2 上scan不到 channel 5 + + 4.target2 上查询channel 6的' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1 断开连接AP + + 2.target1下设置ssid 和pwd 加密方式,set channel 6 + + 3.target2 上scan channel 5 + + 4.target2 上查询channel 6的' + sub module: WIFI Scan + summary: scan with scan config channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + - - SSC SSC1 ap -S -s -p 123456789 -h 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1 set AP,set ssid hidden, + + 5.target 2上不能查询到 + + 6.target 2上查询到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan + + 3.target 2上scan + + 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 5.target 2上查询 + + 6.target 2上查询' + sub module: WIFI Scan + summary: scan with scan config show hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 10 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + initial condition: T2_1 + initial condition description (auto): target 1 as SoftAP, target 2 as STA, will + autogen a TC with initial condition T2_2 + level: Integration + module: WIFI MAC + steps: '1.target1 QAP + + 2. target1 set AP,set ssid broad cast,set channel 11 + + 3.target2 上查询到 + + 4.target2 上查询不到 + + 5.target2 上查询不到 + + 6.target2 上查询不到' + sub module: WIFI Scan + summary: scan with several configs + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: scan with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0201 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 phy -S -o 1 -m b + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m g + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 20 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + - - SSC SSC1 phy -S -o 1 -m n -b 40 + - ['R SSC1 C +PHY:OK'] + - - SSC SSC1 sta -S + - [R SSC1 P P P P ] + comment: '' + execution time: 0.0 + expected result: '3. find all 3 ext APs + + 5. find all 3 ext APs + + 7. find all 3 ext APs + + 9. find all 3 ext APs' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: '1. 3 ext APs in 11b, 11g, 11n mode + + 2. STA in 11b mode + + 3. do all channel scan + + 4. STA in 11g mode + + 5. do all channel scan + + 6. STA in 11n ht20 mode + + 7. do all channel scan + + 8. STA in 11n ht40 mode + + 9. do all channel scan' + sub module: WIFI Scan + summary: STA in differnt PHY mode to scan AP in different PHY mode + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: basic function + test point 2: Scan in different mode and channel + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0301 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANFAIL, 'P SSC1 P +SCAN:', R SSC1 C +SCANDONE] + comment: '' + execution time: 0.0 + expected result: '1. second scan failed + + 2. first scan succeed' + initial condition: STAM1 + initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a + TC with initial condition STAAP1 + level: Integration + module: WIFI MAC + steps: '1. do all channel scan + + 2. do scan before scan finished' + sub module: WIFI Scan + summary: reject scan request before scan finished + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0302 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -n 1000000 -j 5 + - [''] + - - SSC SSC2 phy -S -o 1 -m b + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m g + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 20 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + - - SSC SSC2 phy -S -o 1 -m n -b 40 + - ['R SSC2 C +PHY:OK'] + - - SSC SSC2 sta -S -n + - [R SSC2 P ] + comment: '' + execution time: 0.0 + expected result: 3. target 2 able to scan AP + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. target 1 connect to AP + + 2. target 1 start sending UDP packets + + 3. target 2 scan in AP channel in 11b.g,n,ht40 mode' + sub module: WIFI Scan + summary: scan in congest channel + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0303 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC1 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. target 1 STA join AP + + 2. target 1 STA scan before JAP succeed + + 3. target 1 quite AP + + 4. target 1 scan + + 5. target 1 JAP before scan succeed' + sub module: WIFI Scan + summary: scan during JAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: WIFI_SCAN_0304 + SDK: ESP32_IDF + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:OK'] + - - SSC SSC1 sta -S + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC1 sta -S + - [''] + - - SSC SSC2 sta -C -s -p + - [P SSC1 C +SCANDONE, 'P SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '2. scan succeed, JAP succeed + + 5. JAP succeed, scan succeed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. target 2 STA join target 1 SoftAP + + 2. target 1 STA scan before target 2 JAP succeed + + 3. target 2 STA QAP + + 4. target 1 STA scan + + 5. target 2 STA JAP before target 1 STA scan succeed' + sub module: WIFI Scan + summary: scan during ext STA join SoftAP + test environment: SSC_T2_PhyMode + test environment description (auto): '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.' + test point 1: interaction + test point 2: Scan interact with other WiFi operation + version: v1 (2015-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 0.0.0.0 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -Q + - ['R SSC1 C +STAIP:0.0.0.0'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -Q + - ['R SSC1 RE "\+STAIP:%%s"%%()'] + comment: '' + execution time: 0.0 + expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ + 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: TCPIP + steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ + \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" + sub module: DHCP + summary: dhcp client function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 20 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target\ + \ 1,FAIL \n4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: "1.target1 set AP OK \n2.target1 关闭DHCP OK\n3.target2 jap target 1,FAIL \n\ + 4.target1 打开DHCP OK\n5.target2 jap target 1,ok" + sub module: DHCP + summary: dhcp server function test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED NC +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 NC +DHCP:STA,STARTED C +DHCP:AP,STARTED'] + - - SSC SSC1 dhcp -E -o 3 + - ['R SSC1 C +DHCP:AP,OK C +DHCP:STA,OK'] + - - SSC SSC1 dhcp -Q -o 3 + - ['R SSC1 C +DHCP:STA,STOPPED C +DHCP:AP,STOPPED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.STA&AP STARTED + + 4.STA STARTED + + 5.AP STARTED + + 6.OK + + 7.STA&AP STOPPED' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: TCPIP + steps: '1.target1 设置mode 为sta+softAP mode + + 2.target1 打开DHCP 3 + + 3.target1 查询DHCP 状态 + + 4.target1 查询sta DHCP 状态 + + 5.target1 查询softAP DHCP 状态 + + 6.target1 关闭 DHCP 3 + + 7.target1 查询 DHCP 状态' + sub module: DHCP + summary: dhcp status query + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP client function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + comment: '' + execution time: 0.0 + expected result: '1.target1 关闭DHCP 2 OK + + 2.target1 设置ip 成功 + + 3.设置dhcp 地址池 OK + + 4.ERROR + + 5.ERROR + + 6.ERROR + + 7.target1 打开DHCP ok' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + level: Integration + module: TCPIP + steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ + 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" + sub module: DHCP + summary: server dhcp lease test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 3 4 "['01','02','03']" "[2,3,4]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3,4: get IP from dhcp pool with correct sequence' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1 + + 3. target change mac, connect to Target1 + + 4. Loop step3' + sub module: DHCP + summary: dhcp server ip pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 2 4 "['01','02']" "[2,3]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - DELAY 20 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:0.0.0.0'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4.1 succeed + + 4.2 failed' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP Server on Target1(.4.2 - .4.3) + + 3. target change mac, connect to Target1 + + 4. Loop step3 twice' + sub module: DHCP + summary: dhcp server ip pool empty + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - DELAY 90 + - [''] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - DELAY 60 + - [''] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 5. succeed + + 6. succeed + + 8. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. config DHCP timeout as 1 minute + + 3. target2 connect to target1 + + 4. wait 90 seconds + + 5. check if target2 IP is same + + 6. target2 disconnect + + 7. wait 60s + + 8. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server timeout test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0205 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 + - ['P SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. target2 wifi disconnected' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 + + 3. disable DHCP server, do config and enable' + sub module: DHCP + summary: disconnect STA if config dhcp server + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0206 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" + - [''] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.{%s}'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 4. get IP 192.168.4.2 - 192.168.4.4 + + 5. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. target2 change mac, connect to softap, disconnect + + 4. Loop step3 twice + + 5. change to first mac, connect to softap' + sub module: DHCP + summary: dhcp server assign same IP to same MAC when it's not released + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0207 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI DISCONN2 + - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 ip -Q -o 1 + - ['R SSC2 C +STAIP:192.168.4.2'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. get IP 192.168.4.2 + + 4. succeed + + 5. succeed + + 6. get IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. disable DHCP server, do config and enable + + 3. PC WIFI NIC connect to target1 softap + + 4. target2 connect to target1 softap and disnnect + + 5. PC release IP and disconnected + + 6. target2 change mac and connect to target1' + sub module: DHCP + summary: dhcp server prefer assign released IP to new client + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0208 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. get IP 192.168.4.2 + + 5. can only find target2 with IP 192.168.4.2' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. PC NIC connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. target2 connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig and new client able to get first IP in pool + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0209 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - DELAY 20 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client and new client able to get IP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0210 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - WIFI CONN2 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to get IP (discover with requested + IP) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0211 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 4 + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN 192.168.4.2 + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - DELAY 10 + - [''] + - - SSC SSC1 ap -L + - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. succeed + + 5. find target2 and PC' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. config softap to a random ssid + + 2. target2 connect to target1 softap + + 3. disable DHCP server, do config and enable + + 4. PC NIC connect to target1 softap try to renew IP 192.168.4.2 + + 5. softap list connected station' + sub module: DHCP + summary: dhcp server reconfig, old client able to renew IP (direct send request) + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DHCP server function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0301 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 ip -S -i 0.0.0.0 -o 1 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.JAP CONNETED + + 4.OK + + 5.等待10s,JAP fail' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: TCPIP + steps: '1.target1 关闭DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 jap AP + + 5.target1 设置sta ip 0.0.0.0 + + 6.target1 jap AP' + sub module: DHCP + summary: sta dhcp static ip interaction + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DHCP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.123.123 -o 2 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.10 + - ['R SSC1 C +DHCP:LEASE,ERROR'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -i 192.168.4.1 -o 2 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.10 + - ['R SSC1 C +DHCP:LEASE,OK'] + - - SSC SSC2 sta -C -s -p + - [''] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target 1 OK + + 2.target1 ERROR + + 3.target1 ERROR + + 4.target2 jap target1 OK + + 5.target1 OK + + 6.target1 OK + + 7.target1 OK + + 8.target2 jap target1 OK' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n3.target1 设置地址池\n\ + 4.target1下设置ssid 和pwd 加密方式\n5.target2 连接target1 \n6.target1 关闭DHCP 2\n7.target1\ + \ 设置softAP ip \n8.target1 设置正确的地址池\n9.target2 连接target1" + sub module: DHCP + summary: ap dhcp static ip interaction + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: interaction + test point 2: static IP and DHCP interaction test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 3/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 C +HOSTIP:OK,115.29.202.58'] + comment: '' + execution time: 0.0 + expected result: 1.OK + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: 1. get host name "espressif.cn" + sub module: DNS + summary: get host by name test + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 3/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p 9001 + - ['R SSC1 RE \+CONNECT:\d+,OK'] + - - SSC SSC1 soc -S -s -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. connect, send, recv1. get host name "espressif.cn" + + 2. connect, send, recv' + sub module: DNS + summary: TCP connect to iot.espressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_DNS_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 3/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -H -d iot.espressif.cn + - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] + - - SSC SSC1 soc -B -t UDP + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p 9003 -l 10 + - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. get host name "espressif.cn" + + 2. sendto, recvfrom1. get host name "espressif.cn" + + 2. sendto, recvfrom' + sub module: DNS + summary: UDP send to iot.expressif.com + test environment: SSC_T1_2 + test environment description (auto): 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: DNS function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_ICMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ping -i + - ['R SSC1 C +PING:OK'] + - - SSC SSC1 ping -i -c 2 + - ['R SSC1 C +PING:OK'] + comment: '' + execution time: 0.0 + expected result: '1.ok + + 2.ok' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.ping -i + + 2.ping -i -c 2' + sub module: ICMP + summary: ping function test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: ping function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: station IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: station IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -J -h -m 223.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. join group with correct host addr and wrong multicast addr + + 3. join group with wrong host addr and correct multicast addr + + 4. join group with wrong host addr and wrong multicast addr' + sub module: IGMP + summary: softAP IGMP join group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 igmp -L -h -m 224.1.1.2 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 224.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h 192.168.237.77 -m 240.1.1.1 + - ['R SSC1 C +IGMP:ERROR'] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. success + + 2. failed + + 3. failed + + 4. failed + + 5. succeed' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1. join group with correct host addr and multicast addr + + 2. leave group with correct host addr and wrong multicast addr + + 3. leave group with wrong host addr and correct multicast addr + + 4. leave group with wrong host addr and wrong multicast addr + + 5. leave group with correct host addr and correct multicast addr' + sub module: IGMP + summary: softAP IGMP leave group address check + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP API parameter check + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: station IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1. target2 set to sta mode and join AP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: station send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC1 SENDTO 1 224.1.1.1 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. able to recv packet' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1. join group + + 2. create UDP socket using multicast addr + + 3. PC send UDP packet to multicast addr' + sub module: IGMP + summary: softAP IGMP recv packets + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IGMP_0204 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 igmp -J -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + - - SSC SSC1 soc -B -t UDP -i 224.1.1.1 -p + - ['R SSC1 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -B -t UDP -p + - ['R SSC2 A :\+BIND:(\d+),OK'] + - - SSC SSC2 soc -S -s -i 224.1.1.1 -p -l 10 + - [R SSC1 SL +1] + - - SSC SSC1 igmp -L -h -m 224.1.1.1 + - ['R SSC1 C +IGMP:OK'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. succeed + + 4. target1 recv multicast packet' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: TCPIP + steps: '1. target2 join SoftAP + + 2. target1 join group and create UDP socket using multicast addr + + 3. target2 create UDP socket + + 4. target2 send to multicast addr' + sub module: IGMP + summary: softAP send multicast packets + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: IGMP send/recv test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.123.123'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.STAIP:192.168.123.123' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: TCPIP + steps: '1.target1 打开DHCP 1 + + 2.target1 设置sta ip 192.168.123.123 + + 4.target1 关闭DHCP 1 + + 5.target1 设置sta ip 192.168.123.123 + + 6.target1 查询 当前sta ip' + sub module: IP + summary: sta set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_IP_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 dhcp -S -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:ERROR'] + - - SSC SSC1 dhcp -E -o 2 + - ['R SSC1 C +DHCP:AP,OK'] + - - SSC SSC1 ip -S -o 2 -i 192.168.123.123 + - ['R SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 2 + - ['R SSC1 C +APIP:192.168.123.123'] + - - SSC SSC1 ip -S -o 2 -i + - ['R SSC1 C +IP:OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ERROR + + 3.OK + + 4.OK + + 5.APIP:192.168.123.123 + + 6.OK' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + level: Integration + module: TCPIP + steps: "1.target1 打开DHCP 2\n2.target1 设置softAP ip 192.168.123.123\n4.target1 关闭DHCP\ + \ 2\n5.target1 设置softAP ip 192.168.123.123\n6.target1 查询 当前sta ip \n7.target1\ + \ 设置softAP ip 为target_ap_ip" + sub module: IP + summary: ap set and query static ip test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: set and query static IP + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: STA mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0102 SDK: '8266_NonOS 8266_RTOS @@ -9261,9 +9938,10 @@ test cases: 3.PC TCP client accept 4.error' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP steps: '1.target1上创建TCP socket,bind到本地端口 @@ -9284,7 +9962,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0103 + ID: ^TCPIP_TCP_0103 SDK: '8266_NonOS 8266_RTOS @@ -9329,9 +10007,10 @@ test cases: 7.target收到 146000 byte 8.OK,PC 回SOC_RECV=SOC2,RECV_LEN=字节数' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP steps: '1. PC上建立TCP 监听 test_tcp_port1 @@ -9347,7 +10026,7 @@ test cases: 7. PC send 100 * 1460 data to 8266, - 8.8266 send 100 * 1460 to PC. ' + 8.8266 send 100 * 1460 to PC.' sub module: TCP summary: STA mode, send/recv basic test test environment: SSC_T1_1 @@ -9360,7 +10039,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0101 + ID: ^TCPIP_TCP_0104 SDK: '8266_NonOS 8266_RTOS @@ -9373,47 +10052,72 @@ test cases: cmd set: - '' - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP - ['R SSC1 A :BIND:(\d+),OK'] - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i 123.456.678.789 -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] comment: '' execution time: 0.0 expected result: '1.OK 2.OK - 3.OK; PC TCP server accept 成功 + 3.OK,pc tcp server accept OK 4.OK - 5.ERROR + 5.OK - 6.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + 6.OK,pc tcp server accept OK + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept OK + + 10.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 + steps: '1. PC上建立TCP 监听 test_tcp_port1 - 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + 2.target1上创建TCP socket - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + 4.target1 shutdown socket1 B - 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + 5.target1上创建TCP socket - 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' sub module: TCP - summary: STA mode, connect test. use different ip, port + summary: STA mode, shutdown basic test test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -9424,7 +10128,198 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_TCP_0116 + ID: ^TCPIP_TCP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK + + 6.OK + + 7.target1关闭socket1 + + 8.target1关闭socket2 + + 9.OK + + 10.OK,pc tcp server accept成功 + + 11.target1关闭socket1 + + 12.OK + + 13.OK,pc tcp server accept成功 + + 14.OK + + 15.target1关闭socket1' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ + 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ + 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ + 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" + sub module: TCP + summary: STA mode, close for different types of TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4 OK + + 5.OK,pc tcp server accept成功 + + 6.OK + + 7.OK,pc tcp server accept成功 + + 8 OK + + 9.OK,pc tcp server accept成功 + + 10.OK + + 11.OK,pc tcp server accept成功' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 6.target1上创建TCP socket3 + + 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 8.target1上创建TCP socket4 + + 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1上创建TCP socket5 + + 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' + sub module: TCP + summary: STA mode, create max TCP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0107 SDK: '8266_NonOS 8266_RTOS @@ -9440,15 +10335,15 @@ test cases: - ['R SSC1 A :BIND:(\d+),OK'] - - SSC SSC1 soc -L -s - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT 0 + - - SOC SOC2 CONNECT - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC3 CONNECT 0 + - - SOC SOC3 CONNECT - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC4 CONNECT 0 + - - SOC SOC4 CONNECT - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC5 CONNECT 0 + - - SOC SOC5 CONNECT - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC6 CONNECT 0 + - - SOC SOC6 CONNECT - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] comment: '' execution time: 0.0 @@ -9465,16 +10360,301 @@ test cases: 6.OK,pc tcp server accept成功 7.OK,pc tcp server accept成功' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6" sub module: TCP - summary: AP mode, accept max TCP client by server test + summary: STA mode, accept max TCP client by server test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] + - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i 123.456.678.789 -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.ERROR + + 6.ERROR' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 + + 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 + + 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' + sub module: TCP + summary: AP mode, connect test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0111 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC1 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] + - - SOC SOC1 CONNECT 0 + - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.PC TCP client accept + + 4.error' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1.target1上创建TCP socket,bind到本地端口 + + 2.target1上使用步骤1创建的socket,创建TCP 监听 + + 3.PC TCP 连接到target1 , + + 4.PC tcp 连接到不存在的port ,' + sub module: TCP + summary: AP mode, server listen test. use different kinds of port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0112 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SOC SOC2 SEND 5 + - [R SSC1 SL +5] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] + - - SOC SOC2 SEND 146000 + - [R SSC1 SL +146000] + - - SSC SSC1 soc -S -s -l 1460 -n 100 + - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.target收到5byte数据 + + 6.PC收到5byte数据 + + 7.target收到146000 byte数据 + + 8.OK,PC 收到146000 byte数据' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1 创建好TCP 连接,有ACCEPT + + 5.PC send 5 bytes to 8266 + + 6.8266 send 5 bytes to PC + + 7. PC send 100 * 1460 data to 8266, + + 8.8266 send 100 * 1460 to PC.' + sub module: TCP + summary: AP mode, send/recv basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h W + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h R + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK,pc tcp server accept成功 + + 4.OK + + 5.OK + + 6.OK,pc tcp server accept成功 + + 7.OK + + 8.OK + + 9.OK,pc tcp server accept成功 + + 10.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1. PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket + + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 4.target1 shutdown socket1 B + + 5.target1上创建TCP socket + + 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 7.target1 shutdown socket2 W + + 8.target1上创建TCP socket + + 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + + 10.target1 shutdown socket3 R' + sub module: TCP + summary: AP mode, shutdown basic test test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -9561,6 +10741,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ @@ -9640,6 +10821,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: '1.PC上建立TCP 监听 test_tcp_port1 @@ -9674,235 +10856,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_TCP_0112 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SOC SOC2 SEND 5 - - [R SSC1 SL +5] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] - - - SOC SOC2 SEND 146000 - - [R SSC1 SL +146000] - - - SSC SSC1 soc -S -s -l 1460 -n 100 - - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.target收到5byte数据 - - 6.PC收到5byte数据 - - 7.target收到146000 byte数据 - - 8.OK,PC 收到146000 byte数据' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1 创建好TCP 连接,有ACCEPT - - 5.PC send 5 bytes to 8266 - - 6.8266 send 5 bytes to PC - - 7. PC send 100 * 1460 data to 8266, - - 8.8266 send 100 * 1460 to PC.' - sub module: TCP - summary: AP mode, send/recv basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0113 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h W - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h R - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.OK - - 6.OK,pc tcp server accept成功 - - 7.OK - - 8.OK - - 9.OK,pc tcp server accept成功 - - 10.OK' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 4.target1 shutdown socket1 B - - 5.target1上创建TCP socket - - 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 7.target1 shutdown socket2 W - - 8.target1上创建TCP socket - - 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 10.target1 shutdown socket3 R' - sub module: TCP - summary: AP mode, shutdown basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0110 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK', P SOC1 C +ACCEPT] - - - SSC SSC1 soc -B -t TCP -i 0.0.0.0 -p 0 - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i 123.456.678.789 -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.ERROR - - 6.ERROR' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.target1上创建TCP socket,bind到本地ip 0.0.0.0,本地端口 0 - - 5.target1上使用步骤4创建的socket,去连接不存在的ip,test_tcp_port1 - - 6.target1上使用步骤2创建的socket,去连接 PC的ip,远端端口不存在。' - sub module: TCP - summary: AP mode, connect test. use different ip, port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0111 + ID: ^TCPIP_TCP_0116 SDK: '8266_NonOS 8266_RTOS @@ -9918,32 +10872,42 @@ test cases: - ['R SSC1 A :BIND:(\d+),OK'] - - SSC SSC1 soc -L -s - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC1 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] - - - SOC SOC1 CONNECT 0 - - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC3 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC4 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC5 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SOC SOC6 CONNECT 0 + - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] comment: '' execution time: 0.0 - expected result: '1.OK + expected result: '1.+BIND:0,OK,0.0.0.0 2.OK - 3.PC TCP client accept + 3.OK,pc tcp server accept成功 - 4.error' + 4.OK,pc tcp server accept成功 + + 5.OK,pc tcp server accept成功 + + 6.OK,pc tcp server accept成功 + + 7.OK,pc tcp server accept成功' initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP - steps: '1.target1上创建TCP socket,bind到本地端口 - - 2.target1上使用步骤1创建的socket,创建TCP 监听 - - 3.PC TCP 连接到target1 , - - 4.PC tcp 连接到不存在的port ,' + steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ + \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6" sub module: TCP - summary: AP mode, server listen test. use different kinds of port + summary: AP mode, accept max TCP client by server test test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -9954,1078 +10918,97 @@ test cases: test point 2: use TCP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_SCAN_0302 - SDK: ESP32_IDF + ID: ^TCPIP_TCP_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 soc -B -t UDP -p + - - SOC SOC1 LISTEN + - [SOCR SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -n 1000000 -j 5 - - [''] - - - SSC SSC2 phy -S -o 1 -m b - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m g - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -S -n - - [R SSC2 P ] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s -h B + - ['P SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 soc -C -s -i -p + - ['P SSC1 RE CONNECT:\d+,ERROR'] comment: '' execution time: 0.0 - expected result: 3. target 2 able to scan AP - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. target 1 connect to AP - - 2. target 1 start sending UDP packets - - 3. target 2 scan in AP channel in 11b.g,n,ht40 mode' - sub module: WIFI Scan - summary: scan in congest channel - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: interaction - test point 2: Scan interact with other WiFi operation - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0304 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK + expected result: '1.ok 2.OK - 3.OK - - 4.OK - - 5.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0305 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - NIC DISABLED - - [R PC_COM C OK] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after PC NIC disabled - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0306 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -S -s -i -p -l 1 - - ['P SSC1 RE SEND:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 + 3.ERROR 4.OK 5.OK - 6.OK - - 7.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" - sub module: UDP - summary: do UDP send after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0307 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 - - ['P SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.111.210'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK; PC TCP server accept 成功 - - 4.OK - - 5.OK - - 6.OK - - 7.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" - sub module: UDP - summary: close UDP socket after IP changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0301 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -i -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 - - 4.断开与AP 连接 - - 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' - sub module: UDP - summary: do UDP send after WIFI disconnected - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0302 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 sta -D - - ['P SSC1 C +QAP:OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.OK - - ' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上SOC1 UDP传输,bing - - 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - - 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 - - 4.断开与AP 连接 - - 5.关闭建立的socket1连接' - sub module: UDP - summary: "close UDP socket after WIFI \ndisconnected" - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_UDP_0303 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 1/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 BIND - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] - - - SSC SSC1 op -S -o 2 - - ['P SSC1 C +MODE:OK'] - - - SSC SSC1 soc -S -s -i -p -l 5 - - ['P SSC1 RE SEND:(\d+),OK'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK - - 4.OK - - 5.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ - \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ - 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" - sub module: UDP - summary: do UDP send after mode changed - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: UDP handling abnormal event - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0601 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - WIFI CONN - - - ['R PC_COM C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -L - - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP - - 2.PC WIFI CONNECTED - - 3.target2 jap target 1 - - 4.查询到两个sta 连接到target1 上' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1. target1下设置ssid 和pwd 加密方式 - - 2.PC WIFI CONNECTED target1 - - 3.target2 jap target 1 - - 4.查询到两个sta 连接到target1 上' - sub module: WIFI Connect - summary: list stations connected to soft ap test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: list SoftAP connected station - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0209 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - DELAY 20 - - [''] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. succeed - - 5. find target2 and PC' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client and new client able to get IP - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0208 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 P ] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4. get IP 192.168.4.2 - - 5. can only find target2 with IP 192.168.4.2' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. PC NIC connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. target2 connect to target1 softap - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig and new client able to get first IP in pool - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0207 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - WIFI DISCONN2 - - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. get IP 192.168.4.2 - - 4. succeed - - 5. succeed - - 6. get IP 192.168.4.2' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. disable DHCP server, do config and enable - - 3. PC WIFI NIC connect to target1 softap - - 4. target2 connect to target1 softap and disnnect - - 5. PC release IP and disconnected - - 6. target2 change mac and connect to target1' - sub module: DHCP - summary: dhcp server prefer assign released IP to new client - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0206 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 4. get IP 192.168.4.2 - 192.168.4.4 - - 5. get IP 192.168.4.2' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. disable DHCP server, do config and enable - - 3. target2 change mac, connect to softap, disconnect - - 4. Loop step3 twice - - 5. change to first mac, connect to softap' - sub module: DHCP - summary: dhcp server assign same IP to same MAC when it's not released - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0205 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 - - ['P SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. target2 wifi disconnected' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 - - 3. disable DHCP server, do config and enable' - sub module: DHCP - summary: disconnect STA if config dhcp server - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - - - DELAY 90 - - [''] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - - - SSC SSC2 sta -D - - ['R SSC2 C +JAP:DISCONNECTED'] - - - DELAY 60 - - [''] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. get IP 192.168.4.2 - - 5. succeed - - 6. succeed - - 8. get IP 192.168.4.2' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP timeout as 1 minute - - 3. target2 connect to target1 - - 4. wait 90 seconds - - 5. check if target2 IP is same - - 6. target2 disconnect - - 7. wait 60s - - 8. target2 change mac and connect to target1' - sub module: DHCP - summary: dhcp server timeout test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 2 4 "['01','02']" "[2,3]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - DELAY 20 - - [''] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:0.0.0.0'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4.1 succeed - - 4.2 failed' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP Server on Target1(.4.2 - .4.3) - - 3. target change mac, connect to Target1 - - 4. Loop step3 twice' - sub module: DHCP - summary: dhcp server ip pool empty - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 3 4 "['01','02','03']" "[2,3,4]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3,4: get IP from dhcp pool with correct sequence' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP Server on Target1 - - 3. target change mac, connect to Target1 - - 4. Loop step3' - sub module: DHCP - summary: dhcp server ip pool - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -o 2 -i - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - comment: '' - execution time: 0.0 - expected result: '1.target1 关闭DHCP 2 OK - - 2.target1 设置ip 成功 - - 3.设置dhcp 地址池 OK - - 4.ERROR - - 5.ERROR - 6.ERROR - 7.target1 打开DHCP ok' - initial condition: APSTA1 - initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + 7.OK + + 8.OK + + 9.OK + + 10.OK + + 11.OK + + 12.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP - steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ - 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" - sub module: DHCP - summary: server dhcp lease test + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去连接 PC的ip, + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,创建TCP 监听 + + 6.target1上使用步骤4创建的socket,去连接 PC的ip, + + 7.target1上创建TCP socket + + 8.target1上使用步骤7创建的socket,去连接 PC的ip, + + 9.target1上关闭步骤7创建的socket + + 10.target1上使用步骤7创建的socket,去连接 PC的ip, + + 11.target1上关闭所有创建的socket + + 12.target1上使用步骤2创建的socket,去连接 PC的ip,' + sub module: TCP + summary: STA mode, connect test. use socket in state that can't connect test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -11033,10 +11016,176 @@ test cases: 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: DHCP server function test + test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0204 + ID: ^TCPIP_TCP_0202 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,ERROR'] + - - SSC SSC1 soc -L -s 1000 + - ['R SSC1 RE LISTEN:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.OK + + 6.ERROR + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, + + 3.target1上使用步骤2创建的socket,去建立TCP 监听 + + 4.target1上创建TCP socket + + 5.target1上使用步骤4创建的socket,去连接 PC的ip, + + 6.target1上使用步骤4创建的socket,创建TCP 监听 + + 7.target1上shutdown 步骤4的socket + + 8.target1上使用步骤4创建的socket,创建TCP 监听 + + 9.target1上使用不存在socket,创建TCP 监听' + sub module: TCP + summary: STA mode, server listen test. use socket in state that can't listen + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0203 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -S -s + - ['R SSC1 RE SEND:\d+,ERROR'] + - - SSC SSC1 soc -S -s 1000 + - ['R SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK + + 5.ERROR + + 6.OK + + 7.OK + + 8.ERROR + + 9.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建UDP传输socket1, + + 3.target1上使用步骤2创建的socket1,去发送数据 + + 4.target1上创建TCP socket2 + + 5.target1上使用步骤4创建的socket2,去发送数据 + + 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 + + 7.target1上shutdown 步骤4的socket2 + + 8.target1往socket2发送错误命令发送数据 + + 9.target1上不指定socket往上发送数据' + sub module: TCP + summary: send test. use socket in state that can't send + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use TCP SAP (socket/espconn API) in different state + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0204 SDK: '8266_NonOS 8266_RTOS @@ -11076,12 +11225,11 @@ test cases: 6.OK - 7.target收到146000 byte - - ' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + 7.target收到146000 byte' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP steps: '1. PC上建立TCP 监听 test_tcp_port1 @@ -11108,107 +11256,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0207 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [SOCR SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['P SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - - - SSC SSC1 soc -T - - [R SSC1 C +CLOSEALL] - - - SSC SSC1 soc -C -s -i -p - - ['P SSC1 RE CONNECT:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.ok - - 2 OK - - 3.ERROR - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.OK - - 9.OK - - 10.OK - - 11.OK - - 12.ERROR' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去连接 PC的ip, - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,创建TCP 监听 - - 6.target1上使用步骤4创建的socket,去连接 PC的ip, - - 7.target1上创建TCP socket - - 8.target1上使用步骤7创建的socket,去连接 PC的ip, - - 9.target1上关闭步骤7创建的socket - - 10.target1上使用步骤7创建的socket,去连接 PC的ip, - - 11.target1上关闭所有创建的socket - - 12.target1上使用步骤2创建的socket,去连接 PC的ip,' - sub module: TCP - summary: AP mode, connect test. use socket in state that can't connect - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0206 + ID: ^TCPIP_TCP_0206 SDK: '8266_NonOS 8266_RTOS @@ -11271,9 +11319,10 @@ test cases: +SOCINFO:,,, +SOCINF0ALL' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ @@ -11292,7 +11341,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0201 + ID: ^TCPIP_TCP_0207 SDK: '8266_NonOS 8266_RTOS @@ -11304,35 +11353,35 @@ test cases: category: Function cmd set: - '' - - - SOC SOC1 LISTEN + - - SOC SOC1 LISTEN - [SOCR SOC_COM L OK] - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p + - - SSC SSC1 soc -C -s -i -p - ['P SSC1 RE CONNECT:\d+,ERROR'] - - SSC SSC1 soc -B -t TCP - ['R SSC1 A :BIND:(\d+),OK'] - - SSC SSC1 soc -L -s - ['R SSC1 RE LISTEN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p + - - SSC SSC1 soc -C -s -i -p - ['P SSC1 RE CONNECT:\d+,ERROR'] - - SSC SSC1 soc -B -t TCP - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p + - - SSC SSC1 soc -C -s -i -p - ['P SSC1 RE CONNECT:\d+,OK'] - - SSC SSC1 soc -D -s -h B - ['P SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -C -s -i -p + - - SSC SSC1 soc -C -s -i -p - ['P SSC1 RE CONNECT:\d+,ERROR'] - - SSC SSC1 soc -T - [R SSC1 C +CLOSEALL] - - - SSC SSC1 soc -C -s -i -p + - - SSC SSC1 soc -C -s -i -p - ['P SSC1 RE CONNECT:\d+,ERROR'] comment: '' execution time: 0.0 expected result: '1.ok - 2.OK + 2 OK 3.ERROR @@ -11353,9 +11402,10 @@ test cases: 11.OK 12.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration module: TCPIP steps: '1.PC上建立TCP 监听 test_tcp_port1 @@ -11381,7 +11431,7 @@ test cases: 12.target1上使用步骤2创建的socket,去连接 PC的ip,' sub module: TCP - summary: STA mode, connect test. use socket in state that can't connect + summary: AP mode, connect test. use socket in state that can't connect test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -11391,875 +11441,6 @@ test cases: test point 1: basic function test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_DHCP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -i 0.0.0.0 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 20 - - [P PC_COM C +DELAYDONE, 'P SSC1 NC +JAP:CONNECTED'] - - - SSC SSC1 dhcp -S -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -Q - - ['R SSC1 C +STAIP:0.0.0.0'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 ip -Q - - ['R SSC1 RE "\+STAIP:%%s"%%()'] - comment: '' - execution time: 0.0 - expected result: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n\ - 4.target1 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) - module: TCPIP - steps: "1.target1 关闭DHCP OK\n2.target1 设置ip add OK\n3.target1 连接AP fail\n4.target1\ - \ 打开DHCP OK\n5.查询到sta ip \n6.target1 连接AP ok\n7.查询到sta ip 为target_ip" - sub module: DHCP - summary: dhcp client function test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP client function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -S -s - - ['R SSC1 RE SEND:\d+,ERROR'] - - - SSC SSC1 soc -S -s 1000 - - ['R SSC1 RE SEND:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK - - 5.ERROR - - 6.OK - - 7.OK - - 8.ERROR - - 9.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket1, - - 3.target1上使用步骤2创建的socket1,去发送数据 - - 4.target1上创建TCP socket2 - - 5.target1上使用步骤4创建的socket2,去发送数据 - - 6.target1上使用步骤4创建的socket2,创建TCP连接,连接成功 - - 7.target1上shutdown 步骤4的socket2 - - 8.target1往socket2发送错误命令发送数据 - - 9.target1上不指定socket往上发送数据' - sub module: TCP - summary: send test. use socket in state that can't send - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -L -s 1000 - - ['R SSC1 RE LISTEN:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4.OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.ERROR - - 9.ERROR' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去建立TCP 监听 - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,去连接 PC的ip, - - 6.target1上使用步骤4创建的socket,创建TCP 监听 - - 7.target1上shutdown 步骤4的socket - - 8.target1上使用步骤4创建的socket,创建TCP 监听 - - 9.target1上使用不存在socket,创建TCP 监听' - sub module: TCP - summary: STA mode, server listen test. use socket in state that can't listen - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0208 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t UDP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,ERROR'] - - - SSC SSC1 soc -L -s 1000 - - ['R SSC1 RE LISTEN:\d+,ERROR'] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.ERROR - - 4 OK - - 5.OK - - 6.ERROR - - 7.OK - - 8.ERROR - - 9.ERROR' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建UDP传输socket,bind到本地ip 0.0.0.0, - - 3.target1上使用步骤2创建的socket,去建立TCP 监听 - - 4.target1上创建TCP socket - - 5.target1上使用步骤4创建的socket,去连接 PC的ip, - - 6.target1上使用步骤4创建的socket,创建TCP 监听 - - 7.target1上shutdown 步骤4的socket - - 8.target1上使用步骤4创建的socket,创建TCP 监听 - - 9.target1上使用不存在socket,创建TCP 监听' - sub module: TCP - summary: AP mode, server listen test. use socket in state that can't listen - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DNS_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: 3/5 - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 soc -H -d iot.espressif.cn - - ['R SSC1 A :\+HOSTIP:OK,(.+)\r\n'] - - - SSC SSC1 soc -B -t UDP - - ['R SSC1 A :\+BIND:(\d+),OK'] - - - SSC SSC1 soc -S -s -i -p 9003 -l 10 - - ['P SSC1 RE \+SEND:\d+,OK', P SSC1 SL +10] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK' - initial condition: STAM2 - initial condition description (auto): sta mode, join AP, DHCP on, will autogen a - TC with initial condition STAAP2 - module: TCPIP - steps: '1. get host name "espressif.cn" - - 2. sendto, recvfrom1. get host name "espressif.cn" - - 2. sendto, recvfrom' - sub module: DNS - summary: UDP send to iot.expressif.com - test environment: SSC_T1_2 - test environment description (auto): 'Able to access WAN after connect to AP. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DNS function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0206 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 4 4 "['01','02','03','01']" "[2,3,4,2]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 4. get IP 192.168.4.2 - 192.168.4.4 - - 5. get IP 192.168.4.2' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. disable DHCP server, do config and enable - - 3. target2 change mac, connect to softap, disconnect - - 4. Loop step3 twice - - 5. change to first mac, connect to softap' - sub module: DHCP - summary: dhcp server assign same IP to same MAC when it's not released - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0207 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - WIFI DISCONN2 - - ['R PC_COM NC ERROR C +WIFIDISCONN:OK'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. get IP 192.168.4.2 - - 4. succeed - - 5. succeed - - 6. get IP 192.168.4.2' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. disable DHCP server, do config and enable - - 3. PC WIFI NIC connect to target1 softap - - 4. target2 connect to target1 softap and disnnect - - 5. PC release IP and disconnected - - 6. target2 change mac and connect to target1' - sub module: DHCP - summary: dhcp server prefer assign released IP to new client - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - - - DELAY 90 - - [''] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - - - SSC SSC2 sta -D - - ['R SSC2 C +JAP:DISCONNECTED'] - - - DELAY 60 - - [''] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.2'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. get IP 192.168.4.2 - - 5. succeed - - 6. succeed - - 8. get IP 192.168.4.2' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP timeout as 1 minute - - 3. target2 connect to target1 - - 4. wait 90 seconds - - 5. check if target2 IP is same - - 6. target2 disconnect - - 7. wait 60s - - 8. target2 change mac and connect to target1' - sub module: DHCP - summary: dhcp server timeout test - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0205 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 -t 1 - - ['P SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. target2 wifi disconnected' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 - - 3. disable DHCP server, do config and enable' - sub module: DHCP - summary: disconnect STA if config dhcp server - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0202 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 3 4 "['01','02','03']" "[2,3,4]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3,4: get IP from dhcp pool with correct sequence' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP Server on Target1 - - 3. target change mac, connect to Target1 - - 4. Loop step3' - sub module: DHCP - summary: dhcp server ip pool - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0203 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.3 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - LOOP 2 4 "['01','02']" "[2,3]" - - [''] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:{%s} - - ['R SSC2 C +MAC:STA,OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:192.168.4.{%s}'] - - - SSC SSC2 mac -S -o 1 -m 10:22:33:44:55:66 - - ['R SSC2 C +MAC:STA,OK'] - - - DELAY 20 - - [''] - - - SSC SSC2 ip -Q -o 1 - - ['R SSC2 C +STAIP:0.0.0.0'] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. succeed - - 3. succeed - - 4.1 succeed - - 4.2 failed' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: TCPIP - steps: '1. config softap to a random ssid - - 2. config DHCP Server on Target1(.4.2 - .4.3) - - 3. target change mac, connect to Target1 - - 4. Loop step3 twice' - sub module: DHCP - summary: dhcp server ip pool empty - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_TCP_0204 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SSC SSC1 soc -W -s -o 0 - - ['R SSC1 RE WORKTHREAD:\d+,OK'] - - - SOC SOC2 SEND 146000 - - [P SOC_COM R *] - - - SSC SSC1 soc -W -s -o 1 - - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc server accept OK - - 4.OK - - 5.OK - - 6.OK - - 7.target收到146000 byte' - initial condition: STAAP2 - initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP - on (autogen by STAM2) - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1 创建好TCP 连接,有ACCEPT - - 5.target上不进行recv - - 6.PC send 100 * 1460 data to target, - - 7.在target上开始recv' - sub module: TCP - summary: STA mode, recv buffer test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) in different state - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_DHCP_0201 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 ip -S -o 2 -i - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.1 -e 192.168.4.10 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -L -s 192.168.4.5 -e 192.168.4.2 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -L -s 192.168.2.2 -e 192.168.2.5 - - ['R SSC1 C +DHCP:LEASE,ERROR'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - comment: '' - execution time: 0.0 - expected result: '1.target1 关闭DHCP 2 OK - - 2.target1 设置ip 成功 - - 3.设置dhcp 地址池 OK - - 4.ERROR - - 5.ERROR - - 6.ERROR - - 7.target1 打开DHCP ok' - initial condition: APM1 - initial condition description (auto): AP mode, DHCP on, will autogen a TC with initial - condition APSTA1 - module: TCPIP - steps: "1.target1 关闭DHCP 2 \n2.target1 设置ip \n3.设置dhcp 地址池\n4.设置dhcp错误的参数\n5.设置dhcp错误的参数\n\ - 6.设置dhcp错误的参数\n7.target1 打开DHCP ok" - sub module: DHCP - summary: server dhcp lease test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: DHCP server function test - version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_TCP_0208 SDK: '8266_NonOS @@ -12313,6 +11494,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: '1.PC上建立TCP 监听 test_tcp_port1 @@ -12343,7 +11525,7 @@ test cases: test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_DHCP_0208 + ID: ^TCPIP_TCP_0210 SDK: '8266_NonOS 8266_RTOS @@ -12355,61 +11537,64 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['P SSC1 C +DHCP:AP,OK', 'P SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 P ] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC2 SEND 146000 + - [P SOC_COM R *] + - - SSC SSC1 soc -W -s -o 1 + - ['P SSC1 RE WORKTHREAD:\d+,OK', P SSC1 SL +2920] comment: '' execution time: 0.0 - expected result: '1. succeed + expected result: '1.OK - 2. succeed + 2.OK - 3. succeed + 3.OK,pc tcp server accept成功 - 4. get IP 192.168.4.2 + 4.OK - 5. can only find target2 with IP 192.168.4.2' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 + 6.OK + + 7.收到 146000 数据' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration module: TCPIP - steps: '1. config softap to a random ssid + steps: '1. PC上建立TCP 监听 test_tcp_port1 - 2. PC NIC connect to target1 softap + 2.target1上创建TCP socket - 3. disable DHCP server, do config and enable + 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - 4. target2 connect to target1 softap + 4.PC与target1 创建好TCP 连接,有ACCEPT - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig and new client able to get first IP in pool - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. + 5.target停止调用recv + + 6.PC send 100 * 1460 data to 8266, + + 7.target重新调用recv' + sub module: TCP + summary: AP mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. - 2 SSC target connect with PC by UART.' + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: DHCP server function test + test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_DHCP_0209 + ID: ^TCPIP_TCP_0212 SDK: '8266_NonOS 8266_RTOS @@ -12421,59 +11606,80 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 dhcp -E -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - SSC SSC1 dhcp -L -s 192.168.4.2 -e 192.168.4.100 - - ['R SSC1 C +DHCP:LEASE,OK'] - - - SSC SSC1 dhcp -S -o 2 - - ['R SSC1 C +DHCP:AP,OK'] - - - WIFI CONN 192.168.4.2 - - ['R PC_COM NC ERROR C +WIFICONN:OK'] - - - DELAY 20 - - [''] - - - SSC SSC1 ap -L - - [R SSC1 C 192.168.4.2 C 192.168.4.3 P P ] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -i + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 soc -D -s + - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -L -s + - ['R SSC1 RE LISTEN:\d+,OK'] + - - SOC SOC2 CONNECT 0 + - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,2,%%s,\d+,%%s,%%d"%%(,,,)', + 'P SSC1 RE "SOCINFO:%%s,2,.+,\d+,.+,\d+"%%()', 'P SSC1 RE "SOCINFO:%%s,82,.+,%%d,.+,\d+"%%(,)', + 'P SSC1 RE "SOCINFO:%%s,2,%%s,%%d,%%s,\d+"%%(,,,)'] comment: '' execution time: 0.0 - expected result: '1. succeed + expected result: '1.OK - 2. succeed + 2.OK - 3. succeed + 3.OK,pc tcp server accept成功 - 4. succeed + 4.OK - 5. find target2 and PC' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 + 5.OK + + 6.OK + + 7.OK + + 8.OK + + 9.PC OK, target1 +ACCEPT:3,2,,port + + 10.+SOCINFO:,,, + + +SOCINFO:,,, + + +SOCINFO:, + + +SOCINFO:,,, + + +SOCINF0ALL' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration module: TCPIP - steps: '1. config softap to a random ssid - - 2. target2 connect to target1 softap - - 3. disable DHCP server, do config and enable - - 4. PC NIC connect to target1 softap - - 5. softap list connected station' - sub module: DHCP - summary: dhcp server reconfig, old client and new client able to get IP - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1,本地ip target_ip\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n4.target1上创建TCP socket2,本地ip target_ip\n5.target1上使用步骤4创建的socket2,去连接\ + \ PC的ip,test_tcp_port1,PC有ACCEPT\n6.target1 shutdown socket2 \n7.target1上创建TCP\ + \ socket3,本地端口random_port\n8.target1上使用步骤7创建的socket3,去监听\n9.PC CONNECT,\ + \ ,tcp 连接创建成功,创建socket4 \n10.target1 查询the socket information" + sub module: TCP + summary: AP mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. - 2 SSC target connect with PC by UART.' + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: DHCP server function test + test point 2: use TCP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_TCP_0412 + ID: ^TCPIP_TCP_0401 SDK: '8266_NonOS 8266_RTOS @@ -12493,11 +11699,445 @@ test cases: - ['R SSC1 RE CONNECT:\d+,OK'] - - SOC SOC1 ACCEPT SOC2 - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.8266往PC上发送5字节数据' + sub module: TCP + summary: do TCP send after WIFI disconnected + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0402 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK', 'P SSC1 RE CLOSED:\d+,0'] - - SSC SSC1 soc -T -s - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -T -s + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.断开与AP 连接 + + 6.关闭建立的socket1连接' + sub module: TCP + summary: "close TCP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0403 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0404 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.修改8266的Mode为softAP mode\ + \ \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0405 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -S -s -l 1 + - [''] + - - DELAY 5400 + - ['P SSC1 RE CLOSED:\d+,0'] + comment: '' + execution time: 1.5 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.TCP连接断开' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.PC 网卡 disable + + 6.target1上使用socket1发送数据,等待 90 分钟' + sub module: TCP + summary: do TCP send after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0406 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.PC上网卡禁止掉 \n6.关闭建立的socket1连接" + sub module: TCP + summary: close TCP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0407 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK + + 8.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.8266往PC上发送5字节数据" + sub module: TCP + summary: do TCP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_TCP_0408 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK', 'P SSC1 RE CLOSED:\d+,0'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s - ['R SSC1 RE CLOSE:\d+,OK'] comment: '' execution time: 0.0 @@ -12513,26 +12153,19 @@ test cases: 6.OK - 7.OK' + 7.OK + + 8.OK' initial condition: STAAP2 initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP on (autogen by STAM2) + level: Integration module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket1 - - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1创建好TCP 连接,有ACCEPT - - 5.target1上创建TCP socket2 - - 6.关闭socket1 连接 - - 7.关闭socket2连接' + steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1上使用步骤2创建的socket1,去连接\ + \ PC的ip,test_tcp_port1\n4.PC与target1创建好TCP 连接,有ACCEPT\n5.关闭8266的DHCP 1\n6.设置sta\ + \ ip \n7.查询sta ip 地址是否生效\n8.关闭建立的socket1连接" sub module: TCP - summary: close TCP send after socket changed + summary: close TCP socket after IP changed test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -12587,6 +12220,7 @@ test cases: initial condition: STAAP2 initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP on (autogen by STAM2) + level: Integration module: TCPIP steps: '1.PC上建立TCP 监听 test_tcp_port1 @@ -12613,45 +12247,120 @@ test cases: test point 2: TCP handling abnormal event version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_CONN_0901 + ID: ^TCPIP_TCP_0412 SDK: '8266_NonOS 8266_RTOS ESP32_IDF' - Test App: basic function + Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC1 sta -D - - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -C -s -i -p + - ['R SSC1 RE CONNECT:\d+,OK'] + - - SOC SOC1 ACCEPT SOC2 + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t TCP + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] comment: '' execution time: 0.0 - expected result: '1. disconnect event reason REASON_ASSOC_LEAVE + expected result: '1.OK - 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT + 2.OK - 3. disconnect event reason REASON_NO_AP_FOUND' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. sta connect to AP, and disconnect + 3.OK; PC TCP server accept 成功 - 2. connect to AP with wrong password + 4.OK - 3. connect to AP not exist' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, - REASON_NO_AP_FOUND + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上建立TCP 监听 test_tcp_port1 + + 2.target1上创建TCP socket1 + + 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1 + + 4.PC与target1创建好TCP 连接,有ACCEPT + + 5.target1上创建TCP socket2 + + 6.关闭socket1 连接 + + 7.关闭socket2连接' + sub module: TCP + summary: close TCP send after socket changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: TCP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0101 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.ERROR + + 4.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 + + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: STA mode, udp bind test. use different ip, port test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -12659,198 +12368,58 @@ test cases: 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: wifi disconnect reason test + test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_CONN_0902 + ID: ^TCPIP_UDP_0102 SDK: '8266_NonOS 8266_RTOS ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - APC OFF - - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] - - - APC ON - - [P PC_COM L OK] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 10] + - - SSC SSC1 soc -S -s -i -p -l 10 + - ['P SSC1 RE SEND:(\d+),OK', P SOC2 UL 10] comment: '' execution time: 0.0 - expected result: '1. succeed + expected result: '1.OK - 2. disconnect event REASON_BEACON_TIMEOUT' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. connect to AP + 2.OK - 2. AP power off' - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_BEACON_TIMEOUT - test environment: SSC_T1_APC - test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ - \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ - APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ - \ PC by UART." - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0903 - SDK: '8266_NonOS + 3.OK - 8266_RTOS + 4.OK - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -C -s -p bacfd - - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] - comment: '' - execution time: 0.0 - expected result: 1. disconect event reason REASON_AUTH_EXPIRE - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: 1. connect WEP ap with error password (valid wep password) - sub module: WIFI Connect - summary: test wifi disconnect reason REASON_AUTH_EXPIRE - test environment: SSC_T1_WEP - test environment description (auto): '1 SSC target connect with PC by UART. + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing - One WEP share key AP placed near SSC1.' - test point 1: basic function - test point 2: wifi disconnect reason test - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_SCAN_0201 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m b - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m g - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 sta -S - - [R SSC1 P P P P ] - comment: '' - execution time: 0.0 - expected result: '3. find all 3 ext APs + 2.PC上SOC2 UDP传输,bing - 5. find all 3 ext APs + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - 7. find all 3 ext APs + 4.target1上使用步骤3创建的socket1,往pc_ip,test_tcp_port1上发送10字节数据 - 9. find all 3 ext APs' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. 3 ext APs in 11b, 11g, 11n mode - - 2. STA in 11b mode - - 3. do all channel scan - - 4. STA in 11g mode - - 5. do all channel scan - - 6. STA in 11n ht20 mode - - 7. do all channel scan - - 8. STA in 11n ht40 mode - - 9. do all channel scan' - sub module: WIFI Scan - summary: STA in differnt PHY mode to scan AP in different PHY mode - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: Scan in different mode and channel - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0503 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 sta -R -r 0 - - [R SSC1 C OK] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,3'] - - - DELAY 5 - - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,2'] - - - DELAY 5 - - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] - - - SSC SSC1 sta -R -r 1 - - [SSC SSC1 C OK] - comment: '' - execution time: 0.0 - expected result: '1. succeed - - 2. not reconnect when connect failed, status when recv disconnect event is correct - - 3. not reconnect when connect failed, status when recv disconnect event is correct - - 4. succeed' - initial condition: STAM1 - initial condition description (auto): sta mode, quit AP, DHCP on, will autogen a - TC with initial condition STAAP1 - module: WIFI MAC - steps: '1. set sta reconnect policy as not reconnect - - 2. sta connect to ap not exist - - 3. sta connect to ap with wrong password - - 4. reset sta reconnect policy as auto reconnect - - ' - sub module: WIFI Connect - summary: reconnect policy interact with failed STA connect/reconnect + 5.target1上使用步骤3创建的socket1,往pc_ip2,test_tcp_port2上发送10字节数据' + sub module: UDP + summary: STA mode, sendto test. use different ip, port test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -12858,287 +12427,404 @@ test cases: 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: reconnect policy test + test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0402 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0103 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, SoftAP not get - disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + expected result: '1.OK - 2. AP get connected + 2.OK - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 20M, Softap get connected - than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 3.OK - PC has one WiFi NIC support capture wlan packet using libpcap. + 4.OK - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + 5.OK,没有到UDP包 - Put 4 APs near SSC targets.' + 6.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: STA mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0401 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SOC SOC1 SENDTO 1 + - [R SSC1 SL +1] + - - SOC SOC1 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] + - - SOC SOC1 SENDTO 1473 + - [P SSC1 NC +RECVFROM, P SOC_COM C OK] + - - SOC SOC2 BIND + - [R SOC_COM L OK] + - - SOC SOC2 SENDTO 1472 + - ['R SSC1 RE "RECVFROM:%%s,1472,%%s,%%u"%%(,,)'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 20M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht20, in channel2 + expected result: '1.OK - 2. STA connect to ext AP + 2.OK - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 20M, STA connect to - AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 3.OK - PC has one WiFi NIC support capture wlan packet using libpcap. + 4.OK - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + 5.OK,没收到UDP包 - Put 4 APs near SSC targets.' + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.PC往8266上发送1字节数据 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1473字节数据 + + 6.PC上SOC2 UDP传输,bing + + 7.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recvfrom basic test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0407 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0105 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + expected result: '1.OK - 2. STA connect to ext AP + 2.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, STA connect - to AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 2.关闭socket1' + sub module: UDP + summary: STA mode, close UDP sockets test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. - PC has one WiFi NIC support capture wlan packet using libpcap. + PC has 1 WiFi NIC. - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0406 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0106 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, SoftAP not get - disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + expected result: '1.ok - 2. AP get connected + 2.ok - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 40M, Softap get connected - than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 3.ok - PC has one WiFi NIC support capture wlan packet using libpcap. + 4.ok - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + 5.ok' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - Put 4 APs near SSC targets.' + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: STA mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0405 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0107 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC1 NC +JAP:DISCONNECTED', 'P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -I + - ['P SSC1 RE "SOCINFO:%%s,1,.+,%%d"%%(,)'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, both bandwidth 40M, STA not disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht40, in channel2 + expected result: '1.OK - 2. STA connect to ext AP + 2.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - 3. AP get connected' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, both bandwidth 40M, STA connect to - AP then Softap get connected - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 2.target1上查询创建socket信息' + sub module: UDP + summary: STA mode, get active socket info test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. - PC has one WiFi NIC support capture wlan packet using libpcap. + PC has 1 WiFi NIC. - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.' + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0404 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0108 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 20 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 20 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -i 0.0.0.0 -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 C BIND:ERROR'] + - - SSC SSC1 soc -B -t TCP -p + - ['R SSC1 RE BIND:(\d+),OK'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 20M, STA 40M, SoftAP not - get disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht20, in channel1, ext AP 11n ht40, in channel2 + expected result: '1.OK - 2. AP get connected + 2.OK - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 20M, ext AP 40M, Softap get - connected than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 3.ERROR - PC has one WiFi NIC support capture wlan packet using libpcap. + 4.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + 2.target1上UDP传输,Bind socket2,本地ip 0.0.0.0 target_udp_port2 - Put 4 APs near SSC targets.' + 3.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 4.target1上创建TCP socket3, target_udp_port1' + sub module: UDP + summary: AP mode, udp bind test. use different ip, port + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0110 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1] + - - SSC SSC1 soc -S -s -i -p -l 1472 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 1472] + - - SSC SSC1 soc -S -s -i -p -l 1473 + - ['P SSC1 RE SEND:(\d+),OK', P SOC_COM NC SOC_RECVFROM] + - - SSC SSC1 soc -S -s -i -p -l 1472 -n 10 + -j 20 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 14720] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK,没收到UDP包 + + 6.OK' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1字节数据 + + 4.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472字节数据 + + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1473字节数据 + + 6.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送1472*10字节数据' + sub module: UDP + summary: AP mode, sendto test with different length + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0112 SDK: '8266_NonOS @@ -13164,6 +12850,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 @@ -13180,52 +12867,64 @@ test cases: test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_PHY_0408 - SDK: ESP32_IDF + ID: ^TCPIP_UDP_0113 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' Test App: SSC allow fail: '' auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 phy -S -o 1 -m n -b 40 - - ['R SSC2 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['P SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 NC +JAP:DISCONNECTED', 'P SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 RE BIND:(\d+),OK'] comment: '' execution time: 0.0 - expected result: 3. SoftAP and STA in channel2, SoftAP 40M, STA 20M, SoftAP not - get disconnected - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1. SoftAP 11n ht40, in channel1, ext AP 11n ht20, in channel2 + expected result: '1.ok - 2. AP get connected + 2.ok - 3. STA connect to ext AP' - sub module: Phy Mode - summary: SoftAP ext AP in defferent channel, SoftAP 40M, ext AP 20M, Softap get - connected than STA connect to AP - test environment: SSC_T2_PhyMode - test environment description (auto): '2 SSC target connect with PC by UART. + 3.ok - PC has one WiFi NIC support capture wlan packet using libpcap. + 4.ok - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + 5.ok' + initial condition: APSTA2 + initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen + by APM2) + level: Integration + module: TCPIP + steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - Put 4 APs near SSC targets.' + 2.target1上UDP传输,Bind socket2,本地ip target_udp_port2 + + 3.target1上UDP传输,Bind socket3,本地ip target_udp_port3 + + 4.target1上UDP传输,Bind socket4,本地ip target_udp_port4 + + 5.target1上UDP传输,Bind socket5,本地ip target_udp_port5' + sub module: UDP + summary: AP mode, create max udp socket test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: STA+SoftAP initial channel test - version: v1 (2015-8-15) + test point 2: use UDP SAP (socket/espconn API) with different parameter + version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0114 SDK: '8266_NonOS @@ -13251,6 +12950,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: '1.target1上UDP传输,Bind socket1,本地ip target_udp_port1 @@ -13267,7 +12967,7 @@ test cases: test point 2: use UDP SAP (socket/espconn API) with different parameter version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^WIFI_CONN_0104 + ID: ^TCPIP_UDP_0201 SDK: '8266_NonOS 8266_RTOS @@ -13279,45 +12979,69 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t -m - 1 - - ['R SSC1 C +SAP:OK'] - - - WIFI DISCONN - - ['R PC_COM C +WIFIDISCONN:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - WIFI CONN - - - ['R PC_COM C +WIFICONN:ERROR'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -W -s -o 0 + - ['R SSC1 RE WORKTHREAD:\d+,OK'] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] + - - SOC SOC1 SENDTO 1472 + - [''] comment: '' execution time: 0.0 - expected result: '1. target1 set AP,set max allowed sta as 1 + expected result: '1.OK - 2. use PC disconnect, + 2.OK - 3.target 2 jap succeed + 3.OK - 4.PC WIFI can not CONN' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) - module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 + 4.PC OK - 2.use PC disconnect target1 + 5.PC OK - 3.target 2 jap target1 + 6.PC OK - 4.PC WIFI CONNECT target1' - sub module: WIFI Connect - summary: station SAP test, max allowed sta - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. + 7.PC OK + + 8.PC OK SOC_CLOSE=SOC1' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上关闭工作线程 + + 4.PC往8266上发送1472字节数据 + + 5.PC往8266上发送1472字节数据 + + 6.PC往8266上发送1472字节数据 + + 7.PC往8266上发送1472字节数据 + + 8.PC往8266上发送1472字节数据' + sub module: UDP + summary: STA mode, recv buffer test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: use UDP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^TCPIP_UDP_0202 @@ -13368,6 +13092,7 @@ test cases: initial condition: APSTA2 initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen by APM2) + level: Integration module: TCPIP steps: '1.PC上SOC1 UDP传输,bing @@ -13396,364 +13121,406 @@ test cases: test point 2: use UDP SAP (socket/espconn API) in different state version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^TCPIP_IGMP_0103 + ID: ^TCPIP_UDP_0301 SDK: '8266_NonOS 8266_RTOS ESP32_IDF' Test App: SSC - allow fail: '' + allow fail: 1/5 auto test: 'Yes' category: Function cmd set: - '' - - - SSC SSC1 igmp -J -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -L -h -m 224.1.1.1 - - ['R SSC1 C +IGMP:OK'] - - - SSC SSC1 igmp -J -h -m 223.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 224.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - - - SSC SSC1 igmp -J -h 192.168.237.77 -m 240.1.1.1 - - ['R SSC1 C +IGMP:ERROR'] - comment: '' - execution time: 0.0 - expected result: '1. success - - 2. failed - - 3. failed - - 4. failed' - initial condition: APSTA2 - initial condition description (auto): testing ap on sta + ap mode, PC join AP (autogen - by APM2) - module: TCPIP - steps: '1. join group with correct host addr and multicast addr - - 2. join group with correct host addr and wrong multicast addr - - 3. join group with wrong host addr and correct multicast addr - - 4. join group with wrong host addr and wrong multicast addr' - sub module: IGMP - summary: softAP IGMP join group address check - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: IGMP API parameter check - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -t 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -p -t 2 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -p -t - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -p -t 4 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -p -t 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S - - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] - - - SSC SSC1 ap -S -s -p -t 5 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S - - ['R SSC2 RE "\+SCAN:%%s,.+,0,\d+"%%()'] - comment: '' - execution time: 0.0 - expected result: "1.target1 set AP,open, \n2.target 2 jap succeed\n3.target1 set\ - \ AP,wpa_psk \n4.target 2 jap succeed\n5.target1 set AP, wpa2_psk \n6.target 2\ - \ jap succeed\n7.target1 set AP,wap_wpa2_psk\n8.target 2 jap succeed\n9.target1\ - \ set AP,加密方式为t 1\n10.target 2 上查询到target_ssid\n11.target1 set AP,加密方式为t 5\n12.target\ - \ 2 上查询到target_ssid" - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: "1.target1下设置ssid 和pwd,加密方式 open\n2.target2 jap target1\n3.target1下设置ssid\ - \ 和pwd,加密方式 wpa_psk \n4.target2 jap target1\n5.target1下设置ssid 和pwd,加密方式 wpa2_psk\ - \ \n6.target 2 jap target1\n7.target1下设置ssid 和pwd,加密方式 wap_wpa2_psk\n8.target2\ - \ jap target1\n9.target1下设置ssid 和pwd,加密方式 wep \n10.target2上查询target_ssid\n11.target1下设置ssid\ - \ 和pwd,加密方式 t 5 错误的加密方式\n12.target2上查询 target_ssid" - sub module: WIFI Connect - summary: station SAP+JAP test, different encryption - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0102 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -t 0 -n 1 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -t 0 -n 13 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] - - - SSC SSC1 ap -S -s -n 15 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S - - ['R SSC2 RE "\+SCAN:%%s,.+,\d+,1"%%()'] - comment: '' - execution time: 0.0 - expected result: '1. target1 set AP,set channel 1 - - 2.target 2 jap succeed - - 3.target1 set AP,set channel 10 - - 4.target 2 jap succeed - - 5.target1 set AP,set channel 15 - - 6.target 2 上查询到target_ssid' - initial condition: T2O_1 - initial condition description (auto): same as T2_1 but will NOT autogen a TC with - initial condition T2_2 - module: WIFI MAC - steps: '1. target1下设置ssid 和pwd 加密方式,set channel 1 - - 2.target2 jap target 1 - - 3.target1下设置ssid 和pwd 加密方式,set channel 10 - - 4.target2 jap target 1 - - 5.target1下设置ssid 和pwd 加密方式,set channel 15 - - 6.target 2 上查询target_ssid' - sub module: WIFI Connect - summary: station SAP+JAP test, different channel - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_CONN_0103 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 ap -S -s -p -t -h - 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 P , R SSC2 C +SCANDONE] - - - SSC SSC1 ap -S -s -p -t -h - 1 - - ['R SSC1 C +SAP:OK'] - - - DELAY 3 - - [''] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 C +SCANDONE] - - - DELAY 3 - - [''] - - - SSC SSC2 sta -S -h 0 - - [R SSC2 NP C +SCANDONE] - comment: '' - execution time: 0.0 - expected result: '1.target1 set AP,set ssid broad cast - - 2.target 2上scan target_ap_mac - - 3.target1 set AP,set ssid hidden, - - 4.target 2上不能scan target_ap_mac' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 - module: WIFI MAC - steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast - - 2.target 2上scan target_ap_mac - - 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, - - 4.target 2上scan target_ap_mac' - sub module: WIFI Connect - summary: station SAP+JAP test, ssid hidden - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: SAP/JAP with different config - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: WIFI_PHY_0504 - SDK: ESP32_IDF - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 phy -S -o 1 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC1 phy -S -o 2 -m n -b 40 - - ['R SSC1 C +PHY:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:CONNECTED'] - - - SSC SSC3 sta -C -s -p - - ['R SSC3 C +JAP:CONNECTED'] - - - SSC SSC2 sta -C -s -p - - [''] - - - DELAY 10 - - ['P SSC2 C +JAP:CONNECTED', 'P SSC[1,3] NC +JAP:DISCONNECTED'] - comment: '' - execution time: 0.0 - expected result: 4. all STA not get disconnected; target 1 SoftAP and STA both in - channel2 20M - initial condition: T3_PHY1 - initial condition description (auto): '1. target 1 and target 2 set to AP+STA mode, - target 3 set to STA mode - - 2. all interface of target 2,3 set to 11n ht40 - - 3. config softAP of target 1 and target 2' - module: WIFI MAC - steps: '1. target 1 STA and SoftAP set to 40M - - 2. target 2 STA connect to ap_channel1_40 - - 3. target 1/3 STA connect to target 2/1 SoftAP - - 4. target 2 STA connect to ap_channel2_20' - sub module: Phy Mode - summary: SoftAP STA in channel1, SoftAP 20M, STA 40M, STA changed to channel2 40M - test environment: SSC_T3_PhyMode - test environment description (auto): '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.' - test point 1: basic function - test point 2: STA+SoftAP dynamic channel switch test - version: v1 (2015-8-15) -- CI ready: 'Yes' - ID: ^TCPIP_IP_0101 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SSC SSC1 dhcp -S -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 - - ['R SSC1 C +IP:ERROR'] - - - SSC SSC1 dhcp -E -o 1 - - ['R SSC1 C +DHCP:STA,OK'] - - - SSC SSC1 ip -S -o 1 -i 192.168.123.123 - - ['R SSC1 C +IP:OK'] - - - SSC SSC1 ip -Q -o 1 - - ['R SSC1 C +STAIP:192.168.123.123'] + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -i -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:\d+,ERROR'] comment: '' execution time: 0.0 expected result: '1.OK - 2.ERROR + 2.OK 3.OK 4.OK - 5.STAIP:192.168.123.123' - initial condition: STAAP1 - initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen - by STAM1) + 5.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration module: TCPIP - steps: '1.target1 打开DHCP 1 + steps: '1.PC上SOC1 UDP传输,bing - 2.target1 设置sta ip 192.168.123.123 + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 - 4.target1 关闭DHCP 1 + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 - 5.target1 设置sta ip 192.168.123.123 + 4.断开与AP 连接 - 6.target1 查询 当前sta ip' - sub module: IP - summary: sta set and query static ip test + 5.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据' + sub module: UDP + summary: do UDP send after WIFI disconnected test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: set and query static IP + test point 1: abnormal/special use + test point 2: UDP handling abnormal event version: v1 (2016-8-15) - CI ready: 'Yes' - ID: WIFI_CONN_0801 + ID: ^TCPIP_UDP_0302 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 sta -D + - ['P SSC1 C +QAP:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: '1.PC上SOC1 UDP传输,bing + + 2.target1上UDP传输,Bind socket1,本地ip target_udp_port1 + + 3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据 + + 4.断开与AP 连接 + + 5.关闭建立的socket1连接' + sub module: UDP + summary: "close UDP socket after WIFI \ndisconnected" + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0303 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.ERROR' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0304 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 op -S -o 2 + - ['P SSC1 C +MODE:OK'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.修改8266的Mode为softAP mode \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after mode changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0305 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - NIC DISABLED + - [R PC_COM C OK] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK + + 4.OK + + 5.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.PC上网卡禁止掉 \n5.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after PC NIC disabled + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0306 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -S -s -i -p -l 1 + - ['P SSC1 RE SEND:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.8266往PC上发送5字节数据" + sub module: UDP + summary: do UDP send after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^TCPIP_UDP_0307 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: 1/5 + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SOC SOC1 BIND + - [R SOC_COM L OK] + - - SSC SSC1 soc -B -t UDP -p + - ['R SSC1 A :BIND:(\d+),OK'] + - - SSC SSC1 soc -S -s -i -p -l 5 + - ['P SSC1 RE SEND:(\d+),OK', P SOC1 UL 5] + - - SSC SSC1 dhcp -E -o 1 + - ['R SSC1 C +DHCP:STA,OK'] + - - SSC SSC1 ip -S -o 1 -i 192.168.111.210 + - ['P SSC1 C +IP:OK'] + - - SSC SSC1 ip -Q -o 1 + - ['R SSC1 C +STAIP:192.168.111.210'] + - - SSC SSC1 soc -T -s + - ['R SSC1 RE CLOSE:\d+,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.OK + + 3.OK; PC TCP server accept 成功 + + 4.OK + + 5.OK + + 6.OK + + 7.OK' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: TCPIP + steps: "1.PC上SOC1 UDP传输,bing \n2.target1上UDP传输,Bind socket1,本地ip\ + \ target_udp_port1\n3.target1上使用步骤2创建的socket1,往pc_ip,test_tcp_port1上发送5字节数据\n\ + 4.关闭8266的DHCP 1\n5.设置sta ip \n6.查询sta ip 地址是否生效\n7.关闭建立的socket1连接" + sub module: UDP + summary: close UDP socket after IP changed + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: UDP handling abnormal event + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_ADDR_0101 SDK: '8266_NonOS 8266_RTOS @@ -13765,48 +13532,40 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t 0 - - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC1 ap -S -s -p -t 2 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] - - - SSC SSC1 ap -S -s -p -t 3 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] - - - SSC SSC1 ap -S -s -p -t 4 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] - - - SSC SSC1 ap -S -s -p -t 0 - - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 1 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m 22:33:44:55:66:77 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 mac -Q -o 3 + - ['R SSC1 C +STAMAC:44:55:66:77:88:99 C +APMAC:22:33:44:55:66:77'] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] comment: '' execution time: 0.0 - expected result: '1. succeed + expected result: '1.OK - 2. succeed + 2.ok - 3. auth change event old mode 0 new mode 2 + 3.ok - 4. auth change event old mode 2 new mode 3 + 4.ok - 5. auth change event old mode 3 new mode 4 + 5.ok - 6. auth change event old mode 4 new mode 0' - initial condition: T2_1 - initial condition description (auto): target 1 as SoftAP, target 2 as STA, will - autogen a TC with initial condition T2_2 + 6.ok' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration module: WIFI MAC - steps: '1. set target1 softap auth mode 0 - - 2. target2 connect to target1 - - 3. set target1 softap auth mode 2, wait sta connected - - 4. set target1 softap auth mode 3, wait sta connected - - 5. set target1 softap auth mode 4, wait sta connected - - 6. set target1 softap auth mode 0, wait sta connected' - sub module: WIFI Connect - summary: test auth change event + steps: "1.target1 设置mode 为sta+softAP mode\n2.target1 设置sta mode 下的mac \n3.target1\ + \ 设置softAP mode 下的mac\n4.target1 查询softAP+sta 下的mac\n5.target1 设置sta mode 下的mac\ + \ 为target1_mac\n6.target1 设置softAP mode 下的mac 为target1_ap_mac" + sub module: MAC Address + summary: set mac, query mac test environment: SSC_T2_1 test environment description (auto): 'PC has 1 wired NIC connected to AP. @@ -13814,7 +13573,76 @@ test cases: 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: wifi auth changed event test + test point 2: mac address function test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_ADDR_0102 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 mac -S -o 2 -m 44:55:66:77:88:99 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - [''] + - - SSC SSC2 sta -S -b 44:55:66:77:88:99 + - ['R SSC2 RE \+SCAN:.+,44:55:66:77:88:99,'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -Q -o 1 + - ['R SSC2 A :\+STAMAC:(.+)\r\n'] + - - SSC SSC2 mac -S -o 1 -m 22:33:44:55:66:77 + - ['R SSC2 C +MAC:STA,OK'] + - - SSC SSC2 sta -C -s -p + - ['P SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:22:33:44:55:66:77'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + comment: '' + execution time: 0.0 + expected result: '1.OK + + 2.ok + + 3.ok + + 4.ok + + 5.ok + + 6.ok + + 7.ok + + 8.ok + + 9.ok' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: "1.target1 设置sta mode下的mac 44:55:66:77:88:99\n2.target1下设置ssid 和pwd 加密方式\n\ + 3.target2 查询mac为44:55:66:77:88:99的ssid\n4.target1 设置sta mode下的mac target_ap_mac\n\ + 5.target2 查询sta mode 下的mac 为target2_mac_tmp\n6.target2 设置sta mode 下的mac 为22:33:44:55:66:77\n\ + 7.target2 jap target1\n8.target1 查询连接到的sta \n9.target2 设置sta mode 下的mac 为 target2_mac" + sub module: MAC Address + summary: set mac and do scan/JAP/SAP + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: mac address function test version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0101 @@ -13862,6 +13690,7 @@ test cases: \ 2 上查询到target_ssid" initial condition: T2_2 initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration module: WIFI MAC steps: "1.target1下设置ssid 和pwd,加密方式 open\n2.target2 jap target1\n3.target1下设置ssid\ \ 和pwd,加密方式 wpa_psk \n4.target2 jap target1\n5.target1下设置ssid 和pwd,加密方式 wpa2_psk\ @@ -13880,7 +13709,7 @@ test cases: test point 2: SAP/JAP with different config version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^WIFI_CONN_0503 + ID: ^WIFI_CONN_0103 SDK: '8266_NonOS 8266_RTOS @@ -13892,40 +13721,151 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 sta -R -r 0 - - [R SSC1 C OK] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,3'] - - - DELAY 5 - - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] - - - SSC SSC1 sta -C -s -p - - ['R SSC1 C +JAP:OK', 'R SSC1 NC +JAP:DISCONNECTED,1 C +JAP:DISCONNECTED,2'] - - - DELAY 5 - - ['R SSC1 NC +JAP:DISCONNECTED', P PC_COM C +DELAYDONE] - - - SSC SSC1 sta -R -r 1 - - [SSC SSC1 C OK] + - - SSC SSC1 ap -S -s -p -t -h + 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P , R SSC2 C +SCANDONE] + - - SSC SSC1 ap -S -s -p -t -h + 1 + - ['R SSC1 C +SAP:OK'] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 C +SCANDONE] + - - DELAY 3 + - [''] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] comment: '' execution time: 0.0 - expected result: '1. succeed + expected result: '1.target1 set AP,set ssid broad cast - 2. not reconnect when connect failed, status when recv disconnect event is correct + 2.target 2上scan target_ap_mac - 3. not reconnect when connect failed, status when recv disconnect event is correct + 3.target1 set AP,set ssid hidden, - 4. succeed' + 4.target 2上不能scan target_ap_mac' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式,set ssid broad cast + + 2.target 2上scan target_ap_mac + + 3. target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 4.target 2上scan target_ap_mac' + sub module: WIFI Connect + summary: station SAP+JAP test, ssid hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0104 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t -m + 1 + - ['R SSC1 C +SAP:OK'] + - - WIFI DISCONN + - ['R PC_COM C +WIFIDISCONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE "\+JAP:CONNECTED,%%s"%%()'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:ERROR'] + comment: '' + execution time: 0.0 + expected result: '1. target1 set AP,set max allowed sta as 1 + + 2. use PC disconnect, + + 3.target 2 jap succeed + + 4.PC WIFI can not CONN' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set max allowed sta as 1 + + 2.use PC disconnect target1 + + 3.target 2 jap target1 + + 4.PC WIFI CONNECT target1' + sub module: WIFI Connect + summary: station SAP test, max allowed sta + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: SAP/JAP with different config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0201 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:OK'] + - - SSC SSC1 sta -Q + - ['R SSC1 C +JAP:DISCONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.target1 jion AP 成功 + + 2.查询JAP的状态 + + 3.target1 断开AP + + 4.查询target1 JAP 是DISCONN' initial condition: STAAP1 initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen by STAM1) + level: Integration module: WIFI MAC - steps: '1. set sta reconnect policy as not reconnect + steps: '1.target1 jion AP 成功 - 2. sta connect to ap not exist + 2.查询JAP的状态 - 3. sta connect to ap with wrong password + 3.target1 断开AP - 4. reset sta reconnect policy as auto reconnect' + 4.查询target1 JAP 是DISCONN' sub module: WIFI Connect - summary: reconnect policy interact with failed STA connect/reconnect + summary: JAP query test test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -13933,10 +13873,10 @@ test cases: 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: reconnect policy test + test point 2: query JAP status version: v1 (2016-8-15) - CI ready: 'Yes' - ID: ^WIFI_CONN_0502 + ID: ^WIFI_CONN_0301 SDK: '8266_NonOS 8266_RTOS @@ -13948,61 +13888,106 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 ap -S -s -p -t + - - SSC SSC1 ap -S -s -p -t -h + 0 -m 8 - ['R SSC1 C +SAP:OK'] - - - SSC SSC2 sta -C -s -p - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -R -r 1 - - ['R SSC2 C +RECONN:OK'] - - - SSC SSC1 op -S -o 1 - - ['R SSC1 C +MODE:OK'] - - - DELAY 5 - - ['R SSC2 C +JAP:DISCONNECTED'] - - - SSC SSC1 op -S -o 2 - - ['R SSC1 C +MODE:OK'] - - - DELAY 10 - - ['R SSC2 C +JAP:CONNECTED'] - - - SSC SSC2 sta -D - - ['R SSC2 C +QAP:OK'] - - - DELAY 10 - - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,3,0,8,\d+"%%(,)'] comment: '' execution time: 0.0 - expected result: '1.target1 set AP + expected result: '1. target1 set AP - 2.target2 jap target 1 - - 3.设置reconn,开启(此功能不需要重启系统) - - 4.target2 断开target1 连接 - - 5.等待10s,target2 自动重连target1 - - 6.target2 断开target1 连接' - initial condition: T2_2 - initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + 2.target 1上查询到跟设置AP时一致' + initial condition: APSTA1 + initial condition description (auto): testing ap on sta + ap mode (autogen by APM1) + level: Integration module: WIFI MAC - steps: '1.target1下设置ssid 和pwd 加密方式 + steps: '1. target1 set AP - 2.target2 jap target 1 - - 3.设置reconn,开启(此功能不需要重启系统) - - 4.target2 断开target1 连接 - - 5.等待10s,target2 自动重连target1 - - 6.target2 断开target1 连接' + 2.target 1上查询到跟设置AP时一致' sub module: WIFI Connect - summary: will not do reconnect after manually disconnected - test environment: SSC_T2_1 - test environment description (auto): 'PC has 1 wired NIC connected to AP. + summary: AP config query test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. - 2 SSC target connect with PC by UART.' - test point 1: abnormal/special use - test point 2: reconnect policy test + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: query AP config + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0401 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -R -a 0 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:0'] + - - SSC SSC1 reboot + - [''] + - - DELAY 15 + - [''] + - - SSC SSC1 sta -Q + - ['R SSC1 C JAP:DISCONNECTED'] + - - SSC SSC1 sta -R -a 1 + - ['R SSC1 C +AUTORECONN:OK'] + - - SSC SSC1 sta -R -a 2 + - ['R SSC1 C +AUTORECONN:1'] + - - SSC SSC1 reboot + - ['R SSC1 C +JAP:CONNECTED'] + comment: '' + execution time: 0.0 + expected result: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + initial condition: STAAP2 + initial condition description (auto): testing sta on sta + ap mode, join AP, DHCP + on (autogen by STAM2) + level: Integration + module: WIFI MAC + steps: '1.设置autoreconn,关闭 + + 2.查询当前autoreconn状态是否关闭 + + 3.重启系统,等待15s + + 4.查询target1 未自动重连AP + + 5.设置autoreconn,开启 + + 6.查询当前autoreconn状态是否开启 + + 7.系统重启后target1 自动重连AP' + sub module: WIFI Connect + summary: auto reconnect test + test environment: SSC_T1_1 + test environment description (auto): 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: power on auto reconnect test version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_CONN_0501 @@ -14066,6 +14051,7 @@ test cases: 9.等待15s,target2 不会自动重连target1' initial condition: T2_2 initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration module: WIFI MAC steps: "1.设置reconn,开启(此功能不需要重启系统)\n2.target1下设置ssid 和pwd 加密方式\n3.target2 JAP target1\ \ \n4.target1 修改mode 为sta mode\n5.等待10s,target1 修改mode 为softAP mode\n6.设置reconn,关闭\n\ @@ -14082,7 +14068,7 @@ test cases: test point 2: reconnect policy test version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0115 + ID: ^WIFI_CONN_0502 SDK: '8266_NonOS 8266_RTOS @@ -14094,78 +14080,221 @@ test cases: category: Function cmd set: - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -R -r 1 + - ['R SSC2 C +RECONN:OK'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - DELAY 5 + - ['R SSC2 C +JAP:DISCONNECTED'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - DELAY 10 + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - DELAY 10 + - [P PC_COM C +DELAYDONE, 'P SSC2 NC +JAP:CONNECTED'] comment: '' execution time: 0.0 - expected result: '1.OK + expected result: '1.target1 set AP - 2.OK + 2.target2 jap target 1 - 3.OK,pc tcp server accept成功 + 3.设置reconn,开启(此功能不需要重启系统) - 4 OK + 4.target2 断开target1 连接 - 5.OK,pc tcp server accept成功 + 5.等待10s,target2 自动重连target1 - 6.OK + 6.target2 断开target1 连接' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式 - 7.OK,pc tcp server accept成功 + 2.target2 jap target 1 - 8 OK + 3.设置reconn,开启(此功能不需要重启系统) - 9.OK,pc tcp server accept成功 + 4.target2 断开target1 连接 - 10.OK + 5.等待10s,target2 自动重连target1 - 11.OK,pc tcp server accept成功' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.PC上建立TCP 监听 test_tcp_port1 + 6.target2 断开target1 连接' + sub module: WIFI Connect + summary: will not do reconnect after manually disconnected + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. - 2.target1上创建TCP socket1 + PC has 1 WiFi NIC. - 3.target1上使用步骤2创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + 2 SSC target connect with PC by UART.' + test point 1: abnormal/special use + test point 2: reconnect policy test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0601 + SDK: '8266_NonOS - 4.target1上创建TCP socket2 + 8266_RTOS - 5.target1上使用步骤4创建的socket2,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -L + - ['R SSC1 C +LSTA:', 'R SSC1 C +LSTA:', R SSC1 C +LSTADONE] + comment: '' + execution time: 0.0 + expected result: '1.target1 set AP - 6.target1上创建TCP socket3 + 2.PC WIFI CONNECTED - 7.target1上使用步骤6创建的socket3,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + 3.target2 jap target 1 - 8.target1上创建TCP socket4 + 4.查询到两个sta 连接到target1 上' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. target1下设置ssid 和pwd 加密方式 - 9.target1上使用步骤8创建的socket4,去连接 PC的ip,test_tcp_port1,PC有ACCEPT + 2.PC WIFI CONNECTED target1 - 10.target1上创建TCP socket5 + 3.target2 jap target 1 - 11.target1上使用步骤10创建的socket5,去连接 PC的ip,test_tcp_port1,PC有ACCEPT' - sub module: TCP - summary: AP mode, create max TCP sockets test + 4.查询到两个sta 连接到target1 上' + sub module: WIFI Connect + summary: list stations connected to soft ap test + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: list SoftAP connected station + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0801 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 2 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,2,0'] + - - SSC SSC1 ap -S -s -p -t 3 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,3,2'] + - - SSC SSC1 ap -S -s -p -t 4 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,4,3'] + - - SSC SSC1 ap -S -s -p -t 0 + - ['P SSC1 C +SAP:OK', 'P SSC2 C +JAP:AUTHCHANGED,0,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. succeed + + 3. auth change event old mode 0 new mode 2 + + 4. auth change event old mode 2 new mode 3 + + 5. auth change event old mode 3 new mode 4 + + 6. auth change event old mode 4 new mode 0' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. set target1 softap auth mode 0 + + 2. target2 connect to target1 + + 3. set target1 softap auth mode 2, wait sta connected + + 4. set target1 softap auth mode 3, wait sta connected + + 5. set target1 softap auth mode 4, wait sta connected + + 6. set target1 softap auth mode 0, wait sta connected' + sub module: WIFI Connect + summary: test auth change event + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi auth changed event test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0901 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: basic function + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - SSC SSC1 sta -D + - ['R SSC1 RE JAP:DISCONNECTED,\d+,8'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE JAP:DISCONNECTED,\d+,15'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE JAP:DISCONNECTED,\d+,201'] + comment: '' + execution time: 0.0 + expected result: '1. disconnect event reason REASON_ASSOC_LEAVE + + 2. disconnect event reason REASON_4WAY_HANDSHAKE_TIMEOUT + + 3. disconnect event reason REASON_NO_AP_FOUND' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: WIFI MAC + steps: '1. sta connect to AP, and disconnect + + 2. connect to AP with wrong password + + 3. connect to AP not exist' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_LEAVE, REASON_4WAY_HANDSHAKE_TIMEOUT, + REASON_NO_AP_FOUND test environment: SSC_T1_1 test environment description (auto): 'PC has 2 wired NIC connected to AP. @@ -14173,7 +14302,153 @@ test cases: 1 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0902 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p + - ['R SSC1 C +JAP:CONNECTED'] + - - APC OFF + - [P PC_COM L OK, 'R SSC1 RE JAP:DISCONNECTED,\d+,200'] + - - APC ON + - [P PC_COM L OK] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_BEACON_TIMEOUT' + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: WIFI MAC + steps: '1. connect to AP + + 2. AP power off' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_BEACON_TIMEOUT + test environment: SSC_T1_APC + test environment description (auto): "PC has 1 wired NIC connected to AP.\nPC has\ + \ 1 wired NIC connected to APC (static IP within the same subnet with APC). \n\ + APC control AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with\ + \ PC by UART." + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0903 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 sta -C -s -p bacfd + - ['R SSC1 RE JAP:DISCONNECTED,\d+,2'] + comment: '' + execution time: 0.0 + expected result: 1. disconect event reason REASON_AUTH_EXPIRE + initial condition: STAAP1 + initial condition description (auto): testing sta on sta + ap mode, quit AP (autogen + by STAM1) + level: Integration + module: WIFI MAC + steps: 1. connect WEP ap with error password (valid wep password) + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_AUTH_EXPIRE + test environment: SSC_T1_WEP + test environment description (auto): '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.' + test point 1: basic function + test point 2: wifi disconnect reason test + version: v1 (2016-8-15) +- CI ready: 'Yes' + ID: ^WIFI_CONN_0904 + SDK: '8266_NonOS + + 8266_RTOS + + ESP32_IDF' + Test App: SSC + allow fail: '' + auto test: 'Yes' + category: Function + cmd set: + - '' + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -C -s -p 1234567890 + - ['R SSC2 RE JAP:DISCONNECTED,\d+,204'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:OK'] + - - WIFI CONN + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - SSC SSC2 sta -C -s -p + - ['R SSC2 RE JAP:DISCONNECTED,\d+,5'] + - - WIFI DISCONN + - [P PC_COM C OK, 'R SSC2 C +JAP:CONNECTED'] + - - SSC SSC1 ap -S -s -p -t 3 -m 1 + - ['P SSC1 C +SAP:OK', 'P SSC2 RE JAP:DISCONNECTED,\d+,4'] + comment: '' + execution time: 0.0 + expected result: '1. succeed + + 2. disconnect event REASON_HANDSHAKE_TIMEOUT + + 3. succeed + + 4. succeed + + 5. disconnect event REASON_ASSOC_TOOMANY + + 6. succeed, target2 connect succeed + + 7. disconnect event REASON_ASSOC_EXPIRE' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1. config target1 softap max sta allowed 1 + + 2. target2 connect to target1 with wrong password + + 3. target2 disconnect + + 4. PC WIFI NIC connect to target1 + + 5. target2 connect to target1 with correct password + + 6. PC WIFI NIC disconnect + + 7. reconfig softap' + sub module: WIFI Connect + summary: test wifi disconnect reason REASON_ASSOC_TOOMANY, REASON_HANDSHAKE_TIMEOUT, + REASON_ASSOC_EXPIRE + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.' + test point 1: basic function + test point 2: wifi disconnect reason test version: v1 (2016-8-15) - CI ready: 'Yes' ID: ^WIFI_SCAN_0101 @@ -14203,6 +14478,7 @@ test cases: 3.target2上查询到' initial condition: T2_2 initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration module: WIFI MAC steps: '1.target 2 scan .,juhg123 @@ -14221,7 +14497,7 @@ test cases: test point 2: scan with different config version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0114 + ID: ^WIFI_SCAN_0102 SDK: '8266_NonOS 8266_RTOS @@ -14233,90 +14509,35 @@ test cases: category: Function cmd set: - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT 0 - - ['R SSC1 A :ACCEPT:(\d+),\d+,.+,\d+'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -T -s - - ['R SSC1 RE CLOSE:\d+,OK'] + - - SSC SSC2 sta -S -b ff:ff:ff:ff:ff:11 + - ['R SSC2 NC +SCAN: C +SCANDONE'] + - - SSC SSC2 sta -S -b + - ['R SSC2 RE "\+SCAN:.+,%%s"%%()', 'R SSC2 NC +SCAN: C +SCANDONE'] comment: '' execution time: 0.0 - expected result: '1.OK + expected result: '1.target2 上不能查询到此mac - 2.OK + 2.target2上查询到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target2 上查询此macff:ff:ff:ff:ff:11 - 3.OK - - 4.OK - - 5.OK - - 6.OK,target1上accept 成功 - - 7.target1关闭socket1 - - 8.target1关闭socket2 - - 9.OK - - 10.OK,pc tcp server accept成功 - - 11.target1关闭socket1 - - 12.OK - - 13.OK,pc tcp server accept成功 - - 14.OK - - 15.target1关闭socket1' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: "1.PC上建立TCP 监听 test_tcp_port1\n2.target1上创建TCP socket1\n3.target1关闭socket1\n\ - 4.target1上创建TCP socket 端口随机\n5.target1上使用步骤4创建的socket1,去监听\n6.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket2 \n7.target1关闭socket1\n8.target1关闭socket2\n\ - 9.target1上创建TCP socket1\n10.target1上使用步骤10创建的socket1,去连接 PC的ip,test_tcp_port1,PC有ACCEPT\n\ - 11.target1关闭socket1\n12.target1上创建TCP socket1\n13.target1上使用步骤13创建的socket1,去连接\ - \ PC的ip,test_tcp_port1,PC有ACCEPT\n14.target1shutdown socket1\n15.target1关闭socket1" - sub module: TCP - summary: AP mode, close for different types of TCP sockets test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. + 2.target2上查询' + sub module: WIFI Scan + summary: scan with scan config bssid + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. - 1 SSC target connect with PC by UART.' + 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter + test point 2: scan with different config version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0116 + ID: ^WIFI_SCAN_0103 SDK: '8266_NonOS 8266_RTOS @@ -14328,57 +14549,47 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC2 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC3 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC4 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC5 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] - - - SOC SOC6 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -n 6 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -n 5 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -n 6 + - ['R SSC2 C +SCAN:', R SSC2 P ] comment: '' execution time: 0.0 - expected result: '1.+BIND:0,OK,0.0.0.0 + expected result: '1.target1 QAP - 2.OK + 2. target1 set AP,set channel 6 - 3.OK,pc tcp server accept成功 + 3.target2 上scan不到 channel 5 - 4.OK,pc tcp server accept成功 + 4.target2 上查询channel 6的' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target1 断开连接AP - 5.OK,pc tcp server accept成功 + 2.target1下设置ssid 和pwd 加密方式,set channel 6 - 6.OK,pc tcp server accept成功 + 3.target2 上scan channel 5 - 7.OK,pc tcp server accept成功' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: "1.target1上创建TCP socket 端口随机\n2.target1上使用步骤4创建的socket1,去监听\n3.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket2 \n4.PC CONNECT, ,tcp 连接创建成功,创建socket3\ - \ \n5.PC CONNECT, ,tcp 连接创建成功,创建socket4 \n6.PC CONNECT,\ - \ ,tcp 连接创建成功,创建socket5 \n7.PC CONNECT, ,tcp 连接创建成功,创建socket6\ - \ " - sub module: TCP - summary: AP mode, accept max TCP client by server test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. + 4.target2 上查询channel 6的' + sub module: WIFI Scan + summary: scan with scan config channel + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. - 1 SSC target connect with PC by UART.' + 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter + test point 2: scan with different config version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0111 + ID: ^WIFI_SCAN_0104 SDK: '8266_NonOS 8266_RTOS @@ -14390,47 +14601,59 @@ test cases: category: Function cmd set: - '' - - - SSC SSC1 soc -B -t TCP -p - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -L -s - - ['R SSC1 RE LISTEN:\d+,OK'] - - - SOC SOC1 CONNECT 0 - - ['R SSC1 RE ACCEPT:(\d+),\d+,.+,\d+', P SOC_COM C OK] - - - SOC SOC1 CONNECT 0 - - [P SOC_COM C ERROR, P SSC1 NC ACCEPT] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] + - - SSC SSC1 ap -S -s -p 123456789 -h 1 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -h 0 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -h 1 + - [R SSC2 P C +SCANDONE] comment: '' execution time: 0.0 - expected result: '1.OK + expected result: '1.target1 set AP,set ssid broad cast - 2.OK + 2.target 2上scan - 3.PC TCP client accept + 3.target 2上scan - 4.error' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1.target1上创建TCP socket,bind到本地端口 + 4.target1 set AP,set ssid hidden, - 2.target1上使用步骤1创建的socket,创建TCP 监听 + 5.target 2上不能查询到 - 3.PC TCP 连接到target1 , + 6.target 2上查询到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target1下设置ssid 和pwd 加密方式,set ssid broad cast - 4.PC tcp 连接到不存在的port ,' - sub module: TCP - summary: AP mode, server listen test. use different kinds of port - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. + 2.target 2上scan + + 3.target 2上scan + + 4.target1下设置ssid 和pwd 加密方式,set ssid hidden, + + 5.target 2上查询 + + 6.target 2上查询' + sub module: WIFI Scan + summary: scan with scan config show hidden + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. - 1 SSC target connect with PC by UART.' + 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter + test point 2: scan with different config version: v1 (2016-8-15) - CI ready: 'Yes' - ID: TCPIP_TCP_0113 + ID: ^WIFI_SCAN_0105 SDK: '8266_NonOS 8266_RTOS @@ -14442,154 +14665,54 @@ test cases: category: Function cmd set: - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h B - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h W - - ['R SSC1 RE SHUTDOWN:\d+,OK'] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SSC SSC1 soc -D -s -h R - - ['R SSC1 RE SHUTDOWN:\d+,OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 ap -S -s -p 123456789 -t 3 -h 0 -n 11 + - ['R SSC1 C +SAP:OK'] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 P C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 11 + - [R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b ff:ff:ff:ff:ff:11 -n 11 + - [R SSC2 P , R SSC2 NP C +SCANDONE] + - - SSC SSC2 sta -S -s -b -n 10 + - [R SSC2 P , R SSC2 NP C +SCANDONE] comment: '' execution time: 0.0 - expected result: '1.OK + expected result: '1.target1 QAP - 2.OK + 2. target1 set AP,set ssid broad cast,set channel 11 - 3.OK,pc tcp server accept成功 + 3.target2 上查询到 - 4.OK + 4.target2 上查询不到 - 5.OK + 5.target2 上查询不到 - 6.OK,pc tcp server accept成功 + 6.target2 上查询不到' + initial condition: T2_2 + initial condition description (auto): target 1 as AP+STA, target 2 as AP+STA (autogen) + level: Integration + module: WIFI MAC + steps: '1.target1 QAP - 7.OK + 2. target1 set AP,set ssid broad cast,set channel 11 - 8.OK + 3.target2 上查询到 - 9.OK,pc tcp server accept成功 + 4.target2 上查询不到 - 10.OK' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 + 5.target2 上查询不到 - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 4.target1 shutdown socket1 B - - 5.target1上创建TCP socket - - 6.target1上使用步骤5创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 7.target1 shutdown socket2 W - - 8.target1上创建TCP socket - - 9.target1上使用步骤8创建的socket,去连接 PC的ip,test_tcp_port1,PC有ACCEPT - - 10.target1 shutdown socket3 R' - sub module: TCP - summary: AP mode, shutdown basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. + 6.target2 上查询不到' + sub module: WIFI Scan + summary: scan with several configs + test environment: SSC_T2_1 + test environment description (auto): 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. - 1 SSC target connect with PC by UART.' + 2 SSC target connect with PC by UART.' test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter - version: v1 (2016-8-15) -- CI ready: 'Yes' - ID: TCPIP_TCP_0112 - SDK: '8266_NonOS - - 8266_RTOS - - ESP32_IDF' - Test App: SSC - allow fail: '' - auto test: 'Yes' - category: Function - cmd set: - - '' - - - SOC SOC1 LISTEN - - [R SOC_COM L OK] - - - SSC SSC1 soc -B -t TCP - - ['R SSC1 A :BIND:(\d+),OK'] - - - SSC SSC1 soc -C -s -i -p - - ['R SSC1 RE CONNECT:\d+,OK'] - - - SOC SOC1 ACCEPT SOC2 - - [R SOC_COM L OK] - - - SOC SOC2 SEND 5 - - [R SSC1 SL +5] - - - SSC SSC1 soc -S -s -l 5 - - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 5] - - - SOC SOC2 SEND 146000 - - [R SSC1 SL +146000] - - - SSC SSC1 soc -S -s -l 1460 -n 100 - - ['P SSC1 RE SEND:\d+,OK', P SOC2 RL 146000] - comment: '' - execution time: 0.0 - expected result: '1.OK - - 2.OK - - 3.OK,pc tcp server accept成功 - - 4.OK - - 5.target收到5byte数据 - - 6.PC收到5byte数据 - - 7.target收到146000 byte数据 - - 8.OK,PC 收到146000 byte数据' - initial condition: APM2 - initial condition description (auto): AP mode, PC join AP, DHCP on, will autogen - a TC with initial condition APSTA2 - module: TCPIP - steps: '1. PC上建立TCP 监听 test_tcp_port1 - - 2.target1上创建TCP socket - - 3.target1上使用步骤2创建的socket,去连接 PC的ip,test_tcp_port1 - - 4.PC与target1 创建好TCP 连接,有ACCEPT - - 5.PC send 5 bytes to 8266 - - 6.8266 send 5 bytes to PC - - 7. PC send 100 * 1460 data to 8266, - - 8.8266 send 100 * 1460 to PC. ' - sub module: TCP - summary: AP mode, send/recv basic test - test environment: SSC_T1_1 - test environment description (auto): 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.' - test point 1: basic function - test point 2: use TCP SAP (socket/espconn API) with different parameter + test point 2: scan with different config version: v1 (2016-8-15) diff --git a/components/test/TestEnvAll.yml b/components/idf_test/integration_test/TestEnvAll.yml similarity index 100% rename from components/test/TestEnvAll.yml rename to components/idf_test/integration_test/TestEnvAll.yml index a978f5f73a..afa6cb812a 100644 --- a/components/test/TestEnvAll.yml +++ b/components/idf_test/integration_test/TestEnvAll.yml @@ -1,82 +1,18 @@ test environment: -- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_SmartConfig, - test environment detail: '2 SSC target connect with PC by UART. - - PC has 1 WiFi NIC. - - One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_SmartConfig, - test environment detail: '2 AT target connect with PC by UART (AT and LOG port). - - PC has 1 WiFi NIC. - - One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_IOT1, - test environment detail: 'PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART. - - AP todo IOT test are placed near SSC1.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 - - SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, - tag: SSC_T2_GPIO3, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266之间需要测试的Target_GPIO相连', - test script: EnvBase} -- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_1, - test environment detail: 'Web Server target connect with PC by UART. - - PC has 1 wired NIC connected to switch. - - APC, AP also connect with swtich. - - All devices connected with switch use same IP subnet. - - APC control AP power supply.', test script: EnvBase} -- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_2, - test environment detail: 'Web Server target connect with PC by UART. - - 4 PC with WiFi NIC placed near WebServer1.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 - - SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, - tag: SSC_T2_GPIO1, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266的 - GPIO_6相连', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_Enterprise, - test environment detail: "AP use WPA2-Etherprise is placed near SSC1. \n1 SSC target\ - \ connect with PC by UART.", test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 - - SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, - tag: SSC_T2_GPIO2, test environment detail: '[TBD] 1. 2个ESP_8266通过UART连到PC, ESP_8266的 - GPIO_15通过面包板相连 - - 2. 可借助面包板, 将GPIO_15, 以及中断函数被打开的8266板的GPIO_2 相连', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_HighSpeedUART, +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_1, test environment detail: 'PC has 2 wired NIC connected to AP. PC has 1 WiFi NIC. - 1 AT target connect with PC by high speed UART (AT and LOG port).', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_ShieldBox, - test environment detail: '2 SSC target connect with PC by UART. - - Put them to Shield box.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_3, - test environment detail: 'Able to access WAN after connect to AP. - 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} - {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_2, test environment detail: 'PC has 1 WiFi NIC. 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_3, + test environment detail: 'Able to access WAN after connect to AP. - SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, - tag: UART_T1_2, test environment detail: '[TBD] ESP_8266通过UART_0通过USB, UART_1 TXD - 通过 TTLcable 连到PC', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', - basic param list: '', script path: EnvBase.py, tag: UART_T1_1, test environment detail: '[TBD] - 将ESP_8266通过UART连到PC', test script: EnvBase} + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_ADC, test environment detail: 'PC has 1 wired NIC connected to AP. @@ -85,10 +21,88 @@ test environment: Multimeter connect to input, able to measure input voltage. 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_WEP, - test environment detail: '1 SSC target connect with PC by UART. +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC1, + test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ + \ connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply. \nPC has 1 WiFi NIC. \n1 AT target connect with PC by UART\ + \ (AT and LOG port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC2, + test environment detail: "Able to access WAN after connect to AP.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply.\nPC has 1 WiFi NIC.\n1 AT target connect with PC by UART (AT\ + \ and LOG port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_HighSpeedUART, + test environment detail: 'PC has 2 wired NIC connected to AP. - One WEP share key AP placed near SSC1.', test script: EnvBase} + PC has 1 WiFi NIC. + + 1 AT target connect with PC by high speed UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_SmartConfigIOT, + test environment detail: '1 AT target connect with PC by UART (AT and LOG port). + + PC has 1 wired NIC connect to Common AP. + + Several AP are placed near AT target. + + Several smart phone installed test APK are placed near AT target.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_JAP, + test environment detail: "Several AP are placed near AT target.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC).\nAPC control\ + \ power supply for all APs. \n2 AT target connect with PC by UART (AT and LOG\ + \ port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_Sleep, + test environment detail: 'AP support DTIM placed with AT target. + + 2 AT target connect with PC by UART (AT and LOG port). + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of AT1. + + AT1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO.', + test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_SmartConfig, + test environment detail: '2 AT target connect with PC by UART (AT and LOG port). + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: IR_T2_1, test environment detail: '[TBD] 本测试为非自动测试, 红外能够做到数据收发吻合即可通过', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: NVS_T1_1, + test environment detail: '1 NVS target connect with PC by UART. + + 1 SSC target connect with PC by UART. + + SSC2 GPIO connect to NVS1 power control pin.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: PWM_T1_1, test environment detail: "[TBD]\ + \ 1. PWM OS SDK 以及 Non-OS SDK的测试建议分开进行, 放在不同的文件夹, 防止文件命名混淆\n2. 分析CSV文件的Python脚本只能分析单个channel\ + \ \n3. 如果Init脚本打印\"Network Error\" 检查TCP Server是不是正常发送data", test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_1, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_2, + test environment detail: 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_8089, + test environment detail: 'PC has 1 wired NIC connected to AP. + + 1 8089 tablet able to run iperf test placed near SSC1. + + 1 SSC target connect with PC by UART.', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ADC, test environment detail: 'PC has 1 wired NIC connected to AP. @@ -102,12 +116,15 @@ test environment: \ connected to APC (static IP within the same subnet with APC). \nAPC control\ \ AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with PC by UART.", test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_8089, - test environment detail: 'PC has 1 wired NIC connected to AP. +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_Enterprise, + test environment detail: "AP use WPA2-Etherprise is placed near SSC1. \n1 SSC target\ + \ connect with PC by UART.", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_IOT1, + test environment detail: 'PC has 1 WiFi NIC. - 1 8089 tablet able to run iperf test placed near SSC1. + 1 SSC target connect with PC by UART. - 1 SSC target connect with PC by UART.', test script: EnvBase} + AP todo IOT test are placed near SSC1.', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T1_InitData, test environment detail: '2 SSC target connect with PC by UART. @@ -116,30 +133,6 @@ test environment: SSC2 use normal 26M crystal oscillator. SSC2 GPIO connect to SSC1 power control pin.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', - basic param list: '', script path: EnvBase.py, tag: SSC_T1_Timer, test environment detail: '[TBD] - 通过串口工具调节Timer, 将GPIO_13端口连接到逻辑分析仪', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 3.0, script path: EnvBase.py, tag: SSC_T3_PhyMode, - test environment detail: '3 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). - - Put 4 APs near SSC targets.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_JAP, - test environment detail: "Several AP are placed near AT target.\nPC has 1 wired\ - \ NIC connected to APC (static IP within the same subnet with APC).\nAPC control\ - \ power supply for all APs. \n2 AT target connect with PC by UART (AT and LOG\ - \ port).", test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_PhyMode, - test environment detail: '2 SSC target connect with PC by UART. - - PC has one WiFi NIC support capture wlan packet using libpcap. - - Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. - - Put 4 APs near SSC targets.', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ShieldBox, test environment detail: 'refer to figure. @@ -148,12 +141,100 @@ test environment: PC wired NIC should set static IP address within the same subnet with AP. Must use onboard wired NIC.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_TempBox, + test environment detail: '1 SSC target connect with PC by UART. + + Put SSC target to temperature box.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: SSC_T1_Timer, test environment detail: '[TBD] + 通过串口工具调节Timer, 将GPIO_13端口连接到逻辑分析仪', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_VDD33, + test environment detail: '1 SSC target connect with PC by UART. + + Multimeter connect to VDD33, able to measure voltage.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_WEP, + test environment detail: '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.', test script: EnvBase} - {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_1, test environment detail: 'PC has 1 wired NIC connected to AP. PC has 1 WiFi NIC. 2 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO1, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_6相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO2, test environment detail: '[TBD] 1. 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_15通过面包板相连 + + 2. 可借助面包板, 将GPIO_15, 以及中断函数被打开的8266板的GPIO_2 相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO3, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266之间需要测试的Target_GPIO相连', + test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_PhyMode, + test environment detail: '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_ShieldBox, + test environment detail: '2 SSC target connect with PC by UART. + + Put them to Shield box.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep1, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO. + + SSC1''s XPD connect with RSTB.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep2, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s RSTB pin connect with AT2''s GPIO.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_SmartConfig, + test environment detail: '2 SSC target connect with PC by UART. + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 3.0, script path: EnvBase.py, tag: SSC_T3_PhyMode, + test environment detail: '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 5.0, script path: EnvBase.py, tag: SSC_T5_1, + test environment detail: 5 SSC target connect with PC by UART., test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T6_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 6 SSC target connect with PC by UART.', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: TempSensor_T1_1, test environment detail: 'Tempeture sensor target connect with PC by UART. @@ -170,106 +251,25 @@ test environment: All devices connected with switch use the same IP subnet. APC control AP power supply.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_SmartConfigIOT, - test environment detail: '1 AT target connect with PC by UART (AT and LOG port). - - PC has 1 wired NIC connect to Common AP. - - Several AP are placed near AT target. - - Several smart phone installed test APK are placed near AT target.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_Sleep, - test environment detail: 'AP support DTIM placed with AT target. - - 2 AT target connect with PC by UART (AT and LOG port). - - Multimeter connect with PC via GPIB. - - Series multimeter between GND and VCC of AT1. - - AT1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO.', - test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 5.0, script path: EnvBase.py, tag: SSC_T5_1, - test environment detail: 5 SSC target connect with PC by UART., test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_TempBox, - test environment detail: '1 SSC target connect with PC by UART. - - Put SSC target to temperature box.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_1, - test environment detail: 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T6_1, - test environment detail: 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 6 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: UART_T1_1, test environment detail: '[TBD] + 将ESP_8266通过UART连到PC', test script: EnvBase} - {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, - tag: IR_T2_1, test environment detail: '[TBD] 本测试为非自动测试, 红外能够做到数据收发吻合即可通过', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_VDD33, - test environment detail: '1 SSC target connect with PC by UART. + tag: UART_T1_2, test environment detail: '[TBD] ESP_8266通过UART_0通过USB, UART_1 TXD + 通过 TTLcable 连到PC', test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_1, + test environment detail: 'Web Server target connect with PC by UART. - Multimeter connect to VDD33, able to measure voltage.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', - basic param list: '', script path: EnvBase.py, tag: PWM_T1_1, test environment detail: "[TBD]\ - \ 1. PWM OS SDK 以及 Non-OS SDK的测试建议分开进行, 放在不同的文件夹, 防止文件命名混淆\n2. 分析CSV文件的Python脚本只能分析单个channel\ - \ \n3. 如果Init脚本打印\"Network Error\" 检查TCP Server是不是正常发送data", test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: NVS_T1_1, - test environment detail: '1 NVS target connect with PC by UART. + PC has 1 wired NIC connected to switch. - 1 SSC target connect with PC by UART. + APC, AP also connect with swtich. - SSC2 GPIO connect to NVS1 power control pin.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep2, - test environment detail: 'AP support DTIM placed with AT target. + All devices connected with switch use same IP subnet. - 2 SSC target connect with PC by UART. + APC control AP power supply.', test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_2, + test environment detail: 'Web Server target connect with PC by UART. - Multimeter connect with PC via GPIB. - - Series multimeter between GND and VCC of SSC1. - - SSC1''s RSTB pin connect with AT2''s GPIO.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep1, - test environment detail: 'AP support DTIM placed with AT target. - - 2 SSC target connect with PC by UART. - - Multimeter connect with PC via GPIB. - - Series multimeter between GND and VCC of SSC1. - - SSC1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO. - - SSC1''s XPD connect with RSTB.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_1, - test environment detail: 'PC has 1 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 2 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_1, - test environment detail: 'PC has 2 wired NIC connected to AP. - - PC has 1 WiFi NIC. - - 1 SSC target connect with PC by UART.', test script: EnvBase} -- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_2, - test environment detail: 'Able to access WAN after connect to AP. - - 1 SSC target connect with PC by UART.', test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC2, - test environment detail: "Able to access WAN after connect to AP.\nPC has 1 wired\ - \ NIC connected to APC (static IP within the same subnet with APC). \nAPC control\ - \ AP power supply.\nPC has 1 WiFi NIC.\n1 AT target connect with PC by UART (AT\ - \ and LOG port).", test script: EnvBase} -- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC1, - test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ - \ connected to APC (static IP within the same subnet with APC). \nAPC control\ - \ AP power supply. \nPC has 1 WiFi NIC. \n1 AT target connect with PC by UART\ - \ (AT and LOG port).", test script: EnvBase} + 4 PC with WiFi NIC placed near WebServer1.', test script: EnvBase} diff --git a/components/idf_test/uint_test/InitialConditionAll.yml b/components/idf_test/uint_test/InitialConditionAll.yml new file mode 100644 index 0000000000..ba06af9f87 --- /dev/null +++ b/components/idf_test/uint_test/InitialConditionAll.yml @@ -0,0 +1,2935 @@ +initial condition: +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, DHCP on, will autogen a TC with initial condition + APSTA1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 31.0 + tag: APM1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, PC join AP, DHCP on, will autogen a TC with initial + condition APSTA2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 38.0 + tag: APM2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 31.0 + tag: APO1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: AP mode, will NOT autogen a TC with initial condition + APSTA2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 38.0 + tag: APO2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + initial condition detail: AP only mode, running BIN0 (located on flash id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: APOBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + initial condition detail: testing ap on sta + ap mode (autogen by APM1) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 59.0 + tag: APSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 ap -Q + - ['R SSC1 RE "\+APCONFIG:%%s,%%s,\d+,\d+,\d+,4,"%%(,)'] + - - SSC SSC1 ap -L + - ['R SSC1 RE "\+LSTA:.+,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + initial condition detail: testing ap on sta + ap mode, PC join AP (autogen by APM2) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC1 ap -S -s -p -t + - ['R SSC1 C +SAP:OK'] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 66.0 + tag: APSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 5 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + initial condition detail: StationSoftAP mode + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: ATAP1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 5 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, PC join Target AP, multi link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 R *] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: ATAP3 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - DELAY 10 + - [''] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, PC join Target AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: ATAP4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, both PC join Target AP, single link, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAP5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, both PC join Target AP, multi link, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAP6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:2'] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 59.0 + tag: ATAPO1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 R *] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 66.0 + tag: ATAPO3 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 L OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATC AT1 CWSAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + - - WIFI CONN + + - ['R PC_COM NC ERROR C +WIFICONN:OK'] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: SoftAP mode, PC join Target AP, single link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWLIF + - [R AT1 P ] + - - ATS AT1 AT+CWDHCP_DEF=0,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 73.0 + tag: ATAPO4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: SoftAP mode, both PC join Target AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAPO5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: SoftAP mode, both PC join Target AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATAPO6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, DHCP client on + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: ATAPSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 94.0 + tag: ATAPSTA3 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: StationSoftAP mode, connected to AP, single link, use + dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CWDHCP_DEF=2,1 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 101.0 + tag: ATAPSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, multi link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 129.0 + tag: ATAPSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:3'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: StationSoftAP mode, connected to AP, single link, use + static ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 136.0 + tag: ATAPSTA6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + initial condition detail: 'first time usage. Use restore function. ' + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+RESTORE + - [R AT1 L OK, R AT1 C ready] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 143.0 + tag: ATFTU + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT + - [R AT1 L OK] + - - ATS AT1 AT + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+RST + - [R AT1 L OK] + initial condition detail: none + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 3.0 + tag: ATNone + test script: InitCondBase +- check cmd set: + - '' + - - DELAY 0.1 + - [dummy] + force restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + initial condition detail: none 2 + restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 108.0 + tag: ATNone2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: same as STA1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATOSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: same as STA4, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ATOSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:1 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + initial condition detail: same as OT2_1, but will not autogen STA+AP STA test case + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: ATOT2_1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: station mode, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATSTA1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + initial condition detail: station mode, DHCP client on, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 10.0 + tag: ATSTA2 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, multi link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: ATSTA3 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CWDHCP_CUR? + - ['R AT1 C DHCP:3'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + initial condition detail: station mode, connected to AP, single link, use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATS AT1 AT+CWDHCP_DEF=1,1 + - [R AT1 R *] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ATSTA4 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:1'] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, multi link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=1 + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 115.0 + tag: ATSTA5 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 L +CWMODE_CUR:1'] + - - ATS AT1 AT+CWJAP_CUR? + - ['R AT1 C +CWJAP_CUR:', R AT1 P ] + - - ATS AT1 AT+CIPMUX? + - ['R AT1 L +CIPMUX:0'] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + initial condition detail: station mode, connected to AP, single link, use static + ip + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=1 + - [R AT1 L OK] + - - ATC AT1 CWJAP_DEF + - [R AT1 L OK] + - - ATS AT1 AT+CIPSERVER=0 + - [R AT1 R *] + - - ATC AT1 CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMUX=0 + - [R AT1 L OK] + - - ATS AT1 AT+CIPCLOSE + - [R AT1 R *] + - - ATS AT1 AT+CIPMODE=0 + - [R AT1 R *] + - - ATC AT1 CIPSTA_DEF + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 122.0 + tag: ATSTA6 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:3 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:1 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + initial condition detail: Target 1 in StationSoftAP mode, Target 2 in station mode, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=3 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=1 + - [R AT2 L OK] + - - ATS AT1 AT+CWQAP + - [R AT1 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 52.0 + tag: ATT2_1 + test script: InitCondBase +- check cmd set: + - '' + - - ATS AT1 AT+CWMODE_CUR? + - ['R AT1 C +CWMODE_CUR:2 C OK'] + - - ATS AT2 AT+CWMODE_CUR? + - ['R AT2 C +CWMODE_CUR:3 C OK'] + - - ATS AT1 AT+CWJAP_CUR? + - [R AT1 NC OK L ERROR] + force restore cmd set: + - '' + - - ATS AT1 AT+RST + - [R AT1 C ready] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] + initial condition detail: Target 1 in SoftAP mode, Target 2 in StationSoftAP mode, + use dhcp + restore cmd set: + - '' + - - ATSO AT1 +++ + - [''] + - - ATS AT1 AT + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - ATS AT1 AT+CWMODE_DEF=2 + - [R AT1 L OK] + - - ATS AT2 AT+CWMODE_DEF=3 + - [R AT2 L OK] + restore post cmd set: + - '' + - - ATS AT1 AT+CWSTOPSMART + - [R AT1 R *] + - - ATS AT1 AT+SAVETRANSLINK=0 + - [R AT1 R *] + - - AT+SYSRAM + - ['R AT1 A :(\d+)'] + script path: InitCondBase.py + start: 80.0 + tag: ATT2_2 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + initial condition detail: all mesh node disabled + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] op -S -o 1 + - ['P SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] sta -D + - ['P SSC[1-] C +QAP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: DISABLED + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + initial condition detail: all mesh node enabled as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SOC SOC1 LISTEN + - [R SOC_COM L OK] + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC[1-] mesh -A -s -k + - ['P SSC[1-] C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 2 + - ['P SSC1 C +MESH:ENABLED'] + - - SOC SOC1 MACCEPT GSOC1 + - [R SOC_COM L OK] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - ['P SSC[2-] C +MESH:ENABLED'] + - - DELAY 60 + - [''] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + - - SSC SSC[1-] mesh -O -t 1 -o 1 + - ['P SSC[1-] C +MESH:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: ENABLED_1 + test script: InitCondBase +- check cmd set: + - '' + - - ASSERT + - [dummy] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['P SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + initial condition detail: root as LOCAL, rest node as ONLINE, mesh network established + restore cmd set: + - '' + - - SSC SSC[1-] mesh -E -o 0 + - ['P SSC[1-] C +MESH:DISABLED'] + - - SSC SSC[1-] mesh -I -g -a 4 -k -i + -p -h 5 + - ['P SSC[1-] C ENCRYPTION,OK C GROUP,OK C SERVER,OK C HOP,OK'] + - - SSC SSC1 mesh -A -s -k + - ['P SSC1 C +MESHINIT:AP,OK'] + - - SSC SSC1 mesh -E -o 1 -t 1 + - ['P SSC1 C +MESH:ENABLED'] + - - SSC SSC[2-] mesh -E -o 1 -t 2 + - [''] + - - DELAY 60 + - ['P SSC[2-] C +MESH:ENABLED'] + - - SSC SSC[1-] mesh -C + - ['P SSC[1-] C +MESH:CONNECTED'] + - - SSC SSC[1-] mesh -Q -t 4 + - ['R SSC[1-] T '] + - - MESHTREE + - ['R PC_COM RE "MESHTREE:%%s%20nodes"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: ENABLED_2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['R SSC[1-] C !!!ready!!!'] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -m -o 2 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + initial condition detail: one target in AP mode and espnow is de-initialized + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 mac -S -m -o 2 + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC1 espnow -D + - ['R SSC1 C +ESPNOW:'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: NOW1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1-] op -Q + - ['R SSC[1-] C +CURMODE:2'] + - - SSC SSC[1-] mac -Q -o 3 + - ['R SSC[1-] P ]_ap_mac> P ]_mac>'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + force restore cmd set: + - '' + - - SSC SSC[1-] reboot + - ['R SSC[1-] C !!!ready!!!'] + - - SSC SSC[1-] op -S -o 3 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] mac -S -m ]_ap_mac> -o 2 + - ['R SSC[1-] C +MAC:AP,OK'] + - - SSC SSC[1-] mac -S -m ]_mac> -o 1 + - ['R SSC[1-] C +MAC:STA,OK'] + - - SSC SSC[1-] op -S -o 2 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + initial condition detail: multiple () targets in AP mode, espnow is initialized + with self role slave + restore cmd set: + - '' + - - SSC SSC[1-] op -S -o 3 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] mac -S -m ]_ap_mac> -o 2 + - ['R SSC[1-] C +MAC:AP,OK'] + - - SSC SSC[1-] mac -S -m ]_mac> -o 1 + - ['R SSC[1-] C +MAC:STA,OK'] + - - SSC SSC[1-] op -S -o 2 + - ['R SSC[1-] C +MODE:OK'] + - - SSC SSC[1-] espnow -D + - ['R SSC[1-] C +ESPNOW:'] + - - SSC SSC[1-] espnow -I + - ['R SSC[1-] C +ESPNOW:OK'] + - - SSC SSC[1-] espnow -R -t Set -r 2 + - ['R SSC[1-] C +ESPNOW:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: NOW2 + test script: InitCondBase +- check cmd set: + - '' + - - DELAY 0.1 + - [dummy] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + initial condition detail: none + restore cmd set: + - '' + - - DELAY 0.1 + - [dummy] + restore post cmd set: + - '' + - - DELAY 0.1 + - [dummy] + script path: InitCondBase.py + start: 10.0 + tag: None + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + initial condition detail: one target and simple is de-inited + restore cmd set: + - '' + - - SSC SSC1 sp -D + - ['R SSC1 C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 31.0 + tag: PAIR1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1,2] op -Q + - ['R SSC[1,2] C +MODE:[2,1]'] + - - SSC SSC[1,2] mac -Q -o 3 + - ['R SSC[1,2] P P '] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC[1,2] reboot + - ['R SSC[1,2] C !!!ready!!!'] + - - SSC SSC[1,2] op -S -o 3 + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] op -S -o [2,1] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + initial condition detail: target1 in AP mode, target2 in STA mode, two targets de-init + and init simple pair + restore cmd set: + - '' + - - SSC SSC[1,2] op -S -o 3 + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] op -S -o [2,1] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 38.0 + tag: PAIR2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1,2] op -Q + - ['R SSC[1,2] C +MODE:[3,3]'] + - - SSC SSC[1,2] mac -Q -o 3 + - ['R SSC[1,2] P P '] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + force restore cmd set: + - '' + - - SSC SSC[1,2] reboot + - ['R SSC[1,2] C !!!ready!!!'] + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + initial condition detail: target1 and target2 in STA+AP mode, two targets de-init + and init simple pair + restore cmd set: + - '' + - - SSC SSC[1,2] op -S -o [3,3] + - ['R SSC[1,2] C +MODE:OK'] + - - SSC SSC[1,2] mac -S -m -o 2 + - ['R SSC[1,2] C +MAC:AP,OK'] + - - SSC SSC[1,2] mac -S -m -o 1 + - ['R SSC[1,2] C +MAC:STA,OK'] + - - SSC SSC[1,2] sp -D + - ['R SSC[1,2] C +SP:OK'] + - - SSC SSC[1,2] sp -I + - ['R SSC[1,2] C +SP:OK'] + restore post cmd set: + - '' + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 45.0 + tag: PAIR3 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: testing sta on sta + ap mode, quit AP (autogen by STAM1) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 45.0 + tag: STAAP1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: testing sta on sta + ap mode, join AP, DHCP on (autogen + by STAM2) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 52.0 + tag: STAAP2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: APSTA mode, connected to AP, running BIN0 (located on + flash id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 24.0 + tag: STAAPBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, DHCP on, will autogen a TC with initial + condition STAAP1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 17.0 + tag: STAM1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on, will autogen a TC with initial + condition STAAP2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 24.0 + tag: STAM2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 1 + - ['R SSC1 C BIN_ID,0'] + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + force restore cmd set: + - '' + - - SSC SSC1 upgrade -R -r 1 -s + - [R SSC1 NC ERROR C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SOC SOC1 ULISTEN + - [R SOC_COM L OK] + - - SOC SOC1 SETOPT REPLY BIN + - [R SOC_COM C OK] + - - SSC SSC1 upgrade -I -b 0 -f 0 + - ['P SSC1 C +UPGRADE:OK'] + - - SSC SSC1 upgrade -U -i -p -u + - ['P SSC1 C +UPGRADE:SUCCEED'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: STA mode, connected to AP, running BIN0 (located on flash + id 0) + restore cmd set: + - '' + - - SSC SSC1 upgrade -Q -t 2 -b 0 + - ['R SSC1 C BIN_INFO,0'] + - - SSC SSC1 upgrade -R -b 0 + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 upgrade -D + - ['R SSC1 C +UPGRADE:OK'] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 17.0 + tag: STAMBIN0 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + initial condition detail: sta mode, quit AP, will NOT autogen a TC with initial + condition STAAP1 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 sta -D + - ['R SSC1 C +QAP:'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 17.0 + tag: STAO1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:1'] + - - SSC SSC1 sta -Q + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + - - SSC SSC1 dhcp -Q -o 1 + - ['R SSC1 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 1 + - [R SSC1 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + initial condition detail: sta mode, join AP, DHCP on, will NOT autogen a TC with + initial condition STAAP2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 1 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC1 dhcp -S -o 1 + - [R SSC1 C +DHCP] + - - SSC SSC1 mac -S -o 1 -m + - ['R SSC1 C +MAC:STA,OK'] + - - SSC SSC1 sta -C -s -p + - ['R SSC1 RE "\+JAP:CONNECTED,%%s"%%()'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 24.0 + tag: STAO2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:1'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: same as T2_1 but will NOT autogen a TC with initial condition + T2_2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 73.0 + tag: T2O_1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:2'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:1'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: target 1 as SoftAP, target 2 as STA, will autogen a TC + with initial condition T2_2 + restore cmd set: + - '' + - - SSC SSC1 op -S -o 2 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 1 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [''] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 73.0 + tag: T2_1 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC1 op -Q + - ['R SSC1 C +CURMODE:3'] + - - SSC SSC2 op -Q + - ['R SSC2 C +CURMODE:3'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -Q -o 2 + - ['R SSC1 C +DHCP:AP,STARTED'] + - - SSC SSC2 dhcp -Q -o 1 + - ['R SSC2 C +DHCP:STA,STARTED'] + - - SSC SSC1 mac -Q -o 2 + - [R SSC1 P ] + - - SSC SSC2 mac -Q -o 1 + - [R SSC2 P ] + force restore cmd set: + - '' + - - SSC SSC1 reboot + - [R SSC1 C !!!ready!!!] + - - SSC SSC2 reboot + - [R SSC2 C !!!ready!!!] + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 3 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + initial condition detail: target 1 as AP+STA, target 2 as AP+STA (autogen) + restore cmd set: + - '' + - - SSC SSC1 op -S -o 3 + - ['R SSC1 C +MODE:OK'] + - - SSC SSC2 op -S -o 3 + - ['R SSC2 C +MODE:OK'] + - - SSC SSC2 sta -D + - ['R SSC2 C +QAP:'] + - - SSC SSC2 soc -T + - [R SSC2 C +CLOSEALL] + - - SSC SSC1 dhcp -S -o 2 + - [R SSC1 C +DHCP] + - - SSC SSC2 dhcp -S -o 1 + - [R SSC2 C +DHCP] + - - SSC SSC1 mac -S -o 2 -m + - ['R SSC1 C +MAC:AP,OK'] + - - SSC SSC2 mac -S -o 1 -m + - ['R SSC2 C +MAC:STA,OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 ram + - ['R SSC1 C +FREEHEAP:'] + script path: InitCondBase.py + start: 80.0 + tag: T2_2 + test script: InitCondBase +- check cmd set: + - '' + - - SSC SSC[1-3] op -Q + - ['R SSC[1-3] C +CURMODE:3'] + - - SSC SSC[1-3] phy -Q -o 3 + - ['R SSC[1-3] C STA,n,40 C AP,n,40'] + force restore cmd set: + - '' + - - SSC SSC[1-3] reboot + - ['R SSC[1-3] C !!!ready!!!'] + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] + initial condition detail: '1. target 1 and target 2 set to AP+STA mode, target 3 + set to STA mode + + 2. all interface of target 2,3 set to 11n ht40 + + 3. config softAP of target 1 and target 2' + restore cmd set: + - '' + - - SSC SSC[1-3] op -S -o 3 + - ['R SSC[1-3] C +MODE:OK'] + - - SSC SSC[1-3] phy -S -o 3 -m n -b 40 + - ['R SSC[1-3] C +PHY:OK'] + restore post cmd set: + - '' + - - SSC SSC1 soc -T + - [R SSC1 C +CLOSEALL] + - - SSC SSC1 sta -R -r 1 + - [R SSC1 C OK] + - - SSC SSC1 ram + - ['R SSC1 A :(\d+)'] + script path: InitCondBase.py + start: 87.0 + tag: T3_PHY1 + test script: InitCondBase diff --git a/components/idf_test/uint_test/TestCaseAll.yml b/components/idf_test/uint_test/TestCaseAll.yml new file mode 100644 index 0000000000..2b2c65e0bd --- /dev/null +++ b/components/idf_test/uint_test/TestCaseAll.yml @@ -0,0 +1 @@ +test cases: [] diff --git a/components/idf_test/uint_test/TestEnvAll.yml b/components/idf_test/uint_test/TestEnvAll.yml new file mode 100644 index 0000000000..afa6cb812a --- /dev/null +++ b/components/idf_test/uint_test/TestEnvAll.yml @@ -0,0 +1,275 @@ +test environment: +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_1, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_2, + test environment detail: 'PC has 1 WiFi NIC. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_3, + test environment detail: 'Able to access WAN after connect to AP. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_ADC, + test environment detail: 'PC has 1 wired NIC connected to AP. + + Analog input connect to AT1 TOUT. + + Multimeter connect to input, able to measure input voltage. + + 1 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC1, + test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ + \ connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply. \nPC has 1 WiFi NIC. \n1 AT target connect with PC by UART\ + \ (AT and LOG port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_APC2, + test environment detail: "Able to access WAN after connect to AP.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply.\nPC has 1 WiFi NIC.\n1 AT target connect with PC by UART (AT\ + \ and LOG port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_HighSpeedUART, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 AT target connect with PC by high speed UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: AT_T1_SmartConfigIOT, + test environment detail: '1 AT target connect with PC by UART (AT and LOG port). + + PC has 1 wired NIC connect to Common AP. + + Several AP are placed near AT target. + + Several smart phone installed test APK are placed near AT target.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 AT target connect with PC by UART (AT and LOG port).', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_JAP, + test environment detail: "Several AP are placed near AT target.\nPC has 1 wired\ + \ NIC connected to APC (static IP within the same subnet with APC).\nAPC control\ + \ power supply for all APs. \n2 AT target connect with PC by UART (AT and LOG\ + \ port).", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_Sleep, + test environment detail: 'AP support DTIM placed with AT target. + + 2 AT target connect with PC by UART (AT and LOG port). + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of AT1. + + AT1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO.', + test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: AT_T2_SmartConfig, + test environment detail: '2 AT target connect with PC by UART (AT and LOG port). + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: IR_T2_1, test environment detail: '[TBD] 本测试为非自动测试, 红外能够做到数据收发吻合即可通过', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: NVS_T1_1, + test environment detail: '1 NVS target connect with PC by UART. + + 1 SSC target connect with PC by UART. + + SSC2 GPIO connect to NVS1 power control pin.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: PWM_T1_1, test environment detail: "[TBD]\ + \ 1. PWM OS SDK 以及 Non-OS SDK的测试建议分开进行, 放在不同的文件夹, 防止文件命名混淆\n2. 分析CSV文件的Python脚本只能分析单个channel\ + \ \n3. 如果Init脚本打印\"Network Error\" 检查TCP Server是不是正常发送data", test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_1, + test environment detail: 'PC has 2 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_2, + test environment detail: 'Able to access WAN after connect to AP. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_8089, + test environment detail: 'PC has 1 wired NIC connected to AP. + + 1 8089 tablet able to run iperf test placed near SSC1. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ADC, + test environment detail: 'PC has 1 wired NIC connected to AP. + + Analog input connect to SSC1 TOUT. + + Multimeter connect to input, able to measure input voltage. + + 1 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_APC, + test environment detail: "PC has 1 wired NIC connected to AP.\nPC has 1 wired NIC\ + \ connected to APC (static IP within the same subnet with APC). \nAPC control\ + \ AP power supply. \nPC has 1 WiFi NIC. \n1 SSC target connect with PC by UART.", + test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_Enterprise, + test environment detail: "AP use WPA2-Etherprise is placed near SSC1. \n1 SSC target\ + \ connect with PC by UART.", test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_IOT1, + test environment detail: 'PC has 1 WiFi NIC. + + 1 SSC target connect with PC by UART. + + AP todo IOT test are placed near SSC1.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T1_InitData, + test environment detail: '2 SSC target connect with PC by UART. + + SSC1 use 40M crystal oscillator. + + SSC2 use normal 26M crystal oscillator. + + SSC2 GPIO connect to SSC1 power control pin.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_ShieldBox, + test environment detail: 'refer to figure. + + All APs and APC should be set to the same IP subnet. + + PC wired NIC should set static IP address within the same subnet with AP. + + Must use onboard wired NIC.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_TempBox, + test environment detail: '1 SSC target connect with PC by UART. + + Put SSC target to temperature box.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: SSC_T1_Timer, test environment detail: '[TBD] + 通过串口工具调节Timer, 将GPIO_13端口连接到逻辑分析仪', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_VDD33, + test environment detail: '1 SSC target connect with PC by UART. + + Multimeter connect to VDD33, able to measure voltage.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T1_WEP, + test environment detail: '1 SSC target connect with PC by UART. + + One WEP share key AP placed near SSC1.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 2 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO1, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_6相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO2, test environment detail: '[TBD] 1. 2个ESP_8266通过UART连到PC, ESP_8266的 + GPIO_15通过面包板相连 + + 2. 可借助面包板, 将GPIO_15, 以及中断函数被打开的8266板的GPIO_2 相连', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: SSC_T2_GPIO3, test environment detail: '[TBD] 2个ESP_8266通过UART连到PC, ESP_8266之间需要测试的Target_GPIO相连', + test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_PhyMode, + test environment detail: '2 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with phy mode 11b, 11g, 11n HT20, 11n HT40. + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_ShieldBox, + test environment detail: '2 SSC target connect with PC by UART. + + Put them to Shield box.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep1, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s light sleep wakeup pin and wakeup indication connect with AT2''s GPIO. + + SSC1''s XPD connect with RSTB.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_Sleep2, + test environment detail: 'AP support DTIM placed with AT target. + + 2 SSC target connect with PC by UART. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of SSC1. + + SSC1''s RSTB pin connect with AT2''s GPIO.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 2.0, script path: EnvBase.py, tag: SSC_T2_SmartConfig, + test environment detail: '2 SSC target connect with PC by UART. + + PC has 1 WiFi NIC. + + One HT20 AP and One HT40 AP are placed near target.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 3.0, script path: EnvBase.py, tag: SSC_T3_PhyMode, + test environment detail: '3 SSC target connect with PC by UART. + + PC has one WiFi NIC support capture wlan packet using libpcap. + + Set 4 AP with (HT20, channel1), (HT20, channel2), (HT40, channel1), (HT40, channel2). + + Put 4 APs near SSC targets.', test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 5.0, script path: EnvBase.py, tag: SSC_T5_1, + test environment detail: 5 SSC target connect with PC by UART., test script: EnvBase} +- {PC OS: '', Special: N, Target Count: 1.0, script path: EnvBase.py, tag: SSC_T6_1, + test environment detail: 'PC has 1 wired NIC connected to AP. + + PC has 1 WiFi NIC. + + 6 SSC target connect with PC by UART.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: TempSensor_T1_1, + test environment detail: 'Tempeture sensor target connect with PC by UART. + + AP support DTIM placed with AT target. + + Multimeter connect with PC via GPIB. + + Series multimeter between GND and VCC of TempSensor1. + + PC has 1 wired NIC connected to switch. + + APC, AP also connect with swtich. + + All devices connected with switch use the same IP subnet. + + APC control AP power supply.', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: SSC_1, additional param list: '', + basic param list: '', script path: EnvBase.py, tag: UART_T1_1, test environment detail: '[TBD] + 将ESP_8266通过UART连到PC', test script: EnvBase} +- {PC OS: '', Special: Y, Target Count: 1.0, UART ports: 'SSC1 + + SSC2', additional param list: '', basic param list: '', script path: EnvBase.py, + tag: UART_T1_2, test environment detail: '[TBD] ESP_8266通过UART_0通过USB, UART_1 TXD + 通过 TTLcable 连到PC', test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_1, + test environment detail: 'Web Server target connect with PC by UART. + + PC has 1 wired NIC connected to switch. + + APC, AP also connect with swtich. + + All devices connected with switch use same IP subnet. + + APC control AP power supply.', test script: EnvBase} +- {PC OS: linux, Special: Y, Target Count: 1.0, script path: EnvBase.py, tag: WebServer_T1_2, + test environment detail: 'Web Server target connect with PC by UART. + + 4 PC with WiFi NIC placed near WebServer1.', test script: EnvBase} diff --git a/components/test/CIConfigs/Function_TCPIP_01.yml b/components/test/CIConfigs/Function_TCPIP_01.yml deleted file mode 100644 index e947b0c5c7..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_01.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [^TCPIP_DHCP_0302, ^TCPIP_DHCP_0301, ^TCPIP_UDP_0113, TCPIP_DHCP_0302, TCPIP_DHCP_0301, - TCPIP_TCP_0412, TCPIP_TCP_0403, TCPIP_TCP_0402, TCPIP_TCP_0401, TCPIP_TCP_0407, - TCPIP_TCP_0406, TCPIP_TCP_0404, TCPIP_TCP_0408, ^TCPIP_TCP_0202, TCPIP_TCP_0110, - ^TCPIP_TCP_0203, TCPIP_DHCP_0101, TCPIP_DHCP_0103, TCPIP_DHCP_0102, TCPIP_IP_0101, - TCPIP_IP_0102, ^TCPIP_IGMP_0102, ^TCPIP_IGMP_0101, ^TCPIP_IGMP_0104, TCPIP_IGMP_0104, - TCPIP_IGMP_0103, TCPIP_IGMP_0102, TCPIP_IGMP_0101, ^TCPIP_UDP_0201, TCPIP_UDP_0108] diff --git a/components/test/CIConfigs/Function_TCPIP_02.yml b/components/test/CIConfigs/Function_TCPIP_02.yml deleted file mode 100644 index 6a3cb08d6d..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_02.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [TCPIP_UDP_0106, TCPIP_UDP_0107, TCPIP_UDP_0105, TCPIP_UDP_0101, TCPIP_IGMP_0204, - TCPIP_IGMP_0201, TCPIP_IGMP_0202, TCPIP_IGMP_0203, ^TCPIP_TCP_0404, ^TCPIP_TCP_0406, - ^TCPIP_TCP_0407, ^TCPIP_TCP_0401, ^TCPIP_TCP_0402, ^TCPIP_TCP_0403, ^TCPIP_TCP_0408, - TCPIP_UDP_0201, ^TCPIP_TCP_0101, ^TCPIP_TCP_0103, ^TCPIP_TCP_0102, ^TCPIP_TCP_0105, - ^TCPIP_TCP_0104, ^TCPIP_TCP_0107, ^TCPIP_TCP_0106, ^TCPIP_DHCP_0210, ^TCPIP_DHCP_0211, - TCPIP_TCP_0212, TCPIP_TCP_0210, ^TCPIP_TCP_0210, ^TCPIP_TCP_0212, TCPIP_DHCP_0211] diff --git a/components/test/CIConfigs/Function_TCPIP_03.yml b/components/test/CIConfigs/Function_TCPIP_03.yml deleted file mode 100644 index 0c4ac37524..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_03.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [TCPIP_DHCP_0210, TCPIP_UDP_0202, TCPIP_TCP_0411, ^TCPIP_IP_0102, ^TCPIP_UDP_0105, - ^TCPIP_UDP_0107, ^TCPIP_UDP_0106, ^TCPIP_UDP_0101, ^TCPIP_DHCP_0102, ^TCPIP_DHCP_0103, - ^TCPIP_UDP_0108, ^TCPIP_IGMP_0201, ^TCPIP_IGMP_0203, ^TCPIP_IGMP_0202, ^TCPIP_IGMP_0204, - TCPIP_UDP_0114, TCPIP_UDP_0113, TCPIP_UDP_0112, ^TCPIP_TCP_0201, ^TCPIP_TCP_0206, - ^TCPIP_TCP_0207, TCPIP_TCP_0106, TCPIP_TCP_0107, TCPIP_TCP_0104, TCPIP_TCP_0105, - TCPIP_TCP_0102, TCPIP_TCP_0103, TCPIP_TCP_0101, ^TCPIP_TCP_0116, ^TCPIP_TCP_0114] diff --git a/components/test/CIConfigs/Function_TCPIP_04.yml b/components/test/CIConfigs/Function_TCPIP_04.yml deleted file mode 100644 index f8bdb264b9..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_04.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [^TCPIP_TCP_0115, ^TCPIP_TCP_0112, ^TCPIP_TCP_0113, ^TCPIP_TCP_0110, ^TCPIP_TCP_0111, - ^TCPIP_DHCP_0209, ^TCPIP_DHCP_0208, ^TCPIP_DHCP_0207, ^TCPIP_DHCP_0206, ^TCPIP_DHCP_0205, - ^TCPIP_DHCP_0204, ^TCPIP_DHCP_0203, ^TCPIP_DHCP_0202, ^TCPIP_DHCP_0201, TCPIP_TCP_0204, - TCPIP_TCP_0207, TCPIP_TCP_0206, TCPIP_TCP_0201, ^TCPIP_DHCP_0101, TCPIP_TCP_0203, - TCPIP_TCP_0202, TCPIP_TCP_0208, TCPIP_DHCP_0206, TCPIP_DHCP_0207, TCPIP_DHCP_0204, - TCPIP_DHCP_0205, TCPIP_DHCP_0202, TCPIP_DHCP_0203, ^TCPIP_TCP_0204, TCPIP_DHCP_0201] diff --git a/components/test/CIConfigs/Function_TCPIP_05.yml b/components/test/CIConfigs/Function_TCPIP_05.yml deleted file mode 100644 index 21b3b7a6d8..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_05.yml +++ /dev/null @@ -1,8 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [^TCPIP_TCP_0208, TCPIP_DHCP_0208, TCPIP_DHCP_0209, ^TCPIP_TCP_0412, ^TCPIP_TCP_0411, - ^TCPIP_UDP_0112, ^TCPIP_UDP_0114, ^TCPIP_UDP_0202, ^TCPIP_IGMP_0103, ^TCPIP_IP_0101, - TCPIP_TCP_0115, TCPIP_TCP_0114, TCPIP_TCP_0116, TCPIP_TCP_0111, TCPIP_TCP_0113, - TCPIP_TCP_0112] diff --git a/components/test/CIConfigs/Function_TCPIP_07.yml b/components/test/CIConfigs/Function_TCPIP_07.yml deleted file mode 100644 index 2a047b8e16..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_07.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC1] -Filter: -- Add: - ID: [TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, TCPIP_ICMP_0101, - ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, ^TCPIP_UDP_0303, - ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, ^TCPIP_UDP_0302, - ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, ^TCPIP_UDP_0301, - TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, TCPIP_DNS_0102, - TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101, TCPIP_DNS_0101] diff --git a/components/test/CIConfigs/Function_TCPIP_12.yml b/components/test/CIConfigs/Function_TCPIP_12.yml deleted file mode 100644 index e9f5b72a51..0000000000 --- a/components/test/CIConfigs/Function_TCPIP_12.yml +++ /dev/null @@ -1,6 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC1] -Filter: -- Add: - ID: [TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, TCPIP_UDP_0303, - TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103, TCPIP_DNS_0103] diff --git a/components/test/CIConfigs/Function_WIFI_01.yml b/components/test/CIConfigs/Function_WIFI_01.yml deleted file mode 100644 index da9bfecd5d..0000000000 --- a/components/test/CIConfigs/Function_WIFI_01.yml +++ /dev/null @@ -1,10 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [^WIFI_CONN_0601, ^WIFI_ADDR_0101, WIFI_SCAN_0103, WIFI_SCAN_0102, WIFI_SCAN_0101, - WIFI_SCAN_0105, WIFI_SCAN_0104, WIFI_CONN_0201, WIFI_CONN_0904, ^WIFI_CONN_0201, - ^WIFI_SCAN_0102, ^WIFI_SCAN_0103, ^WIFI_SCAN_0104, ^WIFI_SCAN_0105, ^WIFI_ADDR_0102, - WIFI_CONN_0401, ^WIFI_CONN_0103, WIFI_ADDR_0101, WIFI_ADDR_0102, WIFI_CONN_0301, - ^WIFI_CONN_0801, WIFI_CONN_0104, ^WIFI_CONN_0301, WIFI_CONN_0501, WIFI_CONN_0502, - ^WIFI_CONN_0401, WIFI_MODE_0101, WIFI_MODE_0103, WIFI_MODE_0102, ^WIFI_CONN_0904] diff --git a/components/test/CIConfigs/Function_WIFI_02.yml b/components/test/CIConfigs/Function_WIFI_02.yml deleted file mode 100644 index e1b61a20e9..0000000000 --- a/components/test/CIConfigs/Function_WIFI_02.yml +++ /dev/null @@ -1,7 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [^WIFI_CONN_0901, WIFI_CONN_0601, WIFI_CONN_0901, WIFI_CONN_0503, ^WIFI_CONN_0104, - WIFI_CONN_0101, WIFI_CONN_0102, WIFI_CONN_0103, WIFI_CONN_0801, ^WIFI_CONN_0101, - ^WIFI_CONN_0503, ^WIFI_CONN_0502, ^WIFI_CONN_0501, ^WIFI_SCAN_0101] diff --git a/components/test/CIConfigs/Function_WIFI_06.yml b/components/test/CIConfigs/Function_WIFI_06.yml deleted file mode 100644 index f3db504c9f..0000000000 --- a/components/test/CIConfigs/Function_WIFI_06.yml +++ /dev/null @@ -1,7 +0,0 @@ -Config: {execute count: 1, execute order: in order} -DUT: [SSC2, SSC1] -Filter: -- Add: - ID: [WIFI_PHY_0403, WIFI_SCAN_0301, WIFI_SCAN_0303, WIFI_SCAN_0304, WIFI_SCAN_0302, - WIFI_SCAN_0201, WIFI_PHY_0402, WIFI_PHY_0401, WIFI_PHY_0407, WIFI_PHY_0406, - WIFI_PHY_0405, WIFI_PHY_0404, WIFI_PHY_0408] diff --git a/components/test/README.md b/components/test/README.md deleted file mode 100644 index 1d0c4cfbd1..0000000000 --- a/components/test/README.md +++ /dev/null @@ -1,4 +0,0 @@ - -# Note: The test cases in this folder are for Espressif internal use. - -# Goto internal project wiki Testing page for detail about this folder. diff --git a/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py b/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py deleted file mode 100755 index e11ae6f1d8..0000000000 --- a/components/test/TestCaseScript/ATFunc/CmdInterruptTest.py +++ /dev/null @@ -1,130 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -from TCAction import CmdHandler -import time - - -ATCmdList = ["GMR", - "UART=115200,8,1,0,0", - "CWMODE=3", - "CWJAP=\"TL_WR845N_T\",\"1234567890\"", - "CWLAP", - "CWQAP", - "CWSAP=\"asdf\",\"123456789\",5,3", - "CWLIF", - "CWDHCP=3", - "AT+CWAUTOCONN", - "CIPSTAMAC=\"18:fe:34:97:f3:43\"", - "CIPAPMAC=\"1a:fe:34:97:f3:43\"", - "CIPSTA=\"192.168.1.2\"", - "CIPAP=\"192.168.4.1\"", - "CIPSTATUS", - "CIPSTART=\"UDP\",\"192.168.1.4\",6531,7895,1", - "CIPSTART=\"TCP\",\"192.168.1.4\",6531", - "CIPCLOSE", - "CIFSR", - "CIPMUX=1", - "CIPSERVER=1,4567", - "CIPMODE=0", - "CIPSTO=7200", - "PING=\"192.168.1.4\""] - - -class CmdInterruptTest(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=20, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def load_and_exe_one_step(self, checker_stings, test_action_strings, fail_string, - check_freq=0.1, check_time=50, sleep_time=0.1): - # set checker for next executing step - checkers = CmdHandler.parse_results(checker_stings, self.test_env) - self.result_cntx.set_next_step(checkers, check_time, check_freq) - # execute 1 step - for action_string in test_action_strings: - test_action = CmdHandler.parse_action(action_string, self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - time.sleep(sleep_time) - - ret = self.wait_to_execute() - - if ret is False: # # timeout - self.result_cntx.set_result(fail_string) - if ret == check_time: - self.result_cntx.set_result(fail_string) - ret = False - - self.require_waiting() - - return ret - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # step 1, sleep time 0.1 - for cmd1 in ATCmdList: - # check if match CMD - AT - busy - OK/ERROR pattern - checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] - test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - # check again if match CMD - OK/ERROR - AT - OK pattern - checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] - test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - NativeLog.add_trace_critical("CMD Fail: AT+%s; sleep time is 0.1" % cmd1) - - # step 2, sleep time 0 - for cmd1 in ATCmdList: - # check if match CMD - AT - busy - OK/ERROR pattern - checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] - test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - # check again if match CMD - OK/ERROR - AT - OK pattern - checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] - test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - NativeLog.add_trace_critical("CMD Fail: AT+%s; sleep time is 0" % cmd1) - - # step 3, cat string - for cmd1 in ATCmdList: - # check if match CMD - AT - busy - OK/ERROR pattern - checker_stings = ["ATR AT1 C busy", "ATR AT1 R *"] - test_action_string = ["ATSO AT1 AT+%s\r\nAT\r\n" % cmd1] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - # check again if match CMD - OK/ERROR - AT - OK pattern - checker_stings = ["ATR AT1 R *", "ATR AT1 C AT L OK"] - test_action_string = ["ATS AT1 AT+%s" % cmd1, "ATS AT1 AT"] - fail_string = "Fail, Fail on step 1" - if self.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, sleep_time=0.1) is False: - NativeLog.add_trace_critical("CMD Fail: AT+%s; cat string" % cmd1) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATFunc/LAP.py b/components/test/TestCaseScript/ATFunc/LAP.py deleted file mode 100644 index b389e48c04..0000000000 --- a/components/test/TestCaseScript/ATFunc/LAP.py +++ /dev/null @@ -1,64 +0,0 @@ -from TCAction import TCActionBase -import time -import re - - -class LAP(TCActionBase.CommonTCActionBase): - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - # restore set LAPOPT - if self.load_and_exe_one_step(["R AT1 L OK"], - ["ATS AT1 AT+CWLAPOPT=0,127"], - "Failed to set LAP option") is False: - return - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # step 1. set LAPOPT - if self.load_and_exe_one_step(["R AT1 L OK"], - ["ATS AT1 AT+CWLAPOPT=1,4"], - "Failed to set LAP option") is False: - return - - # step 2. LAP - if self.load_and_exe_one_step(["R AT1 A :([[^OK]]+)OK"], # [] is list generator, use [[]] for [] - ["ATS AT1 AT+CWLAP"], - "Failed to LAP") is False: - return - lap_result = self.get_parameter("lap_result") - rssi_list = re.findall("CWLAP:\((-\d+)\)", lap_result) - if len(rssi_list) > 1: - for i in range(len(rssi_list)-1): - if int(rssi_list[i]) < int(rssi_list[i+1]): - break - else: - self.result_cntx.set_result("Succeed") - else: - self.result_cntx.set_result("Succeed") - pass - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - pass - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/ATFunc/SendDataValidation.py b/components/test/TestCaseScript/ATFunc/SendDataValidation.py deleted file mode 100755 index 27f1e7f7c1..0000000000 --- a/components/test/TestCaseScript/ATFunc/SendDataValidation.py +++ /dev/null @@ -1,161 +0,0 @@ -from TCAction import TCActionBase -from TCAction import CmdHandler -from NativeLog import NativeLog -import time -import threading -import sys -reload(sys) -sys.setdefaultencoding('iso-8859-1') # # use encoding that with 1 Byte length and contain 256 chars - - -VALIDATION_STRING = "".join([chr((m+65) % 256) for m in range(256)]) # make it start from 'A' - - -class ResultCheckCntx(TCActionBase.ResultCheckContext): - - def __init__(self, test_action, test_env, name): - TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) - pass - - def run(self): - tx_result = -1 - rx_result = -1 - - while True: - exit_flag = self.wait_exit_event(2) - # force exit - if exit_flag is True: - break - try: - self.lock_data() - rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) - tx_port = filter(lambda x: x[0] == "SOC2", self.data_cache) - finally: - self.unlock_data() - - if len(rx_port) == 1: - data = rx_port[0][1] - rx_result = data.find(VALIDATION_STRING) - if len(tx_port) == 1: - data = tx_port[0][1] - tx_result = data.find(VALIDATION_STRING) - - if tx_result != -1: - self.test_action.tx_check_done.set() - if rx_result != -1: - self.test_action.rx_check_done.set() - - -class SendDataValidation(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.timestamp = time.strftime("%d%H%M%S", time.localtime()) - self.tx_check_done = threading.Event() - self.rx_check_done = threading.Event() - - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - # enable target TCP TX - tx_enable = self.tx_enable - # enable target TCP RX - rx_enable = self.rx_enable - # transparent mode select - is_transparent_mode = self.is_transparent_mode - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step1 create PC server - checker_stings = ["SOCR SOC_COM L OK"] - test_action_string = ["SOC SOC1 LISTEN "] - fail_string = "Fail, Fail on create PC server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 target connect, switch to transparent - checker_stings = ["SOCR SOC1 C +ACCEPT", "ATR AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] - fail_string = "Fail, Fail on connect to PC server" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["SOCR SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC2"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # set to transparent mode - if is_transparent_mode is True: - checker_stings = ["ATR AT1 L OK"] - test_action_strings = ["ATS AT1 AT+CIPMODE=1"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["ATR AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - else: - checker_stings = ["ATR AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=256"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 - - # switch to new result check context - self.result_cntx.stop_thread() - self.result_cntx.join() - self.result_cntx = ResultCheckCntx(self, self.test_env, self.tc_name) - self.result_cntx.start() - - # step 3 send data - if rx_enable is True: - test_action = CmdHandler.parse_action("SOC SOC2 SEND 256", self.test_env) - CmdHandler.do_actions(test_action[0], self.test_env) - self.rx_check_done.wait(5) - if self.rx_check_done.isSet() is False: - # rx fail - return - # flush all data - self.result_cntx.data_flush() - self.tx_check_done.clear() - - if tx_enable is True: - test_action = CmdHandler.parse_action("ATSN AT1 256", self.test_env) - CmdHandler.do_actions(test_action[0], self.test_env) - self.tx_check_done.wait(5) - if self.tx_check_done.isSet() is False: - # tx fail - return - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - pass - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATFunc/UARTTest.py b/components/test/TestCaseScript/ATFunc/UARTTest.py deleted file mode 100644 index 184f440d49..0000000000 --- a/components/test/TestCaseScript/ATFunc/UARTTest.py +++ /dev/null @@ -1,164 +0,0 @@ -import socket -import serial - -from TCAction import PerformanceTCBase -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class UARTTest(PerformanceTCBase.PerformanceTCBase): - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.test_mode = "command" - self.baudrate = None - self.bytesize = None - self.parity = None - self.stopbits = None - self.xonxoff = None - self.rtscts = None - - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - # restore UART config - self.restore_serial_port("AT1") - PerformanceTCBase.PerformanceTCBase.cleanup(self) - - STOP_BITS = { - 1: serial.STOPBITS_ONE, - 2: serial.STOPBITS_ONE_POINT_FIVE, - 3: serial.STOPBITS_TWO, - } - BYTE_SIZE = { - 5: serial.FIVEBITS, - 6: serial.SIXBITS, - 7: serial.SEVENBITS, - 8: serial.EIGHTBITS, - } - PARITY = { - 0: serial.PARITY_NONE, - 1: serial.PARITY_ODD, - 2: serial.PARITY_EVEN, - } - RTSCTS = {} - - def config_serial_port(self): - port = self.test_env.get_port_by_name("AT1") - kwargs = dict() - if self.baudrate is not None: - kwargs["baudrate"] = self.baudrate - if self.bytesize is not None: - kwargs["bytesize"] = self.BYTE_SIZE[self.bytesize] - if self.parity is not None: - kwargs["parity"] = self.PARITY[self.parity] - if self.stopbits is not None: - kwargs["stopbits"] = self.STOP_BITS[self.stopbits] - if self.xonxoff is not None: - kwargs["xonxoff"] = self.xonxoff - if self.rtscts is not None: - kwargs["rtscts"] = self.rtscts - NativeLog.add_prompt_trace("[change PC UART config] %s" % kwargs) - port.reconfig(**kwargs) - - def send_commands(self): - # first change UART config - self.config_serial_port() - # do send commands - for i in range(1, 256): - cmd = bytes().join([chr(x % 256) for x in range(i)]) - try: - self.serial_write_line("AT1", cmd) - except StandardError, e: - NativeLog.add_exception_log(e) - pass - self.flush_data("AT1") - # restore UART config - self.restore_serial_port("AT1") - - def send_data(self): - # create TCP connection and enter send mode - pc_ip = self.get_parameter("pc_ip") - tcp_port = self.get_parameter("test_tcp_port1") - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, tcp_port)) - server_sock.settimeout(10) - server_sock.listen(5) - self.serial_write_line("AT1", "AT+CIPSTART=\"TCP\",\"%s\",%s" % (pc_ip, tcp_port)) - self.check_response("AT1", "OK") - sock, addr = server_sock.accept() - server_sock.close() - self.serial_write_line("AT1", "AT+CIPSEND=1460") - self.check_response("AT1", ">") - # change UART config - self.config_serial_port() - # send data - try: - self.serial_write("AT1", bytes().join([chr(x % 256) for x in range(146000)])) - except StandardError, e: - NativeLog.add_exception_log(e) - pass - sock.send("A"*1460) - # restore UART config - sock.close() - self.restore_serial_port("AT1") - - def pass_through_mode(self): - # create TCP connection and enter pass through mode - pc_ip = self.get_parameter("pc_ip") - tcp_port = self.get_parameter("test_tcp_port1") - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, tcp_port)) - server_sock.settimeout(10) - server_sock.listen(5) - self.serial_write_line("AT1", "AT+CIPMODE=1") - self.check_response("AT1", "OK") - self.serial_write_line("AT1", "AT+CIPSTART=\"TCP\",\"%s\",%s" % (pc_ip, tcp_port)) - self.check_response("AT1", "OK") - sock, addr = server_sock.accept() - server_sock.close() - self.serial_write_line("AT1", "AT+CIPSEND") - self.check_response("AT1", ">") - # change UART config - self.config_serial_port() - # send data - try: - self.serial_write("AT1", bytes().join([chr(x % 256) for x in range(146000)])) - except StandardError, e: - NativeLog.add_exception_log(e) - pass - sock.send("A" * 1460) - # restore UART config - sock.close() - self.restore_serial_port("AT1") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - # test sending command - try: - if self.test_mode == "command": - self.send_commands() - elif self.test_mode == "send_data": - self.send_data() - elif self.test_mode == "pass_through": - self.pass_through_mode() - else: - raise StandardError("test mode not supported: %s" % self.test_mode) - self.set_result("Succeed") - except StandardError, e: - NativeLog.add_exception_log(e) - self.set_result("Failed") - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/ATFunc/__init__.py b/components/test/TestCaseScript/ATFunc/__init__.py deleted file mode 100755 index 5a3bbc44dd..0000000000 --- a/components/test/TestCaseScript/ATFunc/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = ["TCPClientMulti", "TCPClientSingle", "TCPServerMulti", - "TCPTransparent", "UDPMulti", "UDPSingle"] \ No newline at end of file diff --git a/components/test/TestCaseScript/ATStress/ATPassThrough.py b/components/test/TestCaseScript/ATStress/ATPassThrough.py deleted file mode 100755 index 5149ffe3de..0000000000 --- a/components/test/TestCaseScript/ATStress/ATPassThrough.py +++ /dev/null @@ -1,179 +0,0 @@ -import time - -from TCAction import TCActionBase -from NativeLog import NativeLog - - -BEACON_TIMEOUT = 3 -WAIT_FOR_RECONNECT = 20 - - -class ATPassThrough(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.do_scan = True - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - tx_enable = self.tx_enable - rx_enable = self.rx_enable - att_set = self.att_set - do_scan = self.do_scan - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPClientMulti script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # step0, set att and join ap - fail_string = "Fail, Fail on JAP, set to single link mode" - - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT 1"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 C ready"] - test_action_string = ["ATS AT1 AT+RST"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATS AT1 AT+CWMODE=1"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATC AT1 CWJAP "] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATS AT1 AT+CIPMUX=0"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step1, create TCP connection and enter pass through mode - fail_string = "Fail, Fail on create server, create connection or enter pass through mode" - - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 LISTEN "] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] - test_action_string = ["ATC AT1 CIPSTART \"TCP\" "] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_strings = ["ATS AT1 AT+CIPMODE=1"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC2"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step2 - # while - # set att from, send data on both direction - # if TCP connection disconnected, then set att to 1, wait reconnect succeed, continue test - for i in xrange(test_count): - for _att in att_set: - - # set att - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT %d" % _att] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - time.sleep(BEACON_TIMEOUT) - - # do scan to get ssid - if do_scan is True: - checker_stings = [] - test_action_string = ["ATSO AT1 +++"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATC AT1 CWLAP "] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # send data - checker_stings = [] - test_action_string = [] - if tx_enable is True: - checker_stings += ["P SOC2 RL %d" % at_send_length] - test_action_string += ["ATSN AT1 %d" % at_send_length] - if rx_enable is True: - checker_stings += ["P AT1 RL %d" % soc_send_length] - test_action_string += ["SOC SOC2 SEND %d" % soc_send_length] - - if len(test_action_string) > 0: - if self.load_and_exe_one_step(checker_stings, test_action_string, "", - check_freq=1, check_time=30) is False: - # send data fail - NativeLog.add_prompt_trace("Failed to send data @ att %d" % _att) - # set att back to 1 - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT 1"] - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - # wait for reconnect - time.sleep(WAIT_FOR_RECONNECT) - fail_string = "Failed, failed to accept socket" - checker_stings = ["SOCR SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC2"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - break - pass - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/ATSleep.py b/components/test/TestCaseScript/ATStress/ATSleep.py deleted file mode 100644 index 586862a777..0000000000 --- a/components/test/TestCaseScript/ATStress/ATSleep.py +++ /dev/null @@ -1,251 +0,0 @@ -import random -import os -import time - -from TCAction import TCActionBase, PerformanceTCBase -from NativeLog import NativeLog -from Utility import MakeFolder -from Utility import MultimeterUtil - -LOG_PATH = os.path.join("AT_LOG", "SLEEP") - -SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] -SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) - -SAMPLE_RATE_SLEEP_MODE_CHANGE = 0.002 -SAMPLE_NUM_SLEEP_MODE_CHANGE = 256 - -SAMPLE_RATE = 0.002 -SAMPLE_NUM = 512 -MAX_VALUE = 1 -Y_AXIS_LABEL = "Current (mA)" -GPIO_EDGE_DELAY = 120 # 20 ms - -NONE_SLEEP_MIN_CUR = 30 -LIGHT_SLEEP_MIN_CUR = 1.5 -MODEM_SLEEP_MIN_CUR = 20 - -GPIO_WAKE_UP = 15 - -AT_WAKE_UP_IND_PIN = 14 -AT_WAKE_UP_PIN = 12 - - -class ATSleep(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.test_mode = "mode_change" - self.test_count = 100 - self.sleep_mode = SLEEP_MODE_LIST - self.sleep_wake_pin = AT_WAKE_UP_PIN - self.sleep_wakeup_ind_pin = AT_WAKE_UP_IND_PIN - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, - "AT_AUTO_SLEEP_%s_%s" % - (self.test_mode, - time.strftime("%d%H%M%S", time.localtime())))) - self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) - - @staticmethod - def find_min_items(item_list, count): - assert count < len(item_list) - min_items = [] - for i in range(count): - min_val = min(item_list) - min_items.append(min_val) - item_list.remove(min_val) - return min_items - - def sleep_mode_change(self, sleep_mode): - result = True - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] %s start" % sleep_mode) - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - # set sleep mode - self.serial_write_line("AT1", "AT+SLEEP=%d" % sleep_mode_enum) - self.check_response("AT1", "OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] mode set") - time.sleep(10) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE_SLEEP_MODE_CHANGE, - sample_num=SAMPLE_NUM_SLEEP_MODE_CHANGE, - max_value=MAX_VALUE) - # do check measure - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] measure done, average min current %f" % average_val) - - if sleep_mode == "none_sleep": - if average_val < NONE_SLEEP_MIN_CUR: - result = False - elif sleep_mode == "light_sleep": - if average_val > LIGHT_SLEEP_MIN_CUR: - result = False - elif sleep_mode == "modem_sleep": - if average_val > MODEM_SLEEP_MIN_CUR or average_val < LIGHT_SLEEP_MIN_CUR: - result = False - if result is False: - NativeLog.add_trace_critical("[AutoSleep][ModeChange] %s failed" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, "%s_fail" % sleep_mode, Y_AXIS_LABEL) - - time.sleep(5) - return result - - def sleep_current_measure(self, sleep_mode): - result = True - - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] %s start" % sleep_mode) - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - # set sleep mode - self.serial_write_line("AT1", "AT+SLEEP=%d" % sleep_mode_enum) - self.check_response("AT1", "OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] set mode done") - time.sleep(10) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, sleep_mode, Y_AXIS_LABEL) - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] measure done") - return result - - def light_sleep_wakeup(self): - result = True - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] start") - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(1) - self.serial_write_line("AT1", "") - time.sleep(1) - self.check_response("SSC2", "+GPIO_SET:OK", timeout=1) - - for i in range(10): - self.serial_write_line("SSC2", "gpio -G -p %d" % self.sleep_wakeup_ind_pin) - if self.check_response("SSC2", "+GPIO_GET:0", timeout=0.73) is True: - break - else: - NativeLog.add_prompt_trace("AT Sleep wakeup pin is not correct when in sleep") - - # check if respond to uart - self.flush_data("AT1") - for i in range(60): - self.serial_write("AT1", "a") - time.sleep(0.43) - time.sleep(0.1) - respond_data = self.serial_read_data("AT1") - if len(respond_data) >= 60: - NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " - "Failed when recving data during sleep, %d" % len(respond_data)) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on sleep mode done") - - # change GPIO to make target wakeup - self.serial_write_line("SSC2", "gpio -L -p %d -t 0" % GPIO_WAKE_UP) - self.check_response("SSC2", "+GPIO_SET:OK") - time.sleep(0.01) - - for i in range(3): - self.serial_write_line("SSC2", "gpio -G -p %d" % self.sleep_wakeup_ind_pin) - if self.check_response("SSC2", "+GPIO_GET:1") is False: - NativeLog.add_prompt_trace("AT Sleep wakeup pin is not correct when wakeup") - - self.serial_write_line("AT1", "") - time.sleep(1) - self.flush_data("AT1") - for i in range(60): - self.serial_write("AT1", "a") - time.sleep(0.043) - time.sleep(0.1) - respond_data = self.serial_read_data("AT1") - if len(respond_data) < 60: - NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " - "Failed when recving data during wakeup, %d" % len(respond_data)) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on wakeup mode done") - self.serial_write_line("AT1", "") - # restore GPIO level - self.serial_write_line("SSC2", "gpio -L -p %d -t 1" % GPIO_WAKE_UP) - time.sleep(2) - return result - - def cleanup(self): - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - self.serial_write_line("AT1", "") - self.serial_write_line("AT1", "AT+RST") - self.check_response("SSC2", "+GPIO_SET:OK") - self.check_response("AT1", "ready") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - - try: - test_mode = self.test_mode - test_count = self.test_count - sleep_mode = self.sleep_mode - except StandardError, e: - return - - # make sure enter modem sleep mode before start test - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - self.serial_write_line("AT1", "AT+RST") - self.check_response("SSC2", "+GPIO_SET:OK") - self.check_response("AT1", "ready") - self.check_response("AT1", "WIFI GOT IP") - # set AT light sleep wakeup pin - self.serial_write_line("AT1", "AT+WAKEUPGPIO=1,%d,0" % self.sleep_wake_pin) - self.check_response("AT1", "OK") - - # start test - if "mode_change" in test_mode: - for i in range(test_count): - result = self.sleep_mode_change(random.choice(SLEEP_MODE_LIST)) - - elif "measure_current" in test_mode: - for i in range(test_count): - for mode in sleep_mode: - result = self.sleep_current_measure(mode) - pass - elif "gpio_wakeup" in test_mode: - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - # config wakeup gpio - self.serial_write_line("AT1", "AT+WAKEUPGPIO=1,%d,0,%d,1" % (self.sleep_wake_pin, self.sleep_wakeup_ind_pin)) - self.check_response("AT1", "OK") - # set sleep mode - self.serial_write_line("AT1", "AT+SLEEP=%d" % SLEEP_MODE["light_sleep"]) - self.check_response("AT1", "OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - for i in range(test_count): - result = self.light_sleep_wakeup() - pass - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/ATStress/SoftAPServer.py b/components/test/TestCaseScript/ATStress/SoftAPServer.py deleted file mode 100755 index 7522658f15..0000000000 --- a/components/test/TestCaseScript/ATStress/SoftAPServer.py +++ /dev/null @@ -1,308 +0,0 @@ -from TCAction import PerformanceTCBase -import time -import socket -import threading -import Queue -import re -import random -from NativeLog import NativeLog - - -SEND_CMD = ("CIPSEND, CIPSENDBUF", "CIPSENDEX") - - -class RecvThread(threading.Thread): - def __init__(self, test_action): - threading.Thread.__init__(self) - self.setDaemon(True) - self.test_action = test_action - self.exit_flag = threading.Event() - pass - - def run(self): - data = "" - ipd_line = re.compile("IPD,\d,\d+:") - recv_bytes_line = re.compile("Recv \d+ bytes") - allow_send_line = re.compile("OK\r\n>") - send_ok_line = re.compile("SEND OK") - while self.exit_flag.is_set() is False: - flush_pos = 0 - data += self.test_action.serial_read_data("AT1") - # do process IPD data - match_set = ipd_line.findall(data) - for match_line in match_set: - link_id = match_line[4] - flush_pos = data.find(match_line) + len(match_line) - self.test_action.send_queue.put(link_id, 1) - pass - # do process send > - match = allow_send_line.search(data) - if match is not None: - match_line = match.group() - self.test_action.add_info_log("find OK >") - self.test_action.send_allow_evt.set() - pos = data.find(match_line) + len(match_line) - flush_pos = pos if pos > flush_pos else flush_pos - # do process Recv xx bytes - match = recv_bytes_line.search(data) - if match is not None: - match_line = match.group() - self.test_action.add_info_log("find Recv xx bytes") - self.test_action.recv_data_evt.set() - pos = data.find(match_line) + len(match_line) - flush_pos = pos if pos > flush_pos else flush_pos - - match = send_ok_line.search(data) - if match is not None: - match_line = match.group() - self.test_action.add_info_log("find send ok") - self.test_action.send_ok_evt.set() - pos = data.find(match_line) + len(match_line) - flush_pos = pos if pos > flush_pos else flush_pos - # pass - - # flush processed data - if flush_pos > 0: - data = data[flush_pos:] - - pass - - def exit(self): - self.exit_flag.set() - pass - - -class TCPClientThread(threading.Thread): - send_char = "A" - sync_lock = threading.Lock() - - def __init__(self, test_action, pc_ip, target_ip, target_port, request_len, response_len, client_id, - connect_timeout, recv_timeout): - threading.Thread.__init__(self) - self.setDaemon(True) - self.exit_flag = threading.Event() - self.test_action = test_action - self.pc_ip = pc_ip - self.target_ip = target_ip - self.target_port = target_port - self.request_len = request_len - self.response_len = response_len - self.client_id = client_id - self.connect_timeout = connect_timeout - self.recv_timeout = recv_timeout - pass - - @classmethod - def get_send_char(cls): - with cls.sync_lock: - send_char = cls.send_char - cls.send_char = chr(ord(send_char) + 1) if ord(send_char) < ord("Z") else "A" - return send_char - pass - - def run(self): - while self.exit_flag.is_set() is False: - exception_occurred = False - client_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - client_sock.bind((self.pc_ip, 0)) - client_sock.settimeout(20) - time1 = time.time() - name = client_sock.getsockname() - - try: - client_sock.connect((self.target_ip, self.target_port)) - except StandardError, e: - exception_occurred = True - self.test_action.add_critical_log("failed to connect succeed within 2 seconds %s, %d" - % (name[0], name[1])) - client_sock.close() - - time2 = time.time() - time1 - if exception_occurred is True: - self.test_action.add_critical_log("connect timeout %f; ip is %s, port is %d" - % (time2, name[0], name[1])) - continue - if time2 > self.connect_timeout: - self.test_action.add_critical_log("connect time too long %f; ip is %s, port is %d" - % (time2, name[0], name[1])) - - time.sleep(float(random.randint(0, 30))/100) - send_char = self.get_send_char() - data = send_char * self.request_len - try: - client_sock.send(data) - except StandardError: - NativeLog.add_trace_critical("send fail") - # try: - # data = client_sock.recv(1) - # except socket.error, e: - # self.handle_processing_fail("failed to receive data within 2 seconds") - data_received = 0 - time1 = time.time() - while data_received < self.response_len: - try: - data = client_sock.recv(4*1024) - except StandardError, e: - exception_occurred = True - break - data_received += len(data) - - time2 = time.time() - time1 - if exception_occurred is True or time2 > self.recv_timeout: - self.test_action.add_critical_log("receive time too long %f; ip is %s, port is %d"\ - % (time2, name[0], name[1])) - client_sock.close() - time.sleep(float(random.randint(0, 30))/100) - pass - pass - - def exit(self): - self.exit_flag.set() - pass - - -class SendThread(threading.Thread): - def __init__(self, test_action, test_count, send_cmd, response_len, check_send_ok): - threading.Thread.__init__(self) - self.setDaemon(True) - self.test_action = test_action - self.test_count = test_count - self.send_cmd = send_cmd - self.response_len = response_len - self.check_send_ok = check_send_ok - pass - - def run(self): - send_char = "a" - for i in xrange(self.test_count): - link_id = self.test_action.send_queue.get(1) - - self.test_action.send_allow_evt.clear() - self.test_action.serial_write_line("AT1", "AT+%s=%s,%d" % (self.send_cmd, link_id, self.response_len)) - self.test_action.add_info_log("write CIPSEND cmd") - - self.test_action.send_allow_evt.wait(10) - if self.test_action.send_allow_evt.is_set() is False: - self.test_action.add_critical_log("Failed to find OK > in 10s, test break") - break - self.test_action.send_allow_evt.clear() - - data = send_char * self.response_len - send_char = chr(ord(send_char) + 1) if ord(send_char) < ord("z") else "a" - self.test_action.recv_data_evt.clear() - self.test_action.send_ok_evt.clear() - self.test_action.serial_write("AT1", data) - self.test_action.add_info_log("data write done") - self.test_action.recv_data_evt.wait(10) - if self.test_action.recv_data_evt.is_set() is False: - self.test_action.add_critical_log("Failed to find Recv xx bytes in 10s, test break") - break - self.test_action.recv_data_evt.clear() - # if self.test_action.send_cmd == "CIPSEND": - if self.check_send_ok is True: - self.test_action.send_ok_evt.wait(10) - if self.test_action.send_ok_evt.is_set() is False: - self.test_action.add_critical_log("Failed to find SEND OK in 10s, test break") - break - self.test_action.add_info_log("send ok") - self.test_action.send_ok_evt.clear() - pass - pass - - -class SoftAPServer(PerformanceTCBase.PerformanceTCBase): - def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # init value for ip and port - self.pc_ip = "pc_ip" - self.server_port = "test_tcp_port1" - self.send_cmd = "CIPSEND" - self.baudrate = 115200 - self.rtscts = 3 - self.test_count = 1000 - self.request_len = 500 - self.response_len = 1600 - self.check_send_ok = True - self.concurrent_connections = 5 - self.connect_timeout = 3 - self.receive_timeout = 2 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.send_queue = Queue.Queue(maxsize=100) - self.send_allow_evt = threading.Event() - self.recv_data_evt = threading.Event() - self.send_ok_evt = threading.Event() - - pass - - @staticmethod - def add_critical_log(data): - NativeLog.add_trace_critical(data+"\r\n") - pass - - @staticmethod - def add_info_log(data): - NativeLog.add_trace_info(data) - - def process(self): - # step0, use initial condition AP3 (8266 as AP, PC connected to 8266, multiple connection) - pc_ip = self.get_parameter(self.pc_ip) - target_ip = self.get_parameter("target_ip") - server_port = self.get_parameter(self.server_port) - send_cmd = self.send_cmd - test_count = self.test_count - baudrate = self.baudrate - rtscts = self.rtscts - concurrent_connections = self.concurrent_connections - check_send_ok = self.check_send_ok - connect_timeout = self.connect_timeout - receive_timeout = self.receive_timeout - - self.serial_write_line("AT1", "AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)) - self.check_response("AT1", "OK\r\n") - self.reconfig_serial_port("AT1", baudrate, rtscts) - # step1, create server on 8266, create client thread - self.serial_write_line("AT1", "AT+CIPSERVER=1,%d" % server_port) - self.check_response("AT1", "OK") - - recv_thread = RecvThread(self) - send_thread = SendThread(self, test_count, send_cmd, self.response_len, check_send_ok) - send_thread.start() - recv_thread.start() - client_thread_list = [None] * concurrent_connections - for i in range(concurrent_connections): - client_thread_list[i] = TCPClientThread(self, pc_ip, target_ip, server_port, - self.request_len, self.response_len, i, - connect_timeout, receive_timeout) - client_thread_list[i].start() - pass - - # step3, wait sending thread join - send_thread.join() - - recv_thread.exit() - recv_thread.join() - - for i in range(concurrent_connections): - client_thread_list[i].exit() - client_thread_list[i].join() - pass - - self.serial_write_line("AT1", "AT+UART_CUR=115200,8,1,0,3") - self.check_response("AT1", "OK\r\n") - self.restore_serial_port("AT1") - self.set_result("Succeed") - pass - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/ATStress/TCPClientMulti.py b/components/test/TestCaseScript/ATStress/TCPClientMulti.py deleted file mode 100755 index 610a55cbc4..0000000000 --- a/components/test/TestCaseScript/ATStress/TCPClientMulti.py +++ /dev/null @@ -1,116 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class TCPClientMulti(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.max_conn = test_env.get_variable_by_name("max_conn")[1] - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - tx_enable = self.tx_enable - rx_enable = self.rx_enable - enable_log = self.enable_log - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPClientMulti script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # step1 - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 LISTEN "] - fail_string = "Fail, Fail on create PC server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 - for i in range(0, self.max_conn): - checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" " % i] - fail_string = "Fail, Fail on connect to PC server" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC%d" % (i+2)] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 - # turn off AT UART logging - if enable_log is False: - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - - data = "A" * at_send_length - fail_string = "Fail, Fail on send and recv data" - - for j in range(0, test_count): - - if tx_enable is True: - for i in range(0, self.max_conn): - checker_stings = ["P AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail on target send command for link %d" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - return - - checker_stings = ["P SOC%d RL %d" % ((i+2), at_send_length), "P AT1 C OK"] - test_action_strings = ["ATSO AT1 %s" % data] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - return - - if rx_enable is True: - checker_stings = [] - test_action_strings = [] - for i in range(0, self.max_conn): - checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) - test_action_strings.extend(["SOC SOC%d SEND %d %s" % (i+2, soc_send_length, data)]) - - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail to receive PC sent data") - NativeLog.add_trace_critical("Test count is %d" % j) - return - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/TCPClientSingle.py b/components/test/TestCaseScript/ATStress/TCPClientSingle.py deleted file mode 100755 index 7127c3d0f1..0000000000 --- a/components/test/TestCaseScript/ATStress/TCPClientSingle.py +++ /dev/null @@ -1,123 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class TCPClientSingle(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.link_type = "TCP" - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - tx_enable = self.tx_enable - rx_enable = self.rx_enable - enable_log = self.enable_log - link_type = self.link_type - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPClientSingle script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # step1 - checker_stings = ["R SOC_COM L OK"] - if link_type == "TCP": - test_action_string = ["SOC SOC1 LISTEN "] - elif link_type == "SSL": - test_action_string = ["SOC SOC1 SLISTEN "] - pass - else: - raise StandardError() - fail_string = "Fail, Fail on create PC server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 - if link_type == "TCP": - checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] - elif link_type == "SSL": - checker_stings = ["R SOC1 C +SACCEPT", "R AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"SSL\" "] - else: - raise StandardError() - fail_string = "Fail, Fail on connect to PC server" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC2"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 - # turn off AT UART logging - if enable_log is False: - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - - for j in range(0, test_count): - data = "A" * at_send_length - fail_string = "Fail, Fail on send and recv data" - - if tx_enable is True: - checker_stings = ["P AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d" % at_send_length] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail on target send command") - NativeLog.add_trace_critical("Test count is %d" % j) - return - - checker_stings = ["P SOC2 RL %d" % at_send_length, "P AT1 C OK"] - test_action_strings = ["ATSO AT1 %s" % data] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail on target send, send or recv error") - NativeLog.add_trace_critical("Test count is %d" % j) - return - - if rx_enable is True: - checker_stings = ["P AT1 DL S+%d" % soc_send_length] - test_action_strings = ["SOC SOC2 SEND %d" % soc_send_length] - - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail to receive PC sent data") - NativeLog.add_trace_critical("Test count is %d" % j) - return - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/TCPSendPerf.py b/components/test/TestCaseScript/ATStress/TCPSendPerf.py deleted file mode 100755 index a2f6e1a060..0000000000 --- a/components/test/TestCaseScript/ATStress/TCPSendPerf.py +++ /dev/null @@ -1,148 +0,0 @@ -import time -import os -import socket -import ssl - -from NativeLog import NativeLog -from TCAction import PerformanceTCBase -from Utility import MakeFolder - - -SEND_CMD = ("CIPSEND, CIPSENDBUF", "CIPSENDEX") - -LOG_PATH = os.path.join("AT_LOG", "Performance", "AT_SEND") - - -class TCPSendPerf(PerformanceTCBase.PerformanceTCBase): - def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # init value for ip and port - self.pc_ip = "pc_ip" - self.server_port = "test_tcp_port1" - self.packet_len = 1 - self.test_count = 100 - self.send_cmd = "CIPSEND" - self.baudrate = 115200 - self.rtscts = 0 - self.link_type = "TCP" - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - pass - - def process(self): - pc_ip = self.get_parameter(self.pc_ip) - server_port = self.get_parameter(self.server_port) - packet_len = self.packet_len - test_count = self.test_count - send_cmd = self.send_cmd - baudrate = self.baudrate - rtscts = self.rtscts - result = True - link_type = self.link_type - - # create TCP connection - sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - sock.bind((pc_ip, server_port)) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.settimeout(10) - sock.listen(1) - - self.serial_write_line("AT1", "AT+CIPSTART=0,\"%s\",\"%s\",%d" % (link_type, pc_ip, server_port)) - sock_client = sock.accept()[0] - if link_type == "SSL": - sock_client = ssl.wrap_socket(sock_client, - server_side=True, - certfile=os.path.join("Certificate", "default.cer"), - keyfile=os.path.join("Certificate", "default.key")) - pass - if self.check_response("AT1", "OK") is False: - result = False - - self.serial_write_line("AT1", "AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)) - if self.check_response("AT1", "OK\r\n") is False: - result = False - - self.reconfig_serial_port("AT1", baudrate, rtscts) - - # restore to read line mode - self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) - - sock_client.settimeout(0) - - for _dummy in range(1): - if result is False: - NativeLog.add_trace_critical("Fail to create TCP connection") - break - # send TCP packets - data = "A" * packet_len - time1 = time.time() - - i = 0 - data_recv_len = 0 - while i < test_count: - self.serial_write_line("AT1", "AT+%s=0,%d" % (send_cmd, packet_len)) - if self.check_response("AT1", ">", 0.05) is False: - continue - - i += 1 - self.serial_write("AT1", data) - if send_cmd == "CIPSENDBUF": - result = self.check_response("AT1", "Recv %d bytes" % packet_len, 3) - else: - result = self.check_response("AT1", "SEND OK", 3) - if result is False: - NativeLog.add_trace_critical("Fail during sending data") - break - try: - if link_type == "TCP": - data_recv = sock_client.recv(10*1460) - elif link_type == "SSL": - data_recv = sock_client.read(10*1024) - else: - raise StandardError() - data_recv_len += len(data_recv) - except socket.error, e: - if e.errno == 10035: - pass - elif e.message == "The read operation timed out": - pass - else: - NativeLog.add_exception_log(e) - else: - self.set_result("Succeed") - - time2 = time.time() - - folder_path = MakeFolder.make_folder(LOG_PATH) - file_name = os.path.join(folder_path, - "%s_%s_%s.log" % (send_cmd, - packet_len, - time.strftime("%d%H%M%S", time.localtime()))) - with open(file_name, "ab+") as f: - f.write("\r\n[performance] %f packets per second " - "(including failed send operation)" - % (test_count/(time2-time1))) - f.write("\r\n[performance] %f Kbps" % (data_recv_len/(125*(time2-time1)))) - - self.serial_write_line("AT1", "AT+UART_CUR=115200,8,1,0,3") - self.check_response("AT1", "OK\r\n") - self.restore_serial_port("AT1") - - # restore to read line mode - self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) - # close socket - sock.close() - sock_client.close() - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/ATStress/TCPServerMulti.py b/components/test/TestCaseScript/ATStress/TCPServerMulti.py deleted file mode 100755 index c317bc9749..0000000000 --- a/components/test/TestCaseScript/ATStress/TCPServerMulti.py +++ /dev/null @@ -1,126 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class TCPServerMulti(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.max_conn = test_env.get_variable_by_name("max_conn")[1] - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - target_ip_str = self.target_ip_str - enable_log = self.enable_log - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPSeverMulti script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # turn off AT UART logging - if enable_log is False: - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - - # step1 create TCP server on target - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATC AT1 CIPSERVER 1 "] - fail_string = "Fail, Fail on create target TCP server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 PC connect to target server - for j in range(0, test_count): - data = "A" * at_send_length - fail_string = "Fail, Fail on connect to target server" - - # check if all connection can send data on target - checker_stings = ["P AT1 C OK"] - test_action_strings = ["ATS AT1 AT+CIPCLOSE=%d" % self.max_conn] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=100) is False: - NativeLog.add_trace_critical("Fail to close all connection") - NativeLog.add_trace_critical("Test count is %d" % j) - continue # if fail on this step, we can recover and continue - - # a) do connect - fail_flag = False - for i in range(0, self.max_conn): - checker_stings = ["P SOC_COM C OK", "P AT1 C CONNECT"] - test_action_strings = ["SOC SOC%d CONNECT %s" % (i+1, target_ip_str)] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail to connect to target for link %d" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - # if fail on this step, we can recover and continue - fail_flag = True - break - - if fail_flag is True: - # fail on step a) - continue - - # b) check if all connection can recv data on target - checker_stings = [] - test_action_strings = [] - for i in range(0, self.max_conn): - checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) - test_action_strings.extend(["SOC SOC%d SEND %d" % (i+1, soc_send_length)]) - - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail to receive data from PC") - NativeLog.add_trace_critical("Test count is %d" % j) - continue # if fail on this step, we can recover and continue - - # c) check if all connection can send data on target - for i in range(0, self.max_conn): - checker_stings = ["P AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail on target send command for link %d" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - return - - checker_stings = ["P SOC%d RL %d" % ((i+1), at_send_length), "P AT1 C OK"] - test_action_strings = ["ATSO AT1 %s" % data] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - return - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/TCPTransparent.py b/components/test/TestCaseScript/ATStress/TCPTransparent.py deleted file mode 100755 index d116923bf5..0000000000 --- a/components/test/TestCaseScript/ATStress/TCPTransparent.py +++ /dev/null @@ -1,280 +0,0 @@ -from TCAction import TCActionBase -from TCAction import CmdHandler -from NativeLog import NativeLog -import time -import random -import string -import os - - -class TransparentResultCheckCntx(TCActionBase.ResultCheckContext): - - def __init__(self, test_action, test_env, name): - TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) - self.result_array = [] - self.at_data_recv_total = 0 - self.pc_data_recv_total = 0 - self.temp_data_at2wifi = "" - self.temp_data_wifi2at = "" - pass - - def run(self): - validation_required = self.test_action.data_validation - path = os.path.split(self.test_action.log_file_name) - file_name_at2wifi = os.path.join(path[0], "%s_at2wifi_pc.bin" % self.test_action.timestamp) - file_name_wifi2at = os.path.join(path[0], "%s_wifi2at_at.bin" % self.test_action.timestamp) - - while True: - exit_flag = self.wait_exit_event(2) - # force exit - if exit_flag is True: - break - rx_len = 0 - tx_len = 0 - try: - self.lock_data() - rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) - tx_port = filter(lambda x: x[0] == "SOC2", self.data_cache) - self.data_cache = [] - finally: - self.unlock_data() - - if len(rx_port) == 1: - rx_len = len(rx_port[0][1]) - self.at_data_recv_total += rx_len - if validation_required is True: - self.temp_data_wifi2at += rx_port[0][1] - if len(tx_port) == 1: - tx_len = len(tx_port[0][1]) - self.pc_data_recv_total += tx_len - if validation_required is True: - self.temp_data_at2wifi += tx_port[0][1] - - self.result_array.append(["TX %8d %s" % - (tx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) - self.result_array.append(["RX %8d %s" % - (rx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) - - if validation_required is True: - with open(file_name_at2wifi, "ab+") as f: - f.write(self.temp_data_at2wifi) - with open(file_name_wifi2at, "ab+") as f: - f.write(self.temp_data_wifi2at) - - def get_validation_data(self): - return self.temp_data_at2wifi, self.temp_data_wifi2at - - def get_test_results(self): - return self.result_array, self.at_data_recv_total, self.pc_data_recv_total - - -class TCPTransparent(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.timestamp = time.strftime("%d%H%M%S", time.localtime()) - - pass - - def cleanup(self): - # close current result check context - self.result_cntx.stop_thread() - self.result_cntx.join() - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - # restore to read line mode - self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) - - # make sure enter condition that can respond to AT command - self.result_cntx = TCActionBase.ResultCheckContext(self, self.test_env, self.tc_name) - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - checker_stings = ["ATR AT1 R *"] - test_action_string = ["ATSO AT1 +++", "DELAY 0.1", "ATS AT1 AT"] - fail_string = "Fail, Fail to reconfig UART" - - result = False - - while result is False: - result = self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - - # reset baudrate - - checker_stings = ["ATR AT1 L OK"] - test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,3" % 115200] - fail_string = "Fail, Fail to reconfig UART" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - test_action = CmdHandler.parse_action("UART AT1 %d" % 115200, self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - TCActionBase.CommonTCActionBase.cleanup(self) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - # at send data len - at_send_data_len = self.at_send_data_len - # pc send data len - pc_send_data_len = self.pc_send_data_len - # sleep time between each send, test count - test_dispatch = self.test_dispatch - # enable target TCP TX - tx_enable = self.tx_enable - # enable target TCP RX - rx_enable = self.rx_enable - # if need to record tx/rx data to file - data_validation = self.data_validation - # UART baudrate - baudrate = self.baudrate - # HW flow control - rtscts = self.rtscts - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step0 reconfig baudrate - if baudrate != 0: - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)] - fail_string = "Fail, Fail to reconfig UART" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - test_action = CmdHandler.parse_action("UART AT1 %d %d" % (baudrate, rtscts), self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - - # step1 create PC server - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 LISTEN "] - fail_string = "Fail, Fail on create PC server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 target connect, switch to transparent - checker_stings = ["R SOC1 C +ACCEPT", "R AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"TCP\" "] - fail_string = "Fail, Fail on connect to PC server" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC2"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_strings = ["ATS AT1 AT+CIPMODE=1"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 - # turn off AT UART logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - # uart try to return data ASAP - self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) - - # switch to new result check context - self.result_cntx.stop_thread() - self.result_cntx.join() - self.result_cntx = TransparentResultCheckCntx(self, self.test_env, self.tc_name) - self.result_cntx.start() - - at_data_sent_total = 0 - pc_data_sent_total = 0 - at2wifi_data = "" - wifi2at_data = "" - - for j in range(0, len(at_send_data_len) * len(pc_send_data_len)): - at_data_len = at_send_data_len[j / len(pc_send_data_len)] - pc_data_len = pc_send_data_len[j % len(pc_send_data_len)] - # data = "".join(["A"] * at_data_len) - chars = string.ascii_lowercase - data_list = ["".join([random.choice(chars) for m in range(at_data_len-16)])] - chars = string.ascii_uppercase - data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) - chars = string.digits - data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) - - for i in range(0, len(test_dispatch)): - for k in range(0, test_dispatch[i][1]): - data_str = "%.2d%.2d%.10d%s\r\n" % (j, i, k, data_list[k % 3]) - # time1 = time.time() - if tx_enable is True: - test_action = CmdHandler.parse_action("ATSO AT1 %s" % data_str, self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - at_data_sent_total += at_data_len - if data_validation is True: - at2wifi_data += data_str - # time2 = time.time() - if rx_enable is True: - if tx_enable is True: - test_action = CmdHandler.parse_action("SOC SOC2 SENDNB %d %s" % (pc_data_len, data_str), - self.test_env) - else: - test_action = CmdHandler.parse_action("SOC SOC2 SEND %d %s" % (pc_data_len, data_str), - self.test_env) - sent_len = CmdHandler.do_action(test_action[0], self.test_env) - pc_data_sent_total += sent_len - if data_validation is True: - wifi2at_data += data_str[:sent_len] - # time3 = time.time() - # if time3-time2 > 0.1: - # break - if test_dispatch[i][0] != 0: - time.sleep(test_dispatch[i][0]) - time.sleep(3) # wait 3 seconds - - # write send data to file for data validation - if data_validation is True: - path = os.path.split(self.log_file_name) - with open(os.path.join(path[0], "%s_at2wifi_at.bin" % self.timestamp), "ab+") as f: - f.write(at2wifi_data) - with open(os.path.join(path[0], "%s_wifi2at_pc.bin" % self.timestamp), "ab+") as f: - f.write(wifi2at_data) - - temp_data_at2wifi, temp_data_wifi2at = self.result_cntx.get_validation_data() - if temp_data_at2wifi != at2wifi_data: - NativeLog.add_prompt_trace("[Validation Fail] at2wifi") - if temp_data_wifi2at != wifi2at_data: - NativeLog.add_prompt_trace("[Validation Fail] wifi2at") - - throughput_results, at_data_recv_total, pc_data_recv_total = self.result_cntx.get_test_results() - result_str = "AT sent %15d\r\n" % at_data_sent_total - result_str += "PC recv %15d\r\n" % pc_data_recv_total - result_str += "PC sent %15d\r\n" % pc_data_sent_total - result_str += "AT recv %15d\r\n" % at_data_recv_total - for _result in throughput_results: - result_str += "%s\r\n" % _result - with open(self.log_file_name, "ab+") as f: - f.write(result_str) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/UDPMulti.py b/components/test/TestCaseScript/ATStress/UDPMulti.py deleted file mode 100755 index 4423db3ce3..0000000000 --- a/components/test/TestCaseScript/ATStress/UDPMulti.py +++ /dev/null @@ -1,113 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import time - - -class UDPMulti(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.max_conn = test_env.get_variable_by_name("max_conn")[1] - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - target_ip_str = self.target_ip_str - tx_enable = self.tx_enable - rx_enable = self.rx_enable - enable_log = self.enable_log - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for UDPMulti script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # step1, bind one PC UDP port - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 BIND "] - fail_string = "Fail, Fail on binding socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 2 create 5 UDP link on target - for i in range(0, self.max_conn): - checker_stings = ["R AT1 C CONNECT L OK"] - test_action_strings = ["ATC AT1 CIPSTART %d \"UDP\" 1" - % (i, i+1)] - fail_string = "Fail, Fail on create UDP link" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 send recv data - # turn off AT UART logging - if enable_log is False: - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - - for j in range(0, test_count): - data = "A" * at_send_length - fail_string = "Fail, Fail on send/recv data" - - if tx_enable is True: - # target link 0-5 sendto PC - for i in range(0, self.max_conn): - checker_stings = ["P AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (i, at_send_length)] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Target fail on send cmd on link %d" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - - checker_stings = ["P SOC_COM C RECV_LEN=%d P " % (at_send_length, i+1), - "P AT1 C OK"] - test_action_strings = ["ATSO AT1 %s" % data] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Target sent UDP packet error on link %d" % i) - NativeLog.add_trace_critical("Test count is %d" % j) - - if rx_enable is True: - # PC send to target - checker_stings = [] - test_action_strings = [] - for i in range(0, self.max_conn): - checker_stings.extend(["P AT1 DL %d+%d" % (i, soc_send_length)]) - test_action_strings.extend(["SOC SOC1 SENDTO %d %s" - % (soc_send_length, i+1, target_ip_str)]) - - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("PC sent UDP packet error") - NativeLog.add_trace_critical("Test count is %d" % j) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/UDPSingle.py b/components/test/TestCaseScript/ATStress/UDPSingle.py deleted file mode 100755 index 0f30330ab6..0000000000 --- a/components/test/TestCaseScript/ATStress/UDPSingle.py +++ /dev/null @@ -1,105 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class UDPSingle(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - TCActionBase.CommonTCActionBase.cleanup(self) - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - try: - at_send_length = self.at_send_length - soc_send_length = self.soc_send_length - test_count = self.test_count - target_ip_str = self.target_ip_str - tx_enable = self.tx_enable - rx_enable = self.rx_enable - enable_log = self.enable_log - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for UDPSingle script, error is %s" % e) - raise StandardError("Error configuration") - # configurable params - - # step1, bind one PC UDP port - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 BIND "] - fail_string = "Fail, Fail on binding UDP socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 2 create UDP link on target - checker_stings = ["R AT1 C CONNECT L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"UDP\" 1"] - fail_string = "Fail, Fail on create UDP link" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 send recv data - # turn off AT UART logging - if enable_log is False: - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - - for j in range(0, test_count): - data = "A" * at_send_length - fail_string = "Fail, Fail on send recv data" - - # target sendto PC - if tx_enable is True: - checker_stings = ["P AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d" % at_send_length] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Target fail on send cmd") - NativeLog.add_trace_critical("Test count is %d" % j) - - checker_stings = ["P SOC_COM C RECV_LEN=%d P " % at_send_length, - "P AT1 C OK"] - test_action_strings = ["ATSO AT1 %s" % data] - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Target sent UDP packet error") - NativeLog.add_trace_critical("Test count is %d" % j) - - # PC send to target - if rx_enable is True: - checker_stings = (["P AT1 DL S+%d" % soc_send_length]) - test_action_strings = (["SOC SOC1 SENDTO %d %s" % (soc_send_length, target_ip_str)]) - - if self.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("PC sent UDP packet error") - NativeLog.add_trace_critical("Test count is %d" % j) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/UDPTransparent.py b/components/test/TestCaseScript/ATStress/UDPTransparent.py deleted file mode 100755 index 699d2b1ad8..0000000000 --- a/components/test/TestCaseScript/ATStress/UDPTransparent.py +++ /dev/null @@ -1,262 +0,0 @@ -from TCAction import TCActionBase -from TCAction import CmdHandler -from NativeLog import NativeLog -import time -import random -import string -import os - - -class TransparentResultCheckCntx(TCActionBase.ResultCheckContext): - - def __init__(self, test_action, test_env, name): - TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) - self.result_array = [] - self.at_data_recv_total = 0 - self.pc_data_recv_total = 0 - pass - - def run(self): - validation_required = self.test_action.data_validation - temp_data_at2wifi = "" - temp_data_wifi2at = "" - path = os.path.split(self.test_action.log_file_name) - file_name_at2wifi = os.path.join(path[0], "%s_at2wifi_pc.bin" % self.test_action.timestamp) - file_name_wifi2at = os.path.join(path[0], "%s_wifi2at_at.bin" % self.test_action.timestamp) - - while True: - exit_flag = self.wait_exit_event(2) - # force exit - if exit_flag is True: - break - rx_len = 0 - tx_len = 0 - try: - self.lock_data() - rx_port = filter(lambda x: x[0] == "AT1", self.data_cache) - tx_port = filter(lambda x: x[0] == "SOC1", self.data_cache) - self.data_cache = [] - finally: - self.unlock_data() - - if len(rx_port) == 1: - rx_len = len(rx_port[0][1]) - self.at_data_recv_total += rx_len - if validation_required is True: - temp_data_wifi2at += rx_port[0][1] - if len(tx_port) == 1: - tx_len = len(tx_port[0][1]) - self.pc_data_recv_total += tx_len - if validation_required is True: - temp_data_at2wifi += tx_port[0][1] - - self.result_array.append(["TX %8d %s" % - (tx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) - self.result_array.append(["RX %8d %s" % - (rx_len/2, time.strftime("%m-%d %H:%M:%S", time.localtime()))]) - - if validation_required is True: - with open(file_name_at2wifi, "ab+") as f: - f.write(temp_data_at2wifi) - with open(file_name_wifi2at, "ab+") as f: - f.write(temp_data_wifi2at) - - def get_test_results(self): - return self.result_array, self.at_data_recv_total, self.pc_data_recv_total - - -class UDPTransparent(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.timestamp = time.strftime("%d%H%M%S", time.localtime()) - - pass - - def cleanup(self): - # close current result check context - self.result_cntx.stop_thread() - self.result_cntx.join() - # turn on logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(True) - # restore to read line mode - self.test_env.uart_ports["AT1"].set_performance_flag(flag=False) - - # make sure enter condition that can respond to AT command - self.result_cntx = TCActionBase.ResultCheckContext(self, self.test_env, self.tc_name) - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - checker_stings = ["R AT1 R *"] - test_action_string = ["ATSO AT1 +++", "DELAY 0.1", "ATS AT1 AT"] - fail_string = "Fail, Fail to reconfig UART" - - result = False - - while result is False: - result = self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - - # reset baudrate - - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,3" % 115200] - fail_string = "Fail, Fail to reconfig UART" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - test_action = CmdHandler.parse_action("UART AT1 %d" % 115200, self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - TCActionBase.CommonTCActionBase.cleanup(self) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - # at send data len - at_send_data_len = self.at_send_data_len - # pc send data len - pc_send_data_len = self.pc_send_data_len - # sleep time between each send, test count - test_dispatch = self.test_dispatch - # enable target TCP TX - tx_enable = self.tx_enable - # enable target TCP RX - rx_enable = self.rx_enable - # if need to record tx/rx data to file - data_validation = self.data_validation - # UART baudrate - baudrate = self.baudrate - # HW flow control - rtscts = self.rtscts - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step0 reconfig baudrate - if baudrate != 0: - checker_stings = ["R AT1 L OK"] - test_action_string = ["ATS AT1 AT+UART_CUR=%d,8,1,0,%d" % (baudrate, rtscts)] - fail_string = "Fail, Fail to reconfig UART" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - test_action = CmdHandler.parse_action("UART AT1 %d %d" % (baudrate, rtscts), self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - - # step1 create PC server - checker_stings = ["R SOC_COM L OK"] - test_action_string = ["SOC SOC1 BIND "] - fail_string = "Fail, Fail on create PC server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2 target connect, switch to transparent - checker_stings = ["R AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART \"UDP\" 0"] - fail_string = "Fail, Fail on connect to PC server" - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R AT1 L OK"] - test_action_strings = ["ATS AT1 AT+CIPMODE=1"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - checker_stings = ["R AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND"] - if self.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) is False: - return - - # step 3 - # turn off AT UART logging - self.test_env.uart_ports["AT1"].set_uart_logging_flag(False) - # restore to read data asap - self.test_env.uart_ports["AT1"].set_performance_flag(flag=True) - - # switch to new result check context - self.result_cntx.stop_thread() - self.result_cntx.join() - self.result_cntx = TransparentResultCheckCntx(self, self.test_env, self.tc_name) - self.result_cntx.start() - - at_data_sent_total = 0 - pc_data_sent_total = 0 - at2wifi_data = "" - wifi2at_data = "" - - for j in range(0, len(at_send_data_len) * len(pc_send_data_len)): - at_data_len = at_send_data_len[j / len(pc_send_data_len)] - pc_data_len = pc_send_data_len[j % len(pc_send_data_len)] - # data = "".join(["A"] * at_data_len) - chars = string.ascii_lowercase - data_list = ["".join([random.choice(chars) for m in range(at_data_len-16)])] - chars = string.ascii_uppercase - data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) - chars = string.digits - data_list.append("".join([random.choice(chars) for m in range(at_data_len-16)])) - - for i in range(0, len(test_dispatch)): - for k in range(0, test_dispatch[i][1]): - data_str = "%.2d%.2d%.10d%s\r\n" % (j, i, k, data_list[k % 3]) - # time1 = time.time() - if tx_enable is True: - test_action = CmdHandler.parse_action("ATSO AT1 %s" % data_str, self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - at_data_sent_total += at_data_len - if data_validation is True: - at2wifi_data += data_str - # time2 = time.time() - if rx_enable is True: - test_action = CmdHandler.parse_action("SOC SOC1 SENDTO %d %s %s %s" - % (pc_data_len, "", - "", data_str), self.test_env) - CmdHandler.do_actions(test_action, self.test_env) - pc_data_sent_total += pc_data_len - if data_validation is True: - wifi2at_data += data_str - # time3 = time.time() - # if time3-time2 > 0.1: - # pass - if test_dispatch[i][0] != 0: - time.sleep(test_dispatch[i][0]) - time.sleep(3) # wait 3 seconds - - # write send data to file for data validation - if data_validation is True: - path = os.path.split(self.log_file_name) - with open(os.path.join(path[0], "%s_at2wifi_at.bin" % self.timestamp), "ab+") as f: - f.write(at2wifi_data) - with open(os.path.join(path[0], "%s_wifi2at_pc.bin" % self.timestamp), "ab+") as f: - f.write(wifi2at_data) - throughput_results, at_data_recv_total, pc_data_recv_total = self.result_cntx.get_test_results() - result_str = "AT sent %15d\r\n" % at_data_sent_total - result_str += "PC recv %15d\r\n" % pc_data_recv_total - result_str += "PC sent %15d\r\n" % pc_data_sent_total - result_str += "AT recv %15d\r\n" % at_data_recv_total - for _result in throughput_results: - result_str += "%s\r\n" % _result - with open(self.log_file_name, "ab+") as f: - f.write(result_str) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/ATStress/__init__.py b/components/test/TestCaseScript/ATStress/__init__.py deleted file mode 100755 index 5a3bbc44dd..0000000000 --- a/components/test/TestCaseScript/ATStress/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = ["TCPClientMulti", "TCPClientSingle", "TCPServerMulti", - "TCPTransparent", "UDPMulti", "UDPSingle"] \ No newline at end of file diff --git a/components/test/TestCaseScript/IOT/SCIOT.py b/components/test/TestCaseScript/IOT/SCIOT.py deleted file mode 100755 index 5ced3ef121..0000000000 --- a/components/test/TestCaseScript/IOT/SCIOT.py +++ /dev/null @@ -1,357 +0,0 @@ -import Queue - -from TCAction import TCActionBase -from NativeLog import NativeLog -from SCUDPServer import * -from TCAction.CmdExecutor import CmdExecutorBasic -from Utility import MakeFolder - -TEST_RESULT_CATEGORY = ("AP", "Phone") -TEST_RESULT_PROPERTY = ("model", "total", "succeed", "failed", "total time1", "total time2") -SINGLE_TEST_RESULT = ("AP", "Phone", "result", "time1", "time2") - -LOG_FILES = ("by_ap.tmp", "by_phone.tmp", "failed_item.tmp", "disqualified_item.tmp", "total.tmp") - -LOG_PATH = os.path.join("AT_LOG", "IOT") - - -def make_session_id(mac, test_id): - return mac_to_bytes(mac) + chr((test_id & 0xFF00) >> 8) + chr(test_id & 0xFF) - - -class TestHandler(threading.Thread): - def __init__(self, session_id, ap, phone, udp_server, test_action): - threading.Thread.__init__(self) - self.setDaemon(True) - self.udp_server = udp_server - self.session_id = session_id - self.ap = ap - self.phone = phone - self.test_action = test_action - self.recv_queue = Queue.Queue(10) - self.abort_event = threading.Event() - self.start_time = time.time() - self.test_result = None - udp_server.register_test_handler(session_id, self) - pass - - def req_receiver(self, msg, address): - self.recv_queue.put([msg, address]) - pass - - def res_receiver(self, msg, address): - self.recv_queue.put([msg, address]) - pass - - def abort_handler(self): - NativeLog.add_prompt_trace("[Test Handler][Debug] test aborted") - self.abort_event.set() - self.test_action.remove_from_available_list(self.phone) - pass - - def wait_result(self, event, timeout=None): - time_start = time.time() - while True: - if self.abort_event.isSet() is True: - return False - - if time.time() - self.start_time > ABORT_TIMEOUT: - return False - - if timeout is not None: - if time.time() - time_start > timeout: - return False - - if event == "ACK" or event == "result": - try: - ret = self.recv_queue.get(timeout=0.5) - except Queue.Empty, e: - continue - else: - msg = ret[0] - value_list = get_value_from_msg("type", msg) - msg_typ = ord(value_list[0]) - if msg_typ == TYPE_VAL[event]: - NativeLog.add_prompt_trace("[Test Handler][Debug] wait message succeed") - return msg - elif (msg_typ & 0x80) == 0: # invalid request - self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["Not support"]], - [VALUE_NAME["session id"], self.session_id]], - ret[1]) - pass - else: - pass - pass - - def run(self): - for i in range(1): - # step1 send broadcast to SP - msg = [[VALUE_NAME["type"], TYPE_VAL["Init new test"]], - [VALUE_NAME["session id"], self.session_id]] - self.udp_server.send_request(("", self.udp_server.udp_port), self.session_id, msg) - # wait response - if self.wait_result("ACK") is False: - break - NativeLog.add_prompt_trace("[Step1] Initial new test succeed") - - # step2 start smart config - checker_stings = ["ATR AT1 L OK"] - test_action_string = ["ATS AT1 AT+CWSTOPSMART"] - fail_string = "Fail, Failed to start smart config" - if self.test_action.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - NativeLog.add_prompt_trace(fail_string) - break - checker_stings = ["ATR AT1 L OK"] - test_action_string = ["ATS AT1 AT+CWSTARTSMART=1"] - if self.test_action.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - NativeLog.add_prompt_trace(fail_string) - break - NativeLog.add_prompt_trace("[Step2] Start smart config succeed") - - # step3 send test request to SP - msg = [[VALUE_NAME["type"], TYPE_VAL["test request"]], - [VALUE_NAME["session id"], self.session_id], - [VALUE_NAME["ap ssid"], self.ap["ssid"]], - [VALUE_NAME["ap password"], self.ap["password"]], - [VALUE_NAME["ap bssid"], mac_to_bytes(self.ap["bssid"])], - # [VALUE_NAME["ET version"], 0x20], - [VALUE_NAME["ssid hidden"], self.ap["is_hidden"]], - [VALUE_NAME["ap encryption"], AP_ENCRYPTION_VAL[self.ap["encryption"]]] - ] - self.udp_server.send_request((self.phone["ip"], self.udp_server.udp_port), self.session_id, msg) - # wait SP reply - if self.wait_result("ACK") is False: - break - NativeLog.add_prompt_trace("[Step3] Send test request succeed") - time_base = time.time() - - # step4 wait target smart config succeed - checker_stings = ["ATR AT1 C get%%20wifi%%20info C %s C %s" - % (self.ap["ssid"], self.ap["password"])] - test_action_string = [] - fail_string = "Fail, Fail to get ap info" - # if check target get smart config result fail, continue and get result from SP - ret = self.test_action.load_and_exe_one_step(checker_stings, test_action_string, - fail_string, check_time=600) - if ret is False: - NativeLog.add_prompt_trace("[Step4] Target smart config fail") - step_4_fail = True - else: - NativeLog.add_prompt_trace("[Step4] Target smart config succeed") - step_4_fail = False - time_target_succeed = time.time() - time_base - - # step5 wait SP result - msg = self.wait_result("result") - if msg is False: - NativeLog.add_prompt_trace("[Test Handler][Debug] Failed to get result from SP") - break - else: - self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["ACK"]], - [VALUE_NAME["session id"], self.session_id]], - (self.phone["ip"], self.udp_server.udp_port)) - tmp = get_value_from_msg(["result code", "start SC time", "recv UDP time"], msg) - result_code = ord(tmp[0]) - if result_code == RESULT_CODE_VAL["OK"]: - sp_start_time = bytes_to_time(tmp[1]) - sp_recv_udp_time = bytes_to_time(tmp[2]) - smart_config_protocol_cost = time_target_succeed - sp_start_time - user_experience_time = sp_recv_udp_time - sp_start_time - self.test_result = ["Succeed", smart_config_protocol_cost, user_experience_time] - elif result_code == RESULT_CODE_VAL["recv UDP fail"]: - sp_start_time = bytes_to_time(tmp[1]) - if step_4_fail is True: - smart_config_protocol_cost = 0 - else: - smart_config_protocol_cost = time_target_succeed - sp_start_time - self.test_result = ["Failed", smart_config_protocol_cost, 0] - pass - else: - NativeLog.add_prompt_trace("[Test Handler][Debug] Disqualified message: %s" % tmp) - - for k in range(RETRANSMIT_COUNT - 1): - if self.wait_result("result", RETRANSMIT_TIMEOUT) is not False: - self.udp_server.send_response([[VALUE_NAME["type"], TYPE_VAL["ACK"]], - [VALUE_NAME["session id"], self.session_id]], - (self.phone["ip"], self.udp_server.udp_port)) - - NativeLog.add_prompt_trace("[Step5] Receive test result from SP") - - if self.test_result is None: - self.test_result = ["Disqualified", 0, 0] - self.udp_server.deregister_test_handler(self.session_id) - NativeLog.add_prompt_trace("One Test Done") - pass - - def get_result(self): - if self.test_result is None: - NativeLog.add_trace_critical("Get result before test finish") - return self.test_result - pass - - -class SCIOT(TCActionBase.CommonTCActionBase): - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.ap_list = [] - self.test_result = dict.fromkeys(TEST_RESULT_CATEGORY) - self.test_result["AP"] = [] - self.test_result["Phone"] = [] - self.available_phone_list = [] - self.pc_ip = "" - self.udp_port = "" - self.test_id = 0x00 - self.resource_lock = threading.Lock() - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROPERTY, " + cmd_set[i][1][j] + ")))" - exec cmd_string - for ap in self.ap_list: - self.test_result["AP"].append(dict(zip(TEST_RESULT_PROPERTY, [ap["ssid"], 0, 0, 0, 0, 0]))) - - self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, "TEST_%s" - % (time.strftime("%y%m%d%H%M%S", time.localtime())))) - self.log_files = dict.fromkeys(LOG_FILES) - for _file in self.log_files: - self.log_files[_file] = os.path.join(self.log_folder, - (time.strftime("%H%M%S", time.localtime())) + _file) - pass - - def update_phone_list(self, phone): - with self.resource_lock: - tmp = filter(lambda x: x["model"] == phone["model"], self.available_phone_list) - if len(tmp) == 1: - tmp[0]["ip"] = phone["ip"] - else: - self.available_phone_list.append(phone) - - tmp = filter(lambda x: x["model"] == phone["model"], self.test_result["Phone"]) - if len(tmp) == 0: - self.test_result["Phone"].append(dict(zip(TEST_RESULT_PROPERTY, [phone["model"], 0, 0, 0, 0, 0]))) - pass - - def remove_from_available_list(self, phone): - with self.resource_lock: - tmp = filter(lambda x: x["model"] == phone["model"], self.available_phone_list) - if len(tmp) == 1: - self.available_phone_list.remove(tmp[0]) - pass - - def allocate_test(self): - phone = None - test_count = 0xFFFF - with self.resource_lock: - for _phone in self.available_phone_list: - tmp = filter(lambda x: x["model"] == _phone["model"], self.test_result["Phone"]) - if len(tmp) == 1: - _count = tmp[0]["total"] - if _count < test_count: - test_count = _count - phone = _phone - ap_list = self.ap_list[test_count % len(self.ap_list):] - return phone, ap_list - pass - - def output_test_result(self, ap, phone, test_result): - result_str = "Time stamp" + ":\t" + NativeLog.generate_timestamp() + "\r\n" - result_str += "AP model" + ":\t" + str(ap["ssid"]) + "\r\n" - result_str += "AP encryption" + ":\t" + str(ap["encryption"]) + "\r\n" - result_str += "AP HT" + ":\t" + str(ap["ht"]) + "\r\n" - result_str += "AP ssid hidden" + ":\t" + str(ap["is_hidden"]) + "\r\n" - result_str += "Phone model" + ":\t" + str(phone["model"]) + "\r\n" - result_str += "Result" + ":\t" + str(test_result[0]) + "\r\n" - result_str += "Time1" + ":\t" + str(test_result[1]) + "\r\n" - result_str += "Time2" + ":\t" + str(test_result[2]) + "\r\n" - - with self.resource_lock: - tmp = [filter(lambda x: x["model"] == ap["ssid"], self.test_result["AP"])[0], - filter(lambda x: x["model"] == phone["model"], self.test_result["Phone"])[0]] - if test_result[0] == "Succeed": - for _tmp in tmp: - _tmp["total"] += 1 - _tmp["succeed"] += 1 - _tmp["total time1"] += test_result[1] - _tmp["total time2"] += test_result[2] - pass - elif test_result[0] == "Disqualified": - for _tmp in tmp: - _tmp["total"] += 1 - pass - else: - for _tmp in tmp: - _tmp["total"] += 1 - _tmp["failed"] += 1 - pass - tmp_result = dict(zip(TEST_RESULT_CATEGORY, ["", ""])) - for category in self.test_result: - for _result in self.test_result[category]: - for n in _result: - tmp_result[category] += str(n) + ":\t" + str(_result[n]) + "\r\n" - - # update to log file - with open(self.log_files["by_ap.tmp"], "wb+") as f: - f.write(tmp_result["AP"]) - with open(self.log_files["by_phone.tmp"], "wb+") as f: - f.write(tmp_result["Phone"]) - - with open(self.log_files["total.tmp"], "ab+") as f: - f.write(result_str) - if test_result[0] == "Failed": - with open(self.log_files["failed_item.tmp"], "ab+") as f: - f.write(result_str) - elif test_result[0] == "Disqualified": - with open(self.log_files["disqualified_item.tmp"], "ab+") as f: - f.write(result_str) - - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - pc_ip = CmdExecutorBasic.extract_parameter(self.pc_ip, self.test_env) - if isinstance(self.udp_port, int) is False: - udp_port = CmdExecutorBasic.extract_parameter(self.udp_port, self.test_env) - else: - udp_port = self.udp_port - - server = UDPServer(pc_ip, udp_port, self.update_phone_list) - server.start() - - while True: - phone, ap_list = self.allocate_test() - if phone is None: - time.sleep(5) - continue - for ap in ap_list: - NativeLog.add_prompt_trace("AP is %s, Phone is %s" % (ap["ssid"], phone["model"])) - session_id = make_session_id(phone["mac"], self.test_id) - self.test_id += 1 - test_handler = TestHandler(session_id, ap, phone, server, self) - test_handler.start() - test_handler.join() - result = test_handler.get_result() - self.output_test_result(ap, phone, result) - - # finally, execute done - server.join() - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/IOT/SCUDPServer.py b/components/test/TestCaseScript/IOT/SCUDPServer.py deleted file mode 100755 index 75f24f79ac..0000000000 --- a/components/test/TestCaseScript/IOT/SCUDPServer.py +++ /dev/null @@ -1,378 +0,0 @@ -import socket -import time -import os -import threading - -from NativeLog import NativeLog - - -RETRANSMIT_COUNT = 5 -RETRANSMIT_TIMEOUT = 0.5 -ABORT_TIMEOUT = 120 -BEACON_SEND_RATE = 30 - - -VALUE_NAME = {"type": 0x00, - "session id": 0x01, - "result code": 0x02, - "ap ssid": 0x03, - "ap password": 0x04, - "start SC time": 0x05, - "recv UDP time": 0x06, - "SP model": 0x07, - "SP mac": 0x08, - "ET version": 0x09, - "ap bssid": 0x0A, - "ssid hidden": 0x0B, - "ap encryption": 0x0C, - } - -TYPE_VAL = {"Init new test": 0x00, - "test request": 0x01, - "result": 0x02, - "query phone": 0x03, - "ACK": 0x80, - "phone report": 0x81, - "Not support": 0xFF, - "invalid session": 0xFE, - } - -RESULT_CODE_VAL = {"OK": 0x80, - "JAP fail": 0x81, # SP join AP fail, should disqualify this result - "recv UDP fail": 0x82, # SP did not receive UDP sent by target - } - -AP_ENCRYPTION_VAL = {"OPEN": 0x00, - "WEP": 0x01, - "WPA": 0x02, - } - -AP_PROPERTY = ("ssid", "password", "bssid", "is_hidden", "encryption", "ht") -PHONE_PROPERTY = ("ip", "mac", "model") - - -SERIAL_PORT_NUM = 3 -LOG_FILE_PREFIX = "SC_IOT" -LOG_FOLDER = os.path.join("AT_LOG", "TEMP") -LOG_FILE_NAME = os.path.join(LOG_FOLDER, "%s_%s.log" % (LOG_FILE_PREFIX, time.strftime("%d%H%M%S", time.localtime()))) - - -REQUEST_LOCK = threading.Lock() -HANDLER_LOCK = threading.Lock() - - -def sync_request_list(func): - def handle_args(*args, **kwargs): - with REQUEST_LOCK: - ret = func(*args, **kwargs) - return ret - return handle_args - - -def sync_handler_list(func): - def handle_args(*args, **kwargs): - with HANDLER_LOCK: - ret = func(*args, **kwargs) - return ret - return handle_args - - -def _process_one_tlv_pair(data): - typ = ord(data[0]) - length = ord(data[1]) - value = data[2:2+length] - processed_data = data[2+length:] - return (typ, value), processed_data - pass - - -def bytes_to_msg(data): - data_to_process = data - msg = [] - while True: - one_pair, data_to_process = _process_one_tlv_pair(data_to_process) - msg.append(one_pair) - if len(data_to_process) == 0: - break - return msg - pass - - -def msg_to_bytes(msg): - byte_str = "" - for pair in msg: - byte_str += chr(pair[0]) - if isinstance(pair[1], list) is True: - byte_str += chr(len(pair[1])) - byte_str.join([chr(m) for m in pair[1]]) - elif isinstance(pair[1], str) is True: - byte_str += chr(len(pair[1])) - byte_str += pair[1] - elif isinstance(pair[1], int) is True: - byte_str += chr(1) - byte_str += chr(pair[1]) - else: - raise TypeError("msg content only support list and string type") - return byte_str - - -def get_value_from_msg(type_list, msg): - if isinstance(type_list, str) is True: - type_list = [type_list] - ret = [""] * len(type_list) - for pair in msg: - for i in range(len(type_list)): - if pair[0] == VALUE_NAME[type_list[i]]: - ret[i] = pair[1] - if "" not in ret: - # all type value found - break - else: - NativeLog.add_prompt_trace("missing required type in msg") - return ret - - -def bytes_to_time(bytes_in): - if len(bytes_in) != 4: - return 0 - t = float(ord(bytes_in[0])*256*256*256 + ord(bytes_in[1])*256*256 - + ord(bytes_in[2])*256 + ord(bytes_in[2]))/1000 - return t - pass - - -def mac_to_bytes(mac): - tmp = mac.split(':') - return "".join([chr(int(m[:2], base=16)) for m in tmp]) - pass - - -def bytes_to_mac(bytes_in): - mac = "".join(["%x:" % ord(m) for m in bytes_in] ) - return mac[:-1] - - -class RetransmitHandler(threading.Thread): - def __init__(self, udp_server): - threading.Thread.__init__(self) - self.setDaemon(True) - self.udp_server = udp_server - self.exit_event = threading.Event() - pass - - @sync_request_list - def find_required_retransmit_msg(self): - time_now = time.time() - aborted_sessions = [] - retransmit_msg = [] - msgs = filter(lambda x: time_now - x[4] >= RETRANSMIT_TIMEOUT, self.udp_server.unconfirmed_request) - for msg in msgs: - if msg[3] == 0: - aborted_sessions.append(msg[0]) - self.udp_server.unconfirmed_request.remove(msg) - else: - msg[3] -= 1 - msg[4] = time_now - retransmit_msg.append(msg) - pass - return aborted_sessions, retransmit_msg - pass - - def run(self): - while True: - self.exit_event.wait(0.1) - if self.exit_event.isSet() is True: - break - aborted_sessions, retransmit_msg = self.find_required_retransmit_msg() - for msg in retransmit_msg: - self.udp_server.udp_socket.sendto(msg[1], msg[2]) - for session_id in aborted_sessions: - self.udp_server.session_aborted(session_id) - - def exit(self): - self.exit_event.set() - pass - - -class SendBeacon(threading.Thread): - def __init__(self, sock, udp_port): - threading.Thread.__init__(self) - self.setDaemon(True) - self.udp_sock = sock - self.udp_port = udp_port - self.exit_event = threading.Event() - - def run(self): - while True: - msg = [[VALUE_NAME["type"], TYPE_VAL["query phone"]]] - data = msg_to_bytes(msg) - self.udp_sock.sendto(data, ("", self.udp_port)) - for i in range(BEACON_SEND_RATE): - self.exit_event.wait(1) - if self.exit_event.isSet() is True: - return - pass - - def exit(self): - self.exit_event.set() - pass - - -class UDPServer(threading.Thread): - def __init__(self, pc_ip, udp_port, update_phone_handler): - threading.Thread.__init__(self) - self.setDaemon(True) - sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) - sock.bind((pc_ip, udp_port)) - sock.settimeout(1) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - self.udp_socket = sock - self.unconfirmed_request = [] - self.test_handler_list = [] - self.pc_ip = pc_ip - self.udp_port = udp_port - self.update_phone_handler = update_phone_handler - self.retransmit_thread = RetransmitHandler(self) - self.beacon_thread = SendBeacon(self.udp_socket, self.udp_port) - self.retransmit_thread.start() - self.beacon_thread.start() - self.exit_event = threading.Event() - pass - - @sync_handler_list - def register_test_handler(self, session_id, test_handler): - tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) - if len(tmp) > 0: - NativeLog.add_prompt_trace("handler with same session id exist") - else: - self.test_handler_list.append([session_id, test_handler]) - pass - - @sync_handler_list - def deregister_test_handler(self, session_id): - tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) - if len(tmp) > 1: - NativeLog.add_prompt_trace("deregister test handler fail") - elif len(tmp) == 1: - self.test_handler_list.remove(tmp[0]) - pass - - @sync_handler_list - def get_test_handler(self, session_id): - ret = None - tmp = filter(lambda x: x[0] == session_id, self.test_handler_list) - if len(tmp) != 1: - NativeLog.add_prompt_trace("failed to get test handler, " - "%d handler found, session id %s" % (len(tmp), session_id)) - elif len(tmp) == 1: - ret = tmp[0][1] - return ret - pass - - def session_aborted(self, session_id): - test_handler = self.get_test_handler(session_id) - if test_handler is not None: - test_handler.abort_handler() - pass - - def confirm_request(self, session_id, msg, address): - test_handler = self.get_test_handler(session_id) - if test_handler is not None: - test_handler.res_receiver(msg, address) - self.remove_pending_request(session_id) - pass - - def receive_request(self, msg, address): - result = get_value_from_msg(["type", "session id"], msg) - msg_type = ord(result[0]) - session_id = result[1] - if msg_type != TYPE_VAL["result"]: - self.send_response([[VALUE_NAME["type"], TYPE_VAL["Not support"]]], address) - else: - test_handler = self.get_test_handler(session_id) - if test_handler is None: - self.send_response([[VALUE_NAME["type"], TYPE_VAL["invalid session"]], - [VALUE_NAME["session id"], session_id]], - address) - pass - else: - test_handler.req_receiver(msg, address) - pass - - @sync_request_list - def add_request_to_queue(self, dest_addr, session_id, data): - tmp = filter(lambda x: x[0] == session_id, self.unconfirmed_request) - if len(tmp) != 0: - NativeLog.add_prompt_trace("One pending request belong to same session id %s" % session_id) - pass - else: - self.unconfirmed_request.append([session_id, data, - dest_addr, RETRANSMIT_COUNT-1, time.time()]) - - def send_request(self, dest_addr, session_id, msg): - data = msg_to_bytes(msg) - self.add_request_to_queue(dest_addr, session_id, data) - self.udp_socket.sendto(data, dest_addr) - pass - - def send_response(self, msg, address): - self.udp_socket.sendto(msg_to_bytes(msg), address) - - @sync_request_list - def remove_pending_request(self, session_id): - tmp = filter(lambda x: x[0] == session_id, self.unconfirmed_request) - if len(tmp) > 0: - self.unconfirmed_request.remove(tmp[0]) - pass - pass - - def handle_response(self, msg, address): - result = get_value_from_msg(["type", "session id"], msg) - msg_type = ord(result[0]) - session_id = result[1] - if msg_type == TYPE_VAL["ACK"]: - self.confirm_request(session_id, msg, address) - elif msg_type == TYPE_VAL["phone report"]: - # add new available phone - tmp = get_value_from_msg(["SP model", "SP mac"], msg) - phone = dict(zip(PHONE_PROPERTY, [address[0], bytes_to_mac(tmp[1]), tmp[0]])) - self.update_phone_handler(phone) - pass - elif msg_type == TYPE_VAL["Not support"] or msg_type == TYPE_VAL["invalid session"]: - self.session_aborted(session_id) - pass - - def run(self): - while self.exit_event.isSet() is False: - try: - data, address = self.udp_socket.recvfrom(65535) - except socket.error, e: - continue - - if address[0] == self.pc_ip: - continue - - msg = bytes_to_msg(data) - msg_type = get_value_from_msg(["type"], msg)[0] - - if msg_type is None: - NativeLog.add_prompt_trace("invalid incoming msg: %s" % "".join(["0x%X, " % m for m in data])) - else: - msg_type = ord(msg_type) - # check if request or reply - if (msg_type & 0x80) != 0: - self.handle_response(msg, address) - else: - self.receive_request(msg, address) - pass - - self.retransmit_thread.exit() - self.beacon_thread.exit() - self.retransmit_thread.join() - self.beacon_thread.join() - pass - - def exit(self): - self.exit_event.set() - pass diff --git a/components/test/TestCaseScript/IOT/WifiConnUtility.py b/components/test/TestCaseScript/IOT/WifiConnUtility.py deleted file mode 100755 index d50474561b..0000000000 --- a/components/test/TestCaseScript/IOT/WifiConnUtility.py +++ /dev/null @@ -1,244 +0,0 @@ -from NativeLog import NativeLog -import time -import random -import string - - -ERROR_AP_PROP = {"ssid": "123456789012345678901234567890", - "ssid_len": 30, - "pwd": "12345678901234567890", - "pwd_len": 20, - "channel": 10, - "enc": 3, - "apc": 9, # invalid apc count - } - - -class WifiConnUtilError(StandardError): - pass - - -class WifiConnUtility(object): - - def __init__(self, tc_action): - self.tc_action = tc_action - self.target_type = tc_action.target_type - pass - - def set_mode(self, mode): - ret = True - fail_string = "set mode fail" - cmd = [] - checker_stings = [] - for i in range(2): - if self.target_type[0] == "SSC": - cmd.append("SSCC SSC%d op -S -o %d" % (i+1, mode[i])) - checker_stings.append("SSCP SSC%d C cur_mode C %d" % (i+1, mode[i])) - pass - else: - cmd.append("ATC AT%d CWMODE %d" % (i+1, mode[i])) - checker_stings.append("ATP AT%d L OK" % (i+1)) - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Failed to set mode") - ret = False - return ret - pass - - def _apc_switch(self, outlet_list, action_list): - checker_stings = ["R PC_COM C OK"] - switch_cmd = "APC APC1" - fail_string = "Error when switching APC" - ret = True - - for [_outlet, _action] in zip(action_list, outlet_list): - switch_cmd += " %s %d" % (_action, _outlet) - - if self.tc_action.load_and_exe_one_step(checker_stings, [switch_cmd], - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Error when switching APC") - ret = False - return ret - pass - - def _set_target_ap(self, ap_prop): - ret = True - fail_string = "set target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - if self.target_type[1] == "SSC": - if ap_prop["pwd"] == "": - cmd = ["SSCC SSC2 ap -S -s %s -t %d" % (ap_prop["ssid"], - ap_prop["enc"]) - ] - else: - cmd = ["SSCC SSC2 ap -S -s %s -p %s -t %d" % (ap_prop["ssid"], - ap_prop["pwd"], - ap_prop["enc"]) - ] - checker_stings = ["SSCP SSC2 C +SAP:OK"] - pass - else: - cmd = ["ATC AT2 CWSAP \"%s\" \"%s\" %d %d" % (ap_prop["ssid"], - ap_prop["pwd"], - ap_prop["channel"], - ap_prop["enc"]) - ] - checker_stings = ["ATR AT2 L OK"] - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("set target ap fail") - ret = False - return ret - pass - - def setup_ap(self, ap_type, ap_prop): - if ap_type == "target": - ret = self._set_target_ap(ap_prop) - pass - else: - ret = self._apc_switch(["ON"], [ap_prop["apc"]]) - # delay for 5 seconds, wait AP ready - time.sleep(5) - pass - return ret - - def do_scan(self, ap_prop): - fail_string = "Scan fail" - ret = True - # do not check if the set AP can be scanned - if self.target_type[1] == "SSC": - cmd = ["SSCC SSC1 sta -S"] - checker_stings = ["SSCR SSC1 C ssc%20scan%20done"] - pass - else: - cmd = ["ATS AT1 AT+CWLAP"] - checker_stings = ["ATR AT1 L OK"] - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=100) is False: - NativeLog.add_trace_critical("Scan fail") - ret = False - return ret - pass - - def _switch_off_target_ap(self, delay): - time.sleep(delay) - self._set_target_ap(ERROR_AP_PROP) - pass - - def _switch_on_target_ap(self, ap_prop, delay): - time.sleep(delay) - self._set_target_ap(ap_prop) - pass - - def _switch_off_ap(self, ap_type, ap_prop, delay_range): - delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 - if ap_type == "target": - self._switch_off_target_ap(delay) - else: - delay -= 1.5 - time.sleep(delay if delay > 0 else 0) - self._apc_switch(["OFF"], [ap_prop["apc"]]) - pass - - def _switch_on_ap(self, ap_type, ap_prop, delay_range): - delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 - if ap_type == "target": - self._switch_on_target_ap(ap_prop, delay) - else: - delay -= 1.5 - time.sleep(delay if delay > 0 else 0) - self._apc_switch(["ON"], [ap_prop["apc"]]) - pass - - def _join_ap(self, ap_prop, test_method): - fail_string = "join target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - if self.target_type[1] == "SSC": - cmd = ["SSCC SSC1 ap -C -s %s -p %s" % (ap_prop["ssid"], - ap_prop["pwd"],) - ] - checker_stings = ["SSCR SSC1 C %s" % ap_prop["ssid"], - "SSCR SSC1 C dhcp%20client%20start", - "SSCR SSC1 C ip C mask C gw"] - pass - else: - cmd = ["ATC AT1 CWJAP \"%s\" \"%s\"" % (ap_prop["ssid"], - ap_prop["pwd"]) - ] - checker_stings = ["ATR AT1 NC ERROR NC FAIL L OK"] - pass - if test_method == "Normal": - ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_freq=0.1, check_time=350) - if ret is not False: - ret *= 0.1 - else: - ret = self.tc_action.load_and_exe_one_step([], cmd, fail_string) - return ret - pass - - def _check_join_ap_result(self, ap_prop): - ret = False - fail_string = "join ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - - if self.target_type[1] == "SSC": - checker_stings = ["SSCR SSC1 C dhcp%20client%20start", - "SSCR SSC1 C ip C mask C gw"] - ret = self.tc_action.load_and_exe_one_step(checker_stings, ["DELAY 0"], - fail_string, check_freq=1, check_time=120) - pass - else: - cmd = ["ATS AT1 AT+CWJAP?"] - checker_stings = ["ATR AT1 NC busy NC No%20AP C +CWJAP"] - for i in range(3): - ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_freq=1, check_time=2) - if ret is not False: - break - time.sleep(15) - - return ret - pass - - def join_ap(self, join_test_method, ap_type, ap_prop, delay): - - if join_test_method == "WRONG_PROP": - _prop = ERROR_AP_PROP - else: - _prop = ap_prop - - ret = self._join_ap(_prop, join_test_method) - - if join_test_method == "OFF_ON": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - self._switch_on_ap(ap_type, ap_prop, delay[1]) - ret = self._check_join_ap_result(_prop) - pass - elif join_test_method == "OFF": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - time.sleep(25) - pass - - return ret - pass - - def do_reconnect(self, reconnect_test_method, ap_type, ap_prop, delay): - ret = True - if reconnect_test_method == "OFF_ON": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - self._switch_on_ap(ap_type, ap_prop, delay[1]) - ret = self._check_join_ap_result(ap_prop) - pass - elif reconnect_test_method == "OFF": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - pass - return ret - pass - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/IOT/WifiJAP.py b/components/test/TestCaseScript/IOT/WifiJAP.py deleted file mode 100755 index 0bb6292955..0000000000 --- a/components/test/TestCaseScript/IOT/WifiJAP.py +++ /dev/null @@ -1,183 +0,0 @@ -import os -import random -import time - -import WifiConnUtility -from NativeLog import NativeLog -from TCAction import TCActionBase -from Utility import Encoding -from Utility import MakeFolder - -STEPS = {"SCAN1": 0x01, "JAP": 0x02, "SCAN2": 0x04, "RECONNECT": 0x08} - -AP_PROP = ("ssid", "ssid_len", "pwd", - "pwd_len", "channel", "enc", "apc") - -JAP_TEST_METHOD = ("Normal", "OFF_ON", "OFF", "WRONG_PROP") - -RECONNECT_TEST_METHOD = ("OFF_ON", "OFF") - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") - - -SSID_LEN_RANGE = (1, 32) # in bytes -ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP -PWD_RANGE = {0: [0, 0], - 1: [5, 5], - 2: [8, 63], - 3: [8, 63], - 4: [8, 63], - } - - -class WifiJAP(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # default value for optional configurable params - self.pwd_len = [8, 64] - self.step_config = [0x03, 0x01, 0x02, 0x0B, 0x0F] - self.join_test_method = ["Normal"] - self.join_delay = [[1.5, 5], [1.5, 5]] - self.reconnect_test_method = ["OFF_ON"] - self.reconnect_delay = [[1.5, 5], [1.5, 6]] - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # read AP list - self.ap_list = [] - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROP, " + cmd_set[i][1][j] + ")))" - exec cmd_string - - folder_path = MakeFolder.make_folder(LOG_FOLDER) - file_name = "JAP_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) - self._performance_log_file = os.path.join(folder_path, file_name) - - # test statistics - self._succeed_count = self._fail_count = self._time_cost_count = 0 - self._total_time = self._longest_time = 0 - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - # get target type "SSC" or "AT" - self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] - self.target_type.append("SSC" if test_env.get_port_by_name("AT1") is None else "AT") - self._utility = WifiConnUtility.WifiConnUtility(self) - pass - - def _generate_random_ap_prop(self): - ap_prop = dict.fromkeys(AP_PROP) - # generate target ap_value - ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) - ap_prop["channel"] = random.choice(range(1, 14)) - ap_prop["enc"] = random.choice(ENC_TYPE) - ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) - # generate string - if self.target_type[0] == self.target_type[1] == "AT": - ap_prop["ssid"] = Encoding.generate_random_utf8_str(ap_prop["ssid_len"]) - ap_prop["pwd"] = Encoding.generate_random_utf8_str(ap_prop["pwd_len"]) - # NativeLog.add_trace_info("ssid hex is : %x" % ap_prop["ssid"]) - # NativeLog.add_trace_info("pwd hex is : %x" % ap_prop["pwd"]) - else: - ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) - ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) - - return ap_prop - - def _logging_performance(self, ssid, join_method="Normal", time_cost=0): - # log performance to performance log file - with open(self._performance_log_file, "ab+") as f: - # log time and ssid - f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % - (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) - if join_method == "Normal" or join_method == "OFF_ON": - if time_cost is not False: - self._succeed_count += 1 - if join_method == "Normal": - f.write("[Succeed][%f]\r\n" % time_cost) - self._longest_time = (time_cost > self._longest_time and - [time_cost] or [self._longest_time])[0] - self._time_cost_count += 1 - self._total_time += time_cost - else: - f.write("[Succeed][%s]\r\n" % join_method) - else: - self._fail_count += 1 - f.write("[Fail][%s]\r\n" % join_method) - pass - - def _logging_fail_step(self, ssid, step): - with open(self._performance_log_file, "ab+") as f: - f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % - (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) - f.write("[Fail][%s]\r\n" % step) - pass - - def _generate_performance_report(self): - with open(self._performance_log_file, "ab+") as f: - f.write("[Test report] Succeed: %d\r\n" % self._succeed_count) - f.write("[Test report] Failed: %d\r\n" % self._fail_count) - if self._succeed_count > 0 or self._fail_count > 0: - f.write("[Test report] Pass Rate: %f\r\n" % - (self._succeed_count/(self._fail_count+self._succeed_count))) - if self._time_cost_count > 0: - f.write("[Test report] Average time: %f\r\n" % (self._total_time/self._time_cost_count)) - f.write("[Test report] Longest time: %f\r\n" % self._longest_time) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # mandatory configurable params - try: - target_ap_num = self.target_ap_num - test_count = self.test_count - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) - raise StandardError("Error configuration") - - # prepare ap list - _ap_list = [["target", None]] * target_ap_num - for _ap_prop in self.ap_list: - _ap_list.append(["AP", _ap_prop]) - - # set to correct mode first - # self._utility.set_mode([1, 2]) - - for _ap in _ap_list: - # arrange ap - _ap_type = _ap[0] - _ap_prop = _ap[1] - if _ap_type == "target": - _ap_prop = self._generate_random_ap_prop() - - for i in xrange(test_count): - # step 3 : mandatory step, join AP - _join_test_method = "Normal" - time_cost = self._utility.join_ap(_join_test_method, _ap_type, _ap_prop, self.join_delay) - # log performance to performance log file - self._logging_performance(_ap_prop["ssid"], _join_test_method, time_cost) - NativeLog.add_prompt_trace("[Step] Join AP done") - - NativeLog.add_prompt_trace("[WifiJAP] One AP Done") - - # generate report and cleanup - self._generate_performance_report() - - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/IOT/__init__.py b/components/test/TestCaseScript/IOT/__init__.py deleted file mode 100755 index db0afd1fc5..0000000000 --- a/components/test/TestCaseScript/IOT/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'Administrator' diff --git a/components/test/TestCaseScript/MeshStress/MeshSendRecv.py b/components/test/TestCaseScript/MeshStress/MeshSendRecv.py deleted file mode 100755 index bad4619a70..0000000000 --- a/components/test/TestCaseScript/MeshStress/MeshSendRecv.py +++ /dev/null @@ -1,525 +0,0 @@ -from __future__ import division -import time -import threading -import re -import random -import os -import binascii - -from TCAction import PerformanceTCBase -from NativeLog import NativeLog -from NativeLog import HTMLGenerator -from comm import MeshPort -from Utility import Encoding - -# check frequency in second -CHECK_FREQ = 0.05 -# check timeout in seconds -CHECK_TIMEOUT = 30 -# multicast group len -MULTICAST_GROUP_LEN = 2 - - -LOG_PATH = os.path.join("..", "log") - -def _convert_to_mesh_mac_format(value_in): - value_out = "" - match_list = re.findall("([0-9a-fA-F]+)", value_in) - try: - for i in range(6): - value_out += "%02X" % int(match_list[i], base=16) - pass - except StandardError, e: - NativeLog.add_exception_log(e) - raise e - return value_out - -class SendRecvTime(threading.Thread): - def __init__(self): - threading.Thread.__init__(self) - self.setDaemon(True) - self.send_time = dict() - self.recv_time = dict() - self.send_time_lock = threading.Lock() - self.recv_time_lock = threading.Lock() - - def add_send_time(self, key, timestamp): - with self.send_time_lock: - self.send_time[key] = timestamp - - def add_recv_time(self, key, timestamp): - with self.recv_time_lock: - if key in self.recv_time.keys(): - self.recv_time[key].append(timestamp) - else: - self.recv_time[key] = [timestamp] - - def calculate(self): - # add compute delay time code here - print 'send dict len:', len(self.send_time) - print 'recv dict len:', len(self.recv_time) - recv_time_keys = self.recv_time.keys() - Max_delay_time = 0.0 - Total_delay_time = 0.0 - # for i in range(len(recv_time_keys)): - # key = recv_time_keys[i] - for key in recv_time_keys: - Total_delay_time_t = 0.0 - if isinstance(self.recv_time[key], list): - for time1 in self.recv_time[key]: - if time1 - self.send_time[key] >= Max_delay_time: - Max_delay_time = time1 - self.send_time[key] - Total_delay_time_t += (time1 - self.send_time[key]) - else: - pass - else: - if self.recv_time[key] - self.send_time[key] > Max_delay_time: - Max_delay_time = self.recv_time[key] - self.send_time[key] - Total_delay_time_t += (self.recv_time[key] - self.send_time[key]) - Total_delay_time_t += (Total_delay_time_t / len(self.recv_time[key])) - Total_delay_time += Total_delay_time_t - Avg_delay_time = Total_delay_time / len(recv_time_keys) - loss_rate = (len(self.send_time.keys()) - len(self.recv_time.keys())) / len(self.send_time.keys()) - return [Max_delay_time, Avg_delay_time, loss_rate] - pass - -class EntitySendThread(threading.Thread): - def __init__(self, port, behavior, unicast_addr, send_delay, typ, device_mac_list, server_addr, send_recv_time): - threading.Thread.__init__(self) - self.setDaemon(True) - self.recv_data_cache = "" - self.packets_sent = 0 - self.port = port - self.behavior = behavior - self.typ = typ - self.unicast_addr = unicast_addr - self.node_num = len(device_mac_list) - self.device_mac_list = list(device_mac_list) - self.server_addr = server_addr - if typ != "SERVER": - self.device_mac_list.remove(port.device_mac) - self.send_delay = send_delay - self.cache_lock = threading.Lock() - self.exit_event = threading.Event() - self.send_recv_time = send_recv_time - pass - - def data_recv_callback(self, data): - with self.cache_lock: - self.recv_data_cache += data - if self.typ == "SSC": - while True: - if self.recv_data_cache is not None: - match = re.compile(".+\+MSEND1:\d+:OK", re.DOTALL) - res = match.search(self.recv_data_cache) - index = re.search("\+MSEND1:(\d+):OK", self.recv_data_cache) - if index is not None: - time1 = time.time() - index1 = int(index.group(1)) - self.send_recv_time.add_send_time(index1, time1) - #print 'send index:', index1 - process_index = res.group().split("MSEND1") - if len(process_index) > 1: - process_index_t = len(process_index[0]) + len("MSEND1") - self.recv_data_cache = self.recv_data_cache[process_index_t:] - else: - self.recv_data_cache = self.recv_data_cache[len(res.group()):] - else: - break - else: - break - pass - - - def __server_send_packet(self, dst_addr, option_list=None, group_addr=None): - ver = 0x0 - flags = 0x0 - proto = 0x0 - index = random.randint(10000, 999999999) - if group_addr is not None: - len_t = hex(len(group_addr) * 6).split("0x") - if len(group_addr) <= 2: - option_list = "070" + len_t[1] - else: - option_list = "07" + len_t[1] - group = "" - for addr in group_addr: - group += _convert_to_mesh_mac_format(addr) - option_list += group - else: - option_list = None - if self.behavior == "broadcast": - dst_addr = "00:00:00:00:00:00" - elif self.behavior == "unicast": - if self.unicast_addr == "random": - dst_addr = random.choice(self.device_mac_list) - else: - dst_addr = self.unicast_addr - elif self.behavior == "p2p": - proto = 0x2 - if self.unicast_addr == "random": - dst_addr = random.choice(self.device_mac_list) - else: - dst_addr = self.unicast_addr - packet = MeshPort.Packet(ver=ver, flags=flags, proto=proto, - dst_addr=dst_addr, src_addr=self.server_addr, option_list=option_list, data="A" * 100, index=index) - send_data = packet.dumps - try: - self.port.socket.send(send_data) - time2 = time.time() - self.send_recv_time.add_send_time(index, time2) - except StandardError, e: - NativeLog.add_exception_log(e) - return False - - def __server_do_send(self): - if self.behavior == "broadcast": - if self.__server_send_packet(dst_addr="00:00:00:00:00:00", group_addr=None) is True: - self.packets_sent += self.node_num - elif self.behavior == "multicast": - random.shuffle(self.device_mac_list) - group_addr_list = self.device_mac_list[:MULTICAST_GROUP_LEN] - if self.__server_send_packet(dst_addr="01:00:5E:00:00:00", group_addr=group_addr_list) is True: - self.packets_sent += MULTICAST_GROUP_LEN - elif self.behavior == "unicast": - if self.__server_send_packet(dst_addr=random.choice(self.device_mac_list), group_addr=None) is True: - self.packets_sent += 1 - elif self.behavior == "p2p": - if self.__server_send_packet(dst_addr=random.choice(self.device_mac_list), group_addr=None) is True: - self.packets_sent += 1 - else: - NativeLog.add_trace_critical("unsupported behavior [%s]" % self.behavior) - self.exit() - return - - def __node_send_packet(self, dst_addr, group_addr=None): - send_data = "" - ret = False - if group_addr is not None: - len_t = hex(len(group_addr) * 6).split("0x") - if len(group_addr) <= 2: - option_list = "070" + len_t[1] - else: - option_list = "07" + len_t[1] - group = "" - for addr in group_addr: - group += _convert_to_mesh_mac_format(addr) - option_list += group - dst_addr = "01:00:5E:00:00:00" - send_data = "meshsend -S -d %s -o %s -l 100\r\n" % (dst_addr, option_list) - else: - if self.behavior == "broadcast": - dst_addr = "00:00:00:00:00:00" - send_data = "meshsend -S -d %s -l 100\r\n" % dst_addr - elif self.behavior == "unicast": - if self.unicast_addr == "random": - dst_addr = random.choice(self.device_mac_list) - else: - dst_addr = self.unicast_addr - send_data = "meshsend -S -d %s -l 100\r\n" % dst_addr - elif self.behavior == "p2p": - if self.unicast_addr == "random": - dst_addr = random.choice(self.device_mac_list) - else: - dst_addr = self.unicast_addr - send_data = "meshsend -S -d %s -t 1 -l 100\r\n" % dst_addr - try: - self.port.write(send_data) - except StandardError, e: - NativeLog.add_exception_log(e) - pass - for i in range(int(CHECK_TIMEOUT / CHECK_FREQ)): - time.sleep(CHECK_FREQ) - with self.cache_lock: - if self.recv_data_cache.find("+MESHSEND:OK") != -1: - ret = True - break - elif self.recv_data_cache.find("+MESHSEND:ERROR") != -1: - break - return ret - - - def __node_do_send(self): - if self.behavior == "broadcast": - if self.__node_send_packet("00:00:00:00:00:00", group_addr=None) is True: - self.packets_sent += self.node_num - elif self.behavior == "multicast": - random.shuffle(self.device_mac_list) - group_addr_list = self.device_mac_list[:MULTICAST_GROUP_LEN] - if self.__node_send_packet("01:00:5E:00:00:00", group_addr_list) is True: - self.packets_sent += MULTICAST_GROUP_LEN - elif self.behavior == "unicast": - if self.__node_send_packet(random.choice(self.device_mac_list), group_addr=None) is True: - self.packets_sent += 1 - elif self.behavior == "p2p": - if self.__node_send_packet(random.choice(self.device_mac_list), group_addr=None) is True: - self.packets_sent += 1 - else: - NativeLog.add_trace_critical("unsupported behavior [%s]" % self.behavior) - self.exit() - return - - def get_sent_packets(self): - return self.packets_sent - - def exit(self): - self.exit_event.set() - pass - - def run(self): - while self.exit_event.isSet() is False: - if self.typ == "SSC": - self.__node_do_send() - elif self.typ == "SERVER": - self.__server_do_send() - else: - NativeLog.add_trace_critical("type [%s] is neither SSC nor SERVER" % self.typ) - break - time.sleep(self.send_delay) - - pass - - -class EntityRecvThread(threading.Thread): - def __init__(self, port, typ, send_recv_time): - threading.Thread.__init__(self) - self.setDaemon(True) - self.recv_data_cache = "" - self.packets_recv = 0 - self.port = port - self.typ = typ - self.cache_lock = threading.Lock() - self.exit_event = threading.Event() - self.send_recv_time = send_recv_time - pass - - def data_recv_callback(self, data): - # if self.typ == "SERVER": - # NativeLog.add_prompt_trace("[data_recv_callback] server recv len %d" % len(data)) - with self.cache_lock: - self.recv_data_cache += data - pass - - def __server_do_recv(self): - while True: - if self.recv_data_cache: - data_cache = self.recv_data_cache - data_cache_hex = binascii.hexlify(data_cache) - packet_len = int(data_cache_hex[2:6], 16) - if len(self.recv_data_cache) >= packet_len: - time3 = time.time() - data_catch_t = self.recv_data_cache[:packet_len] - packet = binascii.hexlify(data_catch_t) - index3 = int(packet[-8:], 16) - self.send_recv_time.add_recv_time(index3, time3) - self.recv_data_cache = self.recv_data_cache[packet_len:] - else: - break - #self.packets_recv += 1 - else: - break - - def __node_do_recv(self): - with self.cache_lock: - while True: - if self.recv_data_cache: - match = re.search("\+MESHRECV:\d+", self.recv_data_cache) - index = re.search(",(\d+),OK", self.recv_data_cache) - res = re.compile(".+,\d+,OK", re.DOTALL) - res_t = res.search(self.recv_data_cache) - if match is not None: - time4 = time.time() - if index is not None: - index4 = int(index.group(1)) - self.send_recv_time.add_recv_time(index4, time4) - if len(res_t.group()) > 1: - process_index = len(res_t.group(0)) - self.recv_data_cache = self.recv_data_cache[process_index:] - else: - process_index = len(res_t.group()) - self.recv_data_cache = self.recv_data_cache[process_index:] - else: - break - else: - break - # self.packets_recv += 1 - else: - break - pass - - def get_recv_packets(self): - return self.packets_recv - - def exit(self): - self.exit_event.set() - pass - - def run(self): - while self.exit_event.isSet() is False: - if self.typ == "SSC": - self.__node_do_recv() - elif self.typ == "SERVER": - self.__server_do_recv() - else: - NativeLog.add_trace_critical("type [%s] is neither SSC nor SERVER" % self.typ) - break - time.sleep(CHECK_FREQ) - - pass - - -class MeshSendRecv(PerformanceTCBase.PerformanceTCBase): - def __init__(self, name, test_env, cmd_set, timeout, log_path): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.send_config = [] - self.test_time = 0 - self.loss_rate_standard = 0.8 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # load node send config - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.send_config.extend([" + cmd_set[i][1][j] + "])" - exec cmd_string - node_num = self.get_parameter("node_num") - self.recv_cb = dict.fromkeys(["SSC%s" % (x + 1) for x in range(int(node_num))] + ["GSOC1"]) - self.recv_cb_lock = threading.Lock() - pass - - def register_recv_callback(self, port_name, callback): - with self.recv_cb_lock: - if self.recv_cb[port_name] is None: - self.recv_cb[port_name] = [callback] - else: - self.recv_cb[port_name].append(callback) - pass - - def process(self): - try: - test_time = self.test_time * 60 - send_config = self.send_config - loss_rate_standard = self.loss_rate_standard - node_num = self.get_parameter("node_num") - pc_ip_list = self.get_parameter("pc_ip").split(".") - port = self.get_parameter("test_tcp_port1") - send_recv_time = SendRecvTime() - except StandardError: - return - #create server_addr - server_addr = "" - for i in range(len(pc_ip_list)): - if pc_ip_list[i] in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]: - server_addr = server_addr + "0" + pc_ip_list[i] - else: - list_t = hex(int(pc_ip_list[i])).split("0x") - server_addr += list_t[1] - port_t = hex(port).split("0x") - port_t_list = list(port_t[1]) - server_addr = server_addr + port_t_list[2] + port_t_list[3] + port_t_list[0] + port_t_list[1] - server_port = self.test_env.get_port_by_name("GSOC1") - if server_port is None: - return - - # create thread dict - thread_dict = dict.fromkeys(["SSC%s" % (x + 1) for x in range(int(node_num))] + ["GSOC1"]) - for port_name in thread_dict: - thread_dict[port_name] = dict(zip(["tx", "rx"], [None, None])) - device_mac_list = [] - # init recv thread & register port for SSC - for port_name in ["SSC%s" % (x + 1) for x in range(int(node_num))]: - port = self.test_env.get_port_by_name(port_name) - thread_dict[port_name]["rx"] = EntityRecvThread(port, "SSC", send_recv_time) - self.register_recv_callback(port_name, thread_dict[port_name]["rx"].data_recv_callback) - device_mac_list.append(port.device_mac) - - thread_dict["GSOC1"]["rx"] = EntityRecvThread(server_port, "SERVER", send_recv_time) - self.register_recv_callback("GSOC1", thread_dict["GSOC1"]["rx"].data_recv_callback) - - # config[0]: target_name; config[1]: behavior; config[2]: destination; config[3]:send_delay; - for config in send_config: - port = self.test_env.get_port_by_name(config[0]) - name = port.name - if config[2] == "GSOC1": - dst = server_addr[:2] + ":" + server_addr[2:4] + ":" + server_addr[4:6] + ":" + server_addr[6:8] + \ - ":" + server_addr[8:10] + ":" + server_addr[10:12] - elif config[2] == "random": - dst = "random" - else: - dst = self.test_env.get_port_by_name(config[2]).device_mac - if name != "GSOC1": - server_addr = None - if config[1] == "broadcast" or config[1] == "multicast": - dst = None - typ = "SSC" if isinstance(port, MeshPort.MeshPort) is False else "SERVER" - thread_dict[name]["tx"] = EntitySendThread(port, config[1], dst, config[3], typ, device_mac_list, - server_addr, send_recv_time) - self.register_recv_callback(name, thread_dict[name]["tx"].data_recv_callback) - pass - - # start all thread - for port_name in thread_dict: - if thread_dict[port_name]["rx"] is not None: - thread_dict[port_name]["rx"].start() - if thread_dict[port_name]["tx"] is not None: - thread_dict[port_name]["tx"].start() - - # wait test time - time.sleep(test_time) - # close all send thread - for port_name in thread_dict: - if thread_dict[port_name]["tx"] is not None: - thread_dict[port_name]["tx"].exit() - thread_dict[port_name]["tx"].join() - # make sure all packet received before close recv thread - time.sleep(10) - # close all recv thread - for port_name in thread_dict: - if thread_dict[port_name]["rx"] is not None: - thread_dict[port_name]["rx"].exit() - thread_dict[port_name]["rx"].join() - - [max_delay_time, avg_delay_time, loss_rate] = send_recv_time.calculate() - - NativeLog.add_trace_critical("[Mesh Send Recv Test] MAX Delay Time is %.3f" % max_delay_time) - NativeLog.add_trace_critical("[Mesh Send Recv Test] Avg Delay Time is %.3f" % avg_delay_time) - NativeLog.add_trace_critical("[Mesh Send Recv Test] loss rate is %.2f%%" % (loss_rate * 100)) - - # set succeed if loss rate higher than required - if loss_rate < loss_rate_standard: - self.set_result("Succeed") - pass - - @Encoding.encode_utf8(3) - def result_check(self, port_name, data): - if port_name in self.recv_cb: - # if port_name == "GSOC1": - # NativeLog.add_prompt_trace("[result_check] recv GSOC1 data len %s" % len(data)) - with self.recv_cb_lock: - callback_list = self.recv_cb[port_name] - if callback_list is not None: - for callback in callback_list: - callback(data) - - # do logging - timestamp = NativeLog.generate_timestamp() - with self.sync_lock: - _formatted_data = HTMLGenerator.process_one_log_item(data, self.log_index, port_name, timestamp) - self.log_index += 1 - - self.append_to_log_file(_formatted_data) - - NativeLog.add_all_tc_log(data, port_name, timestamp) - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/MeshStress/__init__.py b/components/test/TestCaseScript/MeshStress/__init__.py deleted file mode 100755 index 6e94287c45..0000000000 --- a/components/test/TestCaseScript/MeshStress/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["StableCase1"] \ No newline at end of file diff --git a/components/test/TestCaseScript/SSLTest/Capability.py b/components/test/TestCaseScript/SSLTest/Capability.py deleted file mode 100755 index efdb6eeb9d..0000000000 --- a/components/test/TestCaseScript/SSLTest/Capability.py +++ /dev/null @@ -1,90 +0,0 @@ - - -class SSLCapability(object): - CAPABILITY_TYPE = ["version", "cipher_suite", "fragment_size", # for hello capability negotiation - "verify_server", "verify_client", # if support verify server/client - "key_algorithm", "key_encoding", "pem_encryption", # what kind of private it supports - "certificate_encoding", "certificate_digest", # what kind of certificate it supports - ] - SSL_TYPE = ("TargetClient", "TargetServer", "PCClient", "PCServer") - - def __init__(self, typ, **kwargs): - assert typ in self.SSL_TYPE - self.type = typ - self.capability = dict.fromkeys(self.CAPABILITY_TYPE, None) - for kw in kwargs: - self.capability[kw] = kwargs[kw] - for kw in self.capability: - assert self.capability[kw] is not None - pass - - def get(self, kw): - return self.capability[kw] - - def set(self, **kwargs): - for kw in kwargs: - self.capability[kw] = kwargs[kw] - pass - - -class TargetSSLCapability(SSLCapability): - DEFAULT_CAPABILITY = { - "version": ["SSLv23_2"], - "cipher_suite": ["TLS_RSA_WITH_AES_128_CBC_SHA", - "TLS_RSA_WITH_AES_256_CBC_SHA", - "TLS_RSA_WITH_RC4_128_SHA", - "TLS_RSA_WITH_RC4_128_MD5"], - "fragment_size": [2048, 4096, 8192], - "verify_server": True, - "verify_client": False, - "key_algorithm": ["RSA512", "RSA1024", "RSA2048", "RSA4096"], - "key_encoding": ["PEM", "DER"], - "pem_encryption": [None, "aes128", "aes256"], - "certificate_encoding": ["PEM", "DER"], - "certificate_digest": ["md5", "sha1", "sha256", "sha384", "sha512"], - } - - def __init__(self, typ, **kwargs): - assert typ == "TargetClient" or typ == "TargetServer" - capability = dict(self.DEFAULT_CAPABILITY) - for kw in kwargs: - capability[kw] = kwargs[kw] - SSLCapability.__init__(self, typ, **capability) - pass - pass - - -class PCSSLCapability(SSLCapability): - DEFAULT_CAPABILITY = { - "version": ["SSLv23", "SSLv20", "SSLv30", "TLSv10", "TLSv11", "TLSv12"], - "cipher_suite": ["TLS_RSA_WITH_AES_128_CBC_SHA", - "TLS_RSA_WITH_AES_256_CBC_SHA", - "TLS_RSA_WITH_RC4_128_SHA", - "TLS_RSA_WITH_RC4_128_MD5", - "TLS_DH_DSS_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"], - "fragment_size": [16384], - "verify_server": True, - "verify_client": True, - "key_algorithm": ["RSA512", "RSA1024", "RSA2048", "RSA4096"], - "key_encoding": ["PEM"], - "pem_encryption": [None], - "certificate_encoding": ["PEM"], - "certificate_digest": ["md5", "sha1", "sha256", "sha384", "sha512"], - } - - def __init__(self, typ): - assert typ == "PCClient" or typ == "PCServer" - SSLCapability.__init__(self, typ, **self.DEFAULT_CAPABILITY) - pass - pass - - -def main(): - pc = PCSSLCapability("PCClient") - target = TargetSSLCapability("TargetClient") - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/ConfigUtility.py b/components/test/TestCaseScript/SSLTest/ConfigUtility.py deleted file mode 100755 index f36fe44fe9..0000000000 --- a/components/test/TestCaseScript/SSLTest/ConfigUtility.py +++ /dev/null @@ -1,333 +0,0 @@ -from PKI import PKIDict, PKIItem -import Parameter - - -def multiply_2_lists(list1, list2): - def make_list(li): - if not isinstance(li, list): - li = [li] - return li - list1 = make_list(list1) - list2 = make_list(list2) - ret = [] - for a in list1: - for b in list2: - ret.append(make_list(a) + make_list(b)) - return ret - - -def list_multiply(list1, *args): - ret = list1 - for arg in args: - ret = multiply_2_lists(ret, arg) - return ret - - -def list_and(list1, list2): - ret = [] - for item in list1: - if item in list2: - ret.append(item) - return ret - - -class ComputeResult(object): - NEGOTIATION_CONFIG = ["client_version", "client_cipher_suite", "client_fragment_size", - "server_version", "server_cipher_suite", "server_fragment_size"] - CERT_KEY_CONFIG = ["verify_server", "verify_client", - "client_trust_anchor", "client_certificate", "client_key", - "server_trust_anchor", "server_certificate", "server_key"] - - TYPE_CONTEXT = "context" - TYPE_NEGOTIATION = "negotiation" - TYPE_CERT_KEY = "cert_key" - TYPE_SEND_PARAM = "send_param" - - # results - SUCCEED = 0 - CREATE_CONTEXT_FAIL = 1 - HANDSHAKE_FAIL = 2 - CERT_KEY_FAIL = 3 - - def __init__(self, client_capability, server_capability): - self.client_capability = client_capability - self.server_capability = server_capability - pass - - @staticmethod - def __check_cert(cert, capability, check_encoding=True): - ret = True - if cert.name is not None: - if check_encoding is True: - if cert.digest not in capability.get("certificate_digest") \ - or cert.key_algorithm not in capability.get("key_algorithm") \ - or cert.file_encoding not in capability.get("certificate_encoding"): - ret = False - else: - if cert.digest not in capability.get("certificate_digest") \ - or cert.key_algorithm not in capability.get("key_algorithm"): - ret = False - return ret - - @staticmethod - def __check_key(key, capability, check_encoding=True): - ret = True - if key.name is not None: - if check_encoding is True: - if key.algorithm not in capability.get("key_algorithm") \ - or key.file_encoding not in capability.get("key_encoding") \ - or key.file_encryption not in capability.get("pem_encryption"): - ret = False - else: - if key.algorithm not in capability.get("key_algorithm") \ - or key.file_encryption not in capability.get("pem_encryption"): - ret = False - return ret - - # compute result functions - def check_context(self, config): - result = self.SUCCEED - check_list = [(self.__check_cert, PKIItem.Certificate(config["client_trust_anchor"]), - self.client_capability), - (self.__check_cert, PKIItem.Certificate(config["client_certificate"]), - self.client_capability), - (self.__check_key, PKIItem.PrivateKey(config["client_key"]), - self.client_capability), - (self.__check_cert, PKIItem.Certificate(config["server_trust_anchor"]), - self.server_capability), - (self.__check_cert, PKIItem.Certificate(config["server_certificate"]), - self.server_capability), - (self.__check_key, PKIItem.PrivateKey(config["server_key"]), - self.server_capability)] - for _check in check_list: - if _check[0](_check[1], _check[2]) is False: - result = self.CREATE_CONTEXT_FAIL - break - return result - - def check_negotiation_param(self, config): - result = self.SUCCEED - # first check version - while True: - if Parameter.VERSION[config["client_version"]]\ - & Parameter.VERSION[config["server_version"]] == 0: - result = self.HANDSHAKE_FAIL - break - # check cipher suite - supported_cipher_suite = list_and(self.client_capability.get("cipher_suite"), - self.server_capability.get("cipher_suite")) - if config["client_cipher_suite"] not in supported_cipher_suite\ - or config["server_cipher_suite"] not in supported_cipher_suite\ - or config["client_cipher_suite"] != config["server_cipher_suite"]: - result = self.HANDSHAKE_FAIL - break - break - return result - - # check cert key, if it can be supported by both client and server, if it matches - def __check_cert_key_content(self, cert, key): - if self.__check_cert(cert, self.client_capability, check_encoding=False) is True\ - and self.__check_cert(cert, self.server_capability, check_encoding=False) is True \ - and self.__check_key(key, self.client_capability, check_encoding=False) is True \ - and self.__check_key(key, self.server_capability, check_encoding=False) is True \ - and key.name.find(cert.private_key) != -1: - result = True - else: - result = False - return result - - def __verify_ca(self, ca, cert, capability): - result = True - while True: - # if ca supported - if self.__check_cert(ca, capability) is False: - result = False - break - # check if ca in cert chain - try: - index = cert.cert_chain.index(ca.name) - except StandardError: - result = False - break - - # for pem cert, it contains cert chain to issuer, any cert in chain works - # der cert do not contain cert chain - # only der root cert verify L1 cert and root cert works - if cert.file_encoding == "DER": - if len(cert.cert_chain) > 2 and index != len(cert.cert_chain) - 1: - result = False - break - # check if all certs in before trust anchor supported - for cert_name in cert.cert_chain[1:index]: - _cert = PKIItem.Certificate(cert_name + ".pem") - if self.__check_cert(_cert, capability) is False: - result = False - break - break - return result - - def __check_verify_client(self, client_cert, client_key, server_ca): - result = self.__check_cert_key_content(client_cert, client_key) - if result is True: - result = self.__verify_ca(server_ca, client_cert, self.server_capability) - return result - - def __check_verify_server(self, client_ca, server_cert): - return self.__verify_ca(client_ca, server_cert, self.client_capability) - - def check_cert_key(self, config): - result = self.SUCCEED - while True: # break if when anything failed - if (config["verify_server"] is True and self.client_capability.get("verify_server") is False) \ - or (config["verify_client"] is True and - (self.server_capability.get("verify_client") is False or - self.client_capability.get("verify_client") is False)): - result = self.CERT_KEY_FAIL - break - - server_cert = PKIItem.Certificate(config["server_certificate"]) - server_key = PKIItem.PrivateKey(config["server_key"]) - server_ca = PKIItem.Certificate(config["server_trust_anchor"]) - client_cert = PKIItem.Certificate(config["client_certificate"]) - client_key = PKIItem.PrivateKey(config["client_key"]) - client_ca = PKIItem.Certificate(config["client_trust_anchor"]) - # always check server cert key - if self.__check_cert_key_content(server_cert, server_key) is False: - result = self.CERT_KEY_FAIL - break - # if require to verify server - if config["verify_server"] is True: - if self.__check_verify_server(client_ca, server_cert) is False: - result = self.CERT_KEY_FAIL - break - # if require to verify client - if config["verify_client"] is True: - if self.__check_verify_client(client_cert, client_key, server_ca) is False: - result = self.CERT_KEY_FAIL - break - break - return result - - CHECK_FUNC = { - TYPE_CONTEXT: check_context, - TYPE_NEGOTIATION: check_negotiation_param, - TYPE_CERT_KEY: check_cert_key, - } - CONFIG_KEY = { - TYPE_CONTEXT: CERT_KEY_CONFIG, - TYPE_NEGOTIATION: NEGOTIATION_CONFIG, - TYPE_CERT_KEY: CERT_KEY_CONFIG, - } - - def compute_result(self, typ, config_list): - succeed_list = [] - fail_list = [] - for config in config_list: - if self.CHECK_FUNC[typ](self, dict(zip(self.CONFIG_KEY[typ], config))) != self.SUCCEED: - fail_list.append(config) - else: - succeed_list.append(config) - return succeed_list, fail_list - pass - - -class GenerateTestConfig(ComputeResult): - TEST_CONFIG = ComputeResult.NEGOTIATION_CONFIG + \ - ComputeResult.CERT_KEY_CONFIG - - def __init__(self, client_capability, server_capability): - ComputeResult.__init__(self, client_capability, server_capability) - self.key_dict = PKIDict.PKIDict.KEY_DICT - self.cert_dict = PKIDict.PKIDict.CERT_DICT - pass - - def generate_negotiation_config(self): - _config = list_multiply(self.client_capability.get("version"), - self.client_capability.get("cipher_suite"), - self.client_capability.get("fragment_size"), - self.server_capability.get("version"), - self.server_capability.get("cipher_suite"), - self.server_capability.get("fragment_size")) - return self.compute_result(self.TYPE_NEGOTIATION, _config) - - def __choose_cert_key(self, verify_server, verify_client, - client_ca_opt, client_cert_key_opt, - server_ca_opt, server_cert_key_opt): - pass - - # CERT_KEY_CONFIG = ["verify_server", "verify_client", - # "client_trust_anchor", "client_certificate", "client_key", - # "server_trust_anchor", "server_certificate", "server_key"] - def generate_cert_key_config(self): - # first handle not verify certificate case - _config_list = [] - for cert in PKIDict.PKIDict.CERT_DICT: - for key in PKIDict.PKIDict.KEY_DICT: - _config_list.append([False, False, None, None, None, None, cert, key]) - cert_key_succeed, context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) - cert_key_succeed, cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, cert_key_succeed) - key_cert_pair = [[x[6], x[7]] for x in cert_key_succeed] - # for succeed config, do server cert verify - _config_list = [] - for _config in cert_key_succeed: - for cert in PKIDict.PKIDict.CERT_DICT: - _config_list.append([True, False, cert, None, None, - None, _config[6], _config[7]]) - _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) - context_fail += _context_fail - _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) - cert_key_fail += _cert_key_fail - cert_key_succeed += _cert_key_succeed - # for succeed config, do client verify - _config_list = [] - for _config in _cert_key_succeed: - for key_cert in key_cert_pair: - _config_list.append([True, True, _config[2], key_cert[0], key_cert[1], - key_cert[0], _config[6], _config[7]]) - _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) - context_fail += _context_fail - _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) - cert_key_fail += _cert_key_fail - cert_key_succeed += _cert_key_succeed - # only verify client not verify server - _config_list = [] - for _config in _cert_key_succeed: - _config_list.append([False, True, None, - _config[3], _config[4], _config[5], _config[6], _config[7]]) - _cert_key_succeed, _context_fail = self.compute_result(self.TYPE_CONTEXT, _config_list) - context_fail += _context_fail - _cert_key_succeed, _cert_key_fail = self.compute_result(self.TYPE_CERT_KEY, _cert_key_succeed) - cert_key_fail += _cert_key_fail - cert_key_succeed += _cert_key_succeed - return cert_key_succeed, context_fail, cert_key_fail - - -class ConfigUtility(GenerateTestConfig): - # test config - _TEST_CONFIG_DICT_KEY = ("config", "result") - - def __init__(self, client_capability, server_capability): - GenerateTestConfig.__init__(self, client_capability, server_capability) - pass - - def get_all_test_config(self): - negotiation_succeed, negotiation_fail = self.generate_negotiation_config() - cert_key_succeed, context_fail, cert_key_fail = self.generate_cert_key_config() - succeed_config = list_multiply(negotiation_succeed, cert_key_succeed) - context_fail_config = list_multiply([negotiation_succeed[0]], context_fail) - negotiation_fail_config = list_multiply(negotiation_fail, [cert_key_succeed[0]]) - cert_key_fail_config = list_multiply([negotiation_succeed[0]], cert_key_fail) - return dict(zip(["succeed", "context_fail", "negotiation_fail", "cert_key_fail"], - [[dict(zip(self.TEST_CONFIG, x)) for x in succeed_config], - [dict(zip(self.TEST_CONFIG, x)) for x in context_fail_config], - [dict(zip(self.TEST_CONFIG, x)) for x in negotiation_fail_config], - [dict(zip(self.TEST_CONFIG, x)) for x in cert_key_fail_config]])) - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/Parameter.py b/components/test/TestCaseScript/SSLTest/Parameter.py deleted file mode 100755 index 1670c5fd29..0000000000 --- a/components/test/TestCaseScript/SSLTest/Parameter.py +++ /dev/null @@ -1,56 +0,0 @@ - - -VERSION = { - "SSLv23": 0x1F, - "SSLv23_2": 0x1C, # current target ssl implementation do not support SSLv20 and TLSv12 - "SSLv20": 0x01, - "SSLv30": 0x02, - "TLSv10": 0x04, - "TLSv11": 0x08, - "TLSv12": 0x10, -} - - -CIPHER_SUITE = { - # supported algorithm - "TLS_RSA_WITH_AES_128_CBC_SHA": "AES128-SHA", - "TLS_RSA_WITH_AES_256_CBC_SHA": "AES256-SHA", - "TLS_RSA_WITH_RC4_128_SHA": "RC4-SHA", - "TLS_RSA_WITH_RC4_128_MD5": "RC4-MD5", - "TLS_DH_DSS_WITH_AES_128_CBC_SHA": "DH-DSS-AES128-SHA", - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "ECDHE-RSA-AES128-GCM-SHA256", -} - - -FRAGMENT_SIZE = { - "SIZE_DEFAULT": 0, - "SIZE_512": 512, - "SIZE_1024": 1024, - "SIZE_2048": 2048, - "SIZE_4096": 4096, - "SIZE_8192": 8192, -} - - -VERIFY_OPTION = { - "NOT_VERIFY": "NOT_VERIFY", - "VERIFY": "VERIFY", -} - - -SEND_OPTION = { - "MAX_SEND_SIZE_512": 512, - "MAX_SEND_SIZE_1K": 1024, - "MAX_SEND_SIZE_2K": 2048, - "MAX_SEND_SIZE_4K": 4096, - "MAX_SEND_SIZE_8K": 8192, - "MAX_SEND_SIZE_16K": 16384, -} - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/SSLHandler.py b/components/test/TestCaseScript/SSLTest/SSLHandler.py deleted file mode 100644 index 7fe19b3cef..0000000000 --- a/components/test/TestCaseScript/SSLTest/SSLHandler.py +++ /dev/null @@ -1,498 +0,0 @@ -import socket -import ssl -import os -import re -import time -import threading - -import Parameter -from PKI import PKIDict -from PKI import PKIItem -from NativeLog import NativeLog - - -class SerialPortCheckFail(StandardError): - pass - - -class SSLHandlerFail(StandardError): - pass - - -class PCFail(StandardError): - pass - - -class TargetFail(StandardError): - pass - - -def ssl_handler_wrapper(handler_type): - if handler_type == "PC": - exception_type = PCFail - elif handler_type == "Target": - exception_type = TargetFail - else: - exception_type = None - - def _handle_func(func): - def _handle_args(*args, **kwargs): - try: - ret = func(*args, **kwargs) - except StandardError, e: - NativeLog.add_exception_log(e) - raise exception_type(str(e)) - return ret - return _handle_args - return _handle_func - - -class SerialPort(object): - def __init__(self, tc_action, port_name): - self.tc_action = tc_action - self.port_name = port_name - - def flush(self): - self.tc_action.flush_data(self.port_name) - - def write_line(self, data): - self.tc_action.serial_write_line(self.port_name, data) - - def check(self, condition, timeout=10): - if self.tc_action.check_response(self.port_name, condition, timeout) is False: - raise SerialPortCheckFail("serial port check fail, condition is %s" % condition) - - def read_data(self): - return self.tc_action.serial_read_data(self.port_name) - pass - - -class SSLHandler(object): - # ssl operation timeout is 30 seconds - TIMEOUT = 30 - - def __init__(self, typ, config, serial_port): - self.type = typ - self.config = config - self.timeout = self.TIMEOUT - self.serial_port = serial_port - self.accept_thread = None - self.data_validation = False - - def set_timeout(self, timeout): - self.timeout = timeout - - def init_context(self): - pass - - def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): - pass - - def listen(self, local_port=0, local_ip=0): - pass - - def send(self, size, data): - pass - - def recv(self, length, timeout): - pass - - def set_data_validation(self, validation): - pass - - def close(self): - if self.accept_thread is not None: - self.accept_thread.exit() - self.accept_thread.join(5) - pass - - -class TargetSSLHandler(SSLHandler): - def __init__(self, typ, config, serial_port): - SSLHandler.__init__(self, typ, config, serial_port) - self.ssl_id = None - self.server_id = None - - @ssl_handler_wrapper("Target") - def init_context(self): - self.serial_port.flush() - self.serial_port.write_line("soc -T") - self.serial_port.check("+CLOSEALL") - - if self.type == "client": - version = Parameter.VERSION[self.config["client_version"]] - fragment = self.config["client_fragment_size"] - ca = self.config["client_trust_anchor"] - cert = self.config["client_certificate"] - key = self.config["client_key"] - verify_required = 0x01 if self.config["verify_server"] is True else 0x00 - context_type = 1 - else: - version = Parameter.VERSION[self.config["server_version"]] - fragment = self.config["server_fragment_size"] - ca = self.config["server_trust_anchor"] - cert = self.config["server_certificate"] - key = self.config["server_key"] - verify_required = 0x02 if self.config["verify_client"] is True else 0x00 - context_type = 2 - ssc_cmd = "ssl -I -t %u -r %u -v %u -o %u" % (context_type, fragment, version, verify_required) - - if ca is not None: - _index = PKIDict.PKIDict.CERT_DICT[ca] - ssc_cmd += " -a %d" % _index - if cert is not None: - _index = PKIDict.PKIDict.CERT_DICT[cert] - ssc_cmd += " -c %d" % _index - if key is not None: - _index = PKIDict.PKIDict.KEY_DICT[key] - ssc_cmd += " -k %d" % _index - # write command and check result - self.serial_port.flush() - self.serial_port.write_line(ssc_cmd) - self.serial_port.check(["+SSL:OK", "AND", "!+SSL:ERROR"]) - - @ssl_handler_wrapper("Target") - def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): - self.serial_port.flush() - self.serial_port.write_line("soc -B -t SSL -i %s -p %s" % (local_ip, local_port)) - self.serial_port.check(["OK", "AND", "!ERROR"]) - self.serial_port.flush() - self.serial_port.write_line("soc -C -s 0 -i %s -p %s" % (remote_ip, remote_port)) - self.serial_port.check(["OK", "AND", "!ERROR"], timeout=30) - self.ssl_id = 0 - pass - - def accept_succeed(self): - self.ssl_id = 1 - - class Accept(threading.Thread): - def __init__(self, serial_port, succeed_cb): - threading.Thread.__init__(self) - self.setDaemon(True) - self.serial_port = serial_port - self.succeed_cb = succeed_cb - self.exit_flag = threading.Event() - - def run(self): - while self.exit_flag.isSet() is False: - try: - self.serial_port.check("+ACCEPT:", timeout=1) - self.succeed_cb() - break - except StandardError: - pass - - def exit(self): - self.exit_flag.set() - - @ssl_handler_wrapper("Target") - def listen(self, local_port=0, local_ip=0): - self.serial_port.flush() - self.serial_port.write_line("soc -B -t SSL -i %s -p %s" % (local_ip, local_port)) - self.serial_port.check(["OK", "AND", "!ERROR"]) - self.serial_port.flush() - self.serial_port.write_line("soc -L -s 0") - self.serial_port.check(["OK", "AND", "!ERROR"]) - self.server_id = 0 - self.accept_thread = self.Accept(self.serial_port, self.accept_succeed) - self.accept_thread.start() - pass - - @ssl_handler_wrapper("Target") - def send(self, size=10, data=None): - if data is not None: - size = len(data) - self.serial_port.flush() - self.serial_port.write_line("soc -S -s %s -l %s" % (self.ssl_id, size)) - self.serial_port.check(["OK", "AND", "!ERROR"]) - pass - - @ssl_handler_wrapper("Target") - def recv(self, length, timeout=SSLHandler.TIMEOUT): - pattern = re.compile("\+RECV:\d+,(\d+)\r\n") - data_len = 0 - data = "" - time1 = time.time() - while time.time() - time1 < timeout: - data += self.serial_port.read_data() - if self.data_validation is True: - if "+DATA_ERROR" in data: - raise SSLHandlerFail("target data validation fail") - while True: - match = pattern.search(data) - if match is None: - break - else: - data_len += int(match.group(1)) - data = data[data.find(match.group())+len(match.group()):] - if data_len >= length: - result = True - break - else: - result = False - if result is False: - raise SSLHandlerFail("Target recv fail") - - def set_data_validation(self, validation): - self.data_validation = validation - self.serial_port.flush() - self.serial_port.write_line("soc -V -s %s -o %s" % (self.ssl_id, 1 if validation is True else 0)) - self.serial_port.check(["OK", "AND", "!ERROR"]) - - @ssl_handler_wrapper("Target") - def close(self): - SSLHandler.close(self) - self.serial_port.flush() - self.serial_port.write_line("ssl -D") - self.serial_port.check(["+SSL:OK", "OR", "+SSL:ERROR"]) - self.serial_port.write_line("soc -T") - self.serial_port.check("+CLOSEALL") - pass - - pass - - -def calc_hash(index): - return (index & 0xffffffff) % 83 + (index & 0xffffffff) % 167 - - -def verify_data(data, start_index): - for i, c in enumerate(data): - if ord(c) != calc_hash(start_index + i): - NativeLog.add_trace_critical("[Data Validation Error] target sent data index %u is error." - " Sent data is %x, should be %x" - % (start_index + i, ord(c), calc_hash(start_index + i))) - return False - return True - - -def make_validation_data(length, start_index): - return bytes().join([chr(calc_hash(start_index + i)) for i in range(length)]) - - -class PCSSLHandler(SSLHandler): - PROTOCOL_MAPPING = { - "SSLv23": ssl.PROTOCOL_SSLv23, - "SSLv23_2": ssl.PROTOCOL_SSLv23, - "SSLv20": ssl.PROTOCOL_SSLv2, - "SSLv30": ssl.PROTOCOL_SSLv3, - "TLSv10": ssl.PROTOCOL_TLSv1, - "TLSv11": ssl.PROTOCOL_TLSv1_1, - "TLSv12": ssl.PROTOCOL_TLSv1_2, - } - CERT_FOLDER = os.path.join(".", "PKI", PKIDict.PKIDict.CERT_FOLDER) - KEY_FOLDER = os.path.join(".", "PKI", PKIDict.PKIDict.KEY_FOLDER) - - def __init__(self, typ, config, serial_port): - SSLHandler.__init__(self, typ, config, serial_port) - self.ssl_context = None - self.ssl = None - self.server_sock = None - self.send_index = 0 - self.recv_index = 0 - - class InitContextThread(threading.Thread): - def __init__(self, handler, version, cipher_suite, ca, cert, key, verify_required, remote_cert): - threading.Thread.__init__(self) - self.setDaemon(True) - self.handler = handler - self.version = version - self.cipher_suite = cipher_suite - self.ca = ca - self.cert = cert - self.key = key - self.verify_required = verify_required - self.remote_cert = remote_cert - pass - - @staticmethod - def handle_cert(cert_file, ca_file): - cert = PKIItem.Certificate() - cert.parse_file(cert_file) - ca = PKIItem.Certificate() - ca.parse_file(ca_file) - if cert.file_encoding == "PEM" and ca.name in cert.cert_chain: - cert_chain_t = cert.cert_chain[1:cert.cert_chain.index(ca.name)] - ret = ["%s.pem" % c for c in cert_chain_t] - else: - ret = [] - return ret - - def run(self): - try: - ssl_context = ssl.SSLContext(self.version) - # cipher suite - ssl_context.set_ciphers(self.cipher_suite) - if self.ca is not None: - ssl_context.load_verify_locations(cafile=os.path.join(self.handler.CERT_FOLDER, self.ca)) - # python ssl can't verify cert chain, don't know why - # need to load cert between cert and ca for pem (pem cert contains cert chain) - if self.remote_cert is not None: - cert_chain = self.handle_cert(self.remote_cert, self.ca) - for c in cert_chain: - NativeLog.add_trace_info("load ca chain %s" % c) - ssl_context.load_verify_locations(cafile=os.path.join(self.handler.CERT_FOLDER, c)) - if self.cert is not None: - cert = os.path.join(self.handler.CERT_FOLDER, self.cert) - key = os.path.join(self.handler.KEY_FOLDER, self.key) - ssl_context.load_cert_chain(cert, keyfile=key) - if self.verify_required is True: - ssl_context.verify_mode = ssl.CERT_REQUIRED - else: - ssl_context.verify_mode = ssl.CERT_NONE - self.handler.ssl_context = ssl_context - except StandardError, e: - NativeLog.add_exception_log(e) - pass - pass - - @ssl_handler_wrapper("PC") - def init_context(self): - if self.type == "client": - version = self.PROTOCOL_MAPPING[self.config["client_version"]] - cipher_suite = Parameter.CIPHER_SUITE[self.config["client_cipher_suite"]] - ca = self.config["client_trust_anchor"] - cert = self.config["client_certificate"] - key = self.config["client_key"] - verify_required = self.config["verify_server"] - remote_cert = self.config["server_certificate"] - else: - version = self.PROTOCOL_MAPPING[self.config["server_version"]] - cipher_suite = Parameter.CIPHER_SUITE[self.config["server_cipher_suite"]] - ca = self.config["server_trust_anchor"] - cert = self.config["server_certificate"] - key = self.config["server_key"] - verify_required = self.config["verify_client"] - remote_cert = self.config["client_certificate"] - - _init_context = self.InitContextThread(self, version, cipher_suite, ca, cert, key, verify_required, remote_cert) - _init_context.start() - _init_context.join(5) - if self.ssl_context is None: - raise StandardError("Init Context Fail") - - pass - - @ssl_handler_wrapper("PC") - def connect(self, remote_ip, remote_port, local_ip=0, local_port=0): - sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - # reuse socket in TIME_WAIT state - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.settimeout(self.timeout) - sock.bind((local_ip, local_port)) - self.ssl = self.ssl_context.wrap_socket(sock) - self.ssl.connect((remote_ip, remote_port)) - pass - - def accept_succeed(self, ssl_new): - ssl_new.settimeout(self.timeout) - self.ssl = ssl_new - - class Accept(threading.Thread): - def __init__(self, server_sock, ssl_context, succeed_cb): - threading.Thread.__init__(self) - self.setDaemon(True) - self.server_sock = server_sock - self.ssl_context = ssl_context - self.succeed_cb = succeed_cb - self.exit_flag = threading.Event() - - def run(self): - while self.exit_flag.isSet() is False: - try: - new_socket, addr = self.server_sock.accept() - ssl_new = self.ssl_context.wrap_socket(new_socket, server_side=True) - self.succeed_cb(ssl_new) - break - except StandardError: - pass - pass - - def exit(self): - self.exit_flag.set() - - @ssl_handler_wrapper("PC") - def listen(self, local_port=0, local_ip=0): - self.server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - # reuse socket in TIME_WAIT state - self.server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.server_sock.settimeout(1) - self.server_sock.bind((local_ip, local_port)) - self.server_sock.listen(5) - self.accept_thread = self.Accept(self.server_sock, self.ssl_context, self.accept_succeed) - self.accept_thread.start() - pass - - @ssl_handler_wrapper("PC") - def send(self, size=10, data=None): - if data is None: - self.ssl.send(make_validation_data(size, self.send_index)) - if self.data_validation is True: - self.send_index += size - else: - self.ssl.send(data) - - @ssl_handler_wrapper("PC") - def recv(self, length, timeout=SSLHandler.TIMEOUT, data_validation=False): - time1 = time.time() - data_len = 0 - while time.time() - time1 < timeout: - data = self.ssl.read() - - if data_validation is True and len(data) > 0: - if verify_data(data, self.recv_index) is False: - raise SSLHandlerFail("PC data validation fail, index is %s" % self.recv_index) - self.recv_index += len(data) - data_len += len(data) - if data_len >= length: - result = True - break - else: - result = False - if result is False: - raise SSLHandlerFail("PC recv fail") - - def set_data_validation(self, validation): - self.data_validation = validation - - @ssl_handler_wrapper("PC") - def close(self): - SSLHandler.close(self) - if self.ssl is not None: - self.ssl.close() - self.ssl = None - if self.server_sock is not None: - self.server_sock.close() - self.server_sock = None - del self.ssl_context - - -def main(): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - # cipher suite - ssl_context.set_ciphers("AES256-SHA") - ssl_context.load_cert_chain("D:\workspace\\auto_test_script\PKI\Certificate\\" - "L2CertRSA512sha1_L1CertRSA512sha1_RootCertRSA512sha1.pem", - keyfile="D:\workspace\\auto_test_script\PKI\Key\PrivateKey2RSA512.pem") - ssl_context.verify_mode = ssl.CERT_NONE - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - # reuse socket in TIME_WAIT state - server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server_sock.settimeout(100) - server_sock.bind(("192.168.111.5", 443)) - server_sock.listen(5) - while True: - try: - new_socket, addr = server_sock.accept() - ssl_new = ssl_context.wrap_socket(new_socket, server_side=True) - print "server connected" - break - except StandardError: - pass - - -pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/SSLHandshake.py b/components/test/TestCaseScript/SSLTest/SSLHandshake.py deleted file mode 100755 index 5eb68c3503..0000000000 --- a/components/test/TestCaseScript/SSLTest/SSLHandshake.py +++ /dev/null @@ -1,240 +0,0 @@ -import os -import random -import time -import re - -from TCAction import TCActionBase -from TCAction import PerformanceTCBase -from NativeLog import NativeLog, HTMLGenerator -from Utility import MakeFolder - -import ConfigUtility -import Capability -import SSLHandler - -LOG_FOLDER = os.path.join("AT_LOG", "TEMP") - -HEAP_SIZE_LIMIT = 30000 - - -class SSLHandshake(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.client_type = None - self.server_type = None - self.client_capability = dict() - self.server_capability = dict() - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - timestamp = time.strftime("%d%H%M%S", time.localtime()) - folder = MakeFolder.make_folder(os.path.join(LOG_FOLDER, "SSLHandshake_%s" % timestamp)) - self.tested_log = os.path.join(folder, "SSLHandshakeTested.log") - self.failed_log = os.path.join(folder, "SSLHandshakeFailed.log") - self.memory_track_log = os.path.join(folder, "SSLHandshakeMemTrack.log") - self.succeed_log = os.path.join(folder, "SSLHandshakeSucceed.log") - # store test result for failed config - self.failed_log2 = os.path.join(folder, "SSLHandshakeFailed2.log") - self.succeed_log2 = os.path.join(folder, "SSLHandshakeSucceed2.log") - - self.heap_size_pattern = re.compile("\+FREEHEAP:(\d+)\r\n") - - @staticmethod - def close(client, server): - try: - client.close() - except StandardError: - pass - try: - server.close() - except StandardError: - pass - - def query_heap_size(self, scenario="idle"): - self.flush_data("SSC1") - self.serial_write_line("SSC1", "ram -H") - match = self.check_regular_expression("SSC1", self.heap_size_pattern) - if match is None: - NativeLog.add_trace_critical("No response for SSC ram command") - else: - heap_size = int(match.group(1)) - self.log_memory("[heap size][%s] %s" % (scenario, heap_size)) - if heap_size < HEAP_SIZE_LIMIT and scenario == "idle": - NativeLog.add_trace_critical("[HeapSize] %s" % heap_size) - - pass - - def prepare_handshake_test(self): - # check if connected - self.flush_data("SSC1") - self.serial_write_line("SSC1", "sta -Q") - if self.check_response("SSC1", "+JAP:CONNECTED,") is False: - ap_ssid = self.get_parameter("ap_ssid") - ap_password = self.get_parameter("ap_password") - self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - self.check_response("SSC1", "+JAP:CONNECTED,") - self.query_heap_size() - - @staticmethod - def log_data_to_file(file_name, data): - with open(file_name, "ab+") as f: - f.write(data+"\r\n") - - def log_test_config(self, data): - # append to log - with self.sync_lock: - _formatted_data = HTMLGenerator.process_one_log_item(data) - self.append_to_log_file(_formatted_data) - self.log_data_to_file(self.tested_log, data) - - def log_memory(self, data): - self.log_data_to_file(self.memory_track_log, data) - - def log_fail(self, data, log_type="succeed"): - print data - if log_type == "succeed": - self.log_data_to_file(self.failed_log, data) - else: - self.log_data_to_file(self.failed_log2, data) - - def log_succeed(self, data, log_type="succeed"): - if log_type == "succeed": - self.log_data_to_file(self.succeed_log, data) - else: - self.log_data_to_file(self.succeed_log2, data) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - # rewrite the following code - if self.client_type == "PC": - client_capability = Capability.PCSSLCapability("PCClient") - client_handler = SSLHandler.PCSSLHandler - client_ip = self.get_parameter("pc_ip") - else: - client_capability = Capability.TargetSSLCapability("TargetClient", **self.client_capability) - client_handler = SSLHandler.TargetSSLHandler - client_ip = self.get_parameter("target_ip") - if self.server_type == "PC": - server_capability = Capability.PCSSLCapability("PCServer") - server_handler = SSLHandler.PCSSLHandler - server_ip = self.get_parameter("pc_ip") - else: - server_capability = Capability.TargetSSLCapability("TargetServer", **self.server_capability) - server_handler = SSLHandler.TargetSSLHandler - server_ip = self.get_parameter("target_ip") - - serial_port = SSLHandler.SerialPort(self, "SSC1") - # generate config - config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) - config_list_dict = config_utility.get_all_test_config() - - # succeed - for config in config_list_dict["succeed"]: - self.prepare_handshake_test() - self.log_test_config("[Succeed config] %s" % config) - port = random.randint(500, 50000) - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - try: - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=port) - client.connect(server_ip, port, local_ip=client_ip) - self.query_heap_size(scenario="connected") - self.log_succeed("[Succeed config] %s" % config) - except SSLHandler.TargetFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[Target][%s]\r\n[Failed][Succeed config] %s" % (e, config)) - except SSLHandler.PCFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[PC][%s]\r\n[Failed][Succeed config] %s" % (e, config)) - - self.close(client, server) - - # init context fail - for config in config_list_dict["context_fail"]: - self.prepare_handshake_test() - port = random.randint(500, 50000) - self.log_test_config("[Init context fail config] %s" % config) - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - try: - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=port) - client.connect(server_ip, port, local_ip=client_ip) - self.log_fail("[Target]\r\n[Failed][Init context fail config] %s" % config, log_type="failed") - except StandardError, e: - NativeLog.add_exception_log(e) - self.log_succeed("[init context fail] %s" % config, log_type="failed") - self.close(client, server) - pass - - # negotiation fail - for config in config_list_dict["negotiation_fail"]: - self.prepare_handshake_test() - self.log_test_config("[negotiation_fail] %s" % config) - port = random.randint(500, 50000) - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - try: - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=port) - except SSLHandler.TargetFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[Target][%s]\r\n[Failed][negotiation fail config] %s" % (e, config), log_type="failed") - self.close(client, server) - continue - except SSLHandler.PCFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[PC][%s]\r\n[Failed][negotiation fail config] %s" % (e, config), log_type="failed") - self.close(client, server) - continue - try: - client.connect(server_ip, port, local_ip=client_ip) - self.log_fail("[Target]\r\n[Failed][negotiation fail config] %s" % config, log_type="failed") - except StandardError, e: - NativeLog.add_exception_log(e) - self.log_succeed("[negotiation fail] %s" % config, log_type="failed") - self.close(client, server) - - # cert key fail - for config in config_list_dict["cert_key_fail"]: - self.prepare_handshake_test() - self.log_test_config("[cert_key_fail] %s" % config) - port = random.randint(500, 50000) - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - try: - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=port) - except SSLHandler.TargetFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[Target][%s]\r\n[Failed][cert_key fail config] %s" % (e, config), log_type="failed") - self.close(client, server) - continue - except SSLHandler.PCFail, e: - NativeLog.add_exception_log(e) - self.log_fail("[PC][%s]\r\n[Failed][cert_key fail config] %s" % (e, config), log_type="failed") - self.close(client, server) - continue - try: - client.connect(server_ip, port, local_ip=client_ip) - self.log_fail("[Target][Failed][cert_key fail config] %s" % config, log_type="failed") - except StandardError, e: - NativeLog.add_exception_log(e) - self.log_succeed("[cert_key_fail] %s" % config, log_type="failed") - self.close(client, server) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/SSLLowMem.py b/components/test/TestCaseScript/SSLTest/SSLLowMem.py deleted file mode 100644 index fdc058f902..0000000000 --- a/components/test/TestCaseScript/SSLTest/SSLLowMem.py +++ /dev/null @@ -1,140 +0,0 @@ -import os -import random -import time -import re - -from TCAction import TCActionBase -from TCAction import PerformanceTCBase -from NativeLog import NativeLog, HTMLGenerator -from Utility import MakeFolder - -import ConfigUtility -import Capability -import SSLHandler - -LOG_FOLDER = os.path.join("AT_LOG", "TEMP") - -HEAP_SIZE_LIMIT = 30000 - - -class SSLLowMem(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.client_type = None - self.server_type = None - self.client_capability = dict() - self.server_capability = dict() - self.heap_usage_range = (10000, 30000) - self.test_time = 120 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - timestamp = time.strftime("%d%H%M%S", time.localtime()) - self.heap_size_pattern = re.compile("\+FREEHEAP:(\d+)\r\n") - - @staticmethod - def close(client, server): - try: - client.close() - except StandardError: - pass - try: - server.close() - except StandardError: - pass - - def query_heap_size(self, scenario="idle"): - self.flush_data("SSC1") - self.serial_write_line("SSC1", "ram -H") - match = self.check_regular_expression("SSC1", self.heap_size_pattern) - if match is None: - NativeLog.add_trace_critical("No response for SSC ram command") - else: - heap_size = int(match.group(1)) - if heap_size < HEAP_SIZE_LIMIT and scenario == "idle": - NativeLog.add_trace_critical("[HeapSize] %s" % heap_size) - - pass - - def prepare_handshake_test(self): - # check if connected - self.flush_data("SSC1") - self.serial_write_line("SSC1", "sta -Q") - if self.check_response("SSC1", "+JAP:CONNECTED,") is False: - ap_ssid = self.get_parameter("ap_ssid") - ap_password = self.get_parameter("ap_password") - self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - self.check_response("SSC1", "+JAP:CONNECTED,") - # random alloc memory - while True: - memory_size = random.randint(self.heap_usage_range[0], self.heap_usage_range[1]) - self.serial_write_line("SSC1", "soc -M -l %s" % memory_size) - if self.check_response("SSC1", "+SOC_BUFFER:OK", timeout=1) is True: - break - # query size - self.query_heap_size() - - @staticmethod - def log_data_to_file(file_name, data): - with open(file_name, "ab+") as f: - f.write(data+"\r\n") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - # rewrite the following code - if self.client_type == "PC": - client_capability = Capability.PCSSLCapability("PCClient") - client_handler = SSLHandler.PCSSLHandler - client_ip = self.get_parameter("pc_ip") - else: - client_capability = Capability.TargetSSLCapability("TargetClient", **self.client_capability) - client_handler = SSLHandler.TargetSSLHandler - client_ip = self.get_parameter("target_ip") - if self.server_type == "PC": - server_capability = Capability.PCSSLCapability("PCServer") - server_handler = SSLHandler.PCSSLHandler - server_ip = self.get_parameter("pc_ip") - else: - server_capability = Capability.TargetSSLCapability("TargetServer", **self.server_capability) - server_handler = SSLHandler.TargetSSLHandler - server_ip = self.get_parameter("target_ip") - - test_time = self.test_time * 60 # convert test time from minutes to seconds - - serial_port = SSLHandler.SerialPort(self, "SSC1") - # generate config - config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) - config_list_dict = config_utility.get_all_test_config() - - start_time = time.time() - - # succeed - for config in config_list_dict["succeed"]: - if time.time() - start_time > test_time: - break - self.prepare_handshake_test() - port = random.randint(500, 50000) - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - try: - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=port) - client.connect(server_ip, port, local_ip=client_ip) - self.query_heap_size(scenario="connected") - except SSLHandler.TargetFail, e: - NativeLog.add_exception_log(e) - except SSLHandler.PCFail, e: - NativeLog.add_exception_log(e) - self.close(client, server) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/SSLSendRecv.py b/components/test/TestCaseScript/SSLTest/SSLSendRecv.py deleted file mode 100644 index 13fe0b1529..0000000000 --- a/components/test/TestCaseScript/SSLTest/SSLSendRecv.py +++ /dev/null @@ -1,147 +0,0 @@ -import random -import time - -from TCAction import TCActionBase -from TCAction import PerformanceTCBase -from NativeLog import NativeLog -import ConfigUtility -import Capability -import SSLHandler - - -class SSLSendRecv(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=15, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.target_role = "Client" - self.max_send_len = 2048 - self.test_time = 120 - self.data_validation = False - - self.target_capability = {"version": ["SSLv23"], - "cipher_suite": ["TLS_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA"], - "fragment_size": [2048], - "verify_server": False, - "verify_client": False, - "key_algorithm": ["RSA2048"], - "key_encoding": ["PEM"], - "pem_encryption": [None], - "certificate_encoding": ["PEM"], - "certificate_digest": ["sha1"], - } - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - @staticmethod - def close(client, server): - try: - client.close() - except StandardError: - pass - try: - server.close() - except StandardError: - pass - - def cleanup(self): - self.serial_write_line("SSC1", "ssl -D") - self.check_response("SSC1", "SSL") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - - target_role = self.target_role - max_send_len = self.max_send_len - test_time = self.test_time * 60 - data_validation = self.data_validation - - ssl_port = random.randint(10000, 50000) - NativeLog.add_prompt_trace("SSL port is %s" % ssl_port) - - # make sure ssl context deinit - self.serial_write_line("SSC1", "ssl -D") - self.check_response("SSC1", "SSL") - - # close all sockets and enlarge send buffer - self.serial_write_line("SSC1", "soc -T") - self.check_response("SSC1", "CLOSEALL") - - self.serial_write_line("SSC1", "soc -M -l %s" % max_send_len) - self.check_response("SSC1", "+SOC_BUFFER:OK") - - # rewrite the following code - if target_role == "Server": - client_capability = Capability.PCSSLCapability("PCClient") - client_handler = SSLHandler.PCSSLHandler - client_ip = self.get_parameter("pc_ip") - server_capability = Capability.TargetSSLCapability("TargetServer", **self.target_capability) - server_handler = SSLHandler.TargetSSLHandler - server_ip = self.get_parameter("target_ip") - elif target_role == "Client": - client_capability = Capability.TargetSSLCapability("TargetClient", **self.target_capability) - client_handler = SSLHandler.TargetSSLHandler - client_ip = self.get_parameter("target_ip") - server_capability = Capability.PCSSLCapability("PCServer") - server_handler = SSLHandler.PCSSLHandler - server_ip = self.get_parameter("pc_ip") - else: - raise StandardError("Unsupported target role %s" % target_role) - - serial_port = SSLHandler.SerialPort(self, "SSC1") - - # generate one succeed config - config_utility = ConfigUtility.ConfigUtility(client_capability, server_capability) - config_list_dict = config_utility.get_all_test_config() - - for config in config_list_dict["succeed"]: - try: - # create connection - NativeLog.add_prompt_trace(str(config)) # do print config - client = client_handler("client", config, serial_port) - server = server_handler("server", config, serial_port) - client.init_context() - server.init_context() - server.listen(local_ip=server_ip, local_port=ssl_port) - client.connect(server_ip, ssl_port, local_ip=client_ip) - except StandardError, e: - NativeLog.add_exception_log(e) - return - - # set data validation - client.set_data_validation(data_validation) - server.set_data_validation(data_validation) - - # do send recv - time_start = time.time() - while time.time() - time_start < test_time: - send_len = random.randint(1, max_send_len) - try: - client.send(size=send_len) - client.send(size=send_len) - server.recv(send_len*2) - except StandardError, e: - NativeLog.add_exception_log(e) - NativeLog.add_prompt_trace("client send / server recv fail") - break - try: - # do send twice, try to create a tcp segment with 2 records - server.send(size=send_len) - server.send(size=send_len) - client.recv(send_len*2) - except StandardError, e: - NativeLog.add_exception_log(e) - NativeLog.add_prompt_trace("server send / client recv fail") - break - else: - self.set_result("Succeed") - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SSLTest/__init__.py b/components/test/TestCaseScript/SSLTest/__init__.py deleted file mode 100755 index 98fe3be4a7..0000000000 --- a/components/test/TestCaseScript/SSLTest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["Capability", "ConfigUtility", "Parameter", "SSLHandler", "SSLHandshake"] diff --git a/components/test/TestCaseScript/SleepMode/AutoSleep.py b/components/test/TestCaseScript/SleepMode/AutoSleep.py deleted file mode 100755 index 9db70227cf..0000000000 --- a/components/test/TestCaseScript/SleepMode/AutoSleep.py +++ /dev/null @@ -1,561 +0,0 @@ -import random -import os -import time -import string -import re -import threading - -from TCAction import TCActionBase, PerformanceTCBase -from NativeLog import NativeLog -from Utility import MakeFolder -from Utility import MultimeterUtil -from Utility import ShellCmd - -LOG_PATH = os.path.join("AT_LOG", "SLEEP") - -SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] -SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) - -SAMPLE_RATE_SLEEP_MODE_CHANGE = 0.002 -SAMPLE_NUM_SLEEP_MODE_CHANGE = 256 - -SAMPLE_RATE = 0.002 -SAMPLE_NUM = 512 -MAX_VALUE = 1 -Y_AXIS_LABEL = "Current (mA)" -GPIO_EDGE_DELAY = 120 # 20 ms - -NONE_SLEEP_MIN_CUR = 30 -LIGHT_SLEEP_MIN_CUR = 1.5 -MODEM_SLEEP_MIN_CUR = 20 - -GPIO_WAKE_UP = 15 -GPIO_CHIP_RESET = 14 - -SLEEP_WAKEUP_DELAY = 0.01 - - -class AutoSleep(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.test_mode = "mode_change" - self.test_count = 100 - self.sleep_mode = SLEEP_MODE_LIST - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, - "AUTO_SLEEP_%s_%s" % (self.test_mode, - time.strftime("%d%H%M%S", - time.localtime())))) - self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) - - @staticmethod - def find_min_items(item_list, count): - assert count < len(item_list) - min_items = [] - for i in range(count): - min_val = min(item_list) - min_items.append(min_val) - item_list.remove(min_val) - return min_items - - def sleep_mode_change(self, sleep_mode): - result = True - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] %s start" % sleep_mode) - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - # set sleep mode - self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) - self.check_response("SSC1", "+SLEEP_MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] mode set") - time.sleep(6) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE_SLEEP_MODE_CHANGE, - sample_num=SAMPLE_NUM_SLEEP_MODE_CHANGE, - max_value=MAX_VALUE) - # do check measure - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - - NativeLog.add_prompt_trace("[AutoSleep][ModeChange] measure done, average min current %f" % average_val) - - if sleep_mode == "none_sleep": - if average_val < NONE_SLEEP_MIN_CUR: - result = False - elif sleep_mode == "light_sleep": - if average_val > LIGHT_SLEEP_MIN_CUR: - result = False - elif sleep_mode == "modem_sleep": - if average_val > MODEM_SLEEP_MIN_CUR or average_val < LIGHT_SLEEP_MIN_CUR: - result = False - if result is False: - NativeLog.add_trace_critical("[AutoSleep][ModeChange] %s failed" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, "%s_fail" % sleep_mode, Y_AXIS_LABEL) - - time.sleep(5) - return result - - def sleep_current_measure(self, sleep_mode): - result = True - - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] %s start" % sleep_mode) - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - # set sleep mode - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) - self.check_response("SSC1", "+SLEEP_MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] set mode done") - time.sleep(10) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, sleep_mode, Y_AXIS_LABEL) - NativeLog.add_prompt_trace("[AutoSleep][CurrentMeasure] measure done") - return result - - def light_sleep_wakeup(self): - result = True - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] start") - - time.sleep(1) - self.serial_write_line("SSC1", "") - time.sleep(1) - # check if respond to uart - self.flush_data("SSC1") - for i in range(60): - self.serial_write("SSC1", "a") - time.sleep(0.043) - time.sleep(0.1) - respond_data = self.serial_read_data("SSC1") - if len(respond_data) >= 60: - NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " - "Failed when recving data during sleep, %d" % len(respond_data)) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on sleep mode done") - - self.serial_write_line("SSC1", "") - time.sleep(1) - - # change GPIO to make target wakeup - self.serial_write_line("SSC2", "gpio -L -p %d -t 0" % GPIO_WAKE_UP) - self.check_response("SSC2", "+GPIO_SET:OK") - - self.serial_write_line("SSC1", "") - time.sleep(1) - self.flush_data("SSC1") - for i in range(60): - self.serial_write("SSC1", "a") - time.sleep(0.043) - time.sleep(0.1) - respond_data = self.serial_read_data("SSC1") - if len(respond_data) < 60: - NativeLog.add_trace_critical("[AutoSleep][light sleep wakeup] " - "Failed when recving data during wakeup, %d" % len(respond_data)) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][LightSleepWakeup] check on wakeup mode done") - self.serial_write_line("SSC1", "") - # restore GPIO level - self.serial_write_line("SSC2", "gpio -L -p %d -t 1" % GPIO_WAKE_UP) - self.check_response("SSC2", "+GPIO_SET:OK") - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) - self.check_response("SSC2", "+GPIO_SET:OK") - time.sleep(2) - return result - - def sleep_exit_enter(self, sleep_mode, ssid, password): - result = True - if sleep_mode == "modem_sleep": - max_current_for_sleep = 20 - elif sleep_mode == "light_sleep": - max_current_for_sleep = 5 - else: - raise StandardError("Not supported mode %s" % sleep_mode) - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] %s start" % sleep_mode) - - ap_ssid = self.get_parameter("ap_ssid") - ap_password = self.get_parameter("ap_password") - - # step A: no STA connect to SoftAP, enter modem sleep mode - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 1") - self.check_response("SSC1", "+MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - self.check_response("SSC2", "+GPIO_SET:OK") - self.check_response("SSC1", "+JAP:CONNECTED") - self.check_response("SSC1", "pm open") - - self.serial_write_line("SSC2", "sta -D") - self.check_response("SSC2", "+QAP") - - time.sleep(5) - - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val > max_current_for_sleep: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] " - "did not enter %s sleep, %d" % (sleep_mode, average_val)) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_A" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step A done") - # step B: STA connect to SoftAP, exit modem sleep mode - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 3") - self.check_response("SSC1", "+MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - time.sleep(1) - self.serial_write_line("SSC2", "sta -C -s %s -p %s" % (ssid, password)) - self.check_response("SSC2", "+JAP:CONNECTED") - # self.check_response("SSC1", "pm close") - time.sleep(10) - - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val < 30: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_B" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step B done") - # step C: target set to STA mode, enter modem sleep - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 1") - self.check_response("SSC1", "+MODE:OK") - - self.check_response("SSC2", "+GPIO_SET:OK") - # self.check_response("SSC1", "pm open") - time.sleep(15) - - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val > max_current_for_sleep: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not enter %s sleep" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_C" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step C done") - # step D: target disconnect, exit modem sleep - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sta -D") - self.check_response("SSC1", "+QAP") - self.check_response("SSC2", "+GPIO_SET:OK") - # self.check_response("SSC1", "pm close") - time.sleep(5) - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val < 30: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_D" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step D done") - # step E: target connect to AP, enter modem sleep - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - self.check_response("SSC2", "+GPIO_SET:OK") - self.check_response("SSC1", "+JAP:CONNECTED") - self.check_response("SSC1", "pm open") - time.sleep(3) - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val > max_current_for_sleep: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not enter %s sleep" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_E" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step E done") - # step F: target set to AP mode, exit modem sleep - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 2") - self.check_response("SSC1", "+MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - # self.check_response("SSC1", "pm close") - time.sleep(5) - - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val < 30: - NativeLog.add_trace_critical("[AutoSleep][SleepExitEnter] did not exit %s sleep" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_sleep_exit_enter_fail_F" % sleep_mode, Y_AXIS_LABEL) - result = False - - NativeLog.add_prompt_trace("[AutoSleep][EnterExitSleep] step F done") - return result - - def ping_test(self, sleep_mode): - result = True - NativeLog.add_prompt_trace("[AutoSleep][PingTest] %s start" % sleep_mode) - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - if sleep_mode == "modem_sleep": - max_current_for_sleep = MODEM_SLEEP_MIN_CUR - elif sleep_mode == "light_sleep": - max_current_for_sleep = LIGHT_SLEEP_MIN_CUR - else: - raise StandardError("Not supported mode %s" % sleep_mode) - - self.serial_write_line("SSC1", "op -S -o 1") - self.check_response("SSC1", "+MODE:OK") - - # set sleep mode - self.serial_write_line("SSC1", "sleep -S -t %d" % sleep_mode_enum) - self.check_response("SSC1", "+SLEEP_MODE:OK") - NativeLog.add_prompt_trace("[AutoSleep][PingTest] set mode done") - - # connect to AP - ap_ssid = self.get_parameter("ap_ssid") - ap_password = self.get_parameter("ap_password") - target_ip = self.get_parameter("target_ip") - - self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - self.check_response("SSC1", "+JAP:CONNECTED") - - time.sleep(10) - # measure current, should be in sleep mode - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - - if average_val > max_current_for_sleep: - NativeLog.add_trace_critical("[AutoSleep][PingTest] step A did not enter %s sleep, %f" - % (sleep_mode, average_val)) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_ping_test_fail_not_enter_sleep" % sleep_mode, Y_AXIS_LABEL) - result = False - else: - NativeLog.add_prompt_trace("[AutoSleep][PingTest] step A enter %s sleep, %f" - % (sleep_mode, average_val)) - - class PingThread(threading.Thread): - def __init__(self, ping_ip): - threading.Thread.__init__(self) - self.setDaemon(True) - self.target_ip = ping_ip - self.exit_event = threading.Event() - - def run(self): - while self.exit_event.isSet() is False: - ShellCmd.shell_check_output("ping %s -w 500" % self.target_ip) - time.sleep(0.1) - pass - - def exit(self): - self.exit_event.set() - - NativeLog.add_prompt_trace("[AutoSleep][PingTest] ping start") - ping_thread = PingThread(target_ip) - ping_thread.start() - time.sleep(5) - - # measure current, should not be in sleep mode - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val < 30: - NativeLog.add_trace_critical("[AutoSleep][PingTest] step B did not exit %s sleep, %f" - % (sleep_mode, average_val)) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_ping_test_fail_not_exit_sleep" % sleep_mode, Y_AXIS_LABEL) - result = False - else: - NativeLog.add_prompt_trace("[AutoSleep][PingTest] step B exit %s sleep, %f" - % (sleep_mode, average_val)) - - ping_thread.exit() - ping_thread.join(20) - NativeLog.add_prompt_trace("[AutoSleep][PingTest] ping stop") - time.sleep(10) - - # measure current, should not be in sleep mode - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val > max_current_for_sleep: - NativeLog.add_trace_critical("[AutoSleep][PingTest] step C did not enter %s" % sleep_mode) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "%s_ping_test_fail_not_enter_sleep" % sleep_mode, Y_AXIS_LABEL) - result = False - else: - NativeLog.add_prompt_trace("[AutoSleep][PingTest] step C enter %s sleep" % sleep_mode) - - return result - - def cleanup(self): - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["modem_sleep"]) - self.check_response("SSC1", "OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - - try: - test_mode = self.test_mode - test_count = self.test_count - sleep_mode = self.sleep_mode - except StandardError, e: - return - - # make sure enter modem sleep mode before start test - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["modem_sleep"]) - self.check_response("SSC1", "+SLEEP_MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - self.check_response("SSC1", "pm open", timeout=10) - - self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_WAKE_UP) - self.check_response("SSC1", "+GPIO_GET") - self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_CHIP_RESET) - self.check_response("SSC1", "+GPIO_GET") - - # start test - if "mode_change" in test_mode: - for i in range(test_count): - result = self.sleep_mode_change(random.choice(SLEEP_MODE_LIST)) - - elif "measure_current" in test_mode: - for i in range(test_count): - for mode in sleep_mode: - result = self.sleep_current_measure(mode) - pass - elif "gpio_wakeup" in test_mode: - # change GPIO to make sure target exit sleep mode, so it can process SSC commands - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - # set sleep mode - self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE["light_sleep"]) - self.check_response("SSC1", "+SLEEP_MODE:OK") - - self.check_response("SSC2", "+GPIO_SET:OK") - for i in range(test_count): - result = self.light_sleep_wakeup() - pass - elif "sleep_exit_enter" in test_mode: - ssid = "".join([random.choice(string.lowercase) for i in range(10)]) - password = "".join([random.choice(string.lowercase) for i in range(10)]) - self.serial_write_line("SSC2", "sta -D") - self.check_response("SSC2", "+QAP") - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 3") - self.check_response("SSC1", "+MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - self.serial_write_line("SSC1", "ap -S -s %s -p %s -t 3" % (ssid, password)) - self.check_response("SSC1", "+SAP:OK") - self.serial_write_line("SSC2", "op -S -o 1") - self.check_response("SSC2", "+MODE:OK") - - for mode in sleep_mode: - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "sleep -S -t %d" % SLEEP_MODE[mode]) - self.check_response("SSC1", "+SLEEP_MODE:OK") - self.check_response("SSC2", "+GPIO_SET:OK") - - for i in range(test_count): - result = self.sleep_exit_enter(mode, ssid, password) - elif "ping" in test_mode: - for mode in sleep_mode: - for i in range(test_count): - result = self.ping_test(mode) - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SleepMode/DeepSleep.py b/components/test/TestCaseScript/SleepMode/DeepSleep.py deleted file mode 100755 index 252ebb0758..0000000000 --- a/components/test/TestCaseScript/SleepMode/DeepSleep.py +++ /dev/null @@ -1,259 +0,0 @@ -import random -import os -import time - -from TCAction import TCActionBase, PerformanceTCBase -from Utility import MakeFolder -from Utility import MultimeterUtil -from NativeLog import NativeLog - -LOG_PATH = os.path.join("AT_LOG", "SLEEP") - -DEEP_SLEEP_OPTION_LIST = ["up_to_bin", "normal", "no_rf_calibrate", "rf_off"] -DEEP_SLEEP_OPTION = { - "up_to_bin": 0, - "normal": 1, - "no_rf_calibrate": 2, - "rf_off": 4, -} - -SAMPLE_RATE = 0.001 -SAMPLE_NUM = 512 -MAX_VALUE = 0.1 -Y_AXIS_LABEL = "Current (mA)" - - -MEASURE_FREQ = 3600 - -GPIO_WAKE_UP = 15 -GPIO_CHIP_RESET = 14 -GPIO_EDGE_DELAY = 100 # 20 ms - - -class DeepSleep(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.test_mode = "mode_change" - self.test_count = 100 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, - "DEEP_SLEEP_%s_%s" % (self.test_mode, - time.strftime("%d%H%M%S", - time.localtime())))) - self.sleep_time_log = os.path.join(self.log_folder, "deep_sleep_wakeup_time.log") - self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) - - def deep_sleep_stable(self): - result = True - RandomTime = random.randint(1, 100) - self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - if self.check_response("SSC1", "ready!!!") is False: - result = False - NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") - else: - NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) - time.sleep(1) - - RandomTime = random.randint(100000, 1000000) - self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - if self.check_response("SSC1", "ready!!!") is False: - result = False - NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") - else: - NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) - time.sleep(1) - return result - - def deep_sleep_current_measure(self): - result = True - self.serial_write_line("SSC1", "") - self.serial_write_line("SSC1", "dsleep -S -t 10000000") - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - time.sleep(3) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - average_current = float(0) - for current in current_line: - average_current += current - average_current /= SAMPLE_NUM - - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "deep_sleep_current", Y_AXIS_LABEL) - - if average_current > 1: - NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] average current %f > 1mA" % average_current) - else: - NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] dsleep current ok, %f" % average_current) - - if self.check_response("SSC1", "ready!!!") is False: - NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] CurrentMeasure wait ready err %f" - % average_current) - result = False - - NativeLog.add_trace_critical("[DeepSleep][CurrentMeasure] wait ready ok") - - return result - - ########################################## - # gpio wake up - ########################################## - def deep_sleep_wakeup(self): - result = True - - self.serial_write_line("SSC1", "dsleep -S -t 0") - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - - time.sleep(2) - - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - average_current = float(0) - for current in current_line: - average_current += current - average_current /= SAMPLE_NUM - - if average_current > 1: - NativeLog.add_trace_critical("[DeepSleep][Wakeup] average current %f > 1mA" % average_current) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "deep_sleep_current", Y_AXIS_LABEL) - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) - self.check_response("SSC2", "+GPIO_SET:OK") - if self.check_response("SSC1", "ready!!!") is False: - NativeLog.add_trace_critical("[DeepSleep][Wakeup] target did not wakeup") - result = False - else: - NativeLog.add_trace_critical("[DeepSleep][Wakeup] target wakeup") - - time.sleep(1) - return result - - ######################################### - #test one hour, Verify RTC Clock timer - ######################################### - def deep_sleep_timeout(self): - result = True - Timeout = 3600 - - start_sleep_time = time.time() - self.serial_write_line("SSC1", "") - self.serial_write_line("SSC1", "dsleep -S -t %d" % (Timeout*1000000)) - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - self.check_response("SSC1", "ready!!!", timeout = Timeout*2) - time_escaped = time.time() - start_sleep_time - NativeLog.add_trace_critical("[DeepSleep][timeout] desired sleep timeout is %s, actual sleep timeout is %s" % (Timeout, time_escaped)) - with open(self.sleep_time_log, "ab+") as f: - f.write("[DeepSleep] desired sleep timeout is %s, actual sleep timeout is %s" % (Timeout, time_escaped)) - return result - - ############################################ - # Capture current map, verify the process of power on - # notice: option = "up_to_bin" up to byte108 in init.bin, - ############################################ - def wake_option(self): - result = True - for option in DEEP_SLEEP_OPTION_LIST: - for i in range(8): - self.serial_write_line("SSC1", "dsleep -O -m %s" % DEEP_SLEEP_OPTION[option]) - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - self.serial_write_line("SSC1", "dsleep -S -t 1200000") - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - - # measure current - current_line = self.multimeter.measure_current(sample_rate=0.002, - sample_num=SAMPLE_NUM, - max_value=1) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "deep_sleep_wakeup_option_%s_%d" - % (option, DEEP_SLEEP_OPTION[option]), Y_AXIS_LABEL) - - NativeLog.add_trace_critical("[DeepSleep][wake_option] target wakeup option:%d" - % DEEP_SLEEP_OPTION[option]) - time.sleep(3) - - return result - - def deep_sleep_wakeup_flash_gpio_status(self): - result = True - RandomTime = random.randint(2000000, 2000000) - self.serial_write_line("SSC1", "dsleep -S -t %s" % RandomTime) - if self.check_response("SSC1", "+DSLEEP:OK") is False: - result = False - if self.check_response("SSC1", "ready!!!") is False: - result = False - NativeLog.add_trace_critical("[DeepSleep][Stable] wait ready err") - else: - NativeLog.add_trace_critical("[DeepSleep][Stable] SleepTime:%d" % RandomTime) - - self.serial_write_line("SSC1", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - self.check_response("SSC1", "+GPIO_SET:OK") - - time.sleep(1) - return result - - def cleanup(self): - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) - self.check_response("SSC2", "+GPIO_SET:OK") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.serial_write_line("SSC2", "sta -D") - self.check_response("SSC2", "+QAP") - self.serial_write_line("SSC1", "sta -D") - self.check_response("SSC1", "+QAP") - try: - test_mode = self.test_mode - test_count = self.test_count - except StandardError, e: - return - - # self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_EDGE_DELAY)) - # self.check_response("SSC2", "+GPIO_SET:OK") - # time.sleep(1) - - if "stable" in test_mode: - for i in range(test_count): - # result = self.deep_sleep_wakeup_flash_gpio_status() - result = self.deep_sleep_stable() - elif "measure_current" in test_mode: - for i in range(test_count): - result = self.deep_sleep_current_measure() - elif "timeout" in test_mode: - for i in range(test_count): - result = self.deep_sleep_timeout() - elif "wakeup" in test_mode: - for i in range(test_count): - result = self.deep_sleep_wakeup() - elif "wake_option" in test_mode: - for i in range(test_count): - result = self.wake_option() - - self.set_result("Succeed") - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SleepMode/ForceSleep.py b/components/test/TestCaseScript/SleepMode/ForceSleep.py deleted file mode 100755 index 4938a97c2a..0000000000 --- a/components/test/TestCaseScript/SleepMode/ForceSleep.py +++ /dev/null @@ -1,254 +0,0 @@ -import random -import os -import time - -from TCAction import TCActionBase, PerformanceTCBase -from Utility import MakeFolder -from Utility import MultimeterUtil -from NativeLog import NativeLog - -LOG_PATH = os.path.join("AT_LOG", "SLEEP") - -SLEEP_MODE_LIST = ["none_sleep", "light_sleep", "modem_sleep"] -SLEEP_MODE = dict(zip(SLEEP_MODE_LIST, range(len(SLEEP_MODE_LIST)))) - -SAMPLE_RATE = 0.002 -SAMPLE_NUM = 512 -MAX_VALUE = 1 -Y_AXIS_LABEL = "Current (mA)" - -MEASURE_FREQ_HOUR = 3600 - -GPIO_WAKE_UP = 15 -GPIO_EDGE_DELAY = 120 # 20 ms -GPIO_CHIP_RESET = 14 -GPIO_CHIP_RESET_DELAY = 100 - -NONE_SLEEP_MIN_CUR = 30 -LIGHT_SLEEP_MIN_CUR = 1.5 -MODEM_SLEEP_MIN_CUR = 20 - -LIGHT_SLEEP_WAKEUP_DELAY = 0.01 - - -class ForceSleep(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.test_mode = "mode_change" - self.test_count = 100 - self.sleep_mode = SLEEP_MODE_LIST - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.log_folder = MakeFolder.make_folder(os.path.join(LOG_PATH, - "FORCE_SLEEP_%s_%s" % (self.test_mode, - time.strftime("%d%H%M%S", - time.localtime())))) - self.multimeter = MultimeterUtil.MultimeterUtil(self.log_folder) - - @staticmethod - def find_min_items(item_list, count): - assert count < len(item_list) - min_items = [] - for i in range(count): - min_val = min(item_list) - min_items.append(min_val) - item_list.remove(min_val) - return min_items - - def sleep_time_boundary_test(self): - result = True - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 0") - self.check_response("SSC2", "+GPIO_SET:OK") - if self.check_response("SSC1", "+MODE:OK") is False: - result = False - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "fsleep -S -t 1") - self.check_response("SSC2", "+GPIO_SET:OK") - if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - result = False - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "fsleep -D -d 0") - self.check_response("SSC2", "+GPIO_SET:OK") - # if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - # result = False - time.sleep(1) - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - min_items = self.find_min_items(current_line, 10) - average_val = float(0) - for val in min_items: - average_val += val - average_val /= 10 - if average_val > LIGHT_SLEEP_MIN_CUR: - NativeLog.add_trace_critical("[ForceSleep][Boundary] did not enter light sleep %d" % average_val) - result = False - return result - else: - NativeLog.add_trace_critical("[ForceSleep][Boundary] enter light sleep") - - for i in range(3): - time.sleep(MEASURE_FREQ_HOUR) - for j in range(3): - time.sleep(10) - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "light_sleep_boundary_%s_%s" % (i, j), Y_AXIS_LABEL) - pass - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - self.check_response("SSC2", "+GPIO_SET:OK") - time.sleep(1) - self.serial_write_line("SSC1", "reboot") - self.check_response("SSC1", "ready!!!") - self.serial_write_line("SSC1", "fsleep -S -t 1") - if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - result = False - self.serial_write_line("SSC1", "") - self.serial_write_line("SSC1", "fsleep -B -t 1") - if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - result = False - time.sleep(MEASURE_FREQ_HOUR) - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET,GPIO_CHIP_RESET_DELAY)) - return result - - def force_sleep_current_measure(self, sleep_mode): - result = True - # choose sleep mode - sleep_mode_enum = SLEEP_MODE[sleep_mode] - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 0") - if self.check_response("SSC1", "+MODE:OK") is False: - result = False - self.check_response("SSC2", "+GPIO_SET:OK") - - # set sleep mode - self.serial_write_line("SSC1", "fsleep -S -t %s" % sleep_mode_enum) - if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - result = False - self.serial_write_line("SSC1", "fsleep -D -d 0") - # if self.check_response("SSC1", "+FSLEEP_MODE:OK") is False: - # result = False - - time.sleep(3) - - for i in range(10): - time.sleep(10) - # measure current - current_line = self.multimeter.measure_current(sample_rate=SAMPLE_RATE, - sample_num=SAMPLE_NUM, - max_value=MAX_VALUE) - self.multimeter.draw_graph(current_line, SAMPLE_RATE, - "force_%s_sleep_current_%s" % (sleep_mode, i), Y_AXIS_LABEL) - NativeLog.add_trace_critical("[ForceSleep][current_measure] force_%s_%d"% (sleep_mode,i)) - - # self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP,GPIO_EDGE_DELAY)) - # self.check_response("SSC2", "+GPIO_SET:OK") - # self.serial_write_line("SSC1", "reboot") - # self.check_response("SSC1", "ready!!!") - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_CHIP_RESET_DELAY)) - self.check_response("SSC2", "+GPIO_SET:OK") - if self.check_response("SSC1", "ready!!!") is False: - result = False - time.sleep(1) - return result - - def force_sleep_illegal_enter(self): - result = True - # choose sleep mode - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "op -S -o 2") - if self.check_response("SSC1", "+MODE:OK") is False: - result = False - self.check_response("SSC2", "+GPIO_SET:OK") - - # set sleep mode - self.serial_write_line("SSC1", "fsleep -D -d 0") - if self.check_response("SSC1", "ready!!!", timeout=10) is False: - result = False - time.sleep(5) - return result - - def force_sleep_stable_test(self): - result = True - # choose sleep mode - - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "fsleep -L") - if self.check_response("SSC1", "+MODE:OK") is False: - result = False - self.check_response("SSC2", "+GPIO_SET:OK") - - time.sleep(3600) - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_CHIP_RESET, GPIO_CHIP_RESET_DELAY)) - time.sleep(5) - return result - - def cleanup(self): - self.serial_write_line("SSC2", "gpio -E -p %d -t 0 -d %d" % (GPIO_WAKE_UP, GPIO_EDGE_DELAY)) - time.sleep(LIGHT_SLEEP_WAKEUP_DELAY) - self.serial_write_line("SSC1", "reboot") - self.check_response("SSC1", "ready!!!") - self.check_response("SSC2", "+GPIO_SET:OK") - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.serial_write_line("SSC2", "sta -D") - self.check_response("SSC2", "+QAP") - self.serial_write_line("SSC1", "sta -D") - self.check_response("SSC1", "+QAP") - try: - test_mode = self.test_mode - test_count = self.test_count - sleep_mode = self.sleep_mode - except StandardError, e: - return - - # set gpio to input on sleep target - self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_WAKE_UP) - self.check_response("SSC1", "+GPIO_GET") - self.serial_write_line("SSC1", "gpio -G -p %d" % GPIO_CHIP_RESET) - self.check_response("SSC1", "+GPIO_GET") - - if test_mode == "boundary_test": - for i in range(test_count): - result = self.sleep_time_boundary_test() - pass - elif test_mode == "measure_current": - for j in range(test_count): - for mode in sleep_mode: - result = self.force_sleep_current_measure(mode) - pass - elif test_mode == "illegal_enter": - for i in range(test_count): - result = self.force_sleep_illegal_enter() - pass - elif test_mode == "stable_test": - for i in range(test_count): - result = self.force_sleep_stable_test() - pass - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/SleepMode/__init__.py b/components/test/TestCaseScript/SleepMode/__init__.py deleted file mode 100755 index fcd54657f3..0000000000 --- a/components/test/TestCaseScript/SleepMode/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["AutoSleep", "DeepSleep", "ForceSleep"] diff --git a/components/test/TestCaseScript/StableTest/StableCase1.py b/components/test/TestCaseScript/StableTest/StableCase1.py deleted file mode 100755 index 2554c1499b..0000000000 --- a/components/test/TestCaseScript/StableTest/StableCase1.py +++ /dev/null @@ -1,160 +0,0 @@ -import time -import random -import threading - -from TCAction import TCActionBase -from NativeLog import NativeLog - - -class StableCase1(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.exit_event = threading.Event() - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def check_wifi_status(self, data): - if data.find("+JAP:DISCONNECTED") != -1: - self.exit_event.set() - NativeLog.add_trace_critical("[Wifi] Disconnected") - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - # target role - target_role = self.target_role - # enable tcp send/recv - tcp_enable = self.tcp_enable - # enable udp send/recv - udp_enable = self.udp_enable - # enable ping - ping_enable = self.ping_enable - # delay range - delay_range = self.delay_range - # test time in hours - test_time = self.test_time * 3600 - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - if target_role == "AP": - pc_ip = "" - target_ip = "" - elif target_role == "STA": - pc_ip = "" - target_ip = "" - else: - raise StandardError("target role only support AP or STA") - - # step 1, create UDP socket and TCP server - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t UDP -p "] - fail_string = "Fail, Fail to create UDP socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t TCP -p "] - fail_string = "Fail, Fail to create tcp server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -L -s "] - fail_string = "Fail, Fail to listen" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 2, PC connect to 8266 tcp server, PC create UDP socket - checker_stings = ["R SOC_COM C OK"] - test_action_string = ["SOC SOC1 BIND %s" % pc_ip] - fail_string = "Fail, Fail to create udp socket on PC" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["P SSC1 A :ACCEPT:(\d+),\d+", "P SOC_COM C OK"] - test_action_string = ["SOC SOC2 CONNECT %s 0 %s" % (target_ip, pc_ip)] - fail_string = "Fail, Fail to create tcp socket on PC" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - total_test_count = ping_fail_count = tcp_fail_count = udp_fail_count = 0 - - # step 3, start do tcp/udp/ping - while time.time() - start_time < test_time and self.exit_event.isSet() is False: - total_test_count += 1 - if ping_enable is True: - # do ping - checker_stings = ["P PC_COM RE \+PING:\d+ms"] - test_action_string = ["PING %s -n 1 -w 1000" % target_ip] - fail_string = "Fail, Fail to ping target" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - ping_fail_count += 1 - NativeLog.add_prompt_trace("[ping fail] fail/total = %s/%s" - % (ping_fail_count, total_test_count)) - pass - - data_len = random.randint(1, 1460) - - if tcp_enable is True: - # do tcp send/recv - checker_stings = ["P SSC1 SL +%s" % data_len, "P SOC2 RL %s" % data_len] - test_action_string = ["SSC SSC1 soc -S -s -l %s" % data_len, - "SOC SOC2 SEND %s" % data_len] - fail_string = "Fail, Fail to send/recv tcp" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - tcp_fail_count += 1 - NativeLog.add_prompt_trace("[tcp fail] fail/total = %s/%s" - % (tcp_fail_count, total_test_count)) - # tcp fail, break - self.exit_event.set() - pass - - if udp_enable is True: - # do udp send/recv - checker_stings = ["P SSC1 SL +%s" % data_len, "P SOC1 RL %s" % data_len] - test_action_string = ["SSC SSC1 soc -S -s " - "-i %s -p -l %s" % (pc_ip, data_len), - "SOC SOC1 SENDTO %s %s" % (data_len, target_ip)] - fail_string = "Fail, Fail to sendto/recvfrom udp" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=20) is False: - udp_fail_count += 1 - NativeLog.add_prompt_trace("[udp fail] fail/total = %s/%s" - % (udp_fail_count, total_test_count)) - pass - - # sleep - time.sleep(random.randint(delay_range[0], delay_range[1])) - pass - - # finally, execute done - if self.exit_event.isSet() is False: - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - self.result_cntx.append_data(port_name, data) - if port_name != "SOC1" and port_name != "SOC2": - # socket received data do not need to be logged - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - if port_name == "SSC1": - self.check_wifi_status(data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/StableTest/__init__.py b/components/test/TestCaseScript/StableTest/__init__.py deleted file mode 100755 index be905f816c..0000000000 --- a/components/test/TestCaseScript/StableTest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["StableCase1"] diff --git a/components/test/TestCaseScript/TCPIPStress/ARPStress.py b/components/test/TestCaseScript/TCPIPStress/ARPStress.py deleted file mode 100755 index 38dcb8fd8b..0000000000 --- a/components/test/TestCaseScript/TCPIPStress/ARPStress.py +++ /dev/null @@ -1,121 +0,0 @@ -import time - -from NativeLog import NativeLog -from TCAction import TCActionBase -from comm.NIC import Adapter - -WARNING_COUNT = 5 - - -class ARPStress(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.adapter = None - self.target_mode = "STA" - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - self.adapter.close() - del self.adapter - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - test_time = self.test_time * 60 - # test frequency min should be 0.1s, otherwise reply could be missed - test_freq = self.test_freq if self.test_freq > 0.1 else 0.1 - # test softAP or sta - target_mode = self.target_mode - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for ARPStress script, error is %s" % e) - raise StandardError("Error configuration") - - # get parameters - if target_mode == "STA": - target_ip = self.get_parameter("target_ip") - target_mac = self.get_parameter("target_mac") - pc_mac = self.get_parameter("pc_nic_mac") - pc_nic_name = self.get_parameter("pc_nic") - elif target_mode == "SoftAP": - target_ip = self.get_parameter("target_ap_ip") - target_mac = self.get_parameter("target_ap_mac") - pc_mac = self.get_parameter("pc_wifi_nic_mac") - pc_nic_name = self.get_parameter("pc_wifi_nic") - else: - raise StandardError("Unsupported target mode: %s" % target_mode) - - time_start = time.time() - - # open device - self.adapter = Adapter.Adapter(pc_nic_name, "capture+send") - ret = self.adapter.set_filter("arp and ether src %s and ether dst %s" % (target_mac, pc_mac)) - if ret != "LIBPCAP_SUCCEED": - NativeLog.add_trace_critical("ARP Stress test error: %s" % ret) - return - - ret = self.adapter.start_capture() - if ret != "LIBPCAP_SUCCEED": - NativeLog.add_trace_critical("ARP Stress test error: %s" % ret) - return - - arp_pdu = self.adapter.create_pdu("ARP", self.adapter.create_payload(), - arp_op_code="request", arp_target_proto_addr=target_ip, - ethernet_dst_addr="ff:ff:ff:ff:ff:ff") - - data = arp_pdu.to_bytes() - - total_test_count = total_fail_count = successive_fail_count = most_successive_fail_count = 0 - - while (time.time() - time_start) < test_time: - # send arp req - ret = self.adapter.ether_send(data) - if ret != "LIBNET_SUCCEED": - NativeLog.add_prompt_trace("libnet send fail, %s" % ret) - continue - total_test_count += 1 - # wait for reply - time.sleep(test_freq) - # should get one arp reply - pdu_list = self.adapter.get_packets() - - if len(pdu_list) == 0: - # failed to get arp reply - total_fail_count += 1 - successive_fail_count += 1 - if successive_fail_count > WARNING_COUNT: - NativeLog.add_trace_critical("ARP Fail: successive fail %u times, total tested %u times" - % (successive_fail_count, total_test_count)) - else: - most_successive_fail_count = most_successive_fail_count \ - if most_successive_fail_count > successive_fail_count \ - else successive_fail_count - successive_fail_count = 0 - pass - NativeLog.add_trace_critical("ARP stress test, total %s times, failed %s times, most successive fail count %s" - % (total_test_count, total_fail_count, most_successive_fail_count)) - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPIPStress/PingStress.py b/components/test/TestCaseScript/TCPIPStress/PingStress.py deleted file mode 100755 index 71ab91ce5a..0000000000 --- a/components/test/TestCaseScript/TCPIPStress/PingStress.py +++ /dev/null @@ -1,122 +0,0 @@ -import time - -from NativeLog import NativeLog -from TCAction import TCActionBase -from comm.NIC import Adapter - -WARNING_COUNT = 2 - - -class PingStress(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.adapter = None - self.target_mode = "STA" - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - self.adapter.close() - del self.adapter - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - test_time = self.test_time * 60 - # ping data len - ping_len = self.ping_len - # test frequency min should be 0.1s, otherwise reply could be missed - test_freq = self.test_freq if self.test_freq > 0.1 else 0.1 - # target mode - target_mode = self.target_mode - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for PingStress script, error is %s" % e) - raise StandardError("Error configuration") - - if target_mode == "STA": - target_ip = self.get_parameter("target_ip") - target_mac = self.get_parameter("target_mac") - pc_mac = self.get_parameter("pc_nic_mac") - pc_nic_name = self.get_parameter("pc_nic") - elif target_mode == "SoftAP": - target_ip = self.get_parameter("target_ap_ip") - target_mac = self.get_parameter("target_ap_mac") - pc_mac = self.get_parameter("pc_wifi_nic_mac") - pc_nic_name = self.get_parameter("pc_wifi_nic") - else: - raise StandardError("Unsupported target mode: %s" % target_mode) - - time_start = time.time() - # open device - self.adapter = Adapter.Adapter(pc_nic_name, "capture+send") - - ret = self.adapter.set_filter("icmp[icmpcode]=icmp-echoreply and ether src %s and ether dst %s" - % (target_mac, pc_mac)) - if ret != "LIBPCAP_SUCCEED": - NativeLog.add_trace_critical("PING Stress test error: %s" % ret) - return - - ret = self.adapter.start_capture() - if ret != "LIBPCAP_SUCCEED": - NativeLog.add_trace_critical("PING Stress test error: %s" % ret) - return - - total_test_count = total_fail_count = successive_fail_count = most_successive_fail_count = 0 - - while (time.time() - time_start) < test_time: - - ping_pdu = self.adapter.create_pdu("ICMP", self.adapter.create_payload("A" * ping_len), - icmp_type="echo-request", ipv4_protocol="ICMP", - ipv4_dst_ip=target_ip, ethernet_dst_addr=target_mac) - # send ping req - ret = self.adapter.ether_send(ping_pdu.to_bytes()) - if ret != "LIBNET_SUCCEED": - NativeLog.add_prompt_trace("libnet send fail, %s" % ret) - continue - total_test_count += 1 - # wait for reply - time.sleep(test_freq) - # should get one ping reply - pdu_list = self.adapter.get_packets() - - if len(pdu_list) == 0: - # failed to get ping reply - total_fail_count += 1 - successive_fail_count += 1 - if successive_fail_count > WARNING_COUNT: - NativeLog.add_trace_critical("Ping Fail: successive fail %u times, total tested %u times" - % (successive_fail_count, total_test_count)) - pass - else: - most_successive_fail_count = most_successive_fail_count \ - if most_successive_fail_count > successive_fail_count \ - else successive_fail_count - successive_fail_count = 0 - pass - pass - NativeLog.add_trace_critical("Ping stress test, total %s times, failed %s times, most successive fail count %s" - % (total_test_count, total_fail_count, most_successive_fail_count)) - self.result_cntx.set_result("Succeed") - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPIPStress/__init__.py b/components/test/TestCaseScript/TCPIPStress/__init__.py deleted file mode 100755 index 25ae689179..0000000000 --- a/components/test/TestCaseScript/TCPIPStress/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["ARPStress", "PingStress"] diff --git a/components/test/TestCaseScript/TCPStress/TCPAP4STA.py b/components/test/TestCaseScript/TCPStress/TCPAP4STA.py deleted file mode 100755 index 95be6fbe4f..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPAP4STA.py +++ /dev/null @@ -1,168 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import copy -import time -import random -import string - - -class TCPAP4STAResultCheckCntx(TCActionBase.ResultCheckContext): - - def __init__(self, test_action, test_env, name): - TCActionBase.ResultCheckContext.__init__(self, test_action, test_env, name) - self.failed_port = [] - pass - - def run(self): - - while True: - exit_flag = self.wait_exit_event(1) - # force exit - if exit_flag is True: - break - try: - self.lock_data() - temp_cache = copy.deepcopy(self.data_cache) - self.data_cache = [] - finally: - self.unlock_data() - - for _cache in temp_cache: - _data = _cache[1] - if _data.find("user_test_tcpclient_recon_cb") != -1 or _data.find("discon") != -1 \ - or _data.find("No heap available") != -1: - self.failed_port.append(_cache[0]) - NativeLog.add_trace_critical("TCPAP4STA failed, failed on %s" % _cache[0]) - pass - if len(self.failed_port) != 0: - # disconnect happen - break - - def get_test_results(self): - return self.failed_port - - -class TCPAP4STA(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len = self.send_len - # test count - test_count = self.test_count - # server port - server_port = self.server_port - # ap ip - ap_ip = self.ap_ip - # server echo - server_echo = self.server_echo - # station number - sta_number = self.sta_number - # pass standard - pass_standard = self.pass_standard - # send delay - send_delay = self.send_delay - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step0 reboot - checker_stings = [] - test_action_string = [] - - for i in range(sta_number+1): - checker_stings.append("P SSC%d C !!!ready!!!" % (i+1)) - test_action_string.append("SSCC SSC%d reboot" % (i+1)) - - fail_string = "Fail, Fail to reboot" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step1 set ap on SSC1, create server - ssid = "".join([random.choice(string.lowercase) for m in range(10)]) - password = "".join([random.choice(string.lowercase) for m in range(10)]) - checker_stings = ["R SSC1 C dhcp%20server%20start"] - test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] - fail_string = "Fail, Fail set ap" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 C server%20starts%20at%20port"] - if server_echo is True: - test_action_string = ["SSCC SSC1 tcp -S -p %s -b 1" % server_port] - else: - test_action_string = ["SSCC SSC1 tcp -S -p %s" % server_port] - fail_string = "Fail, Fail create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 2, 4 SSC target(SSC2 - SSC5) join SSC1 soft AP - checker_stings = [] - test_action_string = [] - - for i in range(sta_number): - checker_stings.append("P SSC%d C ip C mask C gw C get%%20ip%%20of" % (i+2)) - test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i+2, ssid, password)) - - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - - # step 3, create client on SSC2 - SSC5 - checker_stings = [] - test_action_string = [] - - for i in range(sta_number): - checker_stings.append("P SSC%d C tcp%%20client%%20connect%%20with%%20server" % (i+2)) - test_action_string.append("SSCC SSC%d tcp -W -i %s -p %s -c %s -n 1 -l %s -d %d" - % ((i+2), ap_ip, server_port, test_count, send_len, send_delay)) - - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # switch to new result context - self.result_cntx.stop_thread() - self.result_cntx.join() - self.result_cntx = TCPAP4STAResultCheckCntx(self, self.test_env, self.tc_name) - self.result_cntx.start() - - self.result_cntx.join() - - failed_port = self.result_cntx.get_test_results() - if (time.time() - start_time) > pass_standard: - self.result_cntx.set_result("Succeed") - else: - self.result_cntx.set_result("Failed") - NativeLog.add_trace_critical("Failed port: %s" % failed_port) - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py b/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py deleted file mode 100755 index 6c160a9a00..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPAPNSTA.py +++ /dev/null @@ -1,209 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import time -import random -import string - - -TEST_COUNT_ONE_ROUND = 500 - - -class TCPAPNSTA(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len = self.send_len - # test count - test_count = self.test_count - # server port - server_port = self.server_port - # ap ip - ap_ip = self.ap_ip - # server echo - server_echo = self.server_echo - # station number - sta_number = self.sta_number - # pass standard - pass_standard = self.pass_standard - # send delay - send_delay = self.send_delay - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step0 reboot - checker_stings = [] - test_action_string = [] - - for i in range(sta_number+1): - checker_stings.append("P SSC%d C !!!ready!!!" % (i+1)) - test_action_string.append("SSCC SSC%d reboot" % (i+1)) - - fail_string = "Fail, Fail to reboot" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step1 set ap on SSC1, create server - checker_stings = ["R SSC1 C +MODE:OK"] - test_action_string = ["SSCC SSC1 op -S -o 2"] - fail_string = "Fail, Fail set mode" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - ssid = "".join([random.choice(string.lowercase) for m in range(10)]) - password = "".join([random.choice(string.lowercase) for m in range(10)]) - checker_stings = ["R SSC1 C +SAP:OK"] - test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] - fail_string = "Fail, Fail set ap" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] - fail_string = "Fail, Fail create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -L -s "] - fail_string = "Fail, Fail create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 2, 8 SSC target(SSC2 - SSC9) join SSC1 soft AP - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d C +MODE:OK" % (i+2)) - test_action_string.append("SSCC SSC%d op -S -o 1" % (i+2)) - fail_string = "Fail, Fail set mode" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d C +JAP:CONNECTED,%s" % (i+2, ssid)) - test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i+2, ssid, password)) - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - - # step 3, create client on SSC2 - SSC9 - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i+2, i+2)) - test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i+2)) - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for i in range(sta_number): - checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i+2), - "P SSC1 A :ACCEPT:(\d+),.+" % (i+2)] - test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % - (i+2, i+2, ap_ip, server_port)] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 4, do send/recv - while test_count > 0: - _tmp_count = TEST_COUNT_ONE_ROUND if test_count - TEST_COUNT_ONE_ROUND > 0 else test_count - test_count -= TEST_COUNT_ONE_ROUND - - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d RE \+SEND:\d+,OK NC CLOSED" % (i+2)) - test_action_string.append("SSC SSC%d soc -S -s -l %d -n %d -j %d" % - (i+2, i+2, send_len, _tmp_count, send_delay)) - if server_echo is True: - test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % - (i+2, send_len, _tmp_count, send_delay)) - checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%() NC CLOSED)" % - (i+2)) - - fail_string = "Fail, Failed to send/recv data" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=300) is False: - break - pass - - if (time.time() - start_time) > pass_standard: - self.result_cntx.set_result("Succeed") - else: - checker_stings = [] - test_action_string = [] - for i in range(sta_number + 1): - checker_stings.append("P SSC%d C CLOSEALL" % (i + 1)) - test_action_string.append("SSCC SSC%d soc -T" % (i + 1)) - fail_string = "Fail, Fail to close socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - server_port = random.randint(20000, 30000) - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] - fail_string = "Fail, Fail to bind socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -L -s "] - fail_string = "Fail, Fail to listen" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 2, i + 2)) - test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 2)) - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for i in range(sta_number): - checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 2), - "P SSC1 A :ACCEPT:(\d+),.+" % (i + 2)] - test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % - (i + 2, i + 2, ap_ip, server_port)] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - self.result_cntx.set_result("Failed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py b/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py deleted file mode 100755 index b04ede6acb..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPConnStressTC.py +++ /dev/null @@ -1,363 +0,0 @@ -import random -import re -import sys -import threading -import time - -import TCPConnUtility -from NativeLog import NativeLog -from TCAction import TCActionBase - -reload(sys) -sys.setdefaultencoding('iso-8859-1') # # use encoding that with 1 Byte length and contain 256 chars - - -DEFAULT_MAX_CONN_ALLOWED = 5 - - -# complicated design because I want to make this script applied for all TCP connect/close test scenarios -# basic flow: try to create max connections, send/recv data if possible, close all connections -# connect: -# 1. find available (target_link_id, socket_id) list, -# notice that target_link_id maybe not correct if PC is client -# (during that time, some link may timeout and got disconnected from FIN_WAIT or other state) -# 2. choose one method from method set, try to connect -# 3. update state table: a)check result and destination state, b)find real target_link_id, c)update -# send/recv data: -# 1. find channels that are possible to send data on all connections -# 2. send data on possible channels -# disconnect: -# 1. find available connections -# 2. choose one method from disconnect set, try to disconnect -# 3. update state table (phase 1) -# async process: -# listen on AT UART port, record all "x,CONNECT" and "x,CLOSE" command -# for "x,CONNECT", append them to self.target_link_id_list, used when need to find real target_link_id -# for "x,CLOSE", update state table (phase 2), if matching connection is pending on wait state, -# close them and remove from state table -class TCPConnStressTC(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.__at1_buff = "" - self.max_conn_allowed = test_env.get_variable_by_name("max_conn") - self.enable_log = True - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - # connection_state_dict: {target_link_id: [socket_id, target_state, socket_state, is_closed]} - # is_closed: found "x,CLOSE" in AT UART port - self.connection_state_dict = dict(zip(range(self.max_conn_allowed), [None] * self.max_conn_allowed)) - self.created_link_id_list = [] - - self.__available_soc_id = range(2, 2+self.max_conn_allowed) - self.__available_link_id = range(self.max_conn_allowed) - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - self.utility = TCPConnUtility.TCPConnUtility(self) - self.state_lock = threading.Lock() - self.link_id_lock = threading.Lock() - self.available_id_lock = threading.Lock() - pass - - def __add_log(self, log_str): - if self.enable_log is True: - NativeLog.add_trace_info(log_str) - - def __get_created_target_link_id(self): - self.link_id_lock.acquire() - try: - link_id = self.created_link_id_list[-1] - self.created_link_id_list = [] - finally: - self.link_id_lock.release() - return link_id - pass - - def __set_created_target_link_id(self, link_id): - self.link_id_lock.acquire() - try: - self.created_link_id_list.append(link_id) - finally: - self.link_id_lock.release() - pass - - def __find_channel_list(self): - channel_list = [] # # [(socket_id, able_to_send, link_id, able_to_send), ] - self.state_lock.acquire() - try: - for link_id in self.connection_state_dict: - state = self.connection_state_dict[link_id] - if state is not None: - channel_list.append([state[0], self.utility.is_able_to_send_data(state[2]), - link_id, self.utility.is_able_to_send_data(state[1])]) - finally: - self.state_lock.release() - return channel_list - pass - - def __established_connection_list(self): - conn_list = [] # # [(socket_id, link_id), ] - self.state_lock.acquire() - try: - for link_id in self.connection_state_dict: - state = self.connection_state_dict[link_id] - if state is not None: - if self.utility.is_established_connection([state[1], state[2]]) is True: - conn_list.append([state[0], link_id]) - finally: - self.state_lock.release() - return conn_list - pass - - # find free socket_id, target_link_id pair - def __get_available_id_list(self): - self.available_id_lock.acquire() - try: - id_list = zip(self.__available_soc_id, self.__available_link_id) - finally: - self.available_id_lock.release() - return id_list - pass - - def __update_available_id_list(self, soc_id, link_id, action="ADD"): - self.available_id_lock.acquire() - try: - if action == "ADD": - self.__available_link_id.append(link_id) - self.__available_soc_id.append(soc_id) - self.__add_log("[AVAILABLE ID]soc %d link %d is available" % (soc_id, link_id)) - elif action == "REMOVE": - self.__available_link_id.remove(link_id) - self.__available_soc_id.remove(soc_id) - self.__add_log("[AVAILABLE ID]soc %d link %d is used" % (soc_id, link_id)) - finally: - self.available_id_lock.release() - - def __update_connection_state_item(self, target_link_id, socket_id=None, - target_state=None, socket_state=None, is_closed=None): - self.state_lock.acquire() - try: - state = self.connection_state_dict[target_link_id] - if state is None: - state = [None] * 4 - if socket_id is not None: - state[0] = socket_id - if target_state is not None: - state[1] = target_state - if socket_state is not None: - state[2] = socket_state - if is_closed is not None: - state[3] = is_closed - - # remove closed connections - closed = self.utility.is_closed_state(state[1]) and (state[3] is True) - if closed is True: - self.__update_available_id_list(state[0], target_link_id) - state = None - # if new connection created - if self.connection_state_dict[target_link_id] is None: - created = self.utility.is_created_state(state[1]) - if created is True: - self.__update_available_id_list(state[0], target_link_id, "REMOVE") - else: - # connection did not created, do not add them to connection state table - state = None - - # set new connection_state - self.connection_state_dict[target_link_id] = state - self.__add_log("[STATE] link id is %d, state is %s" % (target_link_id, state)) - except StandardError, e: - pass - finally: - self.state_lock.release() - pass - - # update state table: if result is false, return, if result is true: - # for connect, find real link id, update table according to destination state - # for disconnect, if target in SOC_CLOSE_STATE && catch "x,CLOSE" from AT, remove the item - def update_connection_state_table(self, conn_id, destination_state=None): - if isinstance(conn_id, list) is True or isinstance(conn_id, tuple) is True: - socket_id = conn_id[0] - try: - target_link_id = self.__get_created_target_link_id() - except IndexError: - target_link_id = conn_id[1] - self.__add_log("[STATE]fail to get link id, state is %s, %s" - % (destination_state[0], destination_state[1])) - self.__update_connection_state_item(target_link_id, socket_id, - destination_state[0], destination_state[1]) - pass - else: # # called when recv CLOSED - target_link_id = conn_id - self.__update_connection_state_item(target_link_id, is_closed=True) - pass - pass - - def process_at_data(self, data): - pos1 = 0 - pos2 = 0 - connect = re.compile("\d,CONNECT\r\n") - close = re.compile("\d,CLOSED\r\n") - connect_match = connect.findall(data) - close_match = close.findall(data) - close = re.compile("\d,CONNECT FAIL\r\n") - close_match += close.findall(data) - if len(connect_match) != 0: - pos1 = data.find(connect_match[-1]) + 9 - # append last connected link id - self.__set_created_target_link_id(int(connect_match[-1][:1])) - pass - if len(close_match) != 0: - pos2 = data.find(close_match[-1]) + 7 - # update for all closed links - for close_str in close_match: - self.update_connection_state_table(int(close_str[:1])) - pass - pos = pos1 if pos1 > pos2 else pos2 - - return data[pos:] - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # configurable params - # mandatory params - try: - connect_method_set = self.connect_method_set - test_count = self.test_count - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPConnSingleMode script, error is %s" % e) - raise StandardError("Error configuration") - # optional params - try: - disconn_method_set = self.disconn_method_set - except StandardError: - disconn_method_set = ["D_05"] - pass - try: - delay = self.delay - except StandardError: - delay = 0 - pass - try: - check_data_len = self.check_data_len - except StandardError: - check_data_len = [0, 0] - pass - if isinstance(check_data_len, list) is False: - check_data_len = [check_data_len] * 2 - # configurable params - - # step1 use to create server on both PC and target side - checker_stings = ["SOCP SOC_COM L OK", "ATP AT1 L OK"] - test_action_string = ["SOC SOC1 LISTEN ", "ATC AT1 CIPSERVER 1 "] - fail_string = "Fail, Fail on create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for tested_count in xrange(test_count): - # step2 do connect - available_id_list = self.__get_available_id_list() - - for conn_id in available_id_list: - connect_method = random.choice(connect_method_set) - # ret, destination_state = self.utility.execute_tcp_method(connect_method, conn_id) - try: - self.__add_log("[ACTION]connect method is %s, connect id is %s" - % (connect_method, conn_id)) - ret, destination_state = self.utility.execute_tcp_method(connect_method, conn_id) - except StandardError, e: - NativeLog.add_trace_critical("Error in connect, error is %s" % e) - raise StandardError("Exception happen when connect") - if ret is False: - # connect fail, should terminate TC and mark as fail - return - else: - # succeed, append to table - self.update_connection_state_table(conn_id, destination_state) - if delay != 0: - time.sleep(delay) - - # step 3 send/recv test data - # # [(socket_id, able_to_send, link_id, able_to_send)] - self.__add_log("[ACTION]SEND/RECV data") - channel_list = self.__find_channel_list() - for channel in channel_list: - _check_data_len = [0, 0] - if channel[1] is True: - _check_data_len[0] = check_data_len[0] - if channel[3] is True: - _check_data_len[1] = check_data_len[1] - ret = self.utility.send_test_data(channel[0], - channel[2], - _check_data_len) - if ret is False: - # send/recv fail, should terminate TC and mark as fail - return - if delay != 0: - time.sleep(delay) - - # step 4 close all established connections - # (socket_id, link_id) - conn_list = self.__established_connection_list() - for conn_id in conn_list: - disconn_method = random.choice(disconn_method_set) - try: - self.__add_log("[ACTION]disconnect method is %s, connect id is %s" - % (disconn_method, conn_id)) - ret, destination_state = self.utility.execute_tcp_method(disconn_method, conn_id) - except StandardError, e: - NativeLog.add_trace_critical("Error in disconnect, error is %s" % e) - raise StandardError("Exception happen when disconnect") - if ret is False: - # connect fail, should terminate TC and mark as fail - return - else: - # succeed, append to table - self.update_connection_state_table(conn_id, destination_state) - if delay != 0: - time.sleep(delay) - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - # find "x,CONNECT" and "x,CLOSE" - if port_name.find("AT") != -1: - self.__at1_buff += data - self.__at1_buff = self.process_at_data(self.__at1_buff) - - -def main(): - at1_buff = "" - pos1 = 0 - pos2 = 0 - data = "dafgajglajdfg0,CLOSEjdalghalksdg1,CONNECT\r\n\r\n3,CONNECT4,CLOSEadfaasdf" - at1_buff += data - connect = re.compile("\d,CONNECT") - close = re.compile("\d,CLOSE") - connect_match = connect.findall(at1_buff) - close_match = close.findall(at1_buff) - if len(connect_match) != 0: - pos1 = at1_buff.find(connect_match[-1]) + 9 - pass - if len(close_match) != 0: - pos2 = at1_buff.find(close_match[-1]) + 7 - pass - pos = pos1 if pos1 > pos2 else pos2 - - at1_buff = at1_buff[pos:] - - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/TCPStress/TCPConnUtility.py b/components/test/TestCaseScript/TCPStress/TCPConnUtility.py deleted file mode 100755 index 3059369010..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPConnUtility.py +++ /dev/null @@ -1,273 +0,0 @@ -from NativeLog import NativeLog - -# make sure target do not listen on this port -ERROR_PORT = 23333 - - -def unused_param(param): - return param - - -class TCPUtilError(StandardError): - pass - - -class TCPConnUtility(object): - METHOD_RESULT = {"C_01": ("ESTABLISHED", "ESTABLISHED"), # target TCP peer state, PC TCP peer state - "C_02": ("SYNC_SENT", "CLOSED"), - "C_03": ("CLOSED", "CLOSED"), - "C_04": ("SYN_RCVD", "ESTABLISHED"), - "C_05": ("ESTABLISHED", "ESTABLISHED"), - "C_06": ("CLOSED", "CLOSED"), - "C_07": ("CLOSED", "CLOSED"), - "C_08": ("CLOSED", "CLOSED"), - "D_01": ("TIME_WAIT", "CLOSED"), - "D_02": ("TIME_WAIT", "TIME_WAIT"), - "D_03": ("FIN_WAIT_2", "CLOSE_WAIT"), - "D_04": ("FIN_WAIT_1", "CLOSE_WAIT"), - "D_05": ("CLOSED", "TIME_WAIT"), - "D_06": ("CLOSED", "CLOSED"), - "D_07": ("CLOSE_WAIT", "FIN_WAIT2"), - "D_08": ("TIME_WAIT", "CLOSED"), } - - SOC_CLOSED_STATE = ("FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT", "LAST_ACK", "CLOSED") - SOC_CREATED_STATE = ("SYNC_RCVD", "SYNC_SENT", "ESTABLISHED") - SOC_SEND_DATA_STATE = ("ESTABLISHED", "CLOSE_WAIT") - SOC_ESTABLISHED_STATE = ("ESTABLISHED", ) - - def __init__(self, tc_action): - self.tc_action = tc_action - self.pc_server_port = "" - self.target_server_port = "" - self.pc_ip = "" - self.target_ip = "" - pass - - def config_parameters(self, pc_server_port=None, target_server_port=None, pc_ip=None, target_ip=None): - if pc_ip is not None: - self.pc_ip = pc_ip - if target_ip is not None: - self.target_ip = target_ip - if pc_server_port is not None: - self.pc_server_port = pc_server_port - if target_server_port is not None: - self.target_server_port = target_server_port - pass - - def __connect_c_01(self, conn_id): - checker_stings = ["SOCR SOC1 C +ACCEPT", "ATR AT1 NC CLOSE L OK"] - test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" %s %s" % - (conn_id[1], self.pc_ip, self.pc_server_port)] - fail_string = "Fail, Target failed on connect to PC server" - ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) - if ret is False: - return ret - - checker_stings = ["SOCR SOC_COM L OK"] - test_action_strings = ["SOC SOC1 ACCEPT SOC%d" % conn_id[0]] - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) - pass - - def __connect_c_02(self, conn_id): - checker_stings = ["ATR AT1 C ERROR"] - test_action_strings = ["ATC AT1 CIPSTART %d \"TCP\" %s %s" % - (conn_id[1], self.pc_ip, ERROR_PORT)] - fail_string = "Fail, Target fail on connect to port not listened" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, fail_string) - pass - - def __connect_c_03(self, conn_id): - pass - - def __connect_c_04(self, conn_id): - pass - - def __connect_c_05(self, conn_id): - checker_stings = ["SOCP SOC_COM OK", "ATP AT1 C CONNECT"] - test_action_strings = ["SOC SOC%d CONNECT %s %s" % - (conn_id[0], self.target_server_port, self.target_ip)] - fail_string = "Fail, PC fail on connect to target server" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - pass - - def __connect_c_06(self, conn_id): - pass - - def __connect_c_07(self, conn_id): - # no checker strings, only try to create - # while connect is a blocking function, will return till target reply RST - checker_stings = ["SOCR SOC_COM C CLOSE"] - test_action_strings = ["SOC SOC%d CONNECT %s %s" % - (conn_id[0], ERROR_PORT, self.target_ip)] - fail_string = "Fail, PC fail on connect to target server" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=2000, check_freq=0.01) - pass - - def __connect_c_08(self, conn_id): - pass - - def __close_d_01(self, conn_id): - checker_stings = ["ATP AT1 C %d,CLOSED" % conn_id[1], "SOCP SOC_COM C CLOSE"] - test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_FIN" % conn_id[0], - "ATS AT1 AT+CIPCLOSE=%d" % conn_id[1]] - fail_string = "Fail, Fail to close socket using D_01" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - pass - - def __close_d_02(self, conn_id): - pass - - def __close_d_03(self, conn_id): - checker_stings = [] - test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT WAIT_TO" % conn_id[0], - "ATS AT1 AT+CIPCLOSE=%d" % conn_id[1]] - fail_string = "Fail, Fail to close socket using D_01" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=500, check_freq=0.01) - pass - - def __close_d_04(self, conn_id): - pass - - def __close_d_05(self, conn_id): - checker_stings = ["ATP AT1 C %d,CLOSED" % conn_id[1]] - test_action_strings = ["SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_FIN" % conn_id[0], - "SOC SOC%d CLOSE" % conn_id[0]] - fail_string = "Fail, Fail to close socket using D_05" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - pass - - def __close_d_06(self, conn_id): - # 1. set PC socket close option, stop calling recv; send in target - checker_stings = ["ATP AT1 C >"] - test_action_strings = ["SOC SOC%d STOPRECV" % conn_id[0], - "SOC SOC%d SETOPT CLOSE_OPT IMM_SEND_RST" % conn_id[0], - "ATS AT1 AT+CIPSEND=%d,5" % conn_id[1]] - fail_string = "Fail, Fail to close socket using D_06" - ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - if ret is False: - return ret - - # 2. send 5 bytes to socket - checker_stings = ["ATP AT1 C OK"] - test_action_strings = ["ATSN AT1 5"] - fail_string = "Fail, Fail to close socket using D_06" - ret = self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - if ret is False: - return ret - - # 3. close socket - checker_stings = ["ATP AT1 OR 2 C %d,CONNECT C %d,CLOSED" % (conn_id[1], conn_id[1])] - test_action_strings = ["SOC SOC%d CLOSE" % conn_id[0]] - fail_string = "Fail, Fail to close socket using D_06" - return self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=200, check_freq=0.01) - pass - - def __close_d_07(self, conn_id): - pass - - def __close_d_08(self, conn_id): - pass - - def send_test_data(self, socket_id, target_link_id, check_data_len): - # check_data_len[0] for socket data len, check_data_len[1] for target link data len - fail_string = "Fail, Fail on send and recv data" - - ret = True - - for i in range(1): - if check_data_len[1] != 0: - checker_stings = ["ATP AT1 C >"] - test_action_strings = ["ATS AT1 AT+CIPSEND=%d,%d" % (target_link_id, check_data_len[1])] - if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail on target send command for link %d" % target_link_id) - ret = False - break - checker_stings = ["SOCP SOC%d RL %d" % (socket_id, check_data_len[1]), "ATP AT1 C OK"] - test_action_strings = ["ATSN AT1 %d" % check_data_len[1]] - if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail on target send for link %d, send or recv error" % target_link_id) - ret = False - break - - if check_data_len[0] != 0: - checker_stings = ["ATP AT1 DL %d+%d" % (target_link_id, check_data_len[0])] - test_action_strings = ["SOC SOC%d SEND %d" % (socket_id, check_data_len[0])] - - if self.tc_action.load_and_exe_one_step(checker_stings, test_action_strings, - fail_string, check_time=20) is False: - NativeLog.add_trace_critical("Fail to receive PC SOC%d sent data" % socket_id) - ret = False - break - - # return ret - # for now do not validate data - return True - - TCP_ACTION_DICT = {"C_01": __connect_c_01, - "C_02": __connect_c_02, - "C_03": __connect_c_03, - "C_04": __connect_c_04, - "C_05": __connect_c_05, - "C_06": __connect_c_06, - "C_07": __connect_c_07, - "C_08": __connect_c_08, - "D_01": __close_d_01, - "D_02": __close_d_02, - "D_03": __close_d_03, - "D_04": __close_d_04, - "D_05": __close_d_05, - "D_06": __close_d_06, - "D_07": __close_d_07, - "D_08": __close_d_08, - } - - def get_method_destination_state(self, method): - return self.METHOD_RESULT[method] - - def execute_tcp_method(self, method, conn_id): - if method in self.METHOD_RESULT: - return self.TCP_ACTION_DICT[method](self, conn_id), self.get_method_destination_state(method) - else: - raise TCPUtilError("Not TCP connection method") - pass - - def is_created_state(self, state): - if state in self.SOC_CREATED_STATE: - return True - else: - return False - - def is_closed_state(self, state): - if state in self.SOC_CLOSED_STATE: - return True - else: - return False - - def is_able_to_send_data(self, state): - if state in self.SOC_SEND_DATA_STATE: - return True - else: - return False - - def is_established_connection(self, state): - if state[0] in self.SOC_ESTABLISHED_STATE and state[1] in self.SOC_ESTABLISHED_STATE: - return True - else: - return False - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPConnection.py b/components/test/TestCaseScript/TCPStress/TCPConnection.py deleted file mode 100755 index 8b481c7df8..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPConnection.py +++ /dev/null @@ -1,321 +0,0 @@ -import random -import re -import socket -import threading -import time - -import TCPConnectionUtility -from NativeLog import NativeLog -from TCAction import PerformanceTCBase - -DELAY_RANGE = [10, 3000] -CONNECTION_STRUCTURE = ("Connection handler", "PC socket", "Target socket id", - "Target port", "PC port", "PC state", "Target state") - - -class CheckerBase(threading.Thread): - - CHECK_ITEM = ("CONDITION", "NOTIFIER", "ID", "DATA") - SLEEP_TIME = 0.1 # sleep 100ms between each check action - - def __init__(self): - threading.Thread.__init__(self) - self.setDaemon(True) - self.exit_event = threading.Event() - self.sync_lock = threading.Lock() - self.check_item_list = [] - self.check_item_id = 0 - - def run(self): - while self.exit_event.isSet() is False: - self.process() - pass - - def process(self): - pass - - def add_check_item(self, condition, notifier): - with self.sync_lock: - check_item_id = self.check_item_id - self.check_item_id += 1 - self.check_item_list.append(dict(zip(self.CHECK_ITEM, (condition, notifier, check_item_id, str())))) - return check_item_id - - def remove_check_item(self, check_item_id): - ret = None - with self.sync_lock: - check_items = filter(lambda x: x["ID"] == check_item_id, self.check_item_list) - if len(check_items) > 0: - self.check_item_list.remove(check_items[0]) - ret = check_items[0]["DATA"] - return ret - - def exit(self): - self.exit_event.set() - pass - - -# check on serial port -class SerialPortChecker(CheckerBase): - def __init__(self, serial_reader): - CheckerBase.__init__(self) - self.serial_reader = serial_reader - pass - - # check condition for serial is compiled regular expression pattern - @staticmethod - def do_check(check_item, data): - match = check_item["CONDITION"].search(data) - if match is not None: - pos = data.find(match.group()) + len(match.group()) - # notify user - check_item["NOTIFIER"]("serial", match) - else: - pos = -1 - return pos - - def process(self): - # do check - with self.sync_lock: - # read data - new_data = self.serial_reader() - # NativeLog.add_trace_info("[debug][read data] %s" % new_data) - # do check each item - for check_item in self.check_item_list: - # NativeLog.add_trace_info("[debug][read data][ID][%s]" % check_item["ID"]) - check_item["DATA"] += new_data - self.do_check(check_item, check_item["DATA"]) - time.sleep(self.SLEEP_TIME) - - -# handle PC TCP server accept and notify user -class TCPServerChecker(CheckerBase): - def __init__(self, server_sock): - CheckerBase.__init__(self) - self.server_sock = server_sock - server_sock.settimeout(self.SLEEP_TIME) - self.accepted_socket_list = [] - - # check condition for tcp accepted sock is tcp source port - @staticmethod - def do_check(check_item, data): - for sock_addr_pair in data: - addr = sock_addr_pair[1] - if addr[1] == check_item["CONDITION"]: - # same port, so this is the socket that matched, notify and remove it from list - check_item["NOTIFIER"]("tcp", sock_addr_pair[0]) - data.remove(sock_addr_pair) - - def process(self): - # do accept - try: - client_sock, addr = self.server_sock.accept() - self.accepted_socket_list.append((client_sock, addr)) - except socket.error: - pass - # do check - with self.sync_lock: - check_item_list = self.check_item_list - for check_item in check_item_list: - self.do_check(check_item, self.accepted_socket_list) - pass - - -# this thread handles one tcp connection. -class ConnectionHandler(threading.Thread): - CHECK_FREQ = CheckerBase.SLEEP_TIME/2 - - def __init__(self, utility, serial_checker, tcp_checker, connect_method, disconnect_method): - threading.Thread.__init__(self) - self.setDaemon(True) - self.utility = utility - self.connect_method = connect_method - self.disconnect_method = disconnect_method - self.exit_event = threading.Event() - # following members are used in communication with checker threads - self.serial_checker = serial_checker - self.tcp_checker = tcp_checker - self.serial_notify_event = threading.Event() - self.tcp_notify_event = threading.Event() - self.serial_result = None - self.tcp_result = None - self.serial_check_item_id = None - self.tcp_check_item_id = None - self.data_cache = None - pass - - def new_connection_structure(self): - connection = dict.fromkeys(CONNECTION_STRUCTURE, None) - connection["Connection handler"] = self - return connection - - def run(self): - while self.exit_event.isSet() is False: - connection = self.new_connection_structure() - # do connect - connect_method_choice = random.choice(self.connect_method) - self.utility.execute_tcp_method(connect_method_choice, connection) - # check if established - if self.utility.is_established_state(connection) is True: - time.sleep(float(random.randint(DELAY_RANGE[0], DELAY_RANGE[1]))/1000) - # do disconnect if established - disconnect_method_choice = random.choice(self.disconnect_method) - self.utility.execute_tcp_method(disconnect_method_choice, connection) - # make sure target socket closed - self.utility.close_connection(connection) - time.sleep(float(random.randint(DELAY_RANGE[0], DELAY_RANGE[1]))/1000) - pass - - # serial_condition: re string - # tcp_condition: target local port - def add_checkers(self, serial_condition=None, tcp_condition=None): - # cleanup - self.serial_result = None - self.tcp_result = None - self.serial_notify_event.clear() - self.tcp_notify_event.clear() - # serial_checker - if serial_condition is not None: - pattern = re.compile(serial_condition) - self.serial_check_item_id = self.serial_checker.add_check_item(pattern, self.notifier) - else: - # set event so that serial check always pass - self.serial_notify_event.set() - if tcp_condition is not None: - self.tcp_check_item_id = self.tcp_checker.add_check_item(tcp_condition, self.notifier) - else: - # set event so that tcp check always pass - self.tcp_notify_event.set() - # NativeLog.add_trace_info("[Debug] add check item %s, connection is %s" % (self.serial_check_item_id, self)) - pass - - def get_checker_results(self, timeout=5): - time1 = time.time() - while time.time() - time1 < timeout: - # if one type of checker is not set, its event will be set in add_checkers - if self.serial_notify_event.isSet() is True and self.tcp_notify_event.isSet() is True: - break - time.sleep(self.CHECK_FREQ) - # do cleanup - # NativeLog.add_trace_info("[Debug] remove check item %s, connection is %s" % (self.serial_check_item_id, self)) - self.data_cache = self.serial_checker.remove_check_item(self.serial_check_item_id) - self.tcp_checker.remove_check_item(self.tcp_check_item_id) - # self.serial_check_item_id = None - # self.tcp_check_item_id = None - return self.serial_result, self.tcp_result - - def notifier(self, typ, result): - if typ == "serial": - self.serial_notify_event.set() - self.serial_result = result - elif typ == "tcp": - self.tcp_notify_event.set() - self.tcp_result = result - - def exit(self): - self.exit_event.set() - pass - - -class TCPConnection(PerformanceTCBase.PerformanceTCBase): - def __init__(self, name, test_env, cmd_set, timeout=120, log_path=None): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.max_connection = 5 - self.execute_time = 120 # execute time default 120 minutes - self.pc_ip = "pc_ip" - self.target_ip = "target_ip" - self.connect_method = ["C_01"] - self.disconnect_method = ["D_05"] - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - self.error_event = threading.Event() - self.serial_lock = threading.Lock() - pass - - def serial_reader(self): - return self.serial_read_data("SSC1") - - def send_ssc_command(self, data): - with self.serial_lock: - time.sleep(0.05) - self.serial_write_line("SSC1", data) - - def error_detected(self): - self.error_event.set() - - def process(self): - # parameters - max_connection = self.max_connection - execute_time = self.execute_time * 60 - pc_ip = self.get_parameter(self.pc_ip) - target_ip = self.get_parameter(self.target_ip) - connect_method = self.connect_method - disconnect_method = self.disconnect_method - server_port = random.randint(30000, 50000) - - # step 1, create TCP server on target and PC - # create TCP server on target - self.serial_write_line("SSC1", "soc -B -t TCP -p %s" % server_port) - match = self.check_regular_expression("SSC1", re.compile("BIND:(\d+),OK")) - if match is None: - NativeLog.add_prompt_trace("Failed to create TCP server on target") - return - target_sock_id = match.group(1) - - self.serial_write_line("SSC1", "soc -L -s %s" % target_sock_id) - if self.check_response("SSC1", "+LISTEN:%s,OK" % target_sock_id) is False: - NativeLog.add_prompt_trace("Failed to create TCP server on target") - return - - # create TCP server on PC - try: - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, server_port)) - server_sock.listen(5) - except StandardError: - NativeLog.add_prompt_trace("Failed to create TCP server on PC") - return - - # step 2, create checker - serial_port_checker = SerialPortChecker(self.serial_reader) - tcp_server_checker = TCPServerChecker(server_sock) - serial_port_checker.start() - tcp_server_checker.start() - - # step 3, create 5 thread and do connection - utility = TCPConnectionUtility.Utility(self, server_port, server_port, pc_ip, target_ip) - work_thread = [] - for i in range(max_connection): - t = ConnectionHandler(utility, serial_port_checker, tcp_server_checker, - connect_method, disconnect_method) - work_thread.append(t) - t.start() - - # step 4, wait and exit - self.error_event.wait(execute_time) - # close all threads - for t in work_thread: - t.exit() - t.join() - serial_port_checker.exit() - tcp_server_checker.exit() - serial_port_checker.join() - tcp_server_checker.join() - - if self.error_event.isSet() is False: - # no error detected - self.set_result("Succeed") - pass - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py b/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py deleted file mode 100755 index f28218af0b..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPConnectionUtility.py +++ /dev/null @@ -1,251 +0,0 @@ -import random -import socket -import threading - -from NativeLog import NativeLog - -# from NativeLog import NativeLog - -# make sure target do not listen on this port -ERROR_PORT = 62685 - - -class Utility(object): - METHOD_RESULT = {"C_01": ("ESTABLISHED", "ESTABLISHED"), # target TCP peer state, PC TCP peer state - "C_02": ("SYNC_SENT", "CLOSED"), - "C_03": ("CLOSED", "CLOSED"), - "C_04": ("SYN_RCVD", "ESTABLISHED"), - "C_05": ("ESTABLISHED", "ESTABLISHED"), - "C_06": ("CLOSED", "CLOSED"), - "C_07": ("CLOSED", "CLOSED"), - "C_08": ("CLOSED", "CLOSED"), - "D_01": ("TIME_WAIT", "CLOSED"), - "D_02": ("TIME_WAIT", "TIME_WAIT"), - "D_03": ("FIN_WAIT_2", "CLOSE_WAIT"), - "D_04": ("FIN_WAIT_1", "CLOSE_WAIT"), - "D_05": ("CLOSED", "TIME_WAIT"), - "D_06": ("CLOSED", "CLOSED"), - "D_07": ("CLOSE_WAIT", "FIN_WAIT2"), - "D_08": ("TIME_WAIT", "CLOSED"), } - - SOC_CLOSED_STATE = ("FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT", "LAST_ACK", "CLOSED") - SOC_CREATED_STATE = ("SYNC_RCVD", "ESTABLISHED") - SOC_SEND_DATA_STATE = ("ESTABLISHED", "CLOSE_WAIT") - SOC_ESTABLISHED_STATE = ("ESTABLISHED", ) - - def __init__(self, tc_action, pc_server_port, target_server_port, pc_ip, target_ip): - self.tc_action = tc_action - self.pc_server_port = pc_server_port - self.target_server_port = target_server_port - self.pc_ip = pc_ip - self.target_ip = target_ip - self.pc_close_wait_socket_list = [] - self.sync_lock = threading.Lock() - pass - - # create a tcp socket, return True or False - def __create_tcp_socket(self, connection): - connection_handler = connection["Connection handler"] - connection["Target port"] = random.randint(10000, 60000) - connection_handler.add_checkers("BIND:(\d+),OK,%s,%s" - % (self.target_ip, connection["Target port"])) - self.tc_action.send_ssc_command("soc -B -t TCP -i %s -p %s" % (self.target_ip, connection["Target port"])) - serial_result, tcp_result = connection_handler.get_checker_results() - if serial_result is not None: - connection["Target socket id"] = serial_result.group(1) - return True - else: - return False - - # target do connect, return True or False - def __target_do_connect(self, connection, dest_ip, dest_port, timeout=20): - connection_handler = connection["Connection handler"] - connection_handler.add_checkers("CONNECT:%s,OK" % connection["Target socket id"], - connection["Target port"]) - self.tc_action.send_ssc_command("soc -C -s %s -i %s -p %s" - % (connection["Target socket id"], dest_ip, dest_port)) - serial_result, tcp_result = connection_handler.get_checker_results(timeout) - if serial_result is not None and tcp_result is not None: - connection["PC socket"] = tcp_result - return True - else: - return False - pass - - # pc do connect, return True or False - def __pc_do_connect(self, connection, dest_ip, dest_port, timeout=20): - connection_handler = connection["Connection handler"] - sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - while True: - connection["PC port"] = random.randint(10000, 60000) - try: - sock.bind((self.pc_ip, connection["PC port"])) - break - except socket.error, e: - if e.errno == 10048: # socket port reuse - continue - sock.settimeout(timeout) - connection["PC socket"] = sock - connection_handler.add_checkers("ACCEPT:(\d+),\d+,%s,%s" - % (self.pc_ip, connection["PC port"])) - try: - sock.connect((dest_ip, dest_port)) - except socket.error: - pass - serial_result, tcp_result = connection_handler.get_checker_results() - if serial_result is not None: - connection["Target socket id"] = serial_result.group(1) - return True - else: - return False - pass - - def connect_c_01(self, connection): - if self.__create_tcp_socket(connection) is True: - return self.__target_do_connect(connection, self.pc_ip, self.pc_server_port) - else: - return False - - def connect_c_02(self, connection): - if self.__create_tcp_socket(connection) is True: - return not self.__target_do_connect(connection, self.pc_ip, ERROR_PORT, timeout=5) - else: - return False - - def connect_c_03(self, connection): - return False - - def connect_c_04(self, connection): - return False - - def connect_c_05(self, connection): - return self.__pc_do_connect(connection, self.target_ip, self.target_server_port) - - def connect_c_06(self, connection): - return False - - def connect_c_07(self, connection): - return not self.__pc_do_connect(connection, self.target_ip, ERROR_PORT) - - def connect_c_08(self, connection): - return False - - def __target_socket_close(self, connection): - connection_handler = connection["Connection handler"] - if connection["Target socket id"] is not None: - connection_handler.add_checkers("CLOSE:%s" % connection["Target socket id"]) - self.tc_action.send_ssc_command("soc -T -s %s" % connection["Target socket id"]) - serial_result, tcp_result = connection_handler.get_checker_results() - connection["Target socket id"] = None - else: - serial_result = None - return True if serial_result is not None else False - - @staticmethod - def __pc_socket_close(connection): - connection_handler = connection["Connection handler"] - if connection["PC socket"] is not None: - connection_handler.add_checkers("CLOSED:%s" % connection["Target socket id"]) - connection["PC socket"].close() - serial_result, tcp_result = connection_handler.get_checker_results() - connection["PC socket"] = None - else: - serial_result = None - return True if serial_result is not None else False - - def close_d_01(self, connection): - connection["PC socket"] = None - return self.__target_socket_close(connection) - - def close_d_02(self, connection): - pass - - def close_d_03(self, connection): - with self.sync_lock: - self.pc_close_wait_socket_list.append(connection["PC socket"]) - return self.__target_socket_close(connection) - pass - - def close_d_04(self, connection): - pass - - def close_d_05(self, connection): - return self.__pc_socket_close(connection) - - def close_d_06(self, connection): - # target send data to PC, PC don't recv and close socket - connection_handler = connection["Connection handler"] - connection_handler.add_checkers("SEND:%s,OK" % connection["Target socket id"]) - self.tc_action.send_ssc_command("soc -S -s %s -l 100" % connection["Target socket id"]) - serial_result, tcp_result = connection_handler.get_checker_results() - if serial_result is None: - return False - return self.__pc_socket_close(connection) - - def close_d_07(self, connection): - # PC shutdown WR - result = False - try: - connection["PC socket"].shutdown(socket.SHUT_WR) - result = True - except StandardError: - pass - return result - - def close_d_08(self, connection): - pass - - def close_connection(self, connection): - self.__target_socket_close(connection) - pass - - TCP_ACTION_DICT = {"C_01": connect_c_01, - "C_02": connect_c_02, - "C_03": connect_c_03, - "C_04": connect_c_04, - "C_05": connect_c_05, - "C_06": connect_c_06, - "C_07": connect_c_07, - "C_08": connect_c_08, - "D_01": close_d_01, - "D_02": close_d_02, - "D_03": close_d_03, - "D_04": close_d_04, - "D_05": close_d_05, - "D_06": close_d_06, - "D_07": close_d_07, - "D_08": close_d_08, - } - - def get_method_destination_state(self, method): - return self.METHOD_RESULT[method] - - def execute_tcp_method(self, method, connection): - if method in self.METHOD_RESULT: - result = self.TCP_ACTION_DICT[method](self, connection) - if result is True: - state = self.get_method_destination_state(method) - connection["Target state"] = state[0] - connection["PC state"] = state[1] - else: - NativeLog.add_prompt_trace("[TCPConnection] tcp method %s fail, connection is %s" - % (method, connection)) - NativeLog.add_trace_info("[TCPConnection][data cache][check item %s] %s" - % (connection["Connection handler"].serial_check_item_id, - connection["Connection handler"].data_cache)) - else: - raise StandardError("Not TCP connection method") - return result - - def is_established_state(self, connection): - return True if connection["Target state"] in self.SOC_CREATED_STATE else False - - def is_closed_state(self, connection): - return True if connection["Target state"] in self.SOC_CLOSED_STATE else False - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPDataValidation.py b/components/test/TestCaseScript/TCPStress/TCPDataValidation.py deleted file mode 100755 index b056af38fa..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPDataValidation.py +++ /dev/null @@ -1,244 +0,0 @@ -import os -import random -import threading -import socket -import time -import re - -from TCAction import TCActionBase -from TCAction import PerformanceTCBase -from NativeLog import NativeLog - - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") - - -AP_PROP_KEY = ("ssid", "password", "apc") - - -def calc_hash(index): - return (index & 0xffffffff) % 83 + (index & 0xffffffff) % 167 - - -def verify_data(data, start_index): - for i, c in enumerate(data): - if ord(c) != calc_hash(start_index + i): - NativeLog.add_trace_critical("[Data Validation Error] target sent data index %u is error." - " Sent data is %x, should be %x" - % (start_index + i, ord(c), calc_hash(start_index + i))) - return False - return True - - -def make_validation_data(length, start_index): - return bytes().join([chr(calc_hash(start_index + i)) for i in range(length)]) - - -class SendThread(threading.Thread): - def __init__(self, sock, send_len): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.send_len = send_len - self.exit_event = threading.Event() - pass - - def exit(self): - self.exit_event.set() - - def run(self): - index = 0 - while self.exit_event.isSet() is False: - data = make_validation_data(self.send_len, index) - try: - self.sock.send(data) - index += self.send_len - except StandardError: - # pass but not exit thread - time.sleep(1) - continue - pass - - -class RecvThread(threading.Thread): - def __init__(self, sock): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.exit_event = threading.Event() - - def exit(self): - self.exit_event.set() - - def run(self): - index = 0 - while self.exit_event.isSet() is False: - if self.sock is not None: - try: - data = self.sock.recv(8*1024) - except StandardError, e: - NativeLog.add_exception_log(e) - NativeLog.add_trace_critical("recv error, connection closed") - break - if verify_data(data, index) is not True: - break - index += len(data) - else: - time.sleep(1) - pass - - -class ValidationThread(threading.Thread): - def __init__(self, tc_action): - threading.Thread.__init__(self) - self.setDaemon(True) - self.tc_action = tc_action - self.exit_event = threading.Event() - - def exit(self): - self.exit_event.set() - - def run(self): - while self.exit_event.isSet() is False: - if self.tc_action.check_response("SSC1", "DATA_ERROR", 5) is True: - NativeLog.add_trace_critical("[Data Validation Error] target recv data error") - break - pass - - -class TCPDataValidation(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.send_len = 1460 - self.tx_enable = True - self.rx_enable = True - self.conn_num = 1 - self.test_time = 300 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - - try: - # configurable params - send_len = self.send_len - tx_enable = self.tx_enable - rx_enable = self.rx_enable - conn_num = self.conn_num - test_time = self.test_time * 60 # convert minutes to seconds - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) - raise StandardError("Error configuration") - - # init throughput result data - test_item = "" - if tx_enable is True: - test_item += "Tx" - if rx_enable is True: - test_item += "Rx" - if test_item == "": - raise StandardError("no throughput test item") - - pc_ip = self.get_parameter("pc_ip") - tcp_port = random.randint(10000, 50000) - - # disable recv print during throughput test - self.serial_write_line("SSC1", "soc -R -o 0") - if self.check_response("SSC1", "+RECVPRINT", 2) is False: - NativeLog.add_trace_critical("Fail, Fail to disable recv print") - - # create server - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, tcp_port)) - server_sock.settimeout(5) - server_sock.listen(5) - - sock_id_list = [] - send_thread_list = [] - recv_thread_list = [] - - # step 4 create tcp connection - for i in range(conn_num): - self.serial_write_line("SSC1", "soc -B -t TCP") - match = self.check_regular_expression("SSC1", re.compile("\+BIND:(\d+),OK"), 2) - if match is None: - NativeLog.add_trace_critical("Fail, Fail to bind") - return - else: - sock_id_list.append(int(match.group(1))) - - self.serial_write_line("SSC1", "soc -V -s %s -o 3" % sock_id_list[-1]) - if self.check_regular_expression("SSC1", re.compile("\+DATA_VALIDATION:\d+,OK"), 2) is None: - NativeLog.add_trace_critical("Fail, Failed to enable validation") - return - - self.serial_write_line("SSC1", "soc -C -s %s -i %s -p %s" % (sock_id_list[-1], pc_ip, tcp_port)) - try: - sock, addr = server_sock.accept() - except socket.error, e: - NativeLog.add_trace_critical("%s" % e) - raise e - - if self.check_regular_expression("SSC1", re.compile("\+CONNECT:\d+,OK"), 5) is None: - NativeLog.add_trace_critical("Fail, Failed to connect") - return - - sock.settimeout(10) - - send_thread_list.append(SendThread(sock if rx_enable is True else None, send_len)) - recv_thread_list.append(RecvThread(sock if tx_enable is True else None)) - recv_thread_list[-1].start() - - # step 5 do test - validation_thread = ValidationThread(self) - validation_thread.start() - - for send_thread in send_thread_list: - send_thread.start() - - if tx_enable is True: - # do send from target - for sock_id in sock_id_list: - self.serial_write_line("SSC1", "soc -S -s %s -l %s -n 10000000" % (sock_id, send_len)) - - time1 = time.time() - exit_flag = False - - while time.time() - time1 < test_time and exit_flag is False: - for i in sock_id_list: - send_thread_list[i].join(0.5) - recv_thread_list[i].join(0.5) - validation_thread.join(0.5) - if send_thread_list[i].isAlive() is False \ - or recv_thread_list[i].isAlive() is False \ - or validation_thread.isAlive() is False: - NativeLog.add_trace_critical("validation error found") - exit_flag = True - break - else: - self.set_result("Succeed") - - # exit all thread - for i in sock_id_list: - send_thread_list[i].exit() - recv_thread_list[i].exit() - send_thread_list[i].join() - send_thread_list[i].join() - - validation_thread.exit() - validation_thread.join() - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPRandomSend.py b/components/test/TestCaseScript/TCPStress/TCPRandomSend.py deleted file mode 100755 index 5a07a2d965..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPRandomSend.py +++ /dev/null @@ -1,103 +0,0 @@ -import os -import time -import random -import threading -import socket -from TCAction import TCActionBase -from NativeLog import NativeLog -from NativeLog import ThroughputResult - - -class TCPRandomSend(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.send_len_config = range(1460) - self.delay_config = [0, 0.01, 0.1, 0.5, 1] - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len_config = self.send_len_config - delay_config = self.delay_config - send_count = self.send_count - test_time = self.test_time * 60 - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) - raise StandardError("Error configuration") - - # disable recv print during random send test - checker_stings = ["R SSC1 C +RECVPRINT"] - test_action_string = ["SSC SSC1 soc -R -o 0"] - fail_string = "Fail, Fail to disable recv print" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - pc_ip = self.test_env.get_variable_by_name("pc_ip")[1] - tcp_port = random.randint(50000, 60000) - - # step 0 create tcp connection - - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, tcp_port)) - server_sock.settimeout(1) - server_sock.listen(5) - - checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t TCP"] - fail_string = "Fail, Fail bind" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["P SSC1 RE \+CONNECT:\d+,OK"] - test_action_string = ["SSC SSC1 soc -C -s -i %s -p %s" % (pc_ip, tcp_port)] - fail_string = "Fail, Fail to connect" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - sock, addr = server_sock.accept() - sock.settimeout(10) - # set no delay so that tcp segment will be send as soon as send called - sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - - # step 1 start send - start_time = time.time() - while time.time() - start_time < test_time: - for delay in delay_config: - for i in xrange(send_count): - send_len = random.choice(send_len_config) - data = "A" * (send_len+1) - try: - sock.send(data) - except socket.error, e: - NativeLog.add_exception_log(e) - return - pass - time.sleep(delay) - - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPSendRecv.py b/components/test/TestCaseScript/TCPStress/TCPSendRecv.py deleted file mode 100755 index e14d7f04d4..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPSendRecv.py +++ /dev/null @@ -1,143 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import time -import random -import string - -TEST_COUNT_ONE_ROUND = 1000 - - -class TCPSendRecv(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - # step 0 turn on recv print - checker_stings = ["R SSC1 C +RECVPRINT:1"] - test_action_string = ["SSC SSC1 soc -R -o 1"] - fail_string = "Fail, Fail to turn on recv print" - self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len = self.send_len - test_time = self.test_time * 60 - duplex = self.duplex - conn_num = self.conn_num - send_delay = self.send_delay - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPSendRecv script, error is %s" % e) - raise StandardError("Error configuration") - - ssid = "".join([random.choice(string.lowercase) for m in range(10)]) - password = "".join([random.choice(string.lowercase) for m in range(10)]) - - # step 0 set ap - checker_stings = ["R SSC1 C +SAP:OK"] - test_action_string = ["SSC SSC1 ap -S -s %s -p %s -t 3" % (ssid, password)] - fail_string = "Fail, Fail to set ap" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 1 connect to ap and turn off recv print - checker_stings = ["R SSC2 C +JAP:CONNECTED"] - test_action_string = ["SSC SSC2 sta -C -s %s -p %s" % (ssid, password)] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: - return - - checker_stings = ["P SSC1 C +RECVPRINT:0", "P SSC2 C +RECVPRINT:0"] - test_action_string = ["SSC SSC1 soc -R -o 0", "SSC SSC2 soc -R -o 0"] - fail_string = "Fail, Fail to turn off recv print" - self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: - return - - # step 2 create server on AP - checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t TCP -p "] - fail_string = "Fail, Fail to create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 A :\+LISTEN:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -L -s "] - fail_string = "Fail, Fail to create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 3 create conn_num tcp connections - for i in range(conn_num): - checker_stings = ["R SSC2 A :\+BIND:(\d+),OK" % i] - test_action_string = ["SSC SSC2 soc -B -t TCP"] - fail_string = "Fail, Fail to bind" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["P SSC1 A :\+ACCEPT:(\d+),\d+" % i, - "P SSC2 RE \+CONNECT:\d+,OK"] - test_action_string = ["SSC SSC2 soc -C -s -i -p " % i] - fail_string = "Fail, Fail to connect" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - # step 4, do send/recv - while time.time()-start_time < test_time: - - checker_stings = ["P SSC1 NC ERROR NC CLOSE"] - for i in range(conn_num): - test_action_string = ["SSC SSC2 soc -S -s -l %d -n %d -j %d" % - (i, send_len, TEST_COUNT_ONE_ROUND, send_delay)] - checker_stings.append("P SSC2 RE \"\+SEND:%%%%s,OK\"%%%%() NC ERROR NC CLOSE" % i) - - if duplex is True: - checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%()" % i) - test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % - (i, send_len, TEST_COUNT_ONE_ROUND, send_delay)) - - fail_string = "Fail, Failed on send command" - if self.load_and_exe_one_step([], test_action_string, fail_string) is False: - break - # if self.load_and_exe_one_step([], ["SSC SSC1 ram -H", "SSC SSC2 ram -H"], fail_string) is False: - # break - # time.sleep(0.1) - - fail_string = "Fail, Failed to send/recv data" - if self.load_and_exe_one_step(checker_stings, ["DELAY 0.1"], fail_string, - check_freq=1, check_time=300) is False: - break - pass - - NativeLog.add_prompt_trace("time escape: %s" % (time.time() - start_time)) - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - - diff --git a/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py b/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py deleted file mode 100644 index de31bacc11..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPSoftAPSTASendRecv.py +++ /dev/null @@ -1,318 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import time -import random -import string - -TEST_COUNT_ONE_ROUND = 500 - - -class TCPSoftAPSTASendRecv(TCActionBase.CommonTCActionBase): - def __init__(self, name, test_env, cmd_set, timeout=45, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len = self.send_len - # test count - test_count = self.test_count - # server port - server_port = self.server_port - server_port_t = self.server_port_2 - # ap ip - # ap_ip = self.ap_ip - # server echo - server_echo = self.server_echo - # station number - sta_number = self.sta_number - # pass standard - pass_standard = self.pass_standard - # send delay - send_delay = self.send_delay - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPTransparent script, error is %s" % e) - raise StandardError("Error configuration") - - # step0 reboot - checker_stings = [] - test_action_string = [] - - for i in range(sta_number + 2): - checker_stings.append("P SSC%d C !!!ready!!!" % (i + 1)) - test_action_string.append("SSCC SSC%d reboot" % (i + 1)) - - fail_string = "Fail, Fail to reboot" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step1, set ap/STA mode on all target - for i in range(sta_number + 2): - checker_stings = ["R SSC%d C +MODE:OK" % (i + 1)] - test_action_string = ["SSCC SSC%d op -S -o 3" % (i + 1)] - fail_string = "Fail, Fail to set mode on SSC%d" % (i + 1) - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # set different getway for SSC1 softAP - checker_stings = ["R SSC1 C +DHCP:AP,OK"] - test_action_string = ["SSCC SSC1 dhcp -E -o 2"] - fail_string = "Fail, SSC1 Fail to disable DHCP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 C +IP:OK"] - test_action_string = ["SSCC SSC1 ip -S -o 2 -i 192.168.6.1"] - fail_string = "Fail, SSC1 Fail to set IP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 C +DHCP:AP,OK"] - test_action_string = ["SSCC SSC1 dhcp -S -o 2"] - fail_string = "Fail, SSC1 Fail to enable DHCP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # set different getway for SSC2 softAP - checker_stings = ["R SSC2 C +DHCP:AP,OK"] - test_action_string = ["SSCC SSC2 dhcp -E -o 2"] - fail_string = "Fail, SSC2 Fail to disable DHCP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC2 C +IP:OK"] - test_action_string = ["SSCC SSC2 ip -S -o 2 -i 192.168.5.1"] - fail_string = "Fail, SSC2 Fail to set IP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC2 C +DHCP:AP,OK"] - test_action_string = ["SSCC SSC2 dhcp -S -o 2"] - fail_string = "Fail, SSC2 Fail to enable DHCP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step2, set ssid/password on SSC1 - ssid = "".join([random.choice(string.lowercase) for m in range(10)]) - password = "".join([random.choice(string.lowercase) for m in range(10)]) - checker_stings = ["R SSC1 C +SAP:OK"] - test_action_string = ["SSCC SSC1 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid, password)] - fail_string = "Fail, Fail to set ssid/password on SSC1" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step3, set ssid/password on SSC2 - ssid_1 = "".join([random.choice(string.lowercase) for m in range(10)]) - password_1 = "".join([random.choice(string.lowercase) for m in range(10)]) - checker_stings = ["R SSC2 C +SAP:OK"] - test_action_string = ["SSCC SSC2 ap -S -s %s -p %s -n 10 -t 0 -m 8" % (ssid_1, password_1)] - fail_string = "Fail, Fail to set ap ssid/password on SSC2" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step4, SSC2 join SSC1(soft AP) - checker_stings = [] - test_action_string = [] - checker_stings.append("P SSC2 C +JAP:CONNECTED,%s" % ssid) - test_action_string.append("SSCC SSC2 ap -C -s %s -p %s" % (ssid, password)) - fail_string = "Fail, Fail to connect to SSC1 SoftAP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - # step5, create server on SSC1 - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] - fail_string = "Fail, Fail to create server on SSC1 while binding" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -L -s "] - fail_string = "Fail, Fail to create server on SSC1 while listening" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step6, create client on SSC2 - checker_stings = [] - test_action_string = [] - checker_stings.append("P SSC2 A :BIND:(\d+),OK") - test_action_string.append("SSCC SSC2 soc -B -t TCP") - fail_string = "Fail, SSC2 Fail to connect to server while binding" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["P SSC2 RE CONNECT:(\d+),OK", "P SSC1 A :ACCEPT:(\d+),.+"] - test_action_string = ["SSCC SSC2 soc -C -s -i %s -p %s" % ("192.168.6.1", server_port)] - fail_string = "Fail, SSC2 Fail to connect to server while connecting" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step7, SSC3 - SSC5 join SSC2 - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d C +JAP:CONNECTED,%s" % (i + 3, ssid_1)) - test_action_string.append("SSCC SSC%d ap -C -s %s -p %s" % (i + 3, ssid_1, password_1)) - fail_string = "Fail, SSC%d Fail to connect to SSC2" % (i + 3) - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=450) is False: - return - - # step8, create server on SSC2 - checker_stings = ["R SSC2 A :BIND:(\d+),OK"] - test_action_string = ["SSCC SSC2 soc -B -t TCP -p %s -i 192.168.5.1" % server_port_t] - fail_string = "Fail, Fail to create server one SSC2 while binding" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC2 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC2 soc -L -s "] - fail_string = "Fail, Fail to create server one SSC2 while listening" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step9, create client on SSC3 - SSC5 - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 3, i + 3)) - test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 3)) - fail_string = "Fail, Fail to connect to SSC2 server while binding" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for i in range(sta_number): - checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 3), - "P SSC2 A :ACCEPT:(\d+),.+" % (i + 3)] - test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % - (i + 3, i + 3, "192.168.5.1", server_port_t)] - fail_string = "Fail, Fail to connect to SSC2 server while connecting" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - # step 10, do send/recv - while test_count > 0: - _tmp_count = TEST_COUNT_ONE_ROUND if test_count - TEST_COUNT_ONE_ROUND > 0 else test_count - test_count -= TEST_COUNT_ONE_ROUND - - checker_stings = [] - test_action_string = [] - if server_echo is True: - test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" % - (send_len, _tmp_count, send_delay)) - checker_stings.append("P SSC1 RE \+SEND:\d+,OK NC CLOSED") - test_action_string.append("SSC SSC2 soc -S -s -l %d -n %d -j %d" % - (send_len, _tmp_count, send_delay)) - checker_stings.append("P SSC2 RE \+SEND:\d+,OK NC CLOSED") - - for i in range(sta_number): - checker_stings.append("P SSC%d RE \+SEND:\d+,OK NC CLOSED" % (i + 3)) - test_action_string.append("SSC SSC%d soc -S -s -l %d -n %d -j %d" % - (i + 3, i + 3, send_len, _tmp_count, send_delay)) - for i in range(sta_number): - test_action_string.append("SSC SSC2 soc -S -s -l %d -n %d -j %d" % - (i + 3, send_len, _tmp_count, send_delay)) - checker_stings.append("P SSC2 RE \+SEND:\d+,OK NC CLOSED") - - fail_string = "Fail, Failed to send/recv data" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=300) is False: - break - pass - - if (time.time() - start_time) > pass_standard: - self.result_cntx.set_result("Succeed") - else: - checker_stings = [] - test_action_string = [] - for i in range(sta_number + 2): - checker_stings.append("P SSC%d C CLOSEALL" % (i + 1)) - test_action_string.append("SSCC SSC%d soc -T" % (i + 1)) - fail_string = "Fail, Fail to close socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - # re-set server on SSC1 - server_port = random.randint(20000, 30000) - checker_stings = ["R SSC1 A :BIND:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -B -t TCP -p %s" % server_port] - fail_string = "Fail, Fail to bind socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["R SSC1 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC1 soc -L -s "] - fail_string = "Fail, Fail to listen" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - # SSC2 connnect SSC1 - checker_stings = [] - test_action_string = [] - checker_stings.append("P SSC2 A :BIND:(\d+),OK") - test_action_string.append("SSCC SSC2 soc -B -t TCP") - fail_string = "Fail, SSC2 Fail to bind sock" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - checker_stings = ["P SSC2 RE CONNECT:(\d+),OK", "P SSC1 A :ACCEPT:(\d+),.+"] - test_action_string = ["SSCC SSC2 soc -C -s -i %s -p %s" % ("192.168.6.1", server_port)] - fail_string = "Fail, SSC2 Fail to connect to SSC1 server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - #create server on SSC2 - checker_stings = [] - test_action_string = [] - checker_stings.append("P SSC2 A :BIND:(\d+),OK") - test_action_string.append("SSCC SSC2 soc -B -t TCP -p %s -i 192.168.5.1" % server_port_t) - fail_string = "Fail, SSC2 Fail to bind" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - checker_stings = ["R SSC2 RE LISTEN:(\d+),OK"] - test_action_string = ["SSCC SSC2 soc -L -s "] - fail_string = "Fail, SSC2 Fail to listen" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - #create client on SSC3-SSC5 - checker_stings = [] - test_action_string = [] - for i in range(sta_number): - checker_stings.append("P SSC%d A :BIND:(\d+),OK" % (i + 3, i + 3)) - test_action_string.append("SSCC SSC%d soc -B -t TCP" % (i + 3)) - fail_string = "Fail, Fail to connect to SSC2 server while binding" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for i in range(sta_number): - checker_stings = ["P SSC%d RE CONNECT:(\d+),OK" % (i + 3), - "P SSC2 A :ACCEPT:(\d+),.+" % (i + 3)] - test_action_string = ["SSCC SSC%d soc -C -s -i %s -p %s" % - (i + 3, i + 3, "192.168.5.1", server_port_t)] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - self.result_cntx.set_result("Failed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/TCPThroughput.py b/components/test/TestCaseScript/TCPStress/TCPThroughput.py deleted file mode 100755 index 0c40603e37..0000000000 --- a/components/test/TestCaseScript/TCPStress/TCPThroughput.py +++ /dev/null @@ -1,315 +0,0 @@ -import os -import time -import random -import threading -import socket - -from TCAction import TCActionBase -from NativeLog import NativeLog -from NativeLog import ThroughputResult -from Utility import RSSICalibrator -from Utility import MakeFolder - - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") - - -AP_PROP_KEY = ("ssid", "password", "apc") - - -class SendThread(threading.Thread): - def __init__(self, sock, send_len): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.send_len = send_len - self.exit_event = threading.Event() - self.calc_event = threading.Event() - self.bytes_sent = 0 - pass - - def start_calc(self): - self.calc_event.set() - - def stop_calc(self): - self.calc_event.clear() - self.exit_event.set() - - def run(self): - data = "A" * self.send_len - if self.sock is None: - return - while True: - if self.exit_event.isSet() is True: - break - try: - self.sock.send(data) - except StandardError: - break - if self.calc_event.isSet() is True: - self.bytes_sent += self.send_len - - def get_bytes_sent(self): - return self.bytes_sent - pass - - -class RecvThread(threading.Thread): - def __init__(self, sock): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.exit_event = threading.Event() - self.calc_event = threading.Event() - self.bytes_recv = 0 - - def start_calc(self): - self.calc_event.set() - - def stop_calc(self): - self.calc_event.clear() - self.exit_event.set() - - def run(self): - if self.sock is None: - return - while True: - if self.exit_event.isSet() is True: - break - try: - data = self.sock.recv(8*1024) - except StandardError: - break - if self.calc_event.isSet() is True: - self.bytes_recv += len(data) - - def get_bytes_recv(self): - return self.bytes_recv - pass - - -class TCPThroughput(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.att_test_list = range(60) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # read AP list - self.ap_list = [] - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - ap_list = self.ap_list - send_len = self.send_len - att_test_list = self.att_test_list - tx_enable = self.tx_enable - rx_enable = self.rx_enable - measure_period = self.measure_period - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) - raise StandardError("Error configuration") - - # find local ip and generate local port - local_ip_list = socket.gethostbyname_ex(socket.gethostname())[2] - for local_ip in local_ip_list: - if local_ip.find("192.168.1.") != -1: - pc_ip = local_ip - break - else: - raise StandardError("Can't find local IP.") - - tcp_port = random.randint(40000, 50000) - - # init throughput result data - test_item = "" - if tx_enable is True: - test_item += "Tx" - if rx_enable is True: - test_item += "Rx" - if test_item == "": - raise StandardError("no throughput test item") - - folder_path = MakeFolder.make_folder(LOG_FOLDER) - file_name = os.path.join(folder_path, - "TCPThroughput_%s_%s" % (test_item, time.strftime("%d%H%M%S", time.localtime()))) - - result = ThroughputResult.ThroughputResult(file_name, standard_required=True) - - # restart before executing throughput - checker_stings = ["R SSC1 C !!!ready!!!"] - test_action_string = ["SSC SSC1 reboot"] - fail_string = "Fail, Fail to reboot" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # disable recv print during throughput test - checker_stings = ["R SSC1 C +RECVPRINT"] - test_action_string = ["SSC SSC1 soc -R -o 0"] - fail_string = "Fail, Fail to disable recv print" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for ap_prop in ap_list: - if ap_prop["password"] == "": - # set a default string for open ap - ap_prop["password"] = "1" - - # switch off all outlet, switch on AP outlet - outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") - outlet_config_dict[ap_prop["apc"]] = "ON" - apc_cmd = "APC " - for outlet in outlet_config_dict: - apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) - checker_stings = ["P PC_COM L OK"] - fail_string = "Fail, Fail to switch apc" - if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: - return - - # wait AP ready - time.sleep(20) - - # create server - server_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) - server_sock.bind((pc_ip, tcp_port)) - server_sock.settimeout(5) - server_sock.listen(5) - - if tx_enable is True: - result.add_test_item(ap_prop["ssid"] + "_tx") - if rx_enable is True: - result.add_test_item(ap_prop["ssid"] + "_rx") - - # create RSSI Calibrator - calibrator = RSSICalibrator.Calibrator() - - for att_value in att_test_list: - # step 0 set att value - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT %s" % att_value] - fail_string = "Fail, Fail to set att value" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - # step 1 connect to AP - checker_stings = ["R SSC1 C +JAP:CONNECTED"] - test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] - fail_string = "Fail, Fail to JAP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=30) is False: - continue - # step 2 get AP RSSI - checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)" % ap_prop["ssid"]] - test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] - fail_string = "Fail, Fail to scan" - rssi = scan_count = 0 - for i in range(3): - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - rssi += int(self.test_env.get_variable_by_name("rssi")[1]) - scan_count += 1 - - rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) - - # step 3 close all connections - checker_stings = ["R SSC1 C +CLOSEALL"] - test_action_string = ["SSC SSC1 soc -T"] - fail_string = "Fail, Fail to create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - # step 4 create tcp connection - - checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t TCP"] - fail_string = "Fail, Fail bind" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - checker_stings = ["P SSC1 RE \+CONNECT:\d+,OK"] - test_action_string = ["SSC SSC1 soc -C -s -i %s -p %s" % (pc_ip, tcp_port)] - fail_string = "Fail, Fail to connect" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - try: - sock, addr = server_sock.accept() - except socket.error, e: - NativeLog.add_trace_critical("%s" % e) - continue - sock.settimeout(measure_period) - - # step 5 do throughput test - send_thread = SendThread(sock if rx_enable is True else None, send_len) - send_thread.start() - - recv_thread = RecvThread(sock if tx_enable is True else None) - recv_thread.start() - - if tx_enable is True: - # do send from target - test_action_string = ["SSC SSC1 soc -S -s -l %s -n 10000000" % send_len] - fail_string = "Fail, Fail to send" - if self.load_and_exe_one_step([], test_action_string, fail_string) is False: - pass - - # start throughput calculate - send_thread.start_calc() - recv_thread.start_calc() - - # sleep for measure period - time.sleep(measure_period) - - # stop throughput calculate - send_thread.stop_calc() - recv_thread.stop_calc() - - send_thread.join() - recv_thread.join() - - sock.close() - - # output throughput result - # in Mbps - if send_thread.get_bytes_sent() > 0: - result.log_throughput(ap_prop["ssid"] + "_rx", rssi, att_value, - float(send_thread.get_bytes_sent() * 8) / (measure_period * 1000000)) - - if recv_thread.get_bytes_recv() > 0: - result.log_throughput(ap_prop["ssid"] + "_tx", rssi, att_value, - float(recv_thread.get_bytes_recv() * 8) / (measure_period * 1000000)) - - result.output_to_file() - pass - - server_sock.close() - - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/TCPStress/__init__.py b/components/test/TestCaseScript/TCPStress/__init__.py deleted file mode 100755 index 049c1b961f..0000000000 --- a/components/test/TestCaseScript/TCPStress/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["TCPConnUtility", "TCPConnSingleMode", "TCPConnMixedMode"] \ No newline at end of file diff --git a/components/test/TestCaseScript/UDPStress/UDPSendRecv.py b/components/test/TestCaseScript/UDPStress/UDPSendRecv.py deleted file mode 100755 index 3a528c6ba7..0000000000 --- a/components/test/TestCaseScript/UDPStress/UDPSendRecv.py +++ /dev/null @@ -1,130 +0,0 @@ -from TCAction import TCActionBase -from NativeLog import NativeLog -import time -import random -import string - -TEST_COUNT_ONE_ROUND = 1000 - - -class UDPSendRecv(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def cleanup(self): - # step 0 turn on recv print - checker_stings = ["R SSC1 C +RECVPRINT:1"] - test_action_string = ["SSC SSC1 soc -R -o 1"] - fail_string = "Fail, Fail to turn on recv print" - self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - send_len = self.send_len - test_time = self.test_time * 60 - duplex = self.duplex - conn_num = self.conn_num - send_delay = self.send_delay - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for UDPSendRecv script, error is %s" % e) - raise StandardError("Error configuration") - - ssid = "".join([random.choice(string.lowercase) for m in range(10)]) - password = "".join([random.choice(string.lowercase) for m in range(10)]) - - # step 0 set ap - checker_stings = ["R SSC1 C +SAP:OK"] - test_action_string = ["SSC SSC1 ap -S -s %s -p %s -t 3" % (ssid, password)] - fail_string = "Fail, Fail to set ap" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # step 1 connect to ap and turn off recv print - checker_stings = ["R SSC2 C +JAP:CONNECTED"] - test_action_string = ["SSC SSC2 sta -C -s %s -p %s" % (ssid, password)] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: - return - - checker_stings = ["R SSC2 A :\+STAIP:(\d+\.\d+\.\d+\.\d+)\r"] - test_action_string = ["SSC SSC2 ip -Q -o 1"] - fail_string = "Fail, Fail to connect to server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: - return - - checker_stings = ["P SSC1 C +RECVPRINT:0", "P SSC2 C +RECVPRINT:0"] - test_action_string = ["SSC SSC1 soc -R -o 0", "SSC SSC2 soc -R -o 0"] - fail_string = "Fail, Fail to turn off recv print" - self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, check_time=200) is False: - return - - # step 2 create conn_num udp socket - for i in range(1, conn_num+1): - checker_stings = ["R SSC1 A :\+BIND:(\d+),OK" % i, - "R SSC2 A :\+BIND:(\d+),OK" % i] - test_action_string = ["SSC SSC1 soc -B -t UDP -p " % i, - "SSC SSC2 soc -B -t UDP -p " % i] - fail_string = "Fail, Fail to create socket" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - start_time = time.time() - # step 3, do send/recv - while time.time()-start_time < test_time: - - checker_stings = ["P SSC1 NC ERROR NC CLOSE"] - for i in range(1, conn_num+1): - test_action_string = ["SSC SSC2 soc -S -s -l %d -n %d -j %d " - "-i -p " % - (i, send_len, TEST_COUNT_ONE_ROUND, send_delay, i)] - checker_stings.append("P SSC2 RE \"\+SEND:%%%%s,OK\"%%%%() NC ERROR NC CLOSE" % i) - if duplex is True: - test_action_string.append("SSC SSC1 soc -S -s -l %d -n %d -j %d" - " -i -p " % - (i, send_len, TEST_COUNT_ONE_ROUND, send_delay, i)) - checker_stings.append("P SSC1 RE \"\+SEND:%%%%s,OK\"%%%%()" % i) - - fail_string = "Fail, Failed on send command" - if self.load_and_exe_one_step([], test_action_string, fail_string) is False: - break - time.sleep(1) - - fail_string = "Fail, Failed to send/recv data" - if self.load_and_exe_one_step(checker_stings, ["DELAY 0.1"], fail_string, - check_freq=1, check_time=300) is False: - break - pass - - NativeLog.add_prompt_trace("time escape: %s" % (time.time() - start_time)) - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() - - diff --git a/components/test/TestCaseScript/UDPStress/UDPThroughput.py b/components/test/TestCaseScript/UDPStress/UDPThroughput.py deleted file mode 100755 index dac7c2206b..0000000000 --- a/components/test/TestCaseScript/UDPStress/UDPThroughput.py +++ /dev/null @@ -1,305 +0,0 @@ -import os -import time -import random -import threading -import socket - -from TCAction import TCActionBase -from NativeLog import NativeLog -from NativeLog import ThroughputResult -from Utility import RSSICalibrator -from Utility import MakeFolder - - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "Throughput") - - -AP_PROP_KEY = ("ssid", "password", "apc") - - -class SendThread(threading.Thread): - def __init__(self, sock, send_len, target_addr): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.send_len = send_len - self.target_addr = target_addr - self.exit_event = threading.Event() - pass - - def exit(self): - self.exit_event.set() - - def run(self): - data = "A" * self.send_len - if self.sock is None: - return - while True: - if self.exit_event.isSet() is True: - break - try: - self.sock.sendto(data, self.target_addr) - except StandardError: - break - pass - - -class RecvThread(threading.Thread): - def __init__(self, sock): - threading.Thread.__init__(self) - self.setDaemon(True) - self.sock = sock - self.exit_event = threading.Event() - self.calc_event = threading.Event() - self.bytes_recv = 0 - - def start_calc(self): - self.calc_event.set() - - def stop_calc(self): - self.calc_event.clear() - self.exit_event.set() - - def run(self): - if self.sock is None: - return - while True: - if self.exit_event.isSet() is True: - break - try: - data, addr = self.sock.recvfrom(65535) - except StandardError: - break - if self.calc_event.isSet() is True: - self.bytes_recv += len(data) - - def get_bytes_recv(self): - return self.bytes_recv - pass - - -class UDPThroughput(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.att_test_list = range(60) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # read AP list - self.ap_list = [] - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" - exec cmd_string - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - ap_list = self.ap_list - send_len = self.send_len - att_test_list = self.att_test_list - tx_enable = self.tx_enable - rx_enable = self.rx_enable - measure_period = self.measure_period - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for TCPThroughput script, error is %s" % e) - raise StandardError("Error configuration") - - # find local ip and generate local port - local_ip_list = socket.gethostbyname_ex(socket.gethostname())[2] - for local_ip in local_ip_list: - if local_ip.find("192.168.1.") != -1: - pc_ip = local_ip - break - else: - raise StandardError("Can't find local IP.") - - udp_port = random.randint(40000, 50000) - - # init throughput result data - test_item = "" - if tx_enable is True: - test_item += "Tx" - if rx_enable is True: - test_item += "Rx" - if test_item == "": - raise StandardError("no throughput test item") - - folder_path = MakeFolder.make_folder(LOG_FOLDER) - file_name = os.path.join(folder_path, - "UDPThroughput_%s_%s" % (test_item, time.strftime("%d%H%M%S", time.localtime()))) - - result = ThroughputResult.ThroughputResult(file_name) - - # restart before executing throughput - checker_stings = ["R SSC1 C !!!ready!!!"] - test_action_string = ["SSC SSC1 reboot"] - fail_string = "Fail, Fail to reboot" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - # disable recv print during throughput test - checker_stings = ["R SSC1 C +RECVPRINT"] - test_action_string = ["SSC SSC1 soc -R -o 0"] - fail_string = "Fail, Fail to disable recv print" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - return - - for ap_prop in ap_list: - if ap_prop["password"] == "": - # set a default string for open ap - ap_prop["password"] = "1" - - # switch off all outlet, switch on AP outlet - outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") - outlet_config_dict[ap_prop["apc"]] = "ON" - apc_cmd = "APC " - for outlet in outlet_config_dict: - apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) - checker_stings = ["P PC_COM L OK"] - fail_string = "Fail, Fail to switch apc" - if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: - return - - # wait AP ready - time.sleep(20) - - # create server - udp_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) - udp_sock.bind((pc_ip, udp_port)) - udp_sock.settimeout(1) - - if tx_enable is True: - result.add_test_item(ap_prop["ssid"] + "_tx") - if rx_enable is True: - result.add_test_item(ap_prop["ssid"] + "_rx") - - # create RSSI Calibrator - calibrator = RSSICalibrator.Calibrator() - - for att_value in att_test_list: - # step 0 set att value - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT %s" % att_value] - fail_string = "Fail, Fail to set att value" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - # step 1 connect to AP - checker_stings = ["R SSC1 C +JAP:CONNECTED"] - test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] - fail_string = "Fail, Fail to JAP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=30) is False: - continue - checker_stings = ["R SSC1 A :STAIP:(\d+\.\d+\.\d+\.\d+)"] - test_action_string = ["SSC SSC1 ip -Q"] - fail_string = "Fail, Fail to get ip" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=30) is False: - continue - target_ip = self.get_parameter("target_ip") - # step 2 get AP RSSI - checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)\r" % ap_prop["ssid"]] - test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] - fail_string = "Fail, Fail to scan" - rssi = scan_count = 0 - for i in range(3): - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - rssi += int(self.test_env.get_variable_by_name("rssi")[1]) - scan_count += 1 - - rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) - - # step 3 close all connections - checker_stings = ["R SSC1 C +CLOSEALL"] - test_action_string = ["SSC SSC1 soc -T"] - fail_string = "Fail, Fail to create server" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - # step 4 create UDP socket - checker_stings = ["R SSC1 A :\+BIND:(\d+),OK"] - test_action_string = ["SSC SSC1 soc -B -t UDP -i %s -p %s" % (target_ip, udp_port)] - fail_string = "Fail, Fail bind" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - # step 5 do throughput test - send_thread = SendThread(udp_sock if rx_enable is True else None, - send_len, (target_ip, udp_port)) - send_thread.start() - - recv_thread = RecvThread(udp_sock if tx_enable is True else None) - recv_thread.start() - - if tx_enable is True: - # do send from target - test_action_string = ["SSC SSC1 soc -S -s -l %s -n 10000000 -i %s -p %s" - % (send_len, pc_ip, udp_port)] - fail_string = "Fail, Fail to send" - if self.load_and_exe_one_step([], test_action_string, fail_string) is False: - pass - - # start throughput calculate - recv_thread.start_calc() - - # sleep for measure period - time.sleep(measure_period) - - # stop throughput calculate - recv_thread.stop_calc() - send_thread.exit() - - send_thread.join() - recv_thread.join() - - # output throughput result - # in Mbps - if rx_enable is True: - # get received data len from PC - self.load_and_exe_one_step(["R SSC1 A :RECVLEN:(\d+)"], - ["SSC SSC1 soc -Q -s -o 1"], - "Fail, Fail to get recv data len") - try: - rx_data_len = int(self.get_parameter("recv_len")) - except StandardError: - rx_data_len = 0 - - result.log_throughput(ap_prop["ssid"] + "_rx", rssi, att_value, - float(rx_data_len * 8) / (measure_period * 1000000)) - - if recv_thread.get_bytes_recv() > 0: - result.log_throughput(ap_prop["ssid"] + "_tx", rssi, att_value, - float(recv_thread.get_bytes_recv() * 8) / (measure_period * 1000000)) - - result.output_to_file() - pass - - udp_sock.close() - - self.result_cntx.set_result("Succeed") - - # finally, execute done - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/UDPStress/__init__.py b/components/test/TestCaseScript/UDPStress/__init__.py deleted file mode 100755 index d29ee405a4..0000000000 --- a/components/test/TestCaseScript/UDPStress/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["UDPSendRecv", ] diff --git a/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py b/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py deleted file mode 100755 index 70a1169f20..0000000000 --- a/components/test/TestCaseScript/WiFiStress/SoftAPNSTA.py +++ /dev/null @@ -1,178 +0,0 @@ -import random -import time -import string -import threading - -from TCAction import TCActionBase -from NativeLog import NativeLog -from TCAction import PerformanceTCBase -from Utility import Encoding - - -class STAJAPThread(threading.Thread): - def __init__(self, test_action, port_name, ssid, password, delay1, delay2, change_mac): - threading.Thread.__init__(self) - self.setDaemon(True) - self.test_action = test_action - self.port_name = port_name - self.ssid = ssid - self.password = password - self.delay1 = delay1 - self.delay2 = delay2 - self.change_mac = change_mac - self.exit_flag = threading.Event() - pass - - def exit(self): - self.exit_flag.set() - pass - - def run(self): - total_test_count = 0 - fail_count = 0 - while self.exit_flag.isSet() is False: - # change mac - if self.change_mac is True: - mac = Encoding.generate_random_mac() - self.test_action.serial_write_line(self.port_name, "mac -S -o 1 -m %s" % mac) - self.test_action.check_response(self.port_name, "+MAC:STA,OK") - - time.sleep(1) - - # JAP - total_test_count += 1 - # flush current port data - self.test_action.flush_data(self.port_name) - self.test_action.serial_write_line(self.port_name, "sta -C -s %s -p %s" % (self.ssid, self.password)) - if self.test_action.check_response(self.port_name, "+JAP:CONNECTED", 45) is False: - fail_count += 1 - NativeLog.add_trace_critical("[%s] Failed to JAP, Failed/Total : %d/%d" - % (self.port_name, fail_count, total_test_count)) - continue - time.sleep(random.randint(self.delay1[0], self.delay1[1])) - - # QAP - self.test_action.serial_write_line(self.port_name, "sta -D") - if self.test_action.check_response(self.port_name, "+QAP:OK", 5) is False: - NativeLog.add_trace_critical("[%s] Failed to QAP" % self.port_name) - time.sleep(random.randint(self.delay2[0], self.delay2[1])) - - # make sure quit AP - self.test_action.serial_write_line(self.port_name, "sta -D") - pass - pass - - -class SoftAPNSTA(PerformanceTCBase.PerformanceTCBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - PerformanceTCBase.PerformanceTCBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.sta_num = 0 - self.max_sta = 4 - self.test_time = 60 - self.delay1 = [5, 30] - self.delay2 = [5, 10] - self.change_mac = True - self.channel = 11 - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - pass - - def process(self): - # configurable parameters - try: - sta_num = self.sta_num - max_sta = self.max_sta - test_time = self.test_time - # delay between JAP succeed and QAP - delay1 = self.delay1 - # delay between QAP and JAP - delay2 = self.delay2 - # if change mac each time before JAP - change_mac = self.change_mac - # channel - channel = self.channel - except StandardError, e: - raise StandardError("miss mandatory parameters") - - # step 0, set op mode and enable dhcp - self.serial_write_line("SSC1", "op -S -o 2") - if self.check_response("SSC1", "+MODE:OK", 2) is False: - NativeLog.add_trace_critical("Failed to set ap mode") - return - self.serial_write_line("SSC1", "dhcp -E -o 2") - if self.check_response("SSC1", "+DHCP:AP,OK", 2) is False: - NativeLog.add_trace_critical("Failed to enable ap dhcp") - return - self.serial_write_line("SSC1", "dhcp -L -s 192.168.4.2 -e 192.168.4.100 -t 1") - if self.check_response("SSC1", "+DHCP:LEASE,OK", 2) is False: - NativeLog.add_trace_critical("Failed to enable ap dhcp") - return - self.serial_write_line("SSC1", "dhcp -S -o 2") - if self.check_response("SSC1", "+DHCP:AP,OK", 2) is False: - NativeLog.add_trace_critical("Failed to enable ap dhcp") - return - - for i in range(sta_num): - self.serial_write_line("SSC%d" % (i+2), "op -S -o 1") - if self.check_response("SSC%d" % (i+2), "+MODE:OK", 2) is False: - NativeLog.add_trace_critical("Failed to set sta mode") - return - self.serial_write_line("SSC%d" % (i+2), "dhcp -S -o 1") - if self.check_response("SSC%d" % (i+2), "+DHCP:STA,OK", 2) is False: - NativeLog.add_trace_critical("Failed to enable sta dhcp") - - # step 1, set ap config and load - ap_ssid = "".join([random.choice(string.uppercase) for m in range(15)]) - ap_password = "".join([random.choice(string.lowercase) for m in range(15)]) - - self.serial_write_line("SSC1", "ap -S -s %s -p %s -t 3 -m %s -n %s" - % (ap_ssid, ap_password, max_sta, channel)) - if self.check_response("SSC1", "+SAP:OK", 2) is False: - NativeLog.add_trace_critical("Failed to set AP") - return - - # step 2, start thread to let STA JAP - sta_thread_list = [] - for i in range(sta_num): - sta_thread_list.append(STAJAPThread(self, "SSC%d" % (i+2), - ap_ssid, ap_password, delay1, delay2, change_mac)) - for sta_thread in sta_thread_list: - sta_thread.start() - - # step 3, sleep for test time - for i in range(test_time): - self.flush_data("SSC1") - time.sleep(60) - - # step 4, close all thread, will disconnect when exit thread - for sta_thread in sta_thread_list: - sta_thread.exit() - for sta_thread in sta_thread_list: - sta_thread.join() - # wait and make sure disconnect done - time.sleep(1) - - # step 5, join AP and check - sta_num_temp = max_sta if sta_num > max_sta else sta_num - - for i in range(sta_num_temp): - self.serial_write_line("SSC%d" % (i+2), "sta -C -s %s -p %s" % (ap_ssid, ap_password)) - if self.check_response("SSC%d" % (i+2), "+JAP:CONNECTED", 45) is False: - self.set_result("Fail") - break - pass - else: - self.set_result("Succeed") - - -def main(): - pass - -if __name__ == '__main__': - main() - diff --git a/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py b/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py deleted file mode 100755 index 24702bfc8d..0000000000 --- a/components/test/TestCaseScript/WiFiStress/WifiConnUtility.py +++ /dev/null @@ -1,240 +0,0 @@ -from NativeLog import NativeLog -import time -import random - - -ERROR_AP_PROP = {"ssid": "123456789012345678901234567890", - "ssid_len": 30, - "pwd": "12345678901234567890", - "pwd_len": 20, - "channel": 10, - "enc": 3, - "apc": 9, # invalid apc count - } - - -class WifiConnUtilError(StandardError): - pass - - -class WifiConnUtility(object): - - def __init__(self, tc_action): - self.tc_action = tc_action - self.target_type = tc_action.target_type - pass - - def set_mode(self, mode): - ret = True - fail_string = "set mode fail" - cmd = [] - checker_stings = [] - for i in range(2): - if self.target_type[0] == "SSC": - cmd.append("SSCC SSC%d op -S -o %d" % (i+1, mode[i])) - checker_stings.append("SSCP SSC%d C +MODE:OK" % (i+1)) - pass - else: - cmd.append("ATC AT%d CWMODE %d" % (i+1, mode[i])) - checker_stings.append("ATP AT%d L OK" % (i+1)) - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Failed to set mode") - ret = False - return ret - pass - - def _apc_switch(self, outlet_list, action_list): - checker_stings = ["R PC_COM C OK"] - switch_cmd = "APC " - fail_string = "Error when switching APC" - ret = True - - for [_outlet, _action] in zip(action_list, outlet_list): - switch_cmd += " %s %d" % (_action, _outlet) - - if self.tc_action.load_and_exe_one_step(checker_stings, [switch_cmd], - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("Error when switching APC") - ret = False - return ret - pass - - def _set_target_ap(self, ap_prop): - ret = True - fail_string = "set target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - if self.target_type[1] == "SSC": - if ap_prop["pwd"] == "": - cmd = ["SSCC SSC2 ap -S -s %s -t %d" % (ap_prop["ssid"], - ap_prop["enc"]) - ] - else: - cmd = ["SSCC SSC2 ap -S -s %s -p %s -t %d" % (ap_prop["ssid"], - ap_prop["pwd"], - ap_prop["enc"]) - ] - checker_stings = ["SSCP SSC2 C +SAP:OK"] - pass - else: - cmd = ["ATC AT2 CWSAP \"%s\" \"%s\" %d %d" % (ap_prop["ssid"], - ap_prop["pwd"], - ap_prop["channel"], - ap_prop["enc"]) - ] - checker_stings = ["ATR AT2 L OK"] - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical("set target ap fail") - ret = False - return ret - pass - - def setup_ap(self, ap_type, ap_prop): - if ap_type == "target": - ret = self._set_target_ap(ap_prop) - pass - else: - ret = self._apc_switch(["ON"], [ap_prop["apc"]]) - # delay for 5 seconds, wait AP ready - time.sleep(5) - pass - return ret - - def do_scan(self, ap_prop): - fail_string = "Scan fail" - ret = True - # do not check if the set AP can be scanned - if self.target_type[1] == "SSC": - cmd = ["SSCC SSC1 sta -S"] - checker_stings = ["SSCR SSC1 C +SCANDONE"] - pass - else: - cmd = ["ATS AT1 AT+CWLAP"] - checker_stings = ["ATR AT1 L OK"] - pass - if self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=100) is False: - NativeLog.add_trace_critical("Scan fail") - ret = False - return ret - pass - - def _switch_off_target_ap(self, delay): - time.sleep(delay) - self._set_target_ap(ERROR_AP_PROP) - pass - - def _switch_on_target_ap(self, ap_prop, delay): - time.sleep(delay) - self._set_target_ap(ap_prop) - pass - - def _switch_off_ap(self, ap_type, ap_prop, delay_range): - delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 - if ap_type == "target": - self._switch_off_target_ap(delay) - else: - delay -= 1.5 - time.sleep(delay if delay > 0 else 0) - self._apc_switch(["OFF"], [ap_prop["apc"]]) - pass - - def _switch_on_ap(self, ap_type, ap_prop, delay_range): - delay = random.randint(delay_range[0]*10, delay_range[1]*10)/10 - if ap_type == "target": - self._switch_on_target_ap(ap_prop, delay) - else: - delay -= 1.5 - time.sleep(delay if delay > 0 else 0) - self._apc_switch(["ON"], [ap_prop["apc"]]) - pass - - def _join_ap(self, ap_prop, test_method): - fail_string = "join target ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - if self.target_type[1] == "SSC": - cmd = ["SSCC SSC1 ap -C -s %s -p %s" % (ap_prop["ssid"], - ap_prop["pwd"],) - ] - checker_stings = ["SSCR SSC1 C +JAP:CONNECTED"] - pass - else: - cmd = ["ATC AT1 CWJAP \"%s\" \"%s\"" % (ap_prop["ssid"], - ap_prop["pwd"]) - ] - checker_stings = ["ATR AT1 NC ERROR NC FAIL L OK"] - pass - if test_method == "Normal": - ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_freq=0.1, check_time=350) - if ret is not False: - ret *= 0.1 - else: - ret = self.tc_action.load_and_exe_one_step([], cmd, fail_string) - return ret - pass - - def _check_join_ap_result(self, ap_prop): - ret = False - fail_string = "join ap fail, %s, %s" % (ap_prop["ssid"], ap_prop["pwd"]) - - if self.target_type[1] == "SSC": - checker_stings = ["SSCR SSC1 C +JAP:CONNECTED"] - ret = self.tc_action.load_and_exe_one_step(checker_stings, ["DELAY 0"], - fail_string, check_freq=1, check_time=120) - pass - else: - cmd = ["ATS AT1 AT+CWJAP?"] - checker_stings = ["ATR AT1 NC busy NC No%20AP C +CWJAP"] - for i in range(3): - ret = self.tc_action.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_freq=1, check_time=2) - if ret is not False: - break - time.sleep(15) - - return ret - pass - - def join_ap(self, join_test_method, ap_type, ap_prop, delay): - - if join_test_method == "WRONG_PROP": - _prop = ERROR_AP_PROP - else: - _prop = ap_prop - - ret = self._join_ap(_prop, join_test_method) - - if join_test_method == "OFF_ON": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - self._switch_on_ap(ap_type, ap_prop, delay[1]) - ret = self._check_join_ap_result(_prop) - pass - elif join_test_method == "OFF": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - time.sleep(25) - pass - - return ret - pass - - def do_reconnect(self, reconnect_test_method, ap_type, ap_prop, delay): - ret = True - if reconnect_test_method == "OFF_ON": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - self._switch_on_ap(ap_type, ap_prop, delay[1]) - ret = self._check_join_ap_result(ap_prop) - pass - elif reconnect_test_method == "OFF": - self._switch_off_ap(ap_type, ap_prop, delay[0]) - pass - return ret - pass - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiJAP.py b/components/test/TestCaseScript/WiFiStress/WifiJAP.py deleted file mode 100755 index 20dd28041e..0000000000 --- a/components/test/TestCaseScript/WiFiStress/WifiJAP.py +++ /dev/null @@ -1,218 +0,0 @@ -import os -import random -import time - -import WifiConnUtility -from NativeLog import NativeLog -from TCAction import TCActionBase -from Utility import Encoding -from Utility import MakeFolder - -STEPS = {"SCAN1": 0x01, "JAP": 0x02, "SCAN2": 0x04, "RECONNECT": 0x08} - -AP_PROP = ("ssid", "ssid_len", "pwd", - "pwd_len", "channel", "enc", "apc") - -JAP_TEST_METHOD = ("Normal", "OFF_ON", "OFF", "WRONG_PROP") - -RECONNECT_TEST_METHOD = ("OFF_ON", "OFF") - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") - - -SSID_LEN_RANGE = (1, 32) # in bytes -ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP -PWD_RANGE = {0: [0, 0], - 1: [5, 5], - 2: [8, 63], - 3: [8, 63], - 4: [8, 63], - } - - -class WifiJAP(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # default value for optional configurable params - self.pwd_len = [8, 64] - self.step_config = [0x03, 0x01, 0x02, 0x0B, 0x0F] - self.join_test_method = ["Normal"] - self.join_delay = [[1.5, 5], [1.5, 5]] - self.reconnect_test_method = ["OFF_ON"] - self.reconnect_delay = [[1.5, 5], [1.5, 6]] - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # read AP list - self.ap_list = [] - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROP, " + cmd_set[i][1][j] + ")))" - exec cmd_string - - folder_path = MakeFolder.make_folder(LOG_FOLDER) - file_name = "JAP_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) - self._performance_log_file = os.path.join(folder_path, file_name) - - # test statistics - self._succeed_count = self._fail_count = self._time_cost_count = 0 - self._total_time = self._longest_time = 0 - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - # get target type "SSC" or "AT" - self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] - self.target_type.append("SSC" if test_env.get_port_by_name("AT2") is None else "AT") - self._utility = WifiConnUtility.WifiConnUtility(self) - pass - - def _generate_random_ap_prop(self): - ap_prop = dict.fromkeys(AP_PROP) - # generate target ap_value - ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) - ap_prop["channel"] = random.choice(range(1, 14)) - ap_prop["enc"] = random.choice(ENC_TYPE) - ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) - # generate string - if self.target_type[0] == self.target_type[1] == "AT": - ap_prop["ssid"] = Encoding.generate_random_utf8_str(ap_prop["ssid_len"]) - ap_prop["pwd"] = Encoding.generate_random_utf8_str(ap_prop["pwd_len"]) - # NativeLog.add_trace_info("ssid hex is : %x" % ap_prop["ssid"]) - # NativeLog.add_trace_info("pwd hex is : %x" % ap_prop["pwd"]) - else: - ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) - ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) - - return ap_prop - - def _logging_performance(self, ssid, join_method="Normal", time_cost=0): - # log performance to performance log file - with open(self._performance_log_file, "ab+") as f: - # log time and ssid - f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % - (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) - if join_method == "Normal" or join_method == "OFF_ON": - if time_cost is not False: - self._succeed_count += 1 - if join_method == "Normal": - f.write("[Succeed][%f]\r\n" % time_cost) - self._longest_time = (time_cost > self._longest_time and - [time_cost] or [self._longest_time])[0] - self._time_cost_count += 1 - self._total_time += time_cost - else: - f.write("[Succeed][%s]\r\n" % join_method) - else: - self._fail_count += 1 - f.write("[Fail][%s]\r\n" % join_method) - pass - - def _logging_fail_step(self, ssid, step): - with open(self._performance_log_file, "ab+") as f: - f.write("\r\n[%s]:\r\n[AP name] %s\r\n" % - (time.strftime("%m-%d %H:%M:%S", time.localtime()), ssid)) - f.write("[Fail][%s]\r\n" % step) - pass - - def _generate_performance_report(self): - with open(self._performance_log_file, "ab+") as f: - f.write("[Test report] Succeed: %d\r\n" % self._succeed_count) - f.write("[Test report] Failed: %d\r\n" % self._fail_count) - if self._succeed_count > 0 or self._fail_count > 0: - f.write("[Test report] Pass Rate: %f\r\n" % - (self._succeed_count/(self._fail_count+self._succeed_count))) - if self._time_cost_count > 0: - f.write("[Test report] Average time: %f\r\n" % (self._total_time/self._time_cost_count)) - f.write("[Test report] Longest time: %f\r\n" % self._longest_time) - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # mandatory configurable params - try: - target_ap_num = self.target_ap_num - test_count = self.test_count - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) - raise StandardError("Error configuration") - - # prepare ap list - _ap_list = [["target", None]] * target_ap_num - for _ap_prop in self.ap_list: - _ap_list.append(["AP", _ap_prop]) - - # set to correct mode first - self._utility.set_mode([1, 2]) - - for i in xrange(test_count): - _ap = random.choice(_ap_list) - # arrange ap - _ap_type = _ap[0] - _ap_prop = _ap[1] - if _ap_type == "target": - _ap_prop = self._generate_random_ap_prop() - pass - - # step 1 : mandatory step, set up AP - if self._utility.setup_ap(_ap_type, _ap_prop) is False: - self._logging_fail_step(_ap_prop["ssid"], "Set AP") - NativeLog.add_prompt_trace("[Step1] setup AP Fail") - continue - step_config = random.choice(self.step_config) - NativeLog.add_prompt_trace("[Step1] setup AP succeed") - - # step 2 : optional step, do scan before connect - if step_config & STEPS["SCAN1"] != 0: # check option - if self._utility.do_scan(_ap_prop) is False: - self._logging_fail_step(_ap_prop["ssid"], "Scan before JAP") - NativeLog.add_prompt_trace("[Step2] Scan Done") - - # step 3 : mandatory step, join AP - if step_config & STEPS["JAP"] != 0: # check option - _join_test_method = random.choice(self.join_test_method) - time_cost = self._utility.join_ap(_join_test_method, _ap_type, _ap_prop, self.join_delay) - # log performance to performance log file - self._logging_performance(_ap_prop["ssid"], _join_test_method, time_cost) - if time_cost is False: - # do scan once to check if AP exist - self._utility.do_scan(_ap_prop) - continue - NativeLog.add_prompt_trace("[Step3] Join AP done") - - # step 4 : optional step, scan after join AP - if step_config & STEPS["SCAN2"] != 0: # check option - if self._utility.do_scan(_ap_prop) is False: - self._logging_fail_step(_ap_prop["ssid"], "Scan after JAP") - NativeLog.add_prompt_trace("[Step4] Scan done") - - # step 5 : optional step, reconnect test - if step_config & STEPS["RECONNECT"] != 0: # check option - _reconnect_test_method = random.choice(self.reconnect_test_method) - if self._utility.do_reconnect(_reconnect_test_method, - _ap_type, _ap_prop, self.reconnect_delay) is False: - self._logging_fail_step(_ap_prop["ssid"], "Reconnect") - - NativeLog.add_prompt_trace("[Step5] Reconnect done") - # continue to next loop - NativeLog.add_prompt_trace("[WifiJAP] Test count %d done" % i) - - # generate report and cleanup - self._generate_performance_report() - - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py b/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py deleted file mode 100755 index 2c2eadc79d..0000000000 --- a/components/test/TestCaseScript/WiFiStress/WifiJAPAtt.py +++ /dev/null @@ -1,173 +0,0 @@ -import os -import time -from TCAction import TCActionBase -from NativeLog import NativeLog -from Utility import RSSICalibrator -from Utility import MakeFolder - -MAX_RSSI = 0 -MIN_RSSI = -110 -MAX_ATT = 60 -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "JAP") -AP_PROP_KEY = ("ssid", "password", "apc") - - -class Performance(object): - def __init__(self): - self.succeed_rssi = dict.fromkeys(range(MIN_RSSI, MAX_RSSI), 0) - self.failed_rssi = dict.fromkeys(range(MIN_RSSI, MAX_RSSI), 0) - self.failed_att = dict.fromkeys(range(MAX_ATT), 0) - pass - - def log_performance(self, result, att, rssi): - if result == "Succeed": - self.succeed_rssi[rssi] += 1 - else: - if rssi == 0: - self.failed_att[att] += 1 - else: - self.failed_rssi[rssi] += 1 - pass - - def __str__(self): - data = "Succeed:\r\n" - for rssi in self.succeed_rssi: - if self.succeed_rssi[rssi] > 0: - data += "\tRSSI%4d: %2d times\r\n" % (rssi, self.succeed_rssi[rssi]) - - data += "Failed during scan:\r\n" - for att in self.failed_att: - if self.failed_att[att] > 0: - data += "\tATT%3d: %2d times\r\n" % (att, self.failed_att[att]) - - data += "Failed during JAP:\r\n" - for rssi in self.failed_rssi: - if self.failed_rssi[rssi] > 0: - data += "\tRSSI%4d: %2d times\r\n" % (rssi, self.failed_rssi[rssi]) - - return data - pass - - -class WifiJAPAtt(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - self.att_test_list = range(60) - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - # read AP list - self.ap_list = [] - for i in range(1, len(cmd_set)): - for j in range(len(cmd_set[i][1])): - if cmd_set[i][1][j] != "": - cmd_string = "self.ap_list.append(dict(zip(AP_PROP_KEY, " + cmd_set[i][1][j] + ")))" - exec cmd_string - - self.performance = dict([(ap_prop["ssid"], Performance()) for ap_prop in self.ap_list]) - # create log file - folder_path = MakeFolder.make_folder(LOG_FOLDER) - self.performance_log = os.path.join(folder_path, - "JAP_Att_%s.log" % time.strftime("%d%H%M%S", time.localtime())) - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def log_performance(self, att, rssi, ssid, result): - NativeLog.add_prompt_trace("[%s][ssid %s] [att %s] [rssi %s]" % (result, ssid, att, rssi)) - data = "" - self.performance[ssid].log_performance(result, att, rssi) - for _ssid in self.performance: - data += "[ssid] %s\r\n%s\r\n" % (_ssid, self.performance[_ssid]) - with open(self.performance_log, "wb+") as f: - f.write(data) - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - try: - # configurable params - ap_list = self.ap_list - att_test_list = self.att_test_list - test_count = self.test_count - # configurable params - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for JAPAtt script, error is %s" % e) - raise StandardError("Error configuration") - - for x in xrange(test_count): - for ap_prop in ap_list: - if ap_prop["password"] == "": - # set a default string for open ap - ap_prop["password"] = "1" - - # switch off all outlet, switch on AP outlet - outlet_config_dict = dict.fromkeys(range(1, 9), "OFF") - outlet_config_dict[ap_prop["apc"]] = "ON" - apc_cmd = "APC " - for outlet in outlet_config_dict: - apc_cmd += " %s %s" % (outlet_config_dict[outlet], outlet) - checker_stings = ["P PC_COM L OK"] - fail_string = "Fail, Fail to switch apc" - if self.load_and_exe_one_step(checker_stings, [apc_cmd], fail_string) is False: - return - - # wait AP ready - time.sleep(20) - - # create RSSI Calibrator - calibrator = RSSICalibrator.Calibrator() - - for att_value in att_test_list: - # step 0 set att value - checker_stings = ["R PC_COM L OK"] - test_action_string = ["ATT %s" % att_value] - fail_string = "Fail, Fail to set att value" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string) is False: - continue - - # step 1 get AP RSSI - checker_stings = ["R SSC1 A :\+SCAN:%s,[:\d\w]+,\d+,\d+,([-\d]+)" % ap_prop["ssid"]] - test_action_string = ["SSC SSC1 sta -S -s %s" % ap_prop["ssid"]] - fail_string = "Fail, Fail to scan" - rssi = scan_count = 0 - for i in range(3): - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=5) is False: - self.log_performance(att_value, 0, ap_prop["ssid"], "Failed to measure RSSI") - continue - rssi += int(self.test_env.get_variable_by_name("rssi")[1]) - scan_count += 1 - - rssi = calibrator.calibrate_rssi(float(rssi)/scan_count if scan_count > 0 else 0, att_value) - - # step 2 connect to AP - checker_stings = ["R SSC1 C +JAP:CONNECTED"] - test_action_string = ["SSC SSC1 sta -C -s %s -p %s" % (ap_prop["ssid"], ap_prop["password"])] - fail_string = "Fail, Fail to JAP" - if self.load_and_exe_one_step(checker_stings, test_action_string, fail_string, - check_freq=1, check_time=45) is False: - self.log_performance(att_value, rssi, ap_prop["ssid"], "Failed to JAP") - continue - - self.log_performance(att_value, rssi, ap_prop["ssid"], "Succeed") - - # finally, execute done - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py b/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py deleted file mode 100755 index 3a95a920fb..0000000000 --- a/components/test/TestCaseScript/WiFiStress/WifiSmartConfig.py +++ /dev/null @@ -1,273 +0,0 @@ -import random -import os -import time -import copy - -from TCAction import TCActionBase -from NativeLog import NativeLog -from Utility import Encoding -from Utility import MakeFolder - -AP_PROP = ("ssid", "ssid_len", "pwd", - "pwd_len", "channel", "enc", "apc") - -SMART_TYPE = ("esp-touch", "airkiss") - -TEST_METHOD = ("ssid_broadcast", "ssid_hidden") - -HT = ("ht20", "ht40") - -TEST_STAT = ("total count", "fail count", "total time", "longest time") - -_TEST_STAT_INIT_DICT = {"total count": 0, - "fail count": 0, - "total time": 0, - "longest time": 0, - } - -LOG_FOLDER = os.path.join("AT_LOG", "Performance", "SmartConfig") - - -SSID_LEN_RANGE = (1, 32) # in bytes -ENC_TYPE = (0, 2, 3, 4) # do not support WEP for 8266 soft AP -PWD_RANGE = {0: [0, 0], - 1: [5, 5], - 2: [8, 32], - 3: [8, 32], - 4: [8, 32], - } - - -class WifiSmartConfig(TCActionBase.CommonTCActionBase): - - def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH): - TCActionBase.CommonTCActionBase.__init__(self, name, test_env, cmd_set=cmd_set, - timeout=timeout, log_path=log_path) - # default value for optional configurable params - self.test_method = ["ssid_hidden", "ssid_broadcast"] - self.bssid = "ff:ff:ff:ff:ff:ff" - self.ht_ap = dict(zip(HT, [("", ""), - ("", "")])) - self.ap_channel = {"ht20": 1, "ht40": 1} - self.delay_time = 3 # default 3s, wait for scan done - # load param from excel - for i in range(1, len(cmd_set)): - if cmd_set[i][0] != "dummy" and cmd_set[i][0] != "": - cmd_string = "self." + cmd_set[i][0] - exec cmd_string - - folder_path = MakeFolder.make_folder(LOG_FOLDER) - file_name = "SmartConfig_log_%s.log" % (time.strftime("%m%d%H%M%S", time.localtime())) - self._performance_log_file = os.path.join(folder_path, file_name) - - # type - self.target_type = ["SSC" if test_env.get_port_by_name("AT1") is None else "AT"] - self.target_type.append("SSC" if test_env.get_port_by_name("AT2") is None else "AT") - - # test statistics - # better ways to create? - _test_stat = dict.fromkeys(TEST_STAT, 0) - _test_method = dict.fromkeys(TEST_METHOD) - _test_ht = dict.fromkeys(HT) - self.test_stat = dict.fromkeys(SMART_TYPE) - for i in SMART_TYPE: - self.test_stat[i] = copy.deepcopy(_test_ht) - for j in HT: - self.test_stat[i][j] = copy.deepcopy(_test_method) - for k in TEST_METHOD: - self.test_stat[i][j][k] = copy.deepcopy(_test_stat) - - self.result_cntx = TCActionBase.ResultCheckContext(self, test_env, self.tc_name) - pass - - def _generate_random_ap_prop(self, ht_type): - ap_prop = dict.fromkeys(AP_PROP) - # generate target ap_value - ap_prop["ssid_len"] = random.randint(SSID_LEN_RANGE[0], SSID_LEN_RANGE[1]) - ap_prop["channel"] = self.ap_channel[ht_type] - ap_prop["enc"] = random.choice(ENC_TYPE) - ap_prop["pwd_len"] = random.randint(PWD_RANGE[ap_prop["enc"]][0], PWD_RANGE[ap_prop["enc"]][1]) - ap_prop["ssid"] = Encoding.generate_random_printable_str(ap_prop["ssid_len"]) - ap_prop["pwd"] = Encoding.generate_random_printable_str(ap_prop["pwd_len"]) - - return ap_prop - - def _logging_performance(self, time_cost, ssid, password, smart_type, test_method, ht_type): - # update test statistics - stat = self.test_stat[smart_type][ht_type][test_method] - stat["total count"] += 1 - # log performance to performance log file - with open(self._performance_log_file, "ab+") as f: - # log time and ssid - if time_cost is not False: - time_tmp = float(time_cost)/10 - f.write("\r\n[%s]:\r\n[Succeed] [%.2f]\r\n" % - (time.strftime("%m-%d %H:%M:%S", time.localtime()), time_tmp)) - stat["total time"] += time_tmp - stat["longest time"] = time_tmp if time_tmp > stat["longest time"] else stat["longest time"] - else: - f.write("\r\n[%s]:\r\n[Fail]\r\n" % - time.strftime("%m-%d %H:%M:%S", time.localtime())) - stat["fail count"] += 1 - - f.write("[%s] [%s] [%s]\r\n" % - (smart_type, test_method, ht_type)) - f.write("[ssid] %s \r\n[password] %s\r\n" % - (ssid, password)) - pass - - def _generate_performance_report(self): - with open(self._performance_log_file, "ab+") as f: - for i in SMART_TYPE: - for j in HT: - for k in TEST_METHOD: - stat = self.test_stat[i][j][k] - f.write("\r\n[Test report] [%s] [%s] [%s]\r\n" % (i, j, k)) - if stat["total count"] > 0: - f.write("[Total]: %d\r\n" % stat["total count"]) - f.write("[Failed]: %d\r\n" % stat["fail count"]) - f.write("[Fail ratio]: %.2f%%\r\n" % - (float(stat["fail count"])/stat["total count"] * 100)) - f.write("[Longest time cost]: %.2f\r\n" % stat["longest time"]) - if (stat["total count"] - stat["fail count"]) > 0: - f.write("[Average time cost]: %.2f\r\n" % - (stat["total time"]/(stat["total count"]-stat["fail count"]))) - - @staticmethod - def cmd_exception_catcher(e): - raise e - pass - - def execute(self): - TCActionBase.TCActionBase.execute(self) - self.result_cntx.start() - - # mandatory configurable params - try: - test_count = self.test_count - delay_time = self.delay_time - except StandardError, e: - NativeLog.add_trace_critical("Error configuration for WifiJAP script, error is %s" % e) - raise StandardError("Error configuration") - - # step 0 : set AT1 mode - fail_string = "Fail to restore init condition" - if self.target_type[0] == "AT": - cmd = ["ATS AT1 AT+CWMODE=1"] - checker_stings = ["R AT1 L OK"] - else: - cmd = ["SSC SSC1 op -S -o 1"] - checker_stings = ["R SSC1 C +MODE:OK"] - if self.target_type[1] == "AT": - cmd.append("ATS AT2 AT+CWMODE=2") - checker_stings.append("R AT2 L OK") - else: - cmd.append("SSC SSC2 op -S -o 2") - checker_stings.append("R SSC2 C +MODE:OK") - - if self.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=150) is False: - NativeLog.add_trace_critical(fail_string) - return - - for i in xrange(test_count): - _method = random.choice(self.test_method) - _ht = random.choice(self.ht) - _ap_prop = self._generate_random_ap_prop(_ht) - _smart_type = random.choice(self.smart_type) - _ht_ap = self.ht_ap[_ht] - is_hidden = 0 if _method == "ssid_broadcast" else 1 - # get ip and - - # step 1 : restore init condition - fail_string = "Fail to restore init condition" - if self.target_type[0] == "AT": - cmd = ["ATS AT1 AT+CWSTOPSMART", "WIFI CONN %s %s " % (_ht_ap[0], _ht_ap[1])] - checker_stings = ["P AT1 L OK", "P PC_COM L OK"] - else: - cmd = ["SSC SSC1 smart -E", "WIFI CONN %s %s " % (_ht_ap[0], _ht_ap[1])] - checker_stings = ["P SSC1 C +SC:OK", "P PC_COM L OK"] - - if self.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=200) is False: - NativeLog.add_trace_critical(fail_string) - continue - NativeLog.add_prompt_trace("Step1 Done") - - # step 2 : test method is ssid_broadcast, then set AP on target 2 - if _method == "ssid_broadcast": - fail_string = "Fail to set AP" - if self.target_type[1] == "AT": - cmd = ["ATS AT2 AT+CWSAP=\"%s\",\"%s\",%d,%d" % (_ap_prop["ssid"], _ap_prop["pwd"], - _ap_prop["channel"], _ap_prop["enc"])] - checker_stings = ["R AT2 L OK"] - else: - cmd = ["SSC SSC2 ap -S -s %s -p %s -n %d -t %d" % (_ap_prop["ssid"], _ap_prop["pwd"], - _ap_prop["channel"], _ap_prop["enc"])] - checker_stings = ["R SSC2 C +SAP:OK"] - - if self.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical(fail_string) - continue - NativeLog.add_prompt_trace("Step2 Done") - - # step 3 : start SMART - fail_string = "Fail to start smart config" - if self.target_type[0] == "AT": - cmd = ["ATS AT1 AT+CWSTARTSMART"] - checker_stings = ["R AT1 L OK"] - else: - cmd = ["SSC SSC1 smart -S -a 0"] - checker_stings = ["R SSC1 C +SC:OK"] - - if self.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=50) is False: - NativeLog.add_trace_critical(fail_string) - continue - # sleep for delay_time seconds to wait scan done or simulate delay config situation - time.sleep(delay_time) - NativeLog.add_prompt_trace("Step3 Done") - - # step 4 : do smart config - fail_string = "Fail in smart config" - cmd = ["SMART %s %s %s %s %d" - % (_smart_type, _ap_prop["ssid"], _ap_prop["pwd"], self.bssid, is_hidden)] - if self.target_type[0] == "AT": - checker_stings = ["P AT1 C Smart%20get%20wifi%20info", - "P LOG1 C %s C %s" % (_ap_prop["ssid"], _ap_prop["pwd"])] - else: - checker_stings = ["P SSC1 C %s C %s" % (_ap_prop["ssid"], _ap_prop["pwd"])] - - try: - time_cost = self.load_and_exe_one_step(checker_stings, cmd, - fail_string, check_time=400, - cmd_exception_catcher=self.cmd_exception_catcher) - except StandardError: - NativeLog.add_prompt_trace("Exception occurred during executing cmd") - continue - pass - self._logging_performance(time_cost, _ap_prop["ssid"], _ap_prop["pwd"], - _smart_type, _method, _ht) - if time_cost is False: - NativeLog.add_prompt_trace(fail_string) - continue - - # continue to next loop - NativeLog.add_prompt_trace("[WifiSmartConfig] Test count %d done" % i) - - # generate report and cleanup - self._generate_performance_report() - - self.result_cntx.set_result("Succeed") - - def result_check(self, port_name, data): - TCActionBase.CommonTCActionBase.result_check(self, port_name, data) - self.result_cntx.append_data(port_name, data) - - -def main(): - pass - -if __name__ == '__main__': - main() diff --git a/components/test/TestCaseScript/WiFiStress/__init__.py b/components/test/TestCaseScript/WiFiStress/__init__.py deleted file mode 100755 index 7960a3ce80..0000000000 --- a/components/test/TestCaseScript/WiFiStress/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ["WifiJAP", ] \ No newline at end of file diff --git a/components/test/TestCaseScript/__init__.py b/components/test/TestCaseScript/__init__.py deleted file mode 100755 index 0cc319da70..0000000000 --- a/components/test/TestCaseScript/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = ['ATFunc', "ATStress", "IOT", "MeshStress", "StableTest", "TCPIPStress" - "TCPStress", "UDPStress", "WiFiStress"] From e9199a0320c1930274757d3f6759f7851dc8b81c Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 12 Oct 2016 11:44:54 +0800 Subject: [PATCH 178/179] should set TEST_CASE_FILE_PATH before CONFIG_FILE use it --- .gitlab-ci.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42dc78e9ee..8b7b25dd91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -223,8 +223,8 @@ IT_Function_SYS_01: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml IT_Function_WIFI_01: <<: *test_template @@ -233,8 +233,8 @@ IT_Function_WIFI_01: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml IT_Function_WIFI_02: <<: *test_template @@ -243,8 +243,8 @@ IT_Function_WIFI_02: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml IT_Function_TCPIP_01: <<: *test_template @@ -253,8 +253,8 @@ IT_Function_TCPIP_01: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml IT_Function_TCPIP_02: <<: *test_template @@ -263,8 +263,8 @@ IT_Function_TCPIP_02: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml IT_Function_TCPIP_03: <<: *test_template @@ -273,8 +273,8 @@ IT_Function_TCPIP_03: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml IT_Function_TCPIP_04: <<: *test_template @@ -283,8 +283,8 @@ IT_Function_TCPIP_04: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml IT_Function_TCPIP_05: <<: *test_template @@ -293,8 +293,8 @@ IT_Function_TCPIP_05: - SSC_T1_1 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml IT_Function_TCPIP_06: <<: *test_template_night @@ -302,8 +302,8 @@ IT_Function_TCPIP_06: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml IT_Function_WIFI_03: <<: *test_template @@ -311,8 +311,8 @@ IT_Function_WIFI_03: - ESP32_IDF - SSC_T3_PhyMode before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml IT_Function_WIFI_04: <<: *test_template @@ -320,8 +320,8 @@ IT_Function_WIFI_04: - ESP32_IDF - SSC_T1_APC before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml IT_Function_WIFI_05: <<: *test_template @@ -329,8 +329,8 @@ IT_Function_WIFI_05: - ESP32_IDF - SSC_T1_WEP before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml IT_Function_WIFI_06: <<: *test_template @@ -338,8 +338,8 @@ IT_Function_WIFI_06: - ESP32_IDF - SSC_T2_PhyMode before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml IT_Function_TCPIP_07: <<: *test_template @@ -349,8 +349,8 @@ IT_Function_TCPIP_07: - SSC_T1_2 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml IT_Function_TCPIP_08: <<: *test_template @@ -358,8 +358,8 @@ IT_Function_TCPIP_08: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml IT_Function_TCPIP_09: <<: *test_template @@ -367,8 +367,8 @@ IT_Function_TCPIP_09: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml IT_Function_TCPIP_10: <<: *test_template @@ -378,8 +378,8 @@ IT_Function_TCPIP_10: - SSC_T1_2 - SSC_T2_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml IT_Function_TCPIP_11: <<: *test_template @@ -387,8 +387,8 @@ IT_Function_TCPIP_11: - ESP32_IDF - SSC_T1_1 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml IT_Function_TCPIP_12: <<: *test_template @@ -397,5 +397,5 @@ IT_Function_TCPIP_12: - SSC_T1_1 - SSC_T1_2 before_script: - - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml - TEST_CASE_FILE_PATH=$TEST_CASE_FILE_PATH/integration_test + - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml From 5e0a9bfcf20a7da71fbb2c13f4133d29da15363a Mon Sep 17 00:00:00 2001 From: Yinling Date: Wed, 12 Oct 2016 11:48:24 +0800 Subject: [PATCH 179/179] remove debug command "ls" in test report job --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b7b25dd91..dd4049358a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -123,7 +123,6 @@ test_report: - $REPORT_PATH expire_in: 6 mos script: - - ls $LOG_PATH # clone test bench - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git - cd auto_test_script