Merge branch 'release/v0.1.3-release'
This commit is contained in:
commit
e2ae719a3e
|
@ -10,18 +10,18 @@ jobs:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: before_install
|
- name: before_install
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y gcc git wget make libncurses-dev flex bison python python-serial ninja-build
|
sudo apt install -y gcc git wget make libncurses-dev flex bison python python-setuptools python-serial ninja-build
|
||||||
wget https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
|
wget https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
|
||||||
|
|
||||||
- name: install
|
- name: install
|
||||||
run: |
|
run: |
|
||||||
tar -xzf ./xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
|
tar -xzf ./xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
|
||||||
wget https://github.com/espressif/ESP8266_RTOS_SDK/releases/download/v3.3-rc1/ESP8266_RTOS_SDK-v3.3-rc1.zip
|
|
||||||
unzip ESP8266_RTOS_SDK-v3.3-rc1.zip
|
|
||||||
python -m pip install --user -r ./ESP8266_RTOS_SDK/requirements.txt
|
python -m pip install --user -r ./ESP8266_RTOS_SDK/requirements.txt
|
||||||
|
|
||||||
- name: script
|
- name: script
|
||||||
|
@ -41,6 +41,13 @@ jobs:
|
||||||
echo "::set-output name=release_tag::UserBuild_$(date +"%Y.%m.%d_%H-%M")"
|
echo "::set-output name=release_tag::UserBuild_$(date +"%Y.%m.%d_%H-%M")"
|
||||||
echo "::set-output name=status::success"
|
echo "::set-output name=status::success"
|
||||||
|
|
||||||
|
- name: Merge bin files
|
||||||
|
if: steps.tag.outputs.status == 'success' && !cancelled()
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/espressif/esptool.git
|
||||||
|
./esptool/esptool.py --chip esp8266 merge_bin -o build/esp8266_dap_full.bin 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/esp8266_dap.bin
|
||||||
|
mv build/esp8266_dap.bin build/esp8266_dap_app.bin
|
||||||
|
|
||||||
- name: Release user firmware
|
- name: Release user firmware
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: steps.tag.outputs.status == 'success' && !cancelled()
|
if: steps.tag.outputs.status == 'success' && !cancelled()
|
||||||
|
@ -48,5 +55,9 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.tag.outputs.release_tag }}
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
||||||
files: ${{ env.FIRMWARE }}/esp8266_dap.bin
|
files: |
|
||||||
|
${{ env.FIRMWARE }}/esp8266_dap_full.bin
|
||||||
|
${{ env.FIRMWARE }}/esp8266_dap_app.bin
|
||||||
|
${{ env.FIRMWARE }}/bootloader/bootloader.bin
|
||||||
|
${{ env.FIRMWARE }}/partition_table/partition-table.bin
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
.vscode/
|
.vscode/
|
||||||
build/
|
build/
|
||||||
tmp/
|
tmp/
|
||||||
|
.history/
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "ESP8266_RTOS_SDK"]
|
||||||
|
path = ESP8266_RTOS_SDK
|
||||||
|
url = https://github.com/espressif/ESP8266_RTOS_SDK
|
|
@ -1,9 +1,6 @@
|
||||||
# The following five lines of boilerplate have to be in your project's
|
|
||||||
# CMakeLists in this exact order for cmake to work correctly
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
#set(COMPONENT_DIRS "${IDF_PATH}/components ${PROJECT_PATH}/components")
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/main)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
project(esp8266_dap)
|
project(esp8266_dap)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1be2289fcd68672f5d6bf6aafa4f4b57b20527a4
|
9
Makefile
9
Makefile
|
@ -1,9 +0,0 @@
|
||||||
#
|
|
||||||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
|
|
||||||
# project subdirectory.
|
|
||||||
#
|
|
||||||
|
|
||||||
PROJECT_NAME := tcp_server
|
|
||||||
|
|
||||||
include $(IDF_PATH)/make/project.mk
|
|
||||||
|
|
19
README.md
19
README.md
|
@ -1,4 +1,4 @@
|
||||||
<p align="center"><img src="https://user-images.githubusercontent.com/17078589/107881245-7d7d5580-6f1e-11eb-9f66-6ac589e5f95c.png"/></p>
|
<p align="center"><img src="https://user-images.githubusercontent.com/17078589/120061980-49274280-c092-11eb-9916-4965f6c48388.png"/></p>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ Realized by USBIP and CMSIS-DAP protocol stack.
|
||||||
|
|
||||||
> 👉 5m distance, 100kb size firmware(Hex) flash test:
|
> 👉 5m distance, 100kb size firmware(Hex) flash test:
|
||||||
|
|
||||||
<p align="center"><img src="https://user-images.githubusercontent.com/17078589/107896674-e5a95700-6f71-11eb-90f7-bf7362045537.gif"/></p>
|
<p align="center"><img src="https://user-images.githubusercontent.com/17078589/120925694-4bca0d80-c70c-11eb-91b7-ffa54770faea.gif"/></p>
|
||||||
|
|
||||||
## Feature
|
## Feature
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@ The default connected WIFI SSID is `DAP` , password `12345678`
|
||||||
|
|
||||||
You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_configuration.h)
|
You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_configuration.h)
|
||||||
|
|
||||||
|
You can also specify your IP in the above file (We recommend using the static address binding feature of the router).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Debugger
|
### Debugger
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,8 +61,7 @@ You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_
|
||||||
| SWD | |
|
| SWD | |
|
||||||
|----------------|--------|
|
|----------------|--------|
|
||||||
| SWCLK | GPIO14 |
|
| SWCLK | GPIO14 |
|
||||||
| SWDIO | GPIO12 |
|
| SWDIO | GPIO13 |
|
||||||
| SWDIO_MOSI | GPIO13 |
|
|
||||||
| LED\_CONNECTED | GPIO2 |
|
| LED\_CONNECTED | GPIO2 |
|
||||||
| LED\_RUNNING | GPIO15 |
|
| LED\_RUNNING | GPIO15 |
|
||||||
| TVCC | 3V3 |
|
| TVCC | 3V3 |
|
||||||
|
@ -184,7 +187,7 @@ When you select max clock, we will take the following actions:
|
||||||
|
|
||||||
1. Use WinUSB Mode(enabled by default):
|
1. Use WinUSB Mode(enabled by default):
|
||||||
|
|
||||||
change `USE_WINUSB` macor in [USBd_config.h](components/USBIP/USBd_config.h)
|
change `USE_WINUSB` macor in [dap_configuration.h](main/dap_configuration.h)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,9 +237,9 @@ Credits to the following project, people and organizations:
|
||||||
> - https://github.com/cezanne/usbip-win for usbip windows
|
> - https://github.com/cezanne/usbip-win for usbip windows
|
||||||
|
|
||||||
|
|
||||||
- @HeavenSpree
|
- [@HeavenSpree](https://www.github.com/HeavenSpree)
|
||||||
- @Zy19930907
|
- [@Zy19930907](https://www.github.com/Zy19930907)
|
||||||
- @caiguang1997
|
- [@caiguang1997](https://www.github.com/caiguang1997)
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS "config include $ENV{IDF_PATH}/components/esp8266/include/esp8266/ $ENV{IDF_PATH}//components/esp_ringbuf/include/")
|
set(COMPONENT_ADD_INCLUDEDIRS "config include $ENV{IDF_PATH}/components/esp8266/include/esp8266/ $ENV{IDF_PATH}/components/esp_ringbuf/include/")
|
||||||
set(COMPONENT_SRCS "./source/DAP.c ./source/DAP_vendor.c ./source/JTAG_DP.c ./source/SW_DP.c ./source/SWO.c ./source/uart_modify.c ./source/spi_op.c ./source/spi_switch.c ./source/dap_utility.c")
|
set(COMPONENT_SRCS "./source/DAP.c ./source/DAP_vendor.c ./source/JTAG_DP.c ./source/SW_DP.c ./source/SWO.c ./source/uart_modify.c ./source/spi_op.c ./source/spi_switch.c ./source/dap_utility.c")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
* @author windowsair
|
* @author windowsair
|
||||||
* @brief Adaptation of GPIO and SPI pin
|
* @brief Adaptation of GPIO and SPI pin
|
||||||
* @change: 2021-2-10 Support GPIO and SPI
|
* @change: 2021-2-10 Support GPIO and SPI
|
||||||
|
* 2021-2-18 Try to support SWO
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2021-2-10
|
* @date 2021-2-10
|
||||||
*
|
*
|
||||||
|
@ -43,15 +44,20 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "cmsis_compiler.h"
|
|
||||||
|
#include "main/dap_configuration.h"
|
||||||
|
#include "main/timer.h"
|
||||||
|
|
||||||
|
#include "components/DAP/include/cmsis_compiler.h"
|
||||||
|
#include "components/DAP/include/gpio_op.h"
|
||||||
|
#include "components/DAP/include/spi_switch.h"
|
||||||
|
|
||||||
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "gpio_struct.h"
|
#include "gpio_struct.h"
|
||||||
#include "timer_struct.h"
|
|
||||||
#include "esp8266/pin_mux_register.h"
|
#include "esp8266/pin_mux_register.h"
|
||||||
|
|
||||||
#include "gpio_op.h"
|
|
||||||
#include "spi_switch.h"
|
|
||||||
#include "dap_configuration.h"
|
|
||||||
//**************************************************************************************************
|
//**************************************************************************************************
|
||||||
/**
|
/**
|
||||||
\defgroup DAP_Config_Debug_gr CMSIS-DAP Debug Unit Information
|
\defgroup DAP_Config_Debug_gr CMSIS-DAP Debug Unit Information
|
||||||
|
@ -118,9 +124,13 @@ This information includes:
|
||||||
/// setting can be reduced (valid range is 1 .. 255).
|
/// setting can be reduced (valid range is 1 .. 255).
|
||||||
#define DAP_PACKET_COUNT 255 ///< Specifies number of packets buffered.
|
#define DAP_PACKET_COUNT 255 ///< Specifies number of packets buffered.
|
||||||
|
|
||||||
|
/// Indicates that the SWO function(UART SWO & Streaming Trace) is available
|
||||||
|
#define SWO_FUNCTION_ENABLE 0 ///< SWO function: 1 = available, 0 = not available.
|
||||||
|
|
||||||
|
|
||||||
/// Indicate that UART Serial Wire Output (SWO) trace is available.
|
/// Indicate that UART Serial Wire Output (SWO) trace is available.
|
||||||
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
||||||
#define SWO_UART 0 ///< SWO UART: 1 = available, 0 = not available.
|
#define SWO_UART SWO_FUNCTION_ENABLE ///< SWO UART: 1 = available, 0 = not available.
|
||||||
|
|
||||||
/// Maximum SWO UART Baudrate.
|
/// Maximum SWO UART Baudrate.
|
||||||
#define SWO_UART_MAX_BAUDRATE (115200U * 40U) ///< SWO UART Maximum Baudrate in Hz.
|
#define SWO_UART_MAX_BAUDRATE (115200U * 40U) ///< SWO UART Maximum Baudrate in Hz.
|
||||||
|
@ -130,12 +140,14 @@ This information includes:
|
||||||
/// Indicate that Manchester Serial Wire Output (SWO) trace is available.
|
/// Indicate that Manchester Serial Wire Output (SWO) trace is available.
|
||||||
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
||||||
#define SWO_MANCHESTER 0 ///< SWO Manchester: 1 = available, 0 = not available.
|
#define SWO_MANCHESTER 0 ///< SWO Manchester: 1 = available, 0 = not available.
|
||||||
|
// (windowsair)Do not modify. Not support.
|
||||||
|
|
||||||
|
|
||||||
/// SWO Trace Buffer Size.
|
/// SWO Trace Buffer Size.
|
||||||
#define SWO_BUFFER_SIZE 4096U ///< SWO Trace Buffer Size in bytes (must be 2^n).
|
#define SWO_BUFFER_SIZE 2048U ///< SWO Trace Buffer Size in bytes (must be 2^n).
|
||||||
|
|
||||||
/// SWO Streaming Trace.
|
/// SWO Streaming Trace.
|
||||||
#define SWO_STREAM 0 ///< SWO Streaming Trace: 1 = available, 0 = not available.
|
#define SWO_STREAM SWO_FUNCTION_ENABLE ///< SWO Streaming Trace: 1 = available, 0 = not available.
|
||||||
|
|
||||||
/// Clock frequency of the Test Domain Timer. Timer value is returned with \ref TIMESTAMP_GET.
|
/// Clock frequency of the Test Domain Timer. Timer value is returned with \ref TIMESTAMP_GET.
|
||||||
#define TIMESTAMP_CLOCK 5000000U ///< Timestamp clock in Hz (0 = timestamps not supported).
|
#define TIMESTAMP_CLOCK 5000000U ///< Timestamp clock in Hz (0 = timestamps not supported).
|
||||||
|
@ -160,7 +172,6 @@ This information includes:
|
||||||
*/
|
*/
|
||||||
__STATIC_INLINE uint8_t DAP_GetVendorString(char *str)
|
__STATIC_INLINE uint8_t DAP_GetVendorString(char *str)
|
||||||
{
|
{
|
||||||
////TODO: fill this
|
|
||||||
// In fact, Keil can get the corresponding information through USB
|
// In fact, Keil can get the corresponding information through USB
|
||||||
// without filling in this information.
|
// without filling in this information.
|
||||||
// (void)str;
|
// (void)str;
|
||||||
|
@ -258,7 +269,18 @@ __STATIC_INLINE void PORT_JTAG_SETUP(void)
|
||||||
|
|
||||||
|
|
||||||
// set TCK, TMS pin
|
// set TCK, TMS pin
|
||||||
DAP_SPI_Deinit();
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14); // GPIO14 is SPI CLK pin (Clock)
|
||||||
|
GPIO.enable_w1ts |= (0x1 << 14); // PP Output
|
||||||
|
pin_reg.val = READ_PERI_REG(GPIO_PIN_REG(14));
|
||||||
|
pin_reg.pullup = 1;
|
||||||
|
WRITE_PERI_REG(GPIO_PIN_REG(14), pin_reg.val);
|
||||||
|
|
||||||
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13); // GPIO13 is SPI MOSI pin (Master Data Out)
|
||||||
|
GPIO.enable_w1ts |= (0x1 << 13);
|
||||||
|
GPIO.pin[13].driver = 1; // OD output
|
||||||
|
pin_reg.val = READ_PERI_REG(GPIO_PIN_REG(13));
|
||||||
|
pin_reg.pullup = 0;
|
||||||
|
WRITE_PERI_REG(GPIO_PIN_REG(13), pin_reg.val);
|
||||||
|
|
||||||
|
|
||||||
// use RTC pin 16
|
// use RTC pin 16
|
||||||
|
@ -648,8 +670,7 @@ default, the DWT timer is used. The frequency of this timer is configured with
|
||||||
*/
|
*/
|
||||||
__STATIC_INLINE uint32_t TIMESTAMP_GET(void)
|
__STATIC_INLINE uint32_t TIMESTAMP_GET(void)
|
||||||
{
|
{
|
||||||
// FRC1 is a 23-bit countdown timer
|
return get_timer_count();
|
||||||
return (0x7FFFFF - (frc1.count.data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
|
@ -273,8 +273,8 @@ extern void SWO_TransferComplete (void);
|
||||||
extern uint32_t UART_SWO_Mode (uint32_t enable);
|
extern uint32_t UART_SWO_Mode (uint32_t enable);
|
||||||
extern uint32_t UART_SWO_Baudrate (uint32_t baudrate);
|
extern uint32_t UART_SWO_Baudrate (uint32_t baudrate);
|
||||||
extern uint32_t UART_SWO_Control (uint32_t active);
|
extern uint32_t UART_SWO_Control (uint32_t active);
|
||||||
extern void UART_SWO_Capture (uint8_t *buf, uint32_t num);
|
// extern void UART_SWO_Capture (uint8_t *buf, uint32_t num);
|
||||||
extern uint32_t UART_SWO_GetCount (void);
|
// extern uint32_t UART_SWO_GetCount (void);
|
||||||
|
|
||||||
extern uint32_t Manchester_SWO_Mode (uint32_t enable);
|
extern uint32_t Manchester_SWO_Mode (uint32_t enable);
|
||||||
extern uint32_t Manchester_SWO_Baudrate (uint32_t baudrate);
|
extern uint32_t Manchester_SWO_Baudrate (uint32_t baudrate);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef __GPIO_OP_H__
|
#ifndef __GPIO_OP_H__
|
||||||
#define __GPIO_OP_H__
|
#define __GPIO_OP_H__
|
||||||
|
|
||||||
#include "cmsis_compiler.h"
|
#include "components/DAP/include/cmsis_compiler.h"
|
||||||
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "gpio_struct.h"
|
#include "gpio_struct.h"
|
||||||
#include "timer_struct.h"
|
#include "timer_struct.h"
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef __SWO_H__
|
||||||
|
#define __SWO_H__
|
||||||
|
|
||||||
|
typedef void * EventGroupHandle_t;
|
||||||
|
|
||||||
|
// event group bits
|
||||||
|
#define SWO_GOT_DATA 0x00000001
|
||||||
|
#define UART_GOT_DATA 0x00000002
|
||||||
|
#define SWO_ERROR_TIME_OUT 0x00000004
|
||||||
|
|
||||||
|
extern EventGroupHandle_t kSwoThreadEventGroup;
|
||||||
|
extern volatile uint8_t kSwoTransferBusy;
|
||||||
|
|
||||||
|
|
||||||
|
void SetTraceError(uint8_t flag); // Use in the uart handler
|
||||||
|
|
||||||
|
#endif
|
|
@ -27,7 +27,15 @@ extern "C" {
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
|
#include "freertos/semphr.h"
|
||||||
|
|
||||||
|
// SWO modify
|
||||||
|
extern volatile uint32_t kSWO_read_index;
|
||||||
|
extern volatile uint32_t kSWO_read_num;
|
||||||
|
extern volatile uint8_t kSWO_uart_notify_enable;
|
||||||
|
extern SemaphoreHandle_t kSWO_read_mux;
|
||||||
|
|
||||||
#define UART_FIFO_LEN (128) /*!< Length of the hardware FIFO buffers */
|
#define UART_FIFO_LEN (128) /*!< Length of the hardware FIFO buffers */
|
||||||
#define UART_INTR_MASK 0x1ff /*!< Mask of all UART interrupts */
|
#define UART_INTR_MASK 0x1ff /*!< Mask of all UART interrupts */
|
||||||
|
@ -558,6 +566,30 @@ esp_err_t my_uart_get_buffered_data_len(uart_port_t uart_num, size_t *size);
|
||||||
*/
|
*/
|
||||||
esp_err_t my_uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh);
|
esp_err_t my_uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Asynchronously read bytes to swo buffer
|
||||||
|
* @note This function only serves as a notification,
|
||||||
|
* and will initiate a callback when the buffer reaches the length since we modify the uart
|
||||||
|
* @param index buffer index to read
|
||||||
|
* @param length data length
|
||||||
|
* @return esp_err_t
|
||||||
|
* - ESP_OK Success
|
||||||
|
* - ESP_FAIL There are still unfinished requests
|
||||||
|
*/
|
||||||
|
esp_err_t my_uart_read_bytes_async_swo(uint32_t index, uint32_t length);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UART get RX ring buffer cached data length
|
||||||
|
* @note This function is basically equivalent to \ref my_uart_get_buffered_data_len
|
||||||
|
* @param uart_num UART port number.
|
||||||
|
*
|
||||||
|
* @return data length
|
||||||
|
*/
|
||||||
|
int my_uart_get_rx_buffered_data_len(uart_port_t uart_num);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "DAP_config.h"
|
|
||||||
#include "DAP.h"
|
|
||||||
|
|
||||||
#include "spi_switch.h"
|
#include "components/DAP/config/DAP_config.h"
|
||||||
|
#include "components/DAP/include/DAP.h"
|
||||||
|
#include "components/DAP/include/spi_switch.h"
|
||||||
|
|
||||||
|
|
||||||
#if (DAP_PACKET_SIZE < 64U)
|
#if (DAP_PACKET_SIZE < 64U)
|
||||||
|
@ -385,10 +385,15 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) {
|
||||||
|
|
||||||
// clock >= 10MHz -> use 40MHz SPI
|
// clock >= 10MHz -> use 40MHz SPI
|
||||||
if (clock >= 10000000) {
|
if (clock >= 10000000) {
|
||||||
DAP_SPI_Init();
|
if (DAP_Data.debug_port != DAP_PORT_JTAG) {
|
||||||
|
DAP_SPI_Init();
|
||||||
|
SWD_TransferSpeed = kTransfer_SPI;
|
||||||
|
} else {
|
||||||
|
SWD_TransferSpeed = kTransfer_GPIO_fast;
|
||||||
|
}
|
||||||
DAP_Data.fast_clock = 1U;
|
DAP_Data.fast_clock = 1U;
|
||||||
DAP_Data.clock_delay = 1U;
|
DAP_Data.clock_delay = 1U;
|
||||||
SWD_TransferSpeed = kTransfer_SPI;
|
|
||||||
} else if (clock >= 2000000) {
|
} else if (clock >= 2000000) {
|
||||||
// clock >= 2MHz -> Use GPIO with no program delay
|
// clock >= 2MHz -> Use GPIO with no program delay
|
||||||
DAP_SPI_Deinit();
|
DAP_SPI_Deinit();
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DAP_config.h"
|
#include "components/DAP/config/DAP_config.h"
|
||||||
#include "DAP.h"
|
#include "components/DAP/include/DAP.h"
|
||||||
|
|
||||||
//**************************************************************************************************
|
//**************************************************************************************************
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DAP_config.h"
|
#include "components/DAP/config/DAP_config.h"
|
||||||
#include "DAP.h"
|
#include "components/DAP/include/DAP.h"
|
||||||
|
|
||||||
|
|
||||||
// JTAG Macros
|
// JTAG Macros
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* @brief Modify this file to fit esp8266 Uart
|
* @file SWO.c
|
||||||
|
* @author windowsair
|
||||||
|
* @brief SWO support
|
||||||
|
* @change: 2021-02-17: Add basic functions
|
||||||
|
* @version 0.2
|
||||||
|
*
|
||||||
|
* @date 2021-02-17
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -30,22 +38,18 @@
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DAP_config.h"
|
#include "components/DAP/config/DAP_config.h"
|
||||||
#include "DAP.h"
|
#include "components/DAP/include/DAP.h"
|
||||||
|
#include "components/DAP/include/uart_modify.h"
|
||||||
|
#include "components/DAP/include/swo.h"
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
#include "uart_modify.h"
|
|
||||||
|
|
||||||
|
|
||||||
EventGroupHandle_t kSWO_Thread_event_group;
|
EventGroupHandle_t kSwoThreadEventGroup;
|
||||||
EventGroupHandle_t kUART_Monitoe_event_group;
|
|
||||||
#define SWO_GOT_DATA BIT0
|
|
||||||
#define SWO_ERROR_TIME_OUT BIT1
|
|
||||||
|
|
||||||
#define UART_GOT_DATA BIT0
|
|
||||||
|
|
||||||
|
|
||||||
#if (SWO_STREAM != 0)
|
#if (SWO_STREAM != 0)
|
||||||
|
@ -61,14 +65,14 @@ EventGroupHandle_t kUART_Monitoe_event_group;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// use in baudrate setting
|
||||||
static uint8_t USART_Ready = 0U;
|
static uint8_t USART_Ready = 0U;
|
||||||
|
|
||||||
#endif /* (SWO_UART != 0) */
|
#endif /* (SWO_UART != 0) */
|
||||||
|
|
||||||
#if ((SWO_UART != 0) || (SWO_MANCHESTER != 0))
|
#if ((SWO_UART != 0) || (SWO_MANCHESTER != 0))
|
||||||
|
|
||||||
#define SWO_STREAM_TIMEOUT (50 / portTICK_RATE_MS) /* Stream timeout in ms */
|
#define SWO_STREAM_TIMEOUT pdMS_TO_TICKS(50) /* Stream timeout in ms */
|
||||||
|
|
||||||
#define USB_BLOCK_SIZE 512U /* USB Block Size */
|
#define USB_BLOCK_SIZE 512U /* USB Block Size */
|
||||||
#define TRACE_BLOCK_SIZE 64U /* Trace Block Size (2^n: 32...512) */
|
#define TRACE_BLOCK_SIZE 64U /* Trace Block Size (2^n: 32...512) */
|
||||||
|
@ -81,7 +85,7 @@ static uint8_t TraceError[2] = {0U, 0U}; /* Trace Error flags (banked) */
|
||||||
static uint8_t TraceError_n = 0U; /* Active Trace Error bank */
|
static uint8_t TraceError_n = 0U; /* Active Trace Error bank */
|
||||||
|
|
||||||
// Trace Buffer
|
// Trace Buffer
|
||||||
static uint8_t TraceBuf[SWO_BUFFER_SIZE]; /* Trace Buffer (must be 2^n) */
|
static uint8_t kSwoTraceBuf[SWO_BUFFER_SIZE]; /* Trace Buffer (must be 2^n) */
|
||||||
static volatile uint32_t TraceIndexI = 0U; /* Incoming Trace Index */
|
static volatile uint32_t TraceIndexI = 0U; /* Incoming Trace Index */
|
||||||
static volatile uint32_t TraceIndexO = 0U; /* Outgoing Trace Index */
|
static volatile uint32_t TraceIndexO = 0U; /* Outgoing Trace Index */
|
||||||
static volatile uint8_t TraceUpdate; /* Trace Update Flag */
|
static volatile uint8_t TraceUpdate; /* Trace Update Flag */
|
||||||
|
@ -101,105 +105,35 @@ static void ClearTrace(void);
|
||||||
static void ResumeTrace(void);
|
static void ResumeTrace(void);
|
||||||
static uint32_t GetTraceCount(void);
|
static uint32_t GetTraceCount(void);
|
||||||
static uint8_t GetTraceStatus(void);
|
static uint8_t GetTraceStatus(void);
|
||||||
void SetTraceError(uint8_t flag);
|
|
||||||
|
|
||||||
#if (SWO_STREAM != 0)
|
#if (SWO_STREAM != 0)
|
||||||
|
|
||||||
static volatile uint8_t TransferBusy = 0U; /* Transfer Busy Flag */
|
volatile uint8_t kSwoTransferBusy = 0U; /* Transfer Busy Flag */
|
||||||
static uint32_t TransferSize; /* Current Transfer Size */
|
static uint32_t TransferSize; /* Current Transfer Size */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (SWO_UART != 0)
|
#if (SWO_UART != 0)
|
||||||
|
|
||||||
|
|
||||||
void usart_monitor_task(void *argument)
|
|
||||||
{
|
|
||||||
uint32_t index_i;
|
|
||||||
uint32_t index_o;
|
|
||||||
uint32_t count;
|
|
||||||
uint32_t num;
|
|
||||||
uint32_t flags;
|
|
||||||
|
|
||||||
kUART_Monitoe_event_group = xEventGroupCreate();
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
flags = xEventGroupWaitBits(kUART_Monitoe_event_group, UART_GOT_DATA,
|
|
||||||
pdTRUE, pdFALSE, portMAX_DELAY);
|
|
||||||
if (flags & UART_GOT_DATA)
|
|
||||||
{
|
|
||||||
#if (TIMESTAMP_CLOCK != 0U)
|
|
||||||
TraceTimestamp.tick = TIMESTAMP_GET();
|
|
||||||
#endif
|
|
||||||
index_o = TraceIndexO;
|
|
||||||
index_i = TraceIndexI;
|
|
||||||
index_i += TraceBlockSize;
|
|
||||||
TraceIndexI = index_i;
|
|
||||||
#if (TIMESTAMP_CLOCK != 0U)
|
|
||||||
TraceTimestamp.index = index_i;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
num = TRACE_BLOCK_SIZE - (index_i & (TRACE_BLOCK_SIZE - 1U));
|
|
||||||
// num is the number of bytes we need to read
|
|
||||||
// (to achieve the size of TRACE_BLOCK_SIZE)
|
|
||||||
count = index_i - index_o;
|
|
||||||
// Amount of data that has not been processed yet
|
|
||||||
|
|
||||||
// (SWO_BUFFER_SIZE-num): the remaining usable length of the buffer after reading this data
|
|
||||||
if (count <= (SWO_BUFFER_SIZE - num))
|
|
||||||
{
|
|
||||||
index_i &= SWO_BUFFER_SIZE - 1U;
|
|
||||||
TraceBlockSize = num;
|
|
||||||
my_uart_read_bytes(USART_PORT, &TraceBuf[index_i], num, 20 / portTICK_RATE_MS);
|
|
||||||
//pUSART->Receive(&TraceBuf[index_i], num);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Not enough buffers
|
|
||||||
TraceStatus = DAP_SWO_CAPTURE_ACTIVE | DAP_SWO_CAPTURE_PAUSED;
|
|
||||||
}
|
|
||||||
TraceUpdate = 1U;
|
|
||||||
#if (SWO_STREAM != 0)
|
|
||||||
if (TraceTransport == 2U)
|
|
||||||
{
|
|
||||||
if (count >= (USB_BLOCK_SIZE - (index_o & (USB_BLOCK_SIZE - 1U))))
|
|
||||||
{
|
|
||||||
xEventGroupSetBits(kSWO_Thread_event_group, SWO_GOT_DATA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (event & ARM_USART_EVENT_RX_OVERFLOW)
|
|
||||||
// {
|
|
||||||
// SetTraceError(DAP_SWO_BUFFER_OVERRUN);
|
|
||||||
// }
|
|
||||||
// if (event & (ARM_USART_EVENT_RX_BREAK |
|
|
||||||
// ARM_USART_EVENT_RX_FRAMING_ERROR |
|
|
||||||
// ARM_USART_EVENT_RX_PARITY_ERROR))
|
|
||||||
// {
|
|
||||||
// SetTraceError(DAP_SWO_STREAM_ERROR);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable or disable UART SWO Mode
|
// Enable or disable UART SWO Mode
|
||||||
// enable: enable flag
|
// enable: enable flag
|
||||||
// return: 1 - Success, 0 - Error
|
// return: 1 - Success, 0 - Error
|
||||||
__WEAK uint32_t UART_SWO_Mode(uint32_t enable)
|
uint32_t UART_SWO_Mode(uint32_t enable)
|
||||||
{
|
{
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
USART_Ready = 0U;
|
USART_Ready = 0U;
|
||||||
uart_config_t uart_config = {
|
uart_config_t uart_config = {
|
||||||
.baud_rate = 115200,
|
.baud_rate = 74880,
|
||||||
.data_bits = UART_DATA_8_BITS,
|
.data_bits = UART_DATA_8_BITS,
|
||||||
.parity = UART_PARITY_DISABLE,
|
.parity = UART_PARITY_DISABLE,
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
.stop_bits = UART_STOP_BITS_1,
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE};
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE};
|
||||||
my_uart_param_config(USART_PORT, &uart_config);
|
my_uart_param_config(USART_PORT, &uart_config); // register setting
|
||||||
|
|
||||||
#define BUF_SIZE (1024)
|
#define BUF_SIZE (1024)
|
||||||
my_uart_driver_install(USART_PORT, BUF_SIZE, 0, 0, NULL, 0);
|
//// TODO: remove this
|
||||||
|
|
||||||
if (enable != 0U)
|
if (enable != 0U)
|
||||||
{
|
{
|
||||||
|
@ -207,6 +141,7 @@ __WEAK uint32_t UART_SWO_Mode(uint32_t enable)
|
||||||
status = my_uart_driver_install(USART_PORT, BUF_SIZE, 0, 0, NULL, 0);
|
status = my_uart_driver_install(USART_PORT, BUF_SIZE, 0, 0, NULL, 0);
|
||||||
if (status != ESP_OK)
|
if (status != ESP_OK)
|
||||||
{
|
{
|
||||||
|
my_uart_driver_delete(USART_PORT);
|
||||||
return (0U);
|
return (0U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +149,7 @@ __WEAK uint32_t UART_SWO_Mode(uint32_t enable)
|
||||||
{
|
{
|
||||||
my_uart_driver_delete(USART_PORT);
|
my_uart_driver_delete(USART_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1U);
|
return (1U);
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,11 +158,12 @@ __WEAK uint32_t UART_SWO_Mode(uint32_t enable)
|
||||||
// Configure UART SWO Baudrate
|
// Configure UART SWO Baudrate
|
||||||
// baudrate: requested baudrate
|
// baudrate: requested baudrate
|
||||||
// return: actual baudrate or 0 when not configured
|
// return: actual baudrate or 0 when not configured
|
||||||
__WEAK uint32_t UART_SWO_Baudrate(uint32_t baudrate)
|
uint32_t UART_SWO_Baudrate(uint32_t baudrate)
|
||||||
{
|
{
|
||||||
int32_t status;
|
//// TODO: There may be bugs.
|
||||||
|
//int32_t status;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t num;
|
uint32_t remain_trace_block_size;
|
||||||
|
|
||||||
if (baudrate > SWO_UART_MAX_BAUDRATE)
|
if (baudrate > SWO_UART_MAX_BAUDRATE)
|
||||||
{
|
{
|
||||||
|
@ -235,10 +172,8 @@ __WEAK uint32_t UART_SWO_Baudrate(uint32_t baudrate)
|
||||||
|
|
||||||
if (TraceStatus & DAP_SWO_CAPTURE_ACTIVE)
|
if (TraceStatus & DAP_SWO_CAPTURE_ACTIVE)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
TraceIndexI += my_uart_get_rx_buffered_data_len(USART_PORT);
|
||||||
my_uart_get_buffered_data_len(USART_PORT, &len);
|
|
||||||
my_uart_flush(USART_PORT);
|
my_uart_flush(USART_PORT);
|
||||||
TraceIndexI += len;
|
|
||||||
// pUSART->Control(ARM_USART_CONTROL_RX, 0U);
|
// pUSART->Control(ARM_USART_CONTROL_RX, 0U);
|
||||||
// if (pUSART->GetStatus().rx_busy)
|
// if (pUSART->GetStatus().rx_busy)
|
||||||
// {
|
// {
|
||||||
|
@ -248,29 +183,21 @@ __WEAK uint32_t UART_SWO_Baudrate(uint32_t baudrate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
status = my_uart_set_baudrate(USART_PORT, baudrate);
|
my_uart_set_baudrate(USART_PORT, baudrate);
|
||||||
|
|
||||||
if (status == ESP_OK)
|
USART_Ready = 1U;
|
||||||
{
|
|
||||||
USART_Ready = 1U;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
USART_Ready = 0U;
|
|
||||||
return (0U);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TraceStatus & DAP_SWO_CAPTURE_ACTIVE)
|
if (TraceStatus & DAP_SWO_CAPTURE_ACTIVE)
|
||||||
{
|
{
|
||||||
if ((TraceStatus & DAP_SWO_CAPTURE_PAUSED) == 0U)
|
if ((TraceStatus & DAP_SWO_CAPTURE_PAUSED) == 0U)
|
||||||
{
|
{
|
||||||
index = TraceIndexI & (SWO_BUFFER_SIZE - 1U);
|
index = TraceIndexI & (SWO_BUFFER_SIZE - 1U); // TraceIndexI % SWO_BUFFER_SIZE
|
||||||
num = TRACE_BLOCK_SIZE - (index & (TRACE_BLOCK_SIZE - 1U));
|
remain_trace_block_size = TRACE_BLOCK_SIZE - (index & (TRACE_BLOCK_SIZE - 1U)); // index % TRACE_BLOCK_SIZE
|
||||||
TraceBlockSize = num;
|
TraceBlockSize = remain_trace_block_size;
|
||||||
//pUSART->Receive(&TraceBuf[index], num);
|
//pUSART->Receive(&kSwoTraceBuf[index], num);
|
||||||
my_uart_read_bytes(USART_PORT, &TraceBuf[index], num, 20 / portTICK_RATE_MS);
|
my_uart_read_bytes_async_swo(index, remain_trace_block_size);
|
||||||
}
|
}
|
||||||
//pUSART->Control(ARM_USART_CONTROL_RX, 1U); ////TODO:
|
//pUSART->Control(ARM_USART_CONTROL_RX, 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (baudrate);
|
return (baudrate);
|
||||||
|
@ -279,7 +206,7 @@ __WEAK uint32_t UART_SWO_Baudrate(uint32_t baudrate)
|
||||||
// Control UART SWO Capture
|
// Control UART SWO Capture
|
||||||
// active: active flag
|
// active: active flag
|
||||||
// return: 1 - Success, 0 - Error
|
// return: 1 - Success, 0 - Error
|
||||||
__WEAK uint32_t UART_SWO_Control(uint32_t active)
|
uint32_t UART_SWO_Control(uint32_t active)
|
||||||
{
|
{
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
|
@ -290,7 +217,8 @@ __WEAK uint32_t UART_SWO_Control(uint32_t active)
|
||||||
return (0U);
|
return (0U);
|
||||||
}
|
}
|
||||||
TraceBlockSize = 1U;
|
TraceBlockSize = 1U;
|
||||||
status = my_uart_read_bytes(USART_PORT, &TraceBuf[0], 1U, 20 / portTICK_RATE_MS);
|
status = my_uart_read_bytes_async_swo(0, 1U);
|
||||||
|
|
||||||
if (status == ESP_FAIL)
|
if (status == ESP_FAIL)
|
||||||
{
|
{
|
||||||
return (0U);
|
return (0U);
|
||||||
|
@ -299,14 +227,13 @@ __WEAK uint32_t UART_SWO_Control(uint32_t active)
|
||||||
// if (status != ARM_DRIVER_OK)
|
// if (status != ARM_DRIVER_OK)
|
||||||
// {
|
// {
|
||||||
// return (0U);
|
// return (0U);
|
||||||
// } ////TODO:
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
// no active
|
||||||
my_uart_get_buffered_data_len(USART_PORT, &len);
|
TraceIndexI += my_uart_get_rx_buffered_data_len(USART_PORT);
|
||||||
my_uart_flush(USART_PORT);
|
my_uart_flush(USART_PORT);
|
||||||
TraceIndexI += len;
|
|
||||||
// pUSART->Control(ARM_USART_CONTROL_RX, 0U);
|
// pUSART->Control(ARM_USART_CONTROL_RX, 0U);
|
||||||
// if (pUSART->GetStatus().rx_busy)
|
// if (pUSART->GetStatus().rx_busy)
|
||||||
// {
|
// {
|
||||||
|
@ -318,20 +245,19 @@ __WEAK uint32_t UART_SWO_Control(uint32_t active)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start UART SWO Capture
|
// Start UART SWO Capture
|
||||||
// buf: pointer to buffer for capturing
|
// index: trace buffer index to read
|
||||||
// num: number of bytes to capture
|
// num: number of bytes to capture
|
||||||
__WEAK void UART_SWO_Capture(uint8_t *buf, uint32_t num)
|
static void UART_SWO_Capture(uint32_t index, uint32_t num)
|
||||||
{
|
{
|
||||||
TraceBlockSize = num;
|
TraceBlockSize = num;
|
||||||
my_uart_read_bytes(USART_PORT, buf, num, 20 / portTICK_RATE_MS);
|
my_uart_read_bytes_async_swo(index, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get UART SWO Pending Trace Count
|
// Get UART SWO Pending Trace Count
|
||||||
// return: number of pending trace data bytes
|
// return: number of pending trace data bytes
|
||||||
__WEAK uint32_t UART_SWO_GetCount(void)
|
static uint32_t UART_SWO_GetCount(void)
|
||||||
{
|
{
|
||||||
uint32_t count;
|
//// TODO: There may be bugs.
|
||||||
|
|
||||||
// if (pUSART->GetStatus().rx_busy)
|
// if (pUSART->GetStatus().rx_busy)
|
||||||
// {
|
// {
|
||||||
// count = pUSART->GetRxCount();
|
// count = pUSART->GetRxCount();
|
||||||
|
@ -340,65 +266,31 @@ __WEAK uint32_t UART_SWO_GetCount(void)
|
||||||
// {
|
// {
|
||||||
// count = 0U;
|
// count = 0U;
|
||||||
// }
|
// }
|
||||||
my_uart_get_buffered_data_len(USART_PORT, &count);
|
return my_uart_get_rx_buffered_data_len(USART_PORT);
|
||||||
return (count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (SWO_UART != 0) */
|
#endif /* (SWO_UART != 0) */
|
||||||
|
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
|
|
||||||
// Enable or disable Manchester SWO Mode
|
|
||||||
// enable: enable flag
|
|
||||||
// return: 1 - Success, 0 - Error
|
|
||||||
__WEAK uint32_t Manchester_SWO_Mode(uint32_t enable)
|
|
||||||
{
|
|
||||||
return (0U);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure Manchester SWO Baudrate
|
//
|
||||||
// baudrate: requested baudrate
|
// Trace status helper functions
|
||||||
// return: actual baudrate or 0 when not configured
|
//
|
||||||
__WEAK uint32_t Manchester_SWO_Baudrate(uint32_t baudrate)
|
|
||||||
{
|
|
||||||
return (0U);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Control Manchester SWO Capture
|
|
||||||
// active: active flag
|
|
||||||
// return: 1 - Success, 0 - Error
|
|
||||||
__WEAK uint32_t Manchester_SWO_Control(uint32_t active)
|
|
||||||
{
|
|
||||||
return (0U);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start Manchester SWO Capture
|
|
||||||
// buf: pointer to buffer for capturing
|
|
||||||
// num: number of bytes to capture
|
|
||||||
__WEAK void Manchester_SWO_Capture(uint8_t *buf, uint32_t num)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Manchester SWO Pending Trace Count
|
|
||||||
// return: number of pending trace data bytes
|
|
||||||
__WEAK uint32_t Manchester_SWO_GetCount(void)
|
|
||||||
{
|
|
||||||
return (0U);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* (SWO_MANCHESTER != 0) */
|
|
||||||
|
|
||||||
// Clear Trace Errors and Data
|
// Clear Trace Errors and Data
|
||||||
static void ClearTrace(void)
|
static void ClearTrace(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if (SWO_STREAM != 0)
|
#if (SWO_STREAM != 0)
|
||||||
if (TraceTransport == 2U)
|
if (TraceTransport == 2U) // Indicates that we use WinUSB for transfer.
|
||||||
{
|
{
|
||||||
if (TransferBusy != 0U)
|
if (kSwoTransferBusy != 0U)
|
||||||
{
|
{
|
||||||
SWO_AbortTransfer();
|
// Unfortunately, we cannot abort the transmission
|
||||||
TransferBusy = 0U;
|
// SWO_AbortTransfer();
|
||||||
|
kSwoTransferBusy = 0U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -430,18 +322,10 @@ static void ResumeTrace(void)
|
||||||
index_i &= SWO_BUFFER_SIZE - 1U;
|
index_i &= SWO_BUFFER_SIZE - 1U;
|
||||||
switch (TraceMode)
|
switch (TraceMode)
|
||||||
{
|
{
|
||||||
#if (SWO_UART != 0)
|
|
||||||
case DAP_SWO_UART:
|
case DAP_SWO_UART:
|
||||||
TraceStatus = DAP_SWO_CAPTURE_ACTIVE;
|
TraceStatus = DAP_SWO_CAPTURE_ACTIVE;
|
||||||
UART_SWO_Capture(&TraceBuf[index_i], 1U);
|
UART_SWO_Capture(index_i, 1U);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
TraceStatus = DAP_SWO_CAPTURE_ACTIVE;
|
|
||||||
Manchester_SWO_Capture(&TraceBuf[index_i], 1U);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -463,20 +347,15 @@ static uint32_t GetTraceCount(void)
|
||||||
count = TraceIndexI - TraceIndexO;
|
count = TraceIndexI - TraceIndexO;
|
||||||
switch (TraceMode)
|
switch (TraceMode)
|
||||||
{
|
{
|
||||||
#if (SWO_UART != 0)
|
|
||||||
case DAP_SWO_UART:
|
case DAP_SWO_UART:
|
||||||
count += UART_SWO_GetCount();
|
count += UART_SWO_GetCount();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
count += Manchester_SWO_GetCount();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
} while (TraceUpdate != 0U);
|
} while (TraceUpdate != 0U);
|
||||||
|
// Synchronously wait for the data to complete
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -541,14 +420,7 @@ uint32_t SWO_Transport(const uint8_t *request, uint8_t *response)
|
||||||
result = 0U;
|
result = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != 0U)
|
*response = result ? DAP_OK : DAP_ERROR;
|
||||||
{
|
|
||||||
*response = DAP_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*response = DAP_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((1U << 16) | 1U);
|
return ((1U << 16) | 1U);
|
||||||
}
|
}
|
||||||
|
@ -565,6 +437,7 @@ uint32_t SWO_Mode(const uint8_t *request, uint8_t *response)
|
||||||
|
|
||||||
mode = *request;
|
mode = *request;
|
||||||
|
|
||||||
|
// disable swo mode
|
||||||
switch (TraceMode)
|
switch (TraceMode)
|
||||||
{
|
{
|
||||||
#if (SWO_UART != 0)
|
#if (SWO_UART != 0)
|
||||||
|
@ -572,11 +445,7 @@ uint32_t SWO_Mode(const uint8_t *request, uint8_t *response)
|
||||||
UART_SWO_Mode(0U);
|
UART_SWO_Mode(0U);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
Manchester_SWO_Mode(0U);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -591,34 +460,18 @@ uint32_t SWO_Mode(const uint8_t *request, uint8_t *response)
|
||||||
result = UART_SWO_Mode(1U);
|
result = UART_SWO_Mode(1U);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
result = Manchester_SWO_Mode(1U);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
result = 0U;
|
result = 0U;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result != 0U)
|
|
||||||
{
|
// DAP_SWO_OFF -> has error
|
||||||
TraceMode = mode;
|
TraceMode = result ? mode : DAP_SWO_OFF;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TraceMode = DAP_SWO_OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceStatus = 0U;
|
TraceStatus = 0U;
|
||||||
|
|
||||||
if (result != 0U)
|
*response = result ? DAP_OK : DAP_ERROR;
|
||||||
{
|
|
||||||
*response = DAP_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*response = DAP_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((1U << 16) | 1U);
|
return ((1U << 16) | 1U);
|
||||||
}
|
}
|
||||||
|
@ -644,11 +497,7 @@ uint32_t SWO_Baudrate(const uint8_t *request, uint8_t *response)
|
||||||
baudrate = UART_SWO_Baudrate(baudrate);
|
baudrate = UART_SWO_Baudrate(baudrate);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
baudrate = Manchester_SWO_Baudrate(baudrate);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
baudrate = 0U;
|
baudrate = 0U;
|
||||||
break;
|
break;
|
||||||
|
@ -681,7 +530,9 @@ uint32_t SWO_Control(const uint8_t *request, uint8_t *response)
|
||||||
|
|
||||||
if (active != (TraceStatus & DAP_SWO_CAPTURE_ACTIVE))
|
if (active != (TraceStatus & DAP_SWO_CAPTURE_ACTIVE))
|
||||||
{
|
{
|
||||||
if (active)
|
// active status: request != now status
|
||||||
|
|
||||||
|
if (active) // request: active
|
||||||
{
|
{
|
||||||
ClearTrace();
|
ClearTrace();
|
||||||
}
|
}
|
||||||
|
@ -692,39 +543,32 @@ uint32_t SWO_Control(const uint8_t *request, uint8_t *response)
|
||||||
result = UART_SWO_Control(active);
|
result = UART_SWO_Control(active);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (SWO_MANCHESTER != 0)
|
|
||||||
case DAP_SWO_MANCHESTER:
|
|
||||||
result = Manchester_SWO_Control(active);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
result = 0U;
|
result = 0U;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != 0U)
|
if (result != 0U)
|
||||||
{
|
{
|
||||||
|
// success done
|
||||||
TraceStatus = active;
|
TraceStatus = active;
|
||||||
#if (SWO_STREAM != 0)
|
#if (SWO_STREAM != 0)
|
||||||
if (TraceTransport == 2U)
|
if (TraceTransport == 2U) // Indicates that we use WinUSB for transfer.
|
||||||
{
|
{
|
||||||
xEventGroupSetBits(kSWO_Thread_event_group, SWO_GOT_DATA);
|
xEventGroupSetBits(kSwoThreadEventGroup, SWO_GOT_DATA);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// request: active but already actived
|
||||||
result = 1U;
|
result = 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != 0U)
|
|
||||||
{
|
*response = result ? DAP_OK : DAP_ERROR;
|
||||||
*response = DAP_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*response = DAP_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((1U << 16) | 1U);
|
return ((1U << 16) | 1U);
|
||||||
}
|
}
|
||||||
|
@ -793,6 +637,7 @@ uint32_t SWO_ExtendedStatus(const uint8_t *request, uint8_t *response)
|
||||||
TraceUpdate = 0U;
|
TraceUpdate = 0U;
|
||||||
index = TraceTimestamp.index;
|
index = TraceTimestamp.index;
|
||||||
tick = TraceTimestamp.tick;
|
tick = TraceTimestamp.tick;
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
} while (TraceUpdate != 0U);
|
} while (TraceUpdate != 0U);
|
||||||
*response++ = (uint8_t)(index >> 0);
|
*response++ = (uint8_t)(index >> 0);
|
||||||
*response++ = (uint8_t)(index >> 8);
|
*response++ = (uint8_t)(index >> 8);
|
||||||
|
@ -824,6 +669,8 @@ uint32_t SWO_Data(const uint8_t *request, uint8_t *response)
|
||||||
status = GetTraceStatus();
|
status = GetTraceStatus();
|
||||||
count = GetTraceCount();
|
count = GetTraceCount();
|
||||||
|
|
||||||
|
// transport 1: use DAP SWO command
|
||||||
|
// transport 2: WinUSB
|
||||||
if (TraceTransport == 1U)
|
if (TraceTransport == 1U)
|
||||||
{
|
{
|
||||||
n = (uint32_t)(*(request + 0) << 0) |
|
n = (uint32_t)(*(request + 0) << 0) |
|
||||||
|
@ -839,6 +686,7 @@ uint32_t SWO_Data(const uint8_t *request, uint8_t *response)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// if use winusb, then nothing to do.
|
||||||
count = 0U;
|
count = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +700,7 @@ uint32_t SWO_Data(const uint8_t *request, uint8_t *response)
|
||||||
for (i = index, n = count; n; n--)
|
for (i = index, n = count; n; n--)
|
||||||
{
|
{
|
||||||
i &= SWO_BUFFER_SIZE - 1U;
|
i &= SWO_BUFFER_SIZE - 1U;
|
||||||
*response++ = TraceBuf[i++];
|
*response++ = kSwoTraceBuf[i++];
|
||||||
}
|
}
|
||||||
TraceIndexO = index + count;
|
TraceIndexO = index + count;
|
||||||
ResumeTrace();
|
ResumeTrace();
|
||||||
|
@ -867,78 +715,171 @@ uint32_t SWO_Data(const uint8_t *request, uint8_t *response)
|
||||||
void SWO_TransferComplete(void)
|
void SWO_TransferComplete(void)
|
||||||
{
|
{
|
||||||
TraceIndexO += TransferSize;
|
TraceIndexO += TransferSize;
|
||||||
TransferBusy = 0U;
|
kSwoTransferBusy = 0U;
|
||||||
ResumeTrace();
|
ResumeTrace();
|
||||||
xEventGroupSetBits(kSWO_Thread_event_group, SWO_GOT_DATA);
|
xEventGroupSetBits(kSwoThreadEventGroup, SWO_GOT_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SWO Thread
|
// SWO Thread
|
||||||
void SWO_Thread(void *argument)
|
void SWO_Thread()
|
||||||
{
|
{
|
||||||
uint32_t timeout;
|
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t i, n;
|
uint32_t i, n;
|
||||||
(void)argument;
|
|
||||||
|
|
||||||
timeout = portMAX_DELAY;
|
uint32_t index_i;
|
||||||
|
uint32_t index_o;
|
||||||
|
uint32_t remain_trace_block_size;
|
||||||
|
|
||||||
kSWO_Thread_event_group = xEventGroupCreate();
|
TickType_t timeout = portMAX_DELAY;
|
||||||
|
|
||||||
|
kSwoThreadEventGroup = xEventGroupCreate();
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
flags = xEventGroupWaitBits(kSWO_Thread_event_group, SWO_GOT_DATA | SWO_ERROR_TIME_OUT,
|
/*
|
||||||
|
Here, our event group handles two main types of events:
|
||||||
|
1. `SWO_GOT_DATA` : The SWO package may be ready to send.
|
||||||
|
2. `UART_GOT_DATA` : The uart transfer event is complete and we can start reading.
|
||||||
|
|
||||||
|
Note that the `SWO_ERROR_TIME_OUT` flag is only used for internal processing, only when the status is
|
||||||
|
inactive can it be set.
|
||||||
|
|
||||||
|
We deal with uart events first.
|
||||||
|
Currently, SWO events are always handled.
|
||||||
|
*/
|
||||||
|
flags = xEventGroupWaitBits(kSwoThreadEventGroup, SWO_GOT_DATA | UART_GOT_DATA | SWO_ERROR_TIME_OUT,
|
||||||
pdTRUE, pdFALSE, timeout);
|
pdTRUE, pdFALSE, timeout);
|
||||||
if (TraceStatus & DAP_SWO_CAPTURE_ACTIVE)
|
|
||||||
|
if (!(flags & UART_GOT_DATA) && !(flags & SWO_GOT_DATA))
|
||||||
{
|
{
|
||||||
timeout = SWO_STREAM_TIMEOUT;
|
if (TraceMode != DAP_SWO_OFF && my_uart_get_rx_buffered_data_len(USART_PORT) >= kSWO_read_num)
|
||||||
|
{
|
||||||
|
flags = UART_GOT_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & UART_GOT_DATA)
|
||||||
|
{
|
||||||
|
// The data is still in the uart buffer,
|
||||||
|
// and the data in the uart needs to be read into the SWO buffer
|
||||||
|
my_uart_read_bytes(USART_PORT, &kSwoTraceBuf[kSWO_read_index], kSWO_read_num, pdMS_TO_TICKS(20));
|
||||||
|
|
||||||
|
|
||||||
|
index_o = TraceIndexO;
|
||||||
|
|
||||||
|
TraceIndexI += TraceBlockSize;
|
||||||
|
index_i = TraceIndexI;
|
||||||
|
|
||||||
|
#if (TIMESTAMP_CLOCK != 0U)
|
||||||
|
TraceTimestamp.tick = TIMESTAMP_GET();
|
||||||
|
TraceTimestamp.index = index_i;
|
||||||
|
#endif
|
||||||
|
remain_trace_block_size = TRACE_BLOCK_SIZE - (index_i & (TRACE_BLOCK_SIZE - 1U));
|
||||||
|
// remain_trace_block_size is the number of bytes we need to read
|
||||||
|
// (to achieve the size of TRACE_BLOCK_SIZE)
|
||||||
|
count = index_i - index_o;
|
||||||
|
// Amount of data that has not been processed yet
|
||||||
|
|
||||||
|
// (SWO_BUFFER_SIZE-num): the remaining usable length of the buffer after reading this data
|
||||||
|
if (count <= (SWO_BUFFER_SIZE - remain_trace_block_size))
|
||||||
|
{
|
||||||
|
// index_i % 4096
|
||||||
|
index_i &= SWO_BUFFER_SIZE - 1U;
|
||||||
|
TraceBlockSize = remain_trace_block_size;
|
||||||
|
my_uart_read_bytes_async_swo(index_i, remain_trace_block_size);
|
||||||
|
//pUSART->Receive(&kSwoTraceBuf[index_i], num);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not enough buffers
|
||||||
|
TraceStatus = DAP_SWO_CAPTURE_ACTIVE | DAP_SWO_CAPTURE_PAUSED;
|
||||||
|
}
|
||||||
|
TraceUpdate = 1U;
|
||||||
|
#if (SWO_STREAM != 0)
|
||||||
|
if (TraceTransport == 2U) // Indicates that we use WinUSB for transfer.
|
||||||
|
{
|
||||||
|
// unsent length >= remaining length of the USB block
|
||||||
|
//// TODO: may be we can remove this
|
||||||
|
if (count >= (USB_BLOCK_SIZE - (index_o & (USB_BLOCK_SIZE - 1U))))
|
||||||
|
{
|
||||||
|
flags = SWO_GOT_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// xEventGroupClearBits
|
||||||
|
|
||||||
|
/*
|
||||||
|
`SWO_GOT_DATA` may be set in the following situations:
|
||||||
|
- The SWO status requested by `SWD_contorl` is different from the current SWO status.
|
||||||
|
- When `SWO_TransferComplete` is called, and there may be potentially unsent data in the buffer.
|
||||||
|
- monitor task believes we need to send data that is already long enough.
|
||||||
|
|
||||||
|
Note: The processing of the following code segment will always be executed,
|
||||||
|
and should be ensured to be stable enough.
|
||||||
|
|
||||||
|
|
||||||
|
TODO: The time interval for executing the code is not guaranteed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!(TraceStatus & DAP_SWO_CAPTURE_ACTIVE))
|
||||||
|
{
|
||||||
|
flags = SWO_ERROR_TIME_OUT;
|
||||||
|
timeout = portMAX_DELAY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
timeout = portMAX_DELAY;
|
timeout = pdMS_TO_TICKS(150);
|
||||||
flags = SWO_ERROR_TIME_OUT;
|
|
||||||
}
|
}
|
||||||
if (TransferBusy == 0U)
|
|
||||||
|
if (kSwoTransferBusy)
|
||||||
{
|
{
|
||||||
count = GetTraceCount();
|
continue;
|
||||||
if (count != 0U)
|
}
|
||||||
|
|
||||||
|
count = GetTraceCount();
|
||||||
|
if (count != 0U)
|
||||||
|
{
|
||||||
|
index = TraceIndexO & (SWO_BUFFER_SIZE - 1U);
|
||||||
|
n = SWO_BUFFER_SIZE - index;
|
||||||
|
if (count > n)
|
||||||
{
|
{
|
||||||
index = TraceIndexO & (SWO_BUFFER_SIZE - 1U);
|
count = n;
|
||||||
n = SWO_BUFFER_SIZE - index;
|
}
|
||||||
if (count > n)
|
if ((flags & SWO_ERROR_TIME_OUT) == 0)
|
||||||
|
{
|
||||||
|
i = index & (USB_BLOCK_SIZE - 1U);
|
||||||
|
if (i == 0U)
|
||||||
{
|
{
|
||||||
count = n;
|
count &= ~(USB_BLOCK_SIZE - 1U); // Take down to the nearest number that is a multiple of USB_BLOCK_SIZE
|
||||||
}
|
}
|
||||||
if ((flags & SWO_ERROR_TIME_OUT) == 0)
|
else
|
||||||
{
|
{
|
||||||
i = index & (USB_BLOCK_SIZE - 1U);
|
n = USB_BLOCK_SIZE - i;
|
||||||
if (i == 0U)
|
if (count >= n)
|
||||||
{
|
{
|
||||||
count &= ~(USB_BLOCK_SIZE - 1U);
|
count = n; // The number of bytes to be sent exceeds the remain USB block size.
|
||||||
// Take down to the nearest number that is a multiple of USB_BLOCK_SIZE
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = USB_BLOCK_SIZE - i;
|
count = 0U; // Haven't received a full USB block yet.
|
||||||
if (count >= n)
|
|
||||||
{
|
|
||||||
count = n;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
count = 0U;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count != 0U)
|
}
|
||||||
{
|
// Notify that there is data available for transmission
|
||||||
TransferSize = count;
|
if (count != 0U)
|
||||||
TransferBusy = 1U;
|
{
|
||||||
SWO_QueueTransfer(&TraceBuf[index], count); //through USB
|
TransferSize = count;
|
||||||
}
|
kSwoTransferBusy = 1U;
|
||||||
|
SWO_QueueTransfer(&kSwoTraceBuf[index], count); // through USB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For all exceptions, we have handled them directly in the interrupt handlers.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (SWO_STREAM != 0) */
|
#endif /* (SWO_STREAM != 0) */
|
||||||
|
|
|
@ -39,13 +39,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "DAP_config.h"
|
#include "components/DAP/config/DAP_config.h"
|
||||||
#include "DAP.h"
|
#include "components/DAP/include/DAP.h"
|
||||||
|
#include "components/DAP/include/spi_op.h"
|
||||||
|
#include "components/DAP/include/spi_switch.h"
|
||||||
|
#include "components/DAP/include/dap_utility.h"
|
||||||
|
|
||||||
#include "spi_op.h"
|
|
||||||
#include "spi_switch.h"
|
|
||||||
#include "dap_utility.h"
|
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
#define PRINT_SWD_PROTOCOL 0
|
#define PRINT_SWD_PROTOCOL 0
|
||||||
|
@ -218,6 +219,7 @@ void SWD_Sequence_SPI (uint32_t info, const uint8_t *swdo, uint8_t *swdi) {
|
||||||
// data: DATA[31:0]
|
// data: DATA[31:0]
|
||||||
// return: ACK[2:0]
|
// return: ACK[2:0]
|
||||||
static uint8_t SWD_Transfer_SPI (uint32_t request, uint32_t *data) {
|
static uint8_t SWD_Transfer_SPI (uint32_t request, uint32_t *data) {
|
||||||
|
//// FIXME: overrun detection
|
||||||
// SPI transfer mode does not require operations such as PIN_DELAY
|
// SPI transfer mode does not require operations such as PIN_DELAY
|
||||||
uint8_t ack;
|
uint8_t ack;
|
||||||
// uint32_t bit;
|
// uint32_t bit;
|
||||||
|
@ -355,7 +357,6 @@ static uint8_t SWD_Transfer_SPI (uint32_t request, uint32_t *data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//// FIXME: bug
|
|
||||||
/* Protocol error */
|
/* Protocol error */
|
||||||
DAP_SPI_Disable();
|
DAP_SPI_Disable();
|
||||||
PIN_SWDIO_TMS_SET();
|
PIN_SWDIO_TMS_SET();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "dap_utility.h"
|
#include "components/DAP/include/dap_utility.h"
|
||||||
|
|
||||||
const uint8_t kParityByteTable[256] =
|
const uint8_t kParityByteTable[256] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,17 +4,23 @@
|
||||||
* @brief Using SPI for common transfer operations
|
* @brief Using SPI for common transfer operations
|
||||||
* @change: 2020-11-25 first version
|
* @change: 2020-11-25 first version
|
||||||
* 2021-2-11 Support SWD sequence
|
* 2021-2-11 Support SWD sequence
|
||||||
* @version 0.2
|
* 2021-3-10 Support 3-wire SPI
|
||||||
* @date 2021-2-11
|
* @version 0.3
|
||||||
|
* @date 2021-3-10
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2021
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "main/dap_configuration.h"
|
||||||
|
|
||||||
|
#include "components/DAP/include/cmsis_compiler.h"
|
||||||
|
#include "components/DAP/include/spi_op.h"
|
||||||
|
|
||||||
#include "esp8266/spi_struct.h"
|
#include "esp8266/spi_struct.h"
|
||||||
#include "cmsis_compiler.h"
|
|
||||||
#include "spi_op.h"
|
|
||||||
|
|
||||||
#define DAP_SPI SPI1
|
#define DAP_SPI SPI1
|
||||||
|
|
||||||
|
@ -83,7 +89,7 @@ void DAP_SPI_WriteBits(const uint8_t count, const uint8_t *buf)
|
||||||
// Start transmission
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
// Wait for sending to complete
|
// Wait for sending to complete
|
||||||
while (DAP_SPI.cmd.usr);
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,12 +109,20 @@ void DAP_SPI_ReadBits(const uint8_t count, uint8_t *buf) {
|
||||||
DAP_SPI.user.usr_mosi = 0;
|
DAP_SPI.user.usr_mosi = 0;
|
||||||
DAP_SPI.user.usr_miso = 1;
|
DAP_SPI.user.usr_miso = 1;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
DAP_SPI.user1.usr_miso_bitlen = count - 1U;
|
DAP_SPI.user1.usr_miso_bitlen = count - 1U;
|
||||||
|
|
||||||
// Start transmission
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
// Wait for reading to complete
|
// Wait for reading to complete
|
||||||
while (DAP_SPI.cmd.usr);
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
data_buf[0] = DAP_SPI.data_buf[0];
|
data_buf[0] = DAP_SPI.data_buf[0];
|
||||||
data_buf[1] = DAP_SPI.data_buf[1];
|
data_buf[1] = DAP_SPI.data_buf[1];
|
||||||
|
@ -139,6 +153,10 @@ __FORCEINLINE void DAP_SPI_Send_Header(const uint8_t packetHeaderData, uint8_t *
|
||||||
|
|
||||||
DAP_SPI.user.usr_miso = 1;
|
DAP_SPI.user.usr_miso = 1;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 1 bit Trn(Before ACK) + 3bits ACK + TrnAferACK - 1(prescribed)
|
// 1 bit Trn(Before ACK) + 3bits ACK + TrnAferACK - 1(prescribed)
|
||||||
DAP_SPI.user1.usr_miso_bitlen = 1U + 3U + TrnAfterACK - 1U;
|
DAP_SPI.user1.usr_miso_bitlen = 1U + 3U + TrnAfterACK - 1U;
|
||||||
|
|
||||||
|
@ -148,7 +166,11 @@ __FORCEINLINE void DAP_SPI_Send_Header(const uint8_t packetHeaderData, uint8_t *
|
||||||
// Start transmission
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
// Wait for sending to complete
|
// Wait for sending to complete
|
||||||
while (DAP_SPI.cmd.usr);
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
dataBuf = DAP_SPI.data_buf[0];
|
dataBuf = DAP_SPI.data_buf[0];
|
||||||
*ack = (dataBuf >> 1) & 0b111;
|
*ack = (dataBuf >> 1) & 0b111;
|
||||||
|
@ -163,19 +185,27 @@ __FORCEINLINE void DAP_SPI_Send_Header(const uint8_t packetHeaderData, uint8_t *
|
||||||
*/
|
*/
|
||||||
__FORCEINLINE void DAP_SPI_Read_Data(uint32_t *resData, uint8_t *resParity)
|
__FORCEINLINE void DAP_SPI_Read_Data(uint32_t *resData, uint8_t *resParity)
|
||||||
{
|
{
|
||||||
uint64_t dataBuf;
|
volatile uint64_t dataBuf;
|
||||||
uint32_t *pU32Data = (uint32_t *)&dataBuf;
|
uint32_t *pU32Data = (uint32_t *)&dataBuf;
|
||||||
|
|
||||||
DAP_SPI.user.usr_mosi = 0;
|
DAP_SPI.user.usr_mosi = 0;
|
||||||
DAP_SPI.user.usr_miso = 1;
|
DAP_SPI.user.usr_miso = 1;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 1 bit Trn(End) + 3bits ACK + 32bis data + 1bit parity - 1(prescribed)
|
// 1 bit Trn(End) + 3bits ACK + 32bis data + 1bit parity - 1(prescribed)
|
||||||
DAP_SPI.user1.usr_miso_bitlen = 1U + 32U + 1U - 1U;
|
DAP_SPI.user1.usr_miso_bitlen = 1U + 32U + 1U - 1U;
|
||||||
|
|
||||||
// Start transmission
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
// Wait for sending to complete
|
// Wait for sending to complete
|
||||||
while (DAP_SPI.cmd.usr);
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO == 1)
|
||||||
|
DAP_SPI.user.sio = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
pU32Data[0] = DAP_SPI.data_buf[0];
|
pU32Data[0] = DAP_SPI.data_buf[0];
|
||||||
pU32Data[1] = DAP_SPI.data_buf[1];
|
pU32Data[1] = DAP_SPI.data_buf[1];
|
||||||
|
@ -204,7 +234,7 @@ __FORCEINLINE void DAP_SPI_Write_Data(uint32_t data, uint8_t parity)
|
||||||
// Start transmission
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
// Wait for sending to complete
|
// Wait for sending to complete
|
||||||
while (DAP_SPI.cmd.usr);
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,8 +251,10 @@ __FORCEINLINE void DAP_SPI_Generate_Cycle(uint8_t num)
|
||||||
|
|
||||||
DAP_SPI.data_buf[0] = 0x00000000U;
|
DAP_SPI.data_buf[0] = 0x00000000U;
|
||||||
|
|
||||||
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
while (DAP_SPI.cmd.usr);
|
// Wait for sending to complete
|
||||||
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,8 +271,10 @@ __FORCEINLINE void DAP_SPI_Protocol_Error_Read()
|
||||||
DAP_SPI.data_buf[0] = 0xFFFFFFFFU;
|
DAP_SPI.data_buf[0] = 0xFFFFFFFFU;
|
||||||
DAP_SPI.data_buf[1] = 0xFFFFFFFFU;
|
DAP_SPI.data_buf[1] = 0xFFFFFFFFU;
|
||||||
|
|
||||||
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
while (DAP_SPI.cmd.usr);
|
// Wait for sending to complete
|
||||||
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,6 +291,8 @@ __FORCEINLINE void DAP_SPI_Protocol_Error_Write()
|
||||||
DAP_SPI.data_buf[0] = 0xFFFFFFFFU;
|
DAP_SPI.data_buf[0] = 0xFFFFFFFFU;
|
||||||
DAP_SPI.data_buf[1] = 0xFFFFFFFFU;
|
DAP_SPI.data_buf[1] = 0xFFFFFFFFU;
|
||||||
|
|
||||||
|
// Start transmission
|
||||||
DAP_SPI.cmd.usr = 1;
|
DAP_SPI.cmd.usr = 1;
|
||||||
while (DAP_SPI.cmd.usr);
|
// Wait for sending to complete
|
||||||
|
while (DAP_SPI.cmd.usr) continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
*/
|
*/
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "components/DAP/include/cmsis_compiler.h"
|
||||||
|
#include "components/DAP/include/spi_switch.h"
|
||||||
|
|
||||||
#include "esp8266/spi_struct.h"
|
#include "esp8266/spi_struct.h"
|
||||||
#include "esp8266/pin_mux_register.h"
|
#include "esp8266/pin_mux_register.h"
|
||||||
#include "esp8266/gpio_struct.h"
|
#include "esp8266/gpio_struct.h"
|
||||||
|
|
||||||
#include "cmsis_compiler.h"
|
|
||||||
#include "spi_switch.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define DAP_SPI SPI1
|
#define DAP_SPI SPI1
|
||||||
|
|
||||||
|
@ -106,11 +106,13 @@ void DAP_SPI_Init()
|
||||||
pin_reg.pullup = 0;
|
pin_reg.pullup = 0;
|
||||||
WRITE_PERI_REG(GPIO_PIN_REG(13), pin_reg.val);
|
WRITE_PERI_REG(GPIO_PIN_REG(13), pin_reg.val);
|
||||||
|
|
||||||
|
#if (USE_SPI_SIO != 1)
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_HSPIQ_MISO); // GPIO12 is SPI MISO pin (Master Data In)
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_HSPIQ_MISO); // GPIO12 is SPI MISO pin (Master Data In)
|
||||||
// esp8266 in is always connected
|
// esp8266 in is always connected
|
||||||
pin_reg.val = READ_PERI_REG(GPIO_PIN_REG(12));
|
pin_reg.val = READ_PERI_REG(GPIO_PIN_REG(12));
|
||||||
pin_reg.pullup = 0;
|
pin_reg.pullup = 0;
|
||||||
WRITE_PERI_REG(GPIO_PIN_REG(12), pin_reg.val);
|
WRITE_PERI_REG(GPIO_PIN_REG(12), pin_reg.val);
|
||||||
|
#endif // (USE_SPI_SIO != 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,10 +138,12 @@ __FORCEINLINE void DAP_SPI_Deinit()
|
||||||
{
|
{
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13); // MOSI
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13); // MOSI
|
||||||
|
#if (USE_SPI_SIO != 1)
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12); // MISO
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12); // MISO
|
||||||
|
|
||||||
// disable MISO output connect
|
// disable MISO output connect
|
||||||
GPIO.enable_w1tc |= (0x1 << 12);
|
GPIO.enable_w1tc |= (0x1 << 12);
|
||||||
|
#endif // (USE_SPI_SIO != 1)
|
||||||
|
|
||||||
gpio_pin_reg_t pin_reg;
|
gpio_pin_reg_t pin_reg;
|
||||||
GPIO.enable_w1ts |= (0x1 << 13);
|
GPIO.enable_w1ts |= (0x1 << 13);
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "components/DAP/config/DAP_config.h"
|
||||||
|
#include "components/DAP/include/uart_modify.h"
|
||||||
|
#include "components/DAP/include/swo.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
|
@ -26,12 +31,9 @@
|
||||||
#include "freertos/ringbuf.h"
|
#include "freertos/ringbuf.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
|
|
||||||
#include "esp_err.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
|
||||||
// SWO modify
|
// SWO modify
|
||||||
#include "DAP_config.h"
|
|
||||||
#include "esp8266/uart_struct.h"
|
#include "esp8266/uart_struct.h"
|
||||||
#include "esp8266/uart_register.h"
|
#include "esp8266/uart_register.h"
|
||||||
#include "esp8266/pin_mux_register.h"
|
#include "esp8266/pin_mux_register.h"
|
||||||
|
@ -39,8 +41,6 @@
|
||||||
#include "esp8266/rom_functions.h"
|
#include "esp8266/rom_functions.h"
|
||||||
|
|
||||||
#include "rom/ets_sys.h"
|
#include "rom/ets_sys.h"
|
||||||
|
|
||||||
#include "uart_modify.h"
|
|
||||||
#include "driver/uart_select.h"
|
#include "driver/uart_select.h"
|
||||||
|
|
||||||
#define portYIELD_FROM_ISR() taskYIELD()
|
#define portYIELD_FROM_ISR() taskYIELD()
|
||||||
|
@ -70,6 +70,11 @@ typedef struct
|
||||||
} tx_data;
|
} tx_data;
|
||||||
} uart_tx_data_t;
|
} uart_tx_data_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// read:
|
||||||
|
// hardware FIFO -> `rx_data_buf` -> `rx_ring_buf` -> user buf
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uart_port_t uart_num; /*!< UART port number*/
|
uart_port_t uart_num; /*!< UART port number*/
|
||||||
|
@ -118,18 +123,21 @@ typedef struct
|
||||||
static uart_isr_func_t uart_isr_func[UART_NUM_MAX];
|
static uart_isr_func_t uart_isr_func[UART_NUM_MAX];
|
||||||
|
|
||||||
// SWO modify
|
// SWO modify
|
||||||
extern EventGroupHandle_t kUART_Monitoe_event_group;
|
|
||||||
#define UART_GOT_DATA BIT0
|
|
||||||
extern void SetTraceError(uint8_t flag);
|
|
||||||
#define DAP_SWO_CAPTURE_ACTIVE (1U << 0)
|
#define DAP_SWO_CAPTURE_ACTIVE (1U << 0)
|
||||||
#define DAP_SWO_CAPTURE_PAUSED (1U << 1)
|
#define DAP_SWO_CAPTURE_PAUSED (1U << 1)
|
||||||
#define DAP_SWO_STREAM_ERROR (1U << 6)
|
#define DAP_SWO_STREAM_ERROR (1U << 6)
|
||||||
#define DAP_SWO_BUFFER_OVERRUN (1U << 7)
|
#define DAP_SWO_BUFFER_OVERRUN (1U << 7)
|
||||||
//
|
|
||||||
|
// non thread safe
|
||||||
|
volatile uint32_t kSWO_read_index = 0;
|
||||||
|
volatile uint32_t kSWO_read_num = 0;
|
||||||
|
volatile uint8_t kSWO_uart_notify_enable = 1;
|
||||||
|
SemaphoreHandle_t kSWO_read_mux = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
esp_err_t my_uart_set_word_length(uart_port_t uart_num, uart_word_length_t data_bit)
|
esp_err_t my_uart_set_word_length(uart_port_t uart_num, uart_word_length_t data_bit)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((data_bit < UART_DATA_BITS_MAX), "data bit error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((data_bit < UART_DATA_BITS_MAX), "data bit error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
UART_ENTER_CRITICAL();
|
UART_ENTER_CRITICAL();
|
||||||
|
@ -140,7 +148,6 @@ esp_err_t my_uart_set_word_length(uart_port_t uart_num, uart_word_length_t data_
|
||||||
|
|
||||||
esp_err_t my_uart_get_word_length(uart_port_t uart_num, uart_word_length_t *data_bit)
|
esp_err_t my_uart_get_word_length(uart_port_t uart_num, uart_word_length_t *data_bit)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((data_bit), "empty pointer", ESP_FAIL);
|
UART_CHECK((data_bit), "empty pointer", ESP_FAIL);
|
||||||
|
|
||||||
*(data_bit) = UART[uart_num]->conf0.bit_num;
|
*(data_bit) = UART[uart_num]->conf0.bit_num;
|
||||||
|
@ -149,7 +156,6 @@ esp_err_t my_uart_get_word_length(uart_port_t uart_num, uart_word_length_t *data
|
||||||
|
|
||||||
esp_err_t my_uart_set_stop_bits(uart_port_t uart_num, uart_stop_bits_t stop_bit)
|
esp_err_t my_uart_set_stop_bits(uart_port_t uart_num, uart_stop_bits_t stop_bit)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((stop_bit < UART_STOP_BITS_MAX), "stop bit error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((stop_bit < UART_STOP_BITS_MAX), "stop bit error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
UART_ENTER_CRITICAL();
|
UART_ENTER_CRITICAL();
|
||||||
|
@ -160,7 +166,6 @@ esp_err_t my_uart_set_stop_bits(uart_port_t uart_num, uart_stop_bits_t stop_bit)
|
||||||
|
|
||||||
esp_err_t my_uart_get_stop_bits(uart_port_t uart_num, uart_stop_bits_t *stop_bit)
|
esp_err_t my_uart_get_stop_bits(uart_port_t uart_num, uart_stop_bits_t *stop_bit)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((stop_bit), "empty pointer", ESP_FAIL);
|
UART_CHECK((stop_bit), "empty pointer", ESP_FAIL);
|
||||||
|
|
||||||
(*stop_bit) = UART[uart_num]->conf0.stop_bit_num;
|
(*stop_bit) = UART[uart_num]->conf0.stop_bit_num;
|
||||||
|
@ -169,7 +174,6 @@ esp_err_t my_uart_get_stop_bits(uart_port_t uart_num, uart_stop_bits_t *stop_bit
|
||||||
|
|
||||||
esp_err_t my_uart_set_parity(uart_port_t uart_num, uart_parity_t parity_mode)
|
esp_err_t my_uart_set_parity(uart_port_t uart_num, uart_parity_t parity_mode)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK(((parity_mode == UART_PARITY_DISABLE) || (parity_mode == UART_PARITY_EVEN) || (parity_mode == UART_PARITY_ODD)),
|
UART_CHECK(((parity_mode == UART_PARITY_DISABLE) || (parity_mode == UART_PARITY_EVEN) || (parity_mode == UART_PARITY_ODD)),
|
||||||
"parity_mode error", ESP_ERR_INVALID_ARG);
|
"parity_mode error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
|
@ -182,7 +186,6 @@ esp_err_t my_uart_set_parity(uart_port_t uart_num, uart_parity_t parity_mode)
|
||||||
|
|
||||||
esp_err_t my_uart_get_parity(uart_port_t uart_num, uart_parity_t *parity_mode)
|
esp_err_t my_uart_get_parity(uart_port_t uart_num, uart_parity_t *parity_mode)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((parity_mode), "empty pointer", ESP_ERR_INVALID_ARG);
|
UART_CHECK((parity_mode), "empty pointer", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
UART_ENTER_CRITICAL();
|
UART_ENTER_CRITICAL();
|
||||||
|
@ -209,8 +212,6 @@ esp_err_t my_uart_get_parity(uart_port_t uart_num, uart_parity_t *parity_mode)
|
||||||
|
|
||||||
esp_err_t my_uart_set_baudrate(uart_port_t uart_num, uint32_t baud_rate)
|
esp_err_t my_uart_set_baudrate(uart_port_t uart_num, uint32_t baud_rate)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
|
|
||||||
UART_ENTER_CRITICAL();
|
UART_ENTER_CRITICAL();
|
||||||
UART[uart_num]->clk_div.val = (uint32_t)(UART_CLK_FREQ / baud_rate) & 0xFFFFF;
|
UART[uart_num]->clk_div.val = (uint32_t)(UART_CLK_FREQ / baud_rate) & 0xFFFFF;
|
||||||
UART_EXIT_CRITICAL();
|
UART_EXIT_CRITICAL();
|
||||||
|
@ -219,7 +220,6 @@ esp_err_t my_uart_set_baudrate(uart_port_t uart_num, uint32_t baud_rate)
|
||||||
|
|
||||||
esp_err_t my_uart_get_baudrate(uart_port_t uart_num, uint32_t *baudrate)
|
esp_err_t my_uart_get_baudrate(uart_port_t uart_num, uint32_t *baudrate)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((baudrate), "empty pointer", ESP_ERR_INVALID_ARG);
|
UART_CHECK((baudrate), "empty pointer", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
(*baudrate) = (UART_CLK_FREQ / (UART[uart_num]->clk_div.val & 0xFFFFF));
|
(*baudrate) = (UART_CLK_FREQ / (UART[uart_num]->clk_div.val & 0xFFFFF));
|
||||||
|
@ -228,7 +228,6 @@ esp_err_t my_uart_get_baudrate(uart_port_t uart_num, uint32_t *baudrate)
|
||||||
|
|
||||||
esp_err_t my_uart_set_line_inverse(uart_port_t uart_num, uint32_t inverse_mask)
|
esp_err_t my_uart_set_line_inverse(uart_port_t uart_num, uint32_t inverse_mask)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
|
||||||
UART_CHECK((((inverse_mask & ~UART_LINE_INV_MASK) == 0) || (inverse_mask == 0)), "inverse_mask error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((((inverse_mask & ~UART_LINE_INV_MASK) == 0) || (inverse_mask == 0)), "inverse_mask error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
UART_ENTER_CRITICAL();
|
UART_ENTER_CRITICAL();
|
||||||
|
@ -377,6 +376,7 @@ static esp_err_t uart_reset_rx_fifo(uart_port_t uart_num)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear uart interrupts status.
|
||||||
esp_err_t my_uart_clear_intr_status(uart_port_t uart_num, uint32_t mask)
|
esp_err_t my_uart_clear_intr_status(uart_port_t uart_num, uint32_t mask)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
@ -387,6 +387,7 @@ esp_err_t my_uart_clear_intr_status(uart_port_t uart_num, uint32_t mask)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set UART interrupt enable
|
||||||
esp_err_t my_uart_enable_intr_mask(uart_port_t uart_num, uint32_t enable_mask)
|
esp_err_t my_uart_enable_intr_mask(uart_port_t uart_num, uint32_t enable_mask)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
@ -407,6 +408,9 @@ esp_err_t my_uart_disable_intr_mask(uart_port_t uart_num, uint32_t disable_mask)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// helper function
|
||||||
|
|
||||||
esp_err_t my_uart_enable_rx_intr(uart_port_t uart_num)
|
esp_err_t my_uart_enable_rx_intr(uart_port_t uart_num)
|
||||||
{
|
{
|
||||||
return my_uart_enable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA | UART_RXFIFO_TOUT_INT_ENA);
|
return my_uart_enable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA | UART_RXFIFO_TOUT_INT_ENA);
|
||||||
|
@ -435,6 +439,9 @@ esp_err_t my_uart_enable_tx_intr(uart_port_t uart_num, int enable, int thresh)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void uart_intr_service(void *arg)
|
static void uart_intr_service(void *arg)
|
||||||
{
|
{
|
||||||
// UART intr process
|
// UART intr process
|
||||||
|
@ -460,6 +467,7 @@ static void uart_intr_service(void *arg)
|
||||||
} while (++uart_num < UART_NUM_MAX);
|
} while (++uart_num < UART_NUM_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting isr function
|
||||||
esp_err_t my_uart_isr_register(uart_port_t uart_num, void (*fn)(void *), void *arg)
|
esp_err_t my_uart_isr_register(uart_port_t uart_num, void (*fn)(void *), void *arg)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
@ -718,7 +726,17 @@ static void uart_rx_intr_handler_default(void *param)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_uart->rx_buffered_len += p_uart->rx_stash_len;
|
p_uart->rx_buffered_len += p_uart->rx_stash_len;
|
||||||
xEventGroupSetBitsFromISR(kUART_Monitoe_event_group, UART_GOT_DATA, pdFALSE);
|
// SWO modify
|
||||||
|
if (kSWO_read_num && p_uart->rx_buffered_len >= kSWO_read_num)
|
||||||
|
{
|
||||||
|
if (kSWO_uart_notify_enable)
|
||||||
|
{
|
||||||
|
kSWO_uart_notify_enable = 0;
|
||||||
|
xEventGroupSetBitsFromISR(kSwoThreadEventGroup, UART_GOT_DATA, pdFALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notify = UART_SELECT_READ_NOTIF;
|
notify = UART_SELECT_READ_NOTIF;
|
||||||
|
@ -804,6 +822,7 @@ static void uart_rx_intr_handler_default(void *param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fill UART tx_fifo and return a number,
|
// Fill UART tx_fifo and return a number,
|
||||||
// This function by itself is not thread-safe, always call from within a muxed section.
|
// This function by itself is not thread-safe, always call from within a muxed section.
|
||||||
static int uart_fill_fifo(uart_port_t uart_num, const char *buffer, uint32_t len)
|
static int uart_fill_fifo(uart_port_t uart_num, const char *buffer, uint32_t len)
|
||||||
|
@ -904,6 +923,8 @@ int my_uart_write_bytes(uart_port_t uart_num, const char *src, size_t size)
|
||||||
return uart_tx_all(uart_num, src, size);
|
return uart_tx_all(uart_num, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// return min(length, data length in ring buffer)
|
||||||
int my_uart_read_bytes(uart_port_t uart_num, uint8_t *buf, uint32_t length, TickType_t ticks_to_wait)
|
int my_uart_read_bytes(uart_port_t uart_num, uint8_t *buf, uint32_t length, TickType_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1));
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1));
|
||||||
|
@ -934,6 +955,7 @@ int my_uart_read_bytes(uart_port_t uart_num, uint8_t *buf, uint32_t length, Tick
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// nothing receive
|
||||||
xSemaphoreGive(p_uart_obj[uart_num]->rx_mux);
|
xSemaphoreGive(p_uart_obj[uart_num]->rx_mux);
|
||||||
return copy_len;
|
return copy_len;
|
||||||
}
|
}
|
||||||
|
@ -974,6 +996,15 @@ int my_uart_read_bytes(uart_port_t uart_num, uint8_t *buf, uint32_t length, Tick
|
||||||
p_uart_obj[uart_num]->rx_buffer_full_flg = false;
|
p_uart_obj[uart_num]->rx_buffer_full_flg = false;
|
||||||
UART_EXIT_CRITICAL();
|
UART_EXIT_CRITICAL();
|
||||||
my_uart_enable_rx_intr(p_uart_obj[uart_num]->uart_num);
|
my_uart_enable_rx_intr(p_uart_obj[uart_num]->uart_num);
|
||||||
|
// SWO modify
|
||||||
|
if (uart_num == 0 && kSWO_read_num && p_uart_obj[0]->rx_buffered_len >= kSWO_read_num)
|
||||||
|
{
|
||||||
|
if (kSWO_uart_notify_enable)
|
||||||
|
{
|
||||||
|
kSWO_uart_notify_enable = 0;
|
||||||
|
xEventGroupSetBitsFromISR(kSwoThreadEventGroup, UART_GOT_DATA, pdFALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -994,6 +1025,7 @@ esp_err_t my_uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
|
||||||
|
|
||||||
esp_err_t my_uart_flush(uart_port_t uart_num) __attribute__((alias("my_uart_flush_input")));
|
esp_err_t my_uart_flush(uart_port_t uart_num) __attribute__((alias("my_uart_flush_input")));
|
||||||
|
|
||||||
|
// flush RX buffer
|
||||||
esp_err_t my_uart_flush_input(uart_port_t uart_num)
|
esp_err_t my_uart_flush_input(uart_port_t uart_num)
|
||||||
{
|
{
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
@ -1051,6 +1083,15 @@ esp_err_t my_uart_flush_input(uart_port_t uart_num)
|
||||||
p_uart_obj[uart_num]->rx_buffered_len += p_uart_obj[uart_num]->rx_stash_len;
|
p_uart_obj[uart_num]->rx_buffered_len += p_uart_obj[uart_num]->rx_stash_len;
|
||||||
p_uart_obj[uart_num]->rx_buffer_full_flg = false;
|
p_uart_obj[uart_num]->rx_buffer_full_flg = false;
|
||||||
UART_EXIT_CRITICAL();
|
UART_EXIT_CRITICAL();
|
||||||
|
// SWO modify
|
||||||
|
if (uart_num == 0 && kSWO_read_num && p_uart_obj[0]->rx_buffered_len >= kSWO_read_num)
|
||||||
|
{
|
||||||
|
if (kSWO_uart_notify_enable)
|
||||||
|
{
|
||||||
|
kSWO_uart_notify_enable = 0;
|
||||||
|
xEventGroupSetBitsFromISR(kSwoThreadEventGroup, UART_GOT_DATA, pdFALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1099,7 @@ esp_err_t my_uart_flush_input(uart_port_t uart_num)
|
||||||
p_uart->rx_ptr = NULL;
|
p_uart->rx_ptr = NULL;
|
||||||
p_uart->rx_cur_remain = 0;
|
p_uart->rx_cur_remain = 0;
|
||||||
p_uart->rx_head_ptr = NULL;
|
p_uart->rx_head_ptr = NULL;
|
||||||
uart_reset_rx_fifo(uart_num);
|
uart_reset_rx_fifo(uart_num); // reset hardware FIFO
|
||||||
my_uart_enable_rx_intr(p_uart_obj[uart_num]->uart_num);
|
my_uart_enable_rx_intr(p_uart_obj[uart_num]->uart_num);
|
||||||
xSemaphoreGive(p_uart->rx_mux);
|
xSemaphoreGive(p_uart->rx_mux);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@ -1096,6 +1137,14 @@ esp_err_t my_uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int t
|
||||||
p_uart_obj[uart_num]->rx_buffered_len = 0;
|
p_uart_obj[uart_num]->rx_buffered_len = 0;
|
||||||
p_uart_obj[uart_num]->wait_tx_done_flg = false;
|
p_uart_obj[uart_num]->wait_tx_done_flg = false;
|
||||||
|
|
||||||
|
// SWO modify
|
||||||
|
if (uart_num == 0)
|
||||||
|
{
|
||||||
|
kSWO_read_index = 0;
|
||||||
|
kSWO_read_num = 0;
|
||||||
|
kSWO_read_mux = xSemaphoreCreateMutex();
|
||||||
|
}
|
||||||
|
|
||||||
if (uart_queue)
|
if (uart_queue)
|
||||||
{
|
{
|
||||||
p_uart_obj[uart_num]->xQueueUart = xQueueCreate(queue_size, sizeof(uart_event_t));
|
p_uart_obj[uart_num]->xQueueUart = xQueueCreate(queue_size, sizeof(uart_event_t));
|
||||||
|
@ -1176,6 +1225,12 @@ esp_err_t my_uart_driver_delete(uart_port_t uart_num)
|
||||||
my_uart_disable_tx_intr(uart_num);
|
my_uart_disable_tx_intr(uart_num);
|
||||||
_xt_isr_mask(0x1 << ETS_UART_INUM);
|
_xt_isr_mask(0x1 << ETS_UART_INUM);
|
||||||
|
|
||||||
|
// SWO modify
|
||||||
|
if (uart_num == 0 && kSWO_read_mux)
|
||||||
|
{
|
||||||
|
vSemaphoreDelete(kSWO_read_mux);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_uart_obj[uart_num]->tx_fifo_sem)
|
if (p_uart_obj[uart_num]->tx_fifo_sem)
|
||||||
{
|
{
|
||||||
vSemaphoreDelete(p_uart_obj[uart_num]->tx_fifo_sem);
|
vSemaphoreDelete(p_uart_obj[uart_num]->tx_fifo_sem);
|
||||||
|
@ -1254,3 +1309,27 @@ esp_err_t my_uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh
|
||||||
UART_EXIT_CRITICAL();
|
UART_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SWO modify
|
||||||
|
esp_err_t my_uart_read_bytes_async_swo(uint32_t index, uint32_t length)
|
||||||
|
{
|
||||||
|
if (kSWO_read_num > 0) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
xSemaphoreTake(kSWO_read_mux, (portTickType)portMAX_DELAY);
|
||||||
|
kSWO_read_num = length;
|
||||||
|
kSWO_read_index = index;
|
||||||
|
kSWO_uart_notify_enable = 1;
|
||||||
|
xSemaphoreGive(kSWO_read_mux);
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int my_uart_get_rx_buffered_data_len(uart_port_t uart_num)
|
||||||
|
{
|
||||||
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
|
return p_uart_obj[uart_num]->rx_buffered_len;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS ". ../../main")
|
set(COMPONENT_ADD_INCLUDEDIRS ". ../../main")
|
||||||
set(COMPONENT_SRCS "MSOS20Descriptors.c USB_handle.c USBd_config.c")
|
set(COMPONENT_SRCS "MSOS20_descriptor.c usb_handle.c usb_descriptor.c")
|
||||||
|
|
||||||
register_component()
|
register_component()
|
|
@ -1,18 +1,20 @@
|
||||||
/**
|
/**
|
||||||
* @file MSOS20Descriptors.c
|
* @file MSOS20_descriptor.c
|
||||||
* @author windowsair
|
* @author windowsair
|
||||||
* @brief Store related data of Microsoft OS 2.0 descriptor
|
* @brief Store related data of Microsoft OS 2.0 descriptor
|
||||||
* @version 0.1
|
* @change: 2021-5-12 Add support for USB 3.0
|
||||||
* @date 2019-11-21
|
* @version 0.2
|
||||||
|
* @date 2021-5-12
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2019
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
////TODO: refactoring into structure
|
////TODO: refactoring into structure
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "MSOS20Descriptors.h"
|
|
||||||
|
#include "components/USBIP/MSOS20_descriptor.h"
|
||||||
|
|
||||||
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8) //((ui16Value) & 0xFF),(((ui16Value) >> 8) & 0xFF)
|
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8) //((ui16Value) & 0xFF),(((ui16Value) >> 8) & 0xFF)
|
||||||
|
|
||||||
|
@ -57,22 +59,48 @@ const uint8_t msOs20DescriptorSetHeader[kLengthOfMsOS20] =
|
||||||
|
|
||||||
const uint8_t bosDescriptor[kLengthOfBos] =
|
const uint8_t bosDescriptor[kLengthOfBos] =
|
||||||
{
|
{
|
||||||
// Universal Serial Bus 3.0 Specification, Table 9-9.
|
// USB 3.0 Specification, Table 9-9.
|
||||||
0x05, // bLength of this descriptor
|
0x05, // bLength of this descriptor
|
||||||
USB_DESCRIPTOR_TYPE_BOS, // BOS Descriptor type(Constant)
|
USB_DESCRIPTOR_TYPE_BOS, // BOS Descriptor type(Constant)
|
||||||
USBShort(kLengthOfBos), // wLength
|
USBShort(kLengthOfBos), // wLength
|
||||||
|
|
||||||
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
0x03, // bNumDeviceCaps -> USB2.0 extension & SuperSpeed USB Device & OS2.0 descriptor
|
||||||
|
#else
|
||||||
0x01, // bNumDeviceCaps -> only 0x01 for OS2.0 descriptor
|
0x01, // bNumDeviceCaps -> only 0x01 for OS2.0 descriptor
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
// USB 2.0 extension, USB 3.0 Specification, Table 9-12.
|
||||||
|
0x07, // bLength of this descriptor
|
||||||
|
USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY, // DEVICE CAPABILITY Descriptor type
|
||||||
|
USB_DEVICE_CAPABILITY_TYPE_USB2_0_EXTENSION, // Capability type: USB 2.0 EXTENSION
|
||||||
|
0x02, 0x00, 0x00, 0x00, // bmAttributes -> LPM Support
|
||||||
|
|
||||||
|
// SuperSpeed USB Device, USB 3.0 Specification, Table 9-13.
|
||||||
|
0x0A, // bLength of this descriptor
|
||||||
|
USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY, // DEVICE CAPABILITY Descriptor type
|
||||||
|
USB_DEVICE_CAPABILITY_TYPE_SUPERSPEED_USB, // Capability type: SUPERSPEED_USB
|
||||||
|
0x00, // bmAttributes -> LTM Capable
|
||||||
|
0x08, 0x00, // wSpeedsSupported -> only support SuperSpeed
|
||||||
|
0x03, // bFunctionalitySupport
|
||||||
|
0x00, // bU1DevExitLat -> 0 may be ok
|
||||||
|
0x00, 0x00, // wU2DevExitLat -> 0 may be ok
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Microsoft OS 2.0 platform capability descriptor header (Table 4)
|
// Microsoft OS 2.0 platform capability descriptor header (Table 4)
|
||||||
// See also:
|
// See also:
|
||||||
// Universal Serial Bus 3.0 Specification : Format of a Device Capability Descriptor, Table 9-10.
|
// USB 3.0 Specification : Format of a Device Capability Descriptor, Table 9-10.
|
||||||
|
|
||||||
0x1C, // bLength of this first device capability descriptor
|
0x1C, // bLength of this first device capability descriptor
|
||||||
// bLength -> The total length of the remaining arrays containing this field
|
// bLength -> The total length of the remaining arrays containing this field
|
||||||
USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY, // bDescriptorType
|
USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY, // bDescriptorType
|
||||||
USB_DEVICE_CAPABILITY_TYPE_PLATFORM, // bDevCapabilityType
|
USB_DEVICE_CAPABILITY_TYPE_PLATFORM, // bDevCapabilityType
|
||||||
|
|
||||||
// Capability-Dependent (See USB3.0 Specification Table 9-10.)
|
// Capability-Dependent (See USB 3.0 Specification Table 9-10.)
|
||||||
0x00, // bReserved
|
0x00, // bReserved
|
||||||
USB_DEVICE_CAPABILITY_UUID, // MS_OS_20_Platform_Capability_ID
|
USB_DEVICE_CAPABILITY_UUID, // MS_OS_20_Platform_Capability_ID
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
/**
|
/**
|
||||||
* @file MSOS20Descriptors.h
|
* @file MSOS20_descriptor.h
|
||||||
* @author windowsair
|
* @author windowsair
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.2
|
||||||
* @date 2019-11-21
|
* @date 2021-5-12
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2019
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MSOS20DESCRIPTORS_H__
|
#ifndef __MSOS20_DESCRIPTOR_H__
|
||||||
#define __MSOS20DESCRIPTORS_H__
|
#define __MSOS20_DESCRIPTOR_H__
|
||||||
|
|
||||||
|
|
||||||
#define kLengthOfMsOS20 0xA2
|
#define kLengthOfMsOS20 0xA2
|
||||||
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
#define kLengthOfBos 0x32
|
||||||
|
#else
|
||||||
#define kLengthOfBos 0x21
|
#define kLengthOfBos 0x21
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
#define kValueOfbMS_VendorCode 0x01// Just set to 0x01
|
#define kValueOfbMS_VendorCode 0x01// Just set to 0x01
|
||||||
extern const uint8_t bosDescriptor[kLengthOfBos];
|
extern const uint8_t bosDescriptor[kLengthOfBos];
|
||||||
extern const uint8_t msOs20DescriptorSetHeader[kLengthOfMsOS20];
|
extern const uint8_t msOs20DescriptorSetHeader[kLengthOfMsOS20];
|
||||||
|
@ -23,6 +30,11 @@ extern const uint8_t msOs20DescriptorSetHeader[kLengthOfMsOS20];
|
||||||
// Platform capability BOS descriptor, Table 1.
|
// Platform capability BOS descriptor, Table 1.
|
||||||
#define USB_DEVICE_CAPABILITY_TYPE_PLATFORM 5
|
#define USB_DEVICE_CAPABILITY_TYPE_PLATFORM 5
|
||||||
|
|
||||||
|
// USB 2.0 Extension Descriptor, USB3.0 Specification Table 9-11
|
||||||
|
#define USB_DEVICE_CAPABILITY_TYPE_USB2_0_EXTENSION 2
|
||||||
|
// SuperSpeed USB specific device level capabilities, USB3.0 Specification Table 9-11
|
||||||
|
#define USB_DEVICE_CAPABILITY_TYPE_SUPERSPEED_USB 3
|
||||||
|
|
||||||
// Platform capability UUID, Table 3.
|
// Platform capability UUID, Table 3.
|
||||||
// {D8DD60DF-4589-4CC7-9CD2-659D9E648A9F}
|
// {D8DD60DF-4589-4CC7-9CD2-659D9E648A9F}
|
||||||
#define USB_DEVICE_CAPABILITY_UUID 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C, 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F
|
#define USB_DEVICE_CAPABILITY_UUID 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C, 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F
|
|
@ -119,6 +119,7 @@ typedef struct
|
||||||
#define USB_DT_OTHER_SPEED_CONFIGURATION 7
|
#define USB_DT_OTHER_SPEED_CONFIGURATION 7
|
||||||
#define USB_DT_INTERFACE_POWER 8
|
#define USB_DT_INTERFACE_POWER 8
|
||||||
#define USB_DT_BOS 15
|
#define USB_DT_BOS 15
|
||||||
|
#define USB_DT_SUPERSPEED_USB_ENDPOINT_COMPANION 48
|
||||||
/* From ECNs */
|
/* From ECNs */
|
||||||
#define USB_DT_OTG 9
|
#define USB_DT_OTG 9
|
||||||
#define USB_DT_DEBUG 10
|
#define USB_DT_DEBUG 10
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
////TODO: refactoring into structure
|
////TODO: refactoring into structure
|
||||||
/**
|
/**
|
||||||
* @file USBd_config.c
|
* @file usb_descriptor.c
|
||||||
* @brief Standard USB Descriptor Definitions
|
* @brief Standard USB Descriptor Definitions
|
||||||
fix bugs 2020-1-23
|
* @change: 2020-1-23 : fix bugs
|
||||||
|
* 2021-5-12 : Add support for USB 3.0
|
||||||
* @version 0.2
|
* @version 0.2
|
||||||
* @date 2020-1-23
|
* @date 2020-1-23
|
||||||
*
|
*
|
||||||
|
@ -10,10 +11,11 @@
|
||||||
*/
|
*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "USBd_config.h"
|
|
||||||
#include "usb_defs.h"
|
|
||||||
|
|
||||||
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8) //((ui16Value) & 0xFF),(((ui16Value) >> 8) & 0xFF)
|
#include "components/USBIP/usb_descriptor.h"
|
||||||
|
#include "components/USBIP/usb_defs.h"
|
||||||
|
|
||||||
|
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,10 +30,16 @@ const uint8_t kUSBd0DeviceDescriptor[0x12] =
|
||||||
USB_DT_DEVICE, // bDescriptorType
|
USB_DT_DEVICE, // bDescriptorType
|
||||||
|
|
||||||
#if (USE_WINUSB == 1)
|
#if (USE_WINUSB == 1)
|
||||||
USBShort(0x0210), // bcdUSB
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
USBShort(0x0300), // bcdUSB
|
||||||
|
#else
|
||||||
|
USBShort(0x210), // bcdUSB
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
#else
|
#else
|
||||||
USBShort(0x0200), // bcdUSB
|
USBShort(0x0200), // bcdUSB
|
||||||
#endif
|
#endif // (USE_WINUSB == 1)
|
||||||
////TODO: Is it also available elsewhere?
|
////TODO: Is it also available elsewhere?
|
||||||
|
|
||||||
// We need to use a device other than the USB-IF standard, set to 0x00
|
// We need to use a device other than the USB-IF standard, set to 0x00
|
||||||
|
@ -39,7 +47,11 @@ const uint8_t kUSBd0DeviceDescriptor[0x12] =
|
||||||
0x00, // bDeviceSubClass
|
0x00, // bDeviceSubClass
|
||||||
0x00, // bDeviceProtocol
|
0x00, // bDeviceProtocol
|
||||||
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
0x09, // bMaxPacketSize0, for USB 3.0 must set to 0x09(2^9)
|
||||||
|
#else
|
||||||
USBD0_MAX_PACKET0, // bMaxPacketSize0 Maximum packet size for default pipe.
|
USBD0_MAX_PACKET0, // bMaxPacketSize0 Maximum packet size for default pipe.
|
||||||
|
#endif
|
||||||
USBShort(USBD0_DEV_DESC_IDVENDOR), // idVendor Vendor ID (VID).
|
USBShort(USBD0_DEV_DESC_IDVENDOR), // idVendor Vendor ID (VID).
|
||||||
USBShort(USBD0_DEV_DESC_IDPRODUCT), // idProduct Product ID (PID).
|
USBShort(USBD0_DEV_DESC_IDPRODUCT), // idProduct Product ID (PID).
|
||||||
USBShort(USBD0_DEV_DESC_BCDDEVICE), // bcdDevice Device Version BCD.
|
USBShort(USBD0_DEV_DESC_BCDDEVICE), // bcdDevice Device Version BCD.
|
||||||
|
@ -61,7 +73,7 @@ const uint8_t kUSBd0DeviceDescriptor[0x12] =
|
||||||
// Standard Interface Descriptor
|
// Standard Interface Descriptor
|
||||||
|
|
||||||
#if (USE_WINUSB ==1)
|
#if (USE_WINUSB ==1)
|
||||||
const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
|
const uint8_t kUSBd0InterfaceDescriptor[]=
|
||||||
{
|
{
|
||||||
0x09, // bLength
|
0x09, // bLength
|
||||||
USB_DT_INTERFACE, // bDescriptorType
|
USB_DT_INTERFACE, // bDescriptorType
|
||||||
|
@ -98,10 +110,19 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
|
||||||
USB_DT_ENDPOINT, // bDescriptorType
|
USB_DT_ENDPOINT, // bDescriptorType
|
||||||
0x01, // bEndpointAddress
|
0x01, // bEndpointAddress
|
||||||
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
||||||
USBShort(512), // wMaxPacketSize
|
USBShort(USB_ENDPOINT_SIZE), // wMaxPacketSize
|
||||||
// We assume that it always runs in High Speed.
|
|
||||||
0x00, // bInterval
|
0x00, // bInterval
|
||||||
|
|
||||||
|
/* SuperSpeed Endpoint Companion */
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
0x06, // bLength
|
||||||
|
USB_DT_SUPERSPEED_USB_ENDPOINT_COMPANION, // bDescriptorType
|
||||||
|
0x00, // bMaxBurst
|
||||||
|
0x00, // bmAttributes(MaxStream for Bulk)
|
||||||
|
0x00, 0x00, // wBytesPerInterval -> 0 for Bulk
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
|
|
||||||
/* Pysical endpoint 1 */
|
/* Pysical endpoint 1 */
|
||||||
|
|
||||||
// "Endpoint 2: Bulk In – used for responses send to host PC." Device -> PC
|
// "Endpoint 2: Bulk In – used for responses send to host PC." Device -> PC
|
||||||
|
@ -109,9 +130,19 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
|
||||||
USB_DT_ENDPOINT, // bDescriptorType
|
USB_DT_ENDPOINT, // bDescriptorType
|
||||||
0x81, // bEndpointAddress
|
0x81, // bEndpointAddress
|
||||||
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
||||||
USBShort(512), // wMaxPacketSize
|
USBShort(USB_ENDPOINT_SIZE), // wMaxPacketSize
|
||||||
0x00, // bInterval
|
0x00, // bInterval
|
||||||
|
|
||||||
|
/* SuperSpeed Endpoint Companion */
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
0x06, // bLength
|
||||||
|
USB_DT_SUPERSPEED_USB_ENDPOINT_COMPANION, // bDescriptorType
|
||||||
|
0x00, // bMaxBurst
|
||||||
|
0x00, // bmAttributes(MaxStream for Bulk)
|
||||||
|
0x00, 0x00, // wBytesPerInterval -> 0 for Bulk
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
|
|
||||||
/* Pysical endpoint 2 */
|
/* Pysical endpoint 2 */
|
||||||
|
|
||||||
// "Endpoint 3: Bulk In (optional) – used for streaming SWO trace" Device -> PC
|
// "Endpoint 3: Bulk In (optional) – used for streaming SWO trace" Device -> PC
|
||||||
|
@ -119,9 +150,17 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
|
||||||
USB_DT_ENDPOINT, // bDescriptorType
|
USB_DT_ENDPOINT, // bDescriptorType
|
||||||
0x82, // bEndpointAddress
|
0x82, // bEndpointAddress
|
||||||
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
USB_ENDPOINT_ATTR_BULK, // bmAttributes
|
||||||
USBShort(512), // wMaxPacketSize
|
USBShort(USB_ENDPOINT_SIZE), // wMaxPacketSize
|
||||||
0x00, // bInterval
|
0x00, // bInterval
|
||||||
|
|
||||||
|
/* SuperSpeed Endpoint Companion */
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
0x06, // bLength
|
||||||
|
USB_DT_SUPERSPEED_USB_ENDPOINT_COMPANION, // bDescriptorType
|
||||||
|
0x00, // bMaxBurst
|
||||||
|
0x00, // bmAttributes(MaxStream for Bulk)
|
||||||
|
0x00, 0x00, // wBytesPerInterval -> 0 for Bulk
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __USBD_CONFIG_H__
|
#ifndef __USB_DESCRIPTOR_H__
|
||||||
#define __USBD_CONFIG_H__
|
#define __USB_DESCRIPTOR_H__
|
||||||
|
|
||||||
#include "dap_configuration.h"
|
#include "main/dap_configuration.h"
|
||||||
|
|
||||||
// Vendor ID assigned by USB-IF (idVendor).
|
// Vendor ID assigned by USB-IF (idVendor).
|
||||||
#define USBD0_DEV_DESC_IDVENDOR 0xC251
|
#define USBD0_DEV_DESC_IDVENDOR 0xC251
|
||||||
|
@ -51,7 +51,13 @@ extern const uint8_t kProductString[0x18];
|
||||||
extern const uint8_t kSerialNumberString[0x1A];
|
extern const uint8_t kSerialNumberString[0x1A];
|
||||||
|
|
||||||
#if (USE_WINUSB == 1)
|
#if (USE_WINUSB == 1)
|
||||||
|
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
extern const uint8_t kUSBd0InterfaceDescriptor[0x30];
|
||||||
|
#else
|
||||||
extern const uint8_t kUSBd0InterfaceDescriptor[0x1E];
|
extern const uint8_t kUSBd0InterfaceDescriptor[0x1E];
|
||||||
|
#endif // USE_USB_3_0 == 1
|
||||||
|
|
||||||
extern const uint8_t kUSBd0ConfigDescriptor[0x09];
|
extern const uint8_t kUSBd0ConfigDescriptor[0x09];
|
||||||
extern const uint8_t kInterfaceString[0x2C];
|
extern const uint8_t kInterfaceString[0x2C];
|
||||||
|
|
|
@ -9,15 +9,17 @@
|
||||||
*/
|
*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "main/usbip_server.h"
|
||||||
|
|
||||||
|
#include "components/USBIP/usb_handle.h"
|
||||||
|
#include "components/USBIP/usb_descriptor.h"
|
||||||
|
#include "components/USBIP/MSOS20_descriptor.h"
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
#include "lwip/sockets.h"
|
#include "lwip/sockets.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
#include "USB_handle.h"
|
|
||||||
#include "USBd_config.h"
|
|
||||||
#include "usbip_server.h"
|
|
||||||
#include "usb_defs.h"
|
|
||||||
#include "MSOS20Descriptors.h"
|
|
||||||
|
|
||||||
|
|
||||||
const char *strings_list[] = {
|
const char *strings_list[] = {
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef __USB_HANDLE_H__
|
#ifndef __USB_HANDLE_H__
|
||||||
#define __USB_HANDLE_H__
|
#define __USB_HANDLE_H__
|
||||||
|
|
||||||
#include "usbip_defs.h"
|
#include "components/USBIP/usbip_defs.h"
|
||||||
|
|
||||||
void handleUSBControlRequest(usbip_stage2_header *header);
|
void handleUSBControlRequest(usbip_stage2_header *header);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -20,7 +20,8 @@
|
||||||
#define __USBIP_DEFS_H__
|
#define __USBIP_DEFS_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "usb_defs.h"
|
|
||||||
|
#include "components/USBIP/usb_defs.h"
|
||||||
|
|
||||||
#define USBIP_SYSFS_PATH_SIZE 256
|
#define USBIP_SYSFS_PATH_SIZE 256
|
||||||
#define USBIP_BUSID_SIZE 32
|
#define USBIP_BUSID_SIZE 32
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS ". $ENV{IDF_PATH}/components/esp8266/include/esp8266/ ../components/USBIP")
|
set(COMPONENT_ADD_INCLUDEDIRS "${PROJECT_PATH}")
|
||||||
set(COMPONENT_SRCS "main.c timer.c tcp_server.c usbip_server.c DAP_handle.c")
|
set(COMPONENT_SRCS "main.c timer.c tcp_server.c usbip_server.c DAP_handle.c")
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
/**
|
/**
|
||||||
* @file DAP_handle.c
|
* @file DAP_handle.c
|
||||||
* @brief Handle DAP packets and transaction push
|
* @brief Handle DAP packets and transaction push
|
||||||
* @version 0.3
|
* @version 0.4
|
||||||
* @date 2020-02-04 first version
|
* @change: 2020.02.04 first version
|
||||||
* 2020-11-11 support WinUSB mode
|
* 2020.11.11 support WinUSB mode
|
||||||
|
* 2021.02.17 support SWO
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2020
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "usbip_server.h"
|
|
||||||
#include "DAP_handle.h"
|
#include "main/usbip_server.h"
|
||||||
#include "DAP.h"
|
#include "main/DAP_handle.h"
|
||||||
#include "esp_libc.h"
|
#include "main/dap_configuration.h"
|
||||||
#include "USBd_config.h"
|
|
||||||
#include "dap_configuration.h"
|
#include "components/USBIP/usb_descriptor.h"
|
||||||
|
#include "components/DAP/include/DAP.h"
|
||||||
|
#include "components/DAP/include/swo.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
@ -28,42 +31,40 @@
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
|
|
||||||
|
#if (USE_WINUSB == 1)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t length;
|
||||||
|
uint8_t buf[DAP_PACKET_SIZE];
|
||||||
|
} DapPacket_t;
|
||||||
|
#else
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t buf[DAP_PACKET_SIZE];
|
||||||
|
} DapPacket_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DAP_HANDLE_SIZE (sizeof(DapPacket_t))
|
||||||
|
|
||||||
|
|
||||||
extern int kSock;
|
extern int kSock;
|
||||||
extern TaskHandle_t kDAPTaskHandle;
|
extern TaskHandle_t kDAPTaskHandle;
|
||||||
|
|
||||||
int kRestartDAPHandle = 0;
|
int kRestartDAPHandle = 0;
|
||||||
|
|
||||||
|
|
||||||
#if (USE_WINUSB == 1)
|
static DapPacket_t DAPDataProcessed;
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t length;
|
|
||||||
uint8_t buf[DAP_PACKET_SIZE];
|
|
||||||
} DAPPacetDataType;
|
|
||||||
#else
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t buf[DAP_PACKET_SIZE];
|
|
||||||
} DAPPacetDataType;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define DAP_HANDLE_SIZE (sizeof(DAPPacetDataType))
|
|
||||||
|
|
||||||
static DAPPacetDataType DAPDataProcessed;
|
|
||||||
static int dap_respond = 0;
|
static int dap_respond = 0;
|
||||||
|
|
||||||
|
|
||||||
// SWO Trace
|
// SWO Trace
|
||||||
static int swo_trace_respond = 0;
|
static uint8_t *swo_data_to_send = NULL;
|
||||||
static uint8_t *swo_data_to_send;
|
static uint32_t swo_data_num;
|
||||||
static uint32_t num_swo_data;
|
|
||||||
|
|
||||||
|
// DAP handle
|
||||||
static RingbufHandle_t dap_dataIN_handle = NULL;
|
static RingbufHandle_t dap_dataIN_handle = NULL;
|
||||||
static RingbufHandle_t dap_dataOUT_handle = NULL;
|
static RingbufHandle_t dap_dataOUT_handle = NULL;
|
||||||
static SemaphoreHandle_t data_response_mux = NULL;
|
static SemaphoreHandle_t data_response_mux = NULL;
|
||||||
|
|
||||||
static void unpack(void *data, int size);
|
|
||||||
|
|
||||||
void handle_dap_data_request(usbip_stage2_header *header, uint32_t length)
|
void handle_dap_data_request(usbip_stage2_header *header, uint32_t length)
|
||||||
{
|
{
|
||||||
|
@ -110,19 +111,22 @@ void handle_dap_data_response(usbip_stage2_header *header)
|
||||||
|
|
||||||
void handle_swo_trace_response(usbip_stage2_header *header)
|
void handle_swo_trace_response(usbip_stage2_header *header)
|
||||||
{
|
{
|
||||||
// TODO:
|
#if (SWO_FUNCTION_ENABLE == 1)
|
||||||
send_stage2_submit(header, 0, 0);
|
if (kSwoTransferBusy)
|
||||||
return;
|
|
||||||
|
|
||||||
if (swo_trace_respond)
|
|
||||||
{
|
{
|
||||||
swo_trace_respond = 0;
|
// busy indicates that there is data to be send
|
||||||
//send_stage2_submit_data(header, 0, (void *)DAPDataProcessed.buf, DAP_PACKET_SIZE);
|
printf("swo use data\r\n");
|
||||||
|
send_stage2_submit_data(header, 0, (void *)swo_data_to_send, swo_data_num);
|
||||||
|
SWO_TransferComplete();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// nothing to send.
|
||||||
send_stage2_submit(header, 0, 0);
|
send_stage2_submit(header, 0, 0);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
send_stage2_submit(header, 0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// SWO Data Queue Transfer
|
// SWO Data Queue Transfer
|
||||||
|
@ -131,15 +135,7 @@ void handle_swo_trace_response(usbip_stage2_header *header)
|
||||||
void SWO_QueueTransfer(uint8_t *buf, uint32_t num)
|
void SWO_QueueTransfer(uint8_t *buf, uint32_t num)
|
||||||
{
|
{
|
||||||
swo_data_to_send = buf;
|
swo_data_to_send = buf;
|
||||||
num_swo_data = num;
|
swo_data_num = num;
|
||||||
swo_trace_respond = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SWO Data Abort Transfer
|
|
||||||
void SWO_AbortTransfer(void)
|
|
||||||
{
|
|
||||||
//USBD_EndpointAbort(0U, USB_ENDPOINT_IN(2U));
|
|
||||||
////TODO: unlink might be useful ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DAP_Thread(void *argument)
|
void DAP_Thread(void *argument)
|
||||||
|
@ -149,7 +145,7 @@ void DAP_Thread(void *argument)
|
||||||
data_response_mux = xSemaphoreCreateMutex();
|
data_response_mux = xSemaphoreCreateMutex();
|
||||||
size_t packetSize;
|
size_t packetSize;
|
||||||
int resLength;
|
int resLength;
|
||||||
DAPPacetDataType *item;
|
DapPacket_t *item;
|
||||||
|
|
||||||
if (dap_dataIN_handle == NULL || dap_dataIN_handle == NULL ||
|
if (dap_dataIN_handle == NULL || dap_dataIN_handle == NULL ||
|
||||||
data_response_mux == NULL)
|
data_response_mux == NULL)
|
||||||
|
@ -180,8 +176,8 @@ void DAP_Thread(void *argument)
|
||||||
|
|
||||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||||
packetSize = 0;
|
packetSize = 0;
|
||||||
item = (DAPPacetDataType *)xRingbufferReceiveUpTo(dap_dataIN_handle, &packetSize,
|
item = (DapPacket_t *)xRingbufferReceiveUpTo(dap_dataIN_handle, &packetSize,
|
||||||
(1 / portTICK_RATE_MS), DAP_HANDLE_SIZE);
|
pdMS_TO_TICKS(1), DAP_HANDLE_SIZE);
|
||||||
if (packetSize == 0)
|
if (packetSize == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -201,14 +197,14 @@ void DAP_Thread(void *argument)
|
||||||
}
|
}
|
||||||
|
|
||||||
resLength = DAP_ProcessCommand((uint8_t *)item->buf, (uint8_t *)DAPDataProcessed.buf); // use first 4 byte to save length
|
resLength = DAP_ProcessCommand((uint8_t *)item->buf, (uint8_t *)DAPDataProcessed.buf); // use first 4 byte to save length
|
||||||
resLength &= 0xFFFF; // res length in lower 16 bits
|
resLength &= 0xFFFF; // res length in lower 16 bits
|
||||||
|
|
||||||
vRingbufferReturnItem(dap_dataIN_handle, (void *)item); // process done.
|
vRingbufferReturnItem(dap_dataIN_handle, (void *)item); // process done.
|
||||||
|
|
||||||
// now prepare to reply
|
// now prepare to reply
|
||||||
#if (USE_WINUSB == 1)
|
#if (USE_WINUSB == 1)
|
||||||
DAPDataProcessed.length = resLength;
|
DAPDataProcessed.length = resLength;
|
||||||
#endif
|
#endif
|
||||||
xRingbufferSend(dap_dataOUT_handle, (void *)&DAPDataProcessed, DAP_HANDLE_SIZE, portMAX_DELAY);
|
xRingbufferSend(dap_dataOUT_handle, (void *)&DAPDataProcessed, DAP_HANDLE_SIZE, portMAX_DELAY);
|
||||||
|
|
||||||
if (xSemaphoreTake(data_response_mux, portMAX_DELAY) == pdTRUE)
|
if (xSemaphoreTake(data_response_mux, portMAX_DELAY) == pdTRUE)
|
||||||
|
@ -222,25 +218,25 @@ void DAP_Thread(void *argument)
|
||||||
|
|
||||||
int fast_reply(uint8_t *buf, uint32_t length)
|
int fast_reply(uint8_t *buf, uint32_t length)
|
||||||
{
|
{
|
||||||
if (length == 48 && buf[3] == 1 && buf[15] == 1 && buf[19] == 1)
|
usbip_stage2_header *buf_header = (usbip_stage2_header *)buf;
|
||||||
|
if (length == 48 &&
|
||||||
|
buf_header->base.command == PP_HTONL(USBIP_STAGE2_REQ_SUBMIT) &&
|
||||||
|
buf_header->base.direction == PP_HTONL(USBIP_DIR_IN) &&
|
||||||
|
buf_header->base.ep == PP_HTONL(1))
|
||||||
{
|
{
|
||||||
if (dap_respond > 0)
|
if (dap_respond > 0)
|
||||||
{
|
{
|
||||||
DAPPacetDataType *item;
|
DapPacket_t *item;
|
||||||
size_t packetSize = 0;
|
size_t packetSize = 0;
|
||||||
item = (DAPPacetDataType *)xRingbufferReceiveUpTo(dap_dataOUT_handle, &packetSize,
|
item = (DapPacket_t *)xRingbufferReceiveUpTo(dap_dataOUT_handle, &packetSize,
|
||||||
(10 / portTICK_RATE_MS), DAP_HANDLE_SIZE);
|
pdMS_TO_TICKS(10), DAP_HANDLE_SIZE);
|
||||||
if (packetSize == DAP_HANDLE_SIZE)
|
if (packetSize == DAP_HANDLE_SIZE)
|
||||||
{
|
{
|
||||||
unpack((uint32_t *)buf, sizeof(usbip_stage2_header));
|
#if (USE_WINUSB == 1)
|
||||||
|
send_stage2_submit_data_fast((usbip_stage2_header *)buf, item->buf, item->length);
|
||||||
#if (USE_WINUSB == 1)
|
#else
|
||||||
uint32_t resLength = item->length;
|
send_stage2_submit_data_fast((usbip_stage2_header *)buf, item->buf, DAP_HANDLE_SIZE);
|
||||||
send_stage2_submit_data((usbip_stage2_header *)buf, 0, item->buf, resLength);
|
#endif
|
||||||
#else
|
|
||||||
send_stage2_submit_data((usbip_stage2_header *)buf, 0, item->buf, DAP_HANDLE_SIZE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (xSemaphoreTake(data_response_mux, portMAX_DELAY) == pdTRUE)
|
if (xSemaphoreTake(data_response_mux, portMAX_DELAY) == pdTRUE)
|
||||||
{
|
{
|
||||||
|
@ -259,28 +255,14 @@ int fast_reply(uint8_t *buf, uint32_t length)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//// TODO: ep0 dir 0 ?
|
buf_header->base.command = PP_HTONL(USBIP_STAGE2_RSP_SUBMIT);
|
||||||
buf[0x3] = 0x3; // command
|
buf_header->base.direction = PP_HTONL(USBIP_DIR_OUT);
|
||||||
buf[0xF] = 0; // direction
|
buf_header->u.ret_submit.status = 0;
|
||||||
buf[0x16] = 0;
|
buf_header->u.ret_submit.data_length = 0;
|
||||||
buf[0x17] = 0;
|
buf_header->u.ret_submit.error_count = 0;
|
||||||
buf[27] = 0;
|
|
||||||
buf[39] = 0;
|
|
||||||
send(kSock, buf, 48, 0);
|
send(kSock, buf, 48, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unpack(void *data, int size)
|
|
||||||
{
|
|
||||||
// Ignore the setup field
|
|
||||||
int sz = (size / sizeof(uint32_t)) - 2;
|
|
||||||
uint32_t *ptr = (uint32_t *)data;
|
|
||||||
|
|
||||||
for (int i = 0; i < sz; i++)
|
|
||||||
{
|
|
||||||
ptr[i] = ntohl(ptr[i]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __DAP_HANDLE_H__
|
#ifndef __DAP_HANDLE_H__
|
||||||
#define __DAP_HANDLE_H__
|
#define __DAP_HANDLE_H__
|
||||||
|
|
||||||
#include "usbip_defs.h"
|
#include "components/USBIP/usbip_defs.h"
|
||||||
|
|
||||||
void handle_dap_data_request(usbip_stage2_header *header, uint32_t length);
|
void handle_dap_data_request(usbip_stage2_header *header, uint32_t length);
|
||||||
void handle_dap_data_response(usbip_stage2_header *header);
|
void handle_dap_data_response(usbip_stage2_header *header);
|
||||||
|
|
|
@ -7,6 +7,27 @@
|
||||||
*/
|
*/
|
||||||
#define USE_WINUSB 1
|
#define USE_WINUSB 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable this option, no need to physically connect MOSI and MISO
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define USE_SPI_SIO 1
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Specify to enable USB 3.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define USE_USB_3_0 0
|
||||||
|
|
||||||
|
|
||||||
|
// For USB 3.0, it must be 1024 byte.
|
||||||
|
#if (USE_USB_3_0 == 1)
|
||||||
|
#define USB_ENDPOINT_SIZE 1024U
|
||||||
|
#else
|
||||||
|
#define USB_ENDPOINT_SIZE 512U
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Maximum Package Size for Command and Response data.
|
/// Maximum Package Size for Command and Response data.
|
||||||
/// This configuration settings is used to optimize the communication performance with the
|
/// This configuration settings is used to optimize the communication performance with the
|
||||||
/// debugger and depends on the USB peripheral. Typical vales are 64 for Full-speed USB HID or WinUSB,
|
/// debugger and depends on the USB peripheral. Typical vales are 64 for Full-speed USB HID or WinUSB,
|
||||||
|
|
61
main/main.c
61
main/main.c
|
@ -9,6 +9,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
#include "main/tcp_server.h"
|
||||||
|
#include "main/timer.h"
|
||||||
|
#include "main/wifi_configuration.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
|
@ -23,19 +28,17 @@
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
|
|
||||||
#include "tcp_server.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "wifi_configuration.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern void SWO_Thread(void *argument);
|
|
||||||
extern void usart_monitor_task(void *argument);
|
|
||||||
extern void DAP_Setup(void);
|
extern void DAP_Setup(void);
|
||||||
extern void DAP_Thread(void *argument);
|
extern void DAP_Thread(void *argument);
|
||||||
|
extern void SWO_Thread();
|
||||||
|
|
||||||
|
TaskHandle_t kDAPTaskHandle = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* FreeRTOS event group to signal when we are connected & ready to make a request */
|
/* FreeRTOS event group to signal when we are connected & ready to make a request */
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
TaskHandle_t kDAPTaskHandle = NULL;
|
|
||||||
|
|
||||||
const int IPV4_GOTIP_BIT = BIT0;
|
const int IPV4_GOTIP_BIT = BIT0;
|
||||||
#ifdef CONFIG_EXAMPLE_IPV6
|
#ifdef CONFIG_EXAMPLE_IPV6
|
||||||
|
@ -94,6 +97,22 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||||
static void initialise_wifi(void)
|
static void initialise_wifi(void)
|
||||||
{
|
{
|
||||||
tcpip_adapter_init();
|
tcpip_adapter_init();
|
||||||
|
|
||||||
|
#if (USE_STATIC_IP == 1)
|
||||||
|
tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_STA);
|
||||||
|
|
||||||
|
tcpip_adapter_ip_info_t ip_info;
|
||||||
|
|
||||||
|
#define MY_IP4_ADDR(...) IP4_ADDR(__VA_ARGS__)
|
||||||
|
MY_IP4_ADDR(&ip_info.ip, DAP_IP_ADDRESS);
|
||||||
|
MY_IP4_ADDR(&ip_info.gw, DAP_IP_GATEWAY);
|
||||||
|
MY_IP4_ADDR(&ip_info.netmask, DAP_IP_NETMASK);
|
||||||
|
#undef MY_IP4_ADDR
|
||||||
|
|
||||||
|
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
||||||
|
#endif // (USE_STATIC_IP == 1)
|
||||||
|
|
||||||
|
|
||||||
wifi_event_group = xEventGroupCreate();
|
wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
|
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
|
||||||
|
@ -128,15 +147,35 @@ static void wait_for_ip()
|
||||||
|
|
||||||
void app_main()
|
void app_main()
|
||||||
{
|
{
|
||||||
|
// struct rst_info *rtc_info = system_get_rst_info();
|
||||||
|
|
||||||
|
// os_printf("reset reason: %x\n", rtc_info->reason);
|
||||||
|
|
||||||
|
// if (rtc_info->reason == REASON_WDT_RST ||
|
||||||
|
// rtc_info->reason == REASON_EXCEPTION_RST ||
|
||||||
|
// rtc_info->reason == REASON_SOFT_WDT_RST)
|
||||||
|
// {
|
||||||
|
// if (rtc_info->reason == REASON_EXCEPTION_RST)
|
||||||
|
// {
|
||||||
|
// os_printf("Fatal exception (%d):\n", rtc_info->exccause);
|
||||||
|
// }
|
||||||
|
// os_printf("epc1=0x%08x, epc2=0x%08x, epc3=0x%08x,excvaddr=0x%08x, depc=0x%08x\n",
|
||||||
|
// rtc_info->epc1, rtc_info->epc2, rtc_info->epc3,
|
||||||
|
// rtc_info->excvaddr, rtc_info->depc);
|
||||||
|
// }
|
||||||
|
|
||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
initialise_wifi();
|
initialise_wifi();
|
||||||
wait_for_ip();
|
wait_for_ip();
|
||||||
DAP_Setup(); // DAP Setup
|
DAP_Setup();
|
||||||
|
timer_init();
|
||||||
|
|
||||||
|
|
||||||
xTaskCreate(timer_create_task, "timer_create", 512, NULL, 10, NULL);
|
|
||||||
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 14, NULL);
|
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 14, NULL);
|
||||||
xTaskCreate(DAP_Thread, "DAP_Task", 2048, NULL, 10, &kDAPTaskHandle);
|
xTaskCreate(DAP_Thread, "DAP_Task", 2048, NULL, 10, &kDAPTaskHandle);
|
||||||
// SWO Trace Task
|
// SWO Trace Task
|
||||||
//xTaskCreate(SWO_Thread, "swo_task", 1024, NULL, 6, NULL);
|
#if (SWO_FUNCTION_ENABLE == 1)
|
||||||
//xTaskCreate(usart_monitor_task, "uart_task", 512, NULL, 6, NULL);
|
xTaskCreate(SWO_Thread, "SWO_Task", 512, NULL, 10, NULL);
|
||||||
|
#endif
|
||||||
|
// It seems that the task is overly stressful...
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
|
||||||
|
void esp_print_tasks(void)
|
||||||
|
{
|
||||||
|
char *pbuffer = (char *)calloc(1, 2048);
|
||||||
|
printf("--------------- heap:%u ---------------------\r\n", esp_get_free_heap_size());
|
||||||
|
vTaskGetRunTimeStats(pbuffer);
|
||||||
|
printf("%s", pbuffer);
|
||||||
|
printf("----------------------------------------------\r\n");
|
||||||
|
free(pbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void monitor_task()
|
||||||
|
{
|
||||||
|
while(1) {
|
||||||
|
esp_print_tasks();
|
||||||
|
vTaskDelay(3000 / portTICK_RATE_MS);
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
#include "main/wifi_configuration.h"
|
||||||
|
#include "main/usbip_server.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
|
@ -26,9 +30,6 @@
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
|
|
||||||
#include "wifi_configuration.h"
|
|
||||||
#include "usbip_server.h"
|
|
||||||
|
|
||||||
extern TaskHandle_t kDAPTaskHandle;
|
extern TaskHandle_t kDAPTaskHandle;
|
||||||
extern int kRestartDAPHandle;
|
extern int kRestartDAPHandle;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ int kSock = -1;
|
||||||
|
|
||||||
void tcp_server_task(void *pvParameters)
|
void tcp_server_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
uint8_t tcp_rx_buffer[1024];
|
uint8_t tcp_rx_buffer[1500];
|
||||||
char addr_str[128];
|
char addr_str[128];
|
||||||
int addr_family;
|
int addr_family;
|
||||||
int ip_protocol;
|
int ip_protocol;
|
||||||
|
|
44
main/timer.c
44
main/timer.c
|
@ -1,29 +1,49 @@
|
||||||
/**
|
/**
|
||||||
* @file timer.c
|
* @file timer.c
|
||||||
* @brief Hardware timer for DAP timestamp
|
* @brief Hardware timer for DAP timestamp
|
||||||
* @version 0.1
|
* @change: 2021-02-18 Using the FRC2 timer
|
||||||
|
*
|
||||||
|
* @version 0.2
|
||||||
* @date 2020-01-22
|
* @date 2020-01-22
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2020
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "timer.h"
|
|
||||||
|
#include "main/timer.h"
|
||||||
|
|
||||||
#include "hw_timer.h"
|
#include "hw_timer.h"
|
||||||
#include "timer_struct.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
void timer_create_task()
|
|
||||||
|
/*
|
||||||
|
Note:
|
||||||
|
System bus frequency is 80MHz, will not be affected by CPU frequency. The
|
||||||
|
frequency of UART, SPI, or other peripheral devices, are divided from system
|
||||||
|
bus frequency, so they will not be affected by CPU frequency either.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TIMER_BASE 0x60000600
|
||||||
|
volatile frc2_struct_t * frc2 = (frc2_struct_t *)(TIMER_BASE + (1) * 0x20);
|
||||||
|
|
||||||
|
void timer_init()
|
||||||
{
|
{
|
||||||
// FRC1 frequency 80MHz
|
|
||||||
vPortEnterCritical();
|
vPortEnterCritical();
|
||||||
frc1.ctrl.div = TIMER_CLKDIV_16; // 80MHz / 16 = 5MHz
|
frc2->ctrl.div = TIMER_CLKDIV_16; // 80MHz / 16 = 5MHz
|
||||||
frc1.ctrl.intr_type = TIMER_EDGE_INT;
|
frc2->ctrl.intr_type = TIMER_EDGE_INT;
|
||||||
frc1.ctrl.reload = 0x01;
|
frc2->ctrl.reload = 0x01; // enable auto reload
|
||||||
frc1.load.data = 0x7FFFFF; // 23bit??
|
frc2->load.val = 0x7FFFFFFF; // 31bit max
|
||||||
frc1.ctrl.en = 0x01;
|
frc2->ctrl.en = 0x01;
|
||||||
vPortExitCritical();
|
vPortExitCritical();
|
||||||
vTaskDelete(NULL);
|
}
|
||||||
|
|
||||||
|
// Timing up to 2147483647(0x7FFFFFFF) / 5000000(5MHz) = 429s
|
||||||
|
// 0.2 micro-second resolution
|
||||||
|
uint32_t get_timer_count()
|
||||||
|
{
|
||||||
|
return (uint32_t)frc2->count.data;
|
||||||
}
|
}
|
67
main/timer.h
67
main/timer.h
|
@ -1,6 +1,71 @@
|
||||||
|
/**
|
||||||
|
* @file timer.h
|
||||||
|
* @author windowsair
|
||||||
|
* @brief esp8266 hardware timer
|
||||||
|
* @change: 2021-02-18 Add frc2 timer
|
||||||
|
* @note
|
||||||
|
* FRC2 is not officially documented. There is no guarantee of its behavior.
|
||||||
|
* FRC2 may be used for RTC functions. May be reserved for other functions in the future.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2021-02-18
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
|
* 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 __TIMER_H__
|
#ifndef __TIMER_H__
|
||||||
#define __TIMER_H__
|
#define __TIMER_H__
|
||||||
|
|
||||||
void timer_create_task();
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
// FRC2 is a 32-bit countup timer
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t data: 32;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} load;
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t data: 31;
|
||||||
|
uint32_t reserved23: 1;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} count;
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t div: 6;
|
||||||
|
uint32_t reload: 1;
|
||||||
|
uint32_t en: 1;
|
||||||
|
uint32_t intr_type: 1;
|
||||||
|
uint32_t reserved24: 23;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} ctrl;
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t clr: 1;
|
||||||
|
uint32_t reserved1: 31;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} intr;
|
||||||
|
} frc2_struct_t;
|
||||||
|
|
||||||
|
extern volatile frc2_struct_t* frc2;
|
||||||
|
|
||||||
|
extern void timer_init();
|
||||||
|
extern uint32_t get_timer_count();
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,17 +1,17 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "main/usbip_server.h"
|
||||||
|
#include "main/DAP_handle.h"
|
||||||
|
|
||||||
|
#include "components/USBIP/usb_handle.h"
|
||||||
|
#include "components/USBIP/usb_descriptor.h"
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
#include "lwip/sockets.h"
|
#include "lwip/sockets.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
|
|
||||||
#include "usbip_server.h"
|
|
||||||
#include "usbip_defs.h"
|
|
||||||
#include "usb_defs.h"
|
|
||||||
#include "USBd_config.h"
|
|
||||||
#include "DAP_handle.h"
|
|
||||||
#include "USB_handle.h"
|
|
||||||
#include "USBd_config.h"
|
|
||||||
|
|
||||||
// attach helper function
|
// attach helper function
|
||||||
static int read_stage1_command(uint8_t *buffer, uint32_t length);
|
static int read_stage1_command(uint8_t *buffer, uint32_t length);
|
||||||
|
@ -339,7 +339,7 @@ void send_stage2_submit(usbip_stage2_header *req_header, int32_t status, int32_t
|
||||||
|
|
||||||
req_header->u.ret_submit.status = status;
|
req_header->u.ret_submit.status = status;
|
||||||
req_header->u.ret_submit.data_length = data_length;
|
req_header->u.ret_submit.data_length = data_length;
|
||||||
|
// already unpacked
|
||||||
pack(req_header, sizeof(usbip_stage2_header));
|
pack(req_header, sizeof(usbip_stage2_header));
|
||||||
send(kSock, req_header, sizeof(usbip_stage2_header), 0);
|
send(kSock, req_header, sizeof(usbip_stage2_header), 0);
|
||||||
}
|
}
|
||||||
|
@ -355,6 +355,23 @@ void send_stage2_submit_data(usbip_stage2_header *req_header, int32_t status, co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void send_stage2_submit_data_fast(usbip_stage2_header *req_header, const void *const data, int32_t data_length)
|
||||||
|
{
|
||||||
|
uint8_t * send_buf = (uint8_t *)req_header;
|
||||||
|
|
||||||
|
req_header->base.command = PP_HTONL(USBIP_STAGE2_RSP_SUBMIT);
|
||||||
|
req_header->base.direction = htonl(!(req_header->base.direction));
|
||||||
|
|
||||||
|
memset(&(req_header->u.ret_submit), 0, sizeof(usbip_stage2_header_ret_submit));
|
||||||
|
req_header->u.ret_submit.data_length = htonl(data_length);
|
||||||
|
|
||||||
|
|
||||||
|
// payload
|
||||||
|
memcpy(&send_buf[sizeof(usbip_stage2_header)], data, data_length);
|
||||||
|
send(kSock, send_buf, sizeof(usbip_stage2_header) + data_length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void handle_unlink(usbip_stage2_header *header)
|
static void handle_unlink(usbip_stage2_header *header)
|
||||||
{
|
{
|
||||||
os_printf("s2 handling cmd unlink...\r\n");
|
os_printf("s2 handling cmd unlink...\r\n");
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#ifndef __USBIP_SERVER_H__
|
#ifndef __USBIP_SERVER_H__
|
||||||
#define __USBIP_SERVER_H__
|
#define __USBIP_SERVER_H__
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "usbip_defs.h"
|
|
||||||
|
#include "components/USBIP/usbip_defs.h"
|
||||||
|
|
||||||
enum state_t
|
enum state_t
|
||||||
{
|
{
|
||||||
ACCEPTING,
|
ACCEPTING,
|
||||||
|
@ -15,5 +17,7 @@ int attach(uint8_t *buffer, uint32_t length);
|
||||||
int emulate(uint8_t *buffer, uint32_t length);
|
int emulate(uint8_t *buffer, uint32_t length);
|
||||||
void send_stage2_submit_data(usbip_stage2_header *req_header, int32_t status, const void * const data, int32_t data_length);
|
void send_stage2_submit_data(usbip_stage2_header *req_header, int32_t status, const void * const data, int32_t data_length);
|
||||||
void send_stage2_submit(usbip_stage2_header *req_header, int32_t status, int32_t data_length);
|
void send_stage2_submit(usbip_stage2_header *req_header, int32_t status, int32_t data_length);
|
||||||
|
void send_stage2_submit_data_fast(usbip_stage2_header *req_header, const void *const data, int32_t data_length);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -13,8 +13,15 @@
|
||||||
#define WIFI_SSID "DAP"
|
#define WIFI_SSID "DAP"
|
||||||
#define WIFI_PASS "12345678"
|
#define WIFI_PASS "12345678"
|
||||||
|
|
||||||
#define PORT 3240
|
|
||||||
|
|
||||||
|
#define USE_STATIC_IP 1
|
||||||
|
// If you don't want to specify the ip configuration, then ignore the following items.
|
||||||
|
#define DAP_IP_ADDRESS 192, 168, 137, 123
|
||||||
|
#define DAP_IP_GATEWAY 192, 168, 137, 1
|
||||||
|
#define DAP_IP_NETMASK 255, 255, 255, 0
|
||||||
|
|
||||||
|
// DO NOT CHANGE
|
||||||
|
#define PORT 3240
|
||||||
#define CONFIG_EXAMPLE_IPV4 1
|
#define CONFIG_EXAMPLE_IPV4 1
|
||||||
|
|
||||||
#endif
|
#endif
|
340
sdkconfig
340
sdkconfig
|
@ -10,6 +10,8 @@ CONFIG_IDF_TARGET="esp8266"
|
||||||
#
|
#
|
||||||
CONFIG_SDK_TOOLPREFIX="xtensa-lx106-elf-"
|
CONFIG_SDK_TOOLPREFIX="xtensa-lx106-elf-"
|
||||||
CONFIG_BOOTLOADER_INIT_SPI_FLASH=y
|
CONFIG_BOOTLOADER_INIT_SPI_FLASH=y
|
||||||
|
# CONFIG_BOOTLOADER_DISABLE_JTAG_IO is not set
|
||||||
|
# CONFIG_BOOTLOADER_FAST_BOOT is not set
|
||||||
# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
|
# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
|
||||||
# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
|
# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
|
||||||
# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set
|
# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set
|
||||||
|
@ -18,6 +20,7 @@ CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
|
||||||
# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
|
# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
|
||||||
CONFIG_LOG_BOOTLOADER_LEVEL=3
|
CONFIG_LOG_BOOTLOADER_LEVEL=3
|
||||||
# CONFIG_BOOTLOADER_APP_TEST is not set
|
# CONFIG_BOOTLOADER_APP_TEST is not set
|
||||||
|
CONFIG_BOOTLOADER_STORE_OFFSET=0x0
|
||||||
CONFIG_ESPTOOLPY_PORT="/dev/ttyS5"
|
CONFIG_ESPTOOLPY_PORT="/dev/ttyS5"
|
||||||
# CONFIG_ESPTOOLPY_BAUD_115200B is not set
|
# CONFIG_ESPTOOLPY_BAUD_115200B is not set
|
||||||
# CONFIG_ESPTOOLPY_BAUD_230400B is not set
|
# CONFIG_ESPTOOLPY_BAUD_230400B is not set
|
||||||
|
@ -83,14 +86,18 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
|
||||||
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
|
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
|
||||||
CONFIG_APP_UPDATE_CHECK_APP_SUM=y
|
CONFIG_APP_UPDATE_CHECK_APP_SUM=y
|
||||||
CONFIG_APP_UPDATE_CHECK_APP_HASH=y
|
CONFIG_APP_UPDATE_CHECK_APP_HASH=y
|
||||||
# CONFIG_AWS_IOT_SDK is not set
|
CONFIG_APP_COMPILE_TIME_DATE=y
|
||||||
# CONFIG_USING_ESP_CONSOLE is not set
|
# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set
|
||||||
|
# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set
|
||||||
|
# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set
|
||||||
|
# CONFIG_ENABLE_COAP is not set
|
||||||
CONFIG_ESP_TLS_USING_MBEDTLS=y
|
CONFIG_ESP_TLS_USING_MBEDTLS=y
|
||||||
# CONFIG_ESP_TLS_USING_WOLFSSL is not set
|
# CONFIG_ESP_TLS_USING_WOLFSSL is not set
|
||||||
# CONFIG_ESP_TLS_SERVER is not set
|
# CONFIG_ESP_TLS_SERVER is not set
|
||||||
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
|
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
|
||||||
# CONFIG_ESP_WOLFSSL_INTERNAL is not set
|
# CONFIG_ESP_WOLFSSL_INTERNAL is not set
|
||||||
# CONFIG_WOLFSSL_DEBUG is not set
|
# CONFIG_WOLFSSL_DEBUG is not set
|
||||||
|
# CONFIG_ESP8266_NMI_WDT is not set
|
||||||
# CONFIG_ESP8266_DEFAULT_CPU_FREQ_80 is not set
|
# CONFIG_ESP8266_DEFAULT_CPU_FREQ_80 is not set
|
||||||
CONFIG_ESP8266_DEFAULT_CPU_FREQ_160=y
|
CONFIG_ESP8266_DEFAULT_CPU_FREQ_160=y
|
||||||
CONFIG_ESP8266_DEFAULT_CPU_FREQ_MHZ=160
|
CONFIG_ESP8266_DEFAULT_CPU_FREQ_MHZ=160
|
||||||
|
@ -102,38 +109,26 @@ CONFIG_ESP_FILENAME_MACRO_NO_PATH=y
|
||||||
# CONFIG_ESP_FILENAME_MACRO_NULL is not set
|
# CONFIG_ESP_FILENAME_MACRO_NULL is not set
|
||||||
CONFIG_USING_NEW_ETS_VPRINTF=y
|
CONFIG_USING_NEW_ETS_VPRINTF=y
|
||||||
# CONFIG_LINK_ETS_PRINTF_TO_IRAM is not set
|
# CONFIG_LINK_ETS_PRINTF_TO_IRAM is not set
|
||||||
|
CONFIG_ETS_PRINTF_EXIT_WHEN_FLASH_RW=y
|
||||||
CONFIG_SOC_FULL_ICACHE=y
|
CONFIG_SOC_FULL_ICACHE=y
|
||||||
CONFIG_SOC_IRAM_SIZE=0x8000
|
CONFIG_SOC_IRAM_SIZE=0x8000
|
||||||
CONFIG_CONSOLE_UART_DEFAULT=y
|
|
||||||
# CONFIG_CONSOLE_UART_CUSTOM is not set
|
|
||||||
# CONFIG_CONSOLE_UART_NONE is not set
|
|
||||||
CONFIG_CONSOLE_UART_NUM=0
|
|
||||||
CONFIG_CONSOLE_UART_BAUDRATE=74880
|
|
||||||
# CONFIG_UART0_SWAP_IO is not set
|
|
||||||
# CONFIG_DISABLE_ROM_UART_PRINT is not set
|
# CONFIG_DISABLE_ROM_UART_PRINT is not set
|
||||||
# CONFIG_PANIC_FULL_STACK is not set
|
|
||||||
# CONFIG_ESP_PANIC_PRINT_HALT is not set
|
# CONFIG_ESP_PANIC_PRINT_HALT is not set
|
||||||
CONFIG_ESP_PANIC_PRINT_REBOOT=y
|
CONFIG_ESP_PANIC_PRINT_REBOOT=y
|
||||||
# CONFIG_ESP_PANIC_SILENT_REBOOT is not set
|
# CONFIG_ESP_PANIC_SILENT_REBOOT is not set
|
||||||
CONFIG_MAIN_TASK_STACK_SIZE=3584
|
# CONFIG_ESP_PANIC_GDBSTUB is not set
|
||||||
CONFIG_TASK_WDT=y
|
|
||||||
CONFIG_TASK_WDT_PANIC=y
|
|
||||||
# CONFIG_TASK_WDT_TIMEOUT_13N is not set
|
|
||||||
# CONFIG_TASK_WDT_TIMEOUT_14N is not set
|
|
||||||
CONFIG_TASK_WDT_TIMEOUT_15N=y
|
|
||||||
CONFIG_TASK_WDT_TIMEOUT_S=15
|
|
||||||
CONFIG_RESET_REASON=y
|
CONFIG_RESET_REASON=y
|
||||||
CONFIG_WIFI_PPT_TASKSTACK_SIZE=4096
|
CONFIG_WIFI_PPT_TASKSTACK_SIZE=4096
|
||||||
CONFIG_EVENT_LOOP_STACK_SIZE=4096
|
|
||||||
# CONFIG_ESP8266_OTA_FROM_OLD is not set
|
# CONFIG_ESP8266_OTA_FROM_OLD is not set
|
||||||
# CONFIG_ESP8266_BOOT_COPY_APP is not set
|
# CONFIG_ESP8266_BOOT_COPY_APP is not set
|
||||||
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
|
||||||
CONFIG_ESP8266_TIME_SYSCALL_USE_FRC1=y
|
CONFIG_ESP8266_TIME_SYSCALL_USE_FRC1=y
|
||||||
# CONFIG_ESP8266_TIME_SYSCALL_USE_NONE is not set
|
# CONFIG_ESP8266_TIME_SYSCALL_USE_NONE is not set
|
||||||
|
# CONFIG_PM_ENABLE is not set
|
||||||
CONFIG_SCAN_AP_MAX=99
|
CONFIG_SCAN_AP_MAX=99
|
||||||
CONFIG_WIFI_TX_RATE_SEQUENCE_FROM_HIGH=y
|
CONFIG_WIFI_TX_RATE_SEQUENCE_FROM_HIGH=y
|
||||||
# CONFIG_ESP8266_WIFI_QOS_ENABLED is not set
|
# CONFIG_ESP8266_WIFI_QOS_ENABLED is not set
|
||||||
# CONFIG_ESP8266_WIFI_AMPDU_RX_ENABLED is not set
|
CONFIG_ESP8266_WIFI_AMPDU_RX_ENABLED=y
|
||||||
|
CONFIG_ESP8266_WIFI_RX_BA_WIN_SIZE=6
|
||||||
# CONFIG_ESP8266_WIFI_AMSDU_ENABLED is not set
|
# CONFIG_ESP8266_WIFI_AMSDU_ENABLED is not set
|
||||||
CONFIG_ESP8266_WIFI_RX_BUFFER_NUM=28
|
CONFIG_ESP8266_WIFI_RX_BUFFER_NUM=28
|
||||||
CONFIG_ESP8266_WIFI_LEFT_CONTINUOUS_RX_BUFFER_NUM=8
|
CONFIG_ESP8266_WIFI_LEFT_CONTINUOUS_RX_BUFFER_NUM=8
|
||||||
|
@ -141,21 +136,91 @@ CONFIG_ESP8266_WIFI_RX_PKT_NUM=16
|
||||||
CONFIG_ESP8266_WIFI_TX_PKT_NUM=6
|
CONFIG_ESP8266_WIFI_TX_PKT_NUM=6
|
||||||
CONFIG_ESP8266_WIFI_NVS_ENABLED=y
|
CONFIG_ESP8266_WIFI_NVS_ENABLED=y
|
||||||
CONFIG_ESP8266_WIFI_CONNECT_OPEN_ROUTER_WHEN_PWD_IS_SET=y
|
CONFIG_ESP8266_WIFI_CONNECT_OPEN_ROUTER_WHEN_PWD_IS_SET=y
|
||||||
|
CONFIG_ESP8266_WIFI_ENABLE_WPA3_SAE=y
|
||||||
# CONFIG_ESP8266_WIFI_DEBUG_LOG_ENABLE is not set
|
# CONFIG_ESP8266_WIFI_DEBUG_LOG_ENABLE is not set
|
||||||
CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
||||||
# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set
|
# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set
|
||||||
CONFIG_ESP_PHY_INIT_DATA_VDD33_CONST=33
|
CONFIG_ESP_PHY_INIT_DATA_VDD33_CONST=33
|
||||||
CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER=21
|
CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER=21
|
||||||
CONFIG_ESP8266_HSPI_HIGH_THROUGHPUT=y
|
CONFIG_ESP8266_HSPI_HIGH_THROUGHPUT=y
|
||||||
|
# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set
|
||||||
|
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
||||||
|
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048
|
||||||
|
CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584
|
||||||
|
CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048
|
||||||
|
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
|
||||||
|
# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set
|
||||||
|
# CONFIG_ESP_CONSOLE_UART_NONE is not set
|
||||||
|
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||||
|
CONFIG_ESP_CONSOLE_UART_BAUDRATE=74880
|
||||||
|
# CONFIG_ESP_UART0_SWAP_IO is not set
|
||||||
|
# CONFIG_ESP_TASK_WDT is not set
|
||||||
|
# CONFIG_ESP_TASK_WDT_TIMEOUT_13N is not set
|
||||||
|
# CONFIG_ESP_TASK_WDT_TIMEOUT_14N is not set
|
||||||
|
CONFIG_ESP_TASK_WDT_TIMEOUT_15N=y
|
||||||
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=15
|
||||||
|
# CONFIG_ESP_EVENT_LOOP_PROFILING is not set
|
||||||
|
CONFIG_ESP_EVENT_POST_FROM_ISR=y
|
||||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
|
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
|
||||||
|
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
||||||
CONFIG_HTTP_BUF_SIZE=512
|
CONFIG_HTTP_BUF_SIZE=512
|
||||||
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
|
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
|
||||||
CONFIG_HTTPD_MAX_URI_LEN=512
|
CONFIG_HTTPD_MAX_URI_LEN=512
|
||||||
CONFIG_OTA_BUF_SIZE=256
|
CONFIG_OTA_BUF_SIZE=256
|
||||||
# CONFIG_OTA_ALLOW_HTTP is not set
|
# CONFIG_OTA_ALLOW_HTTP is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set
|
||||||
|
CONFIG_FATFS_CODEPAGE_437=y
|
||||||
|
# CONFIG_FATFS_CODEPAGE_720 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_737 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_771 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_775 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_850 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_852 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_855 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_857 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_860 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_861 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_862 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_863 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_864 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_865 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_866 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_869 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_932 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_936 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_949 is not set
|
||||||
|
# CONFIG_FATFS_CODEPAGE_950 is not set
|
||||||
|
CONFIG_FATFS_CODEPAGE=437
|
||||||
|
CONFIG_FATFS_LFN_NONE=y
|
||||||
|
# CONFIG_FATFS_LFN_HEAP is not set
|
||||||
|
# CONFIG_FATFS_LFN_STACK is not set
|
||||||
|
CONFIG_FATFS_FS_LOCK=0
|
||||||
|
CONFIG_FATFS_TIMEOUT_MS=10000
|
||||||
|
CONFIG_FATFS_PER_FILE_CACHE=y
|
||||||
|
CONFIG_FMB_COMM_MODE_TCP_EN=y
|
||||||
|
CONFIG_FMB_TCP_PORT_DEFAULT=502
|
||||||
|
CONFIG_FMB_TCP_PORT_MAX_CONN=5
|
||||||
|
CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20
|
||||||
|
CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150
|
||||||
|
CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200
|
||||||
|
CONFIG_FMB_QUEUE_LENGTH=20
|
||||||
|
CONFIG_FMB_PORT_TASK_STACK_SIZE=4096
|
||||||
|
CONFIG_FMB_SERIAL_BUF_SIZE=256
|
||||||
|
CONFIG_FMB_PORT_TASK_PRIO=10
|
||||||
|
CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y
|
||||||
|
CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233
|
||||||
|
CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20
|
||||||
|
CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
|
||||||
|
CONFIG_FMB_CONTROLLER_STACK_SIZE=4096
|
||||||
|
CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20
|
||||||
|
CONFIG_FMB_TIMER_GROUP=0
|
||||||
|
CONFIG_FMB_TIMER_INDEX=0
|
||||||
|
# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set
|
||||||
# CONFIG_DISABLE_FREERTOS is not set
|
# CONFIG_DISABLE_FREERTOS is not set
|
||||||
|
CONFIG_FREERTOS_UNICORE=y
|
||||||
# CONFIG_FREERTOS_ENABLE_REENT is not set
|
# CONFIG_FREERTOS_ENABLE_REENT is not set
|
||||||
CONFIG_FREERTOS_HZ=100
|
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
|
||||||
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_FREERTOS_MAX_HOOK=2
|
CONFIG_FREERTOS_MAX_HOOK=2
|
||||||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
|
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
|
||||||
CONFIG_FREERTOS_ISR_STACKSIZE=512
|
CONFIG_FREERTOS_ISR_STACKSIZE=512
|
||||||
|
@ -167,7 +232,10 @@ CONFIG_TASK_SWITCH_FASTER=y
|
||||||
# CONFIG_ENABLE_FREERTOS_SLEEP is not set
|
# CONFIG_ENABLE_FREERTOS_SLEEP is not set
|
||||||
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
|
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
|
||||||
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
|
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
|
||||||
|
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||||
CONFIG_HEAP_DISABLE_IRAM=y
|
CONFIG_HEAP_DISABLE_IRAM=y
|
||||||
|
# CONFIG_HEAP_TRACING is not set
|
||||||
|
CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
|
||||||
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
|
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
|
||||||
|
@ -177,73 +245,84 @@ CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
|
||||||
CONFIG_LOG_DEFAULT_LEVEL=1
|
CONFIG_LOG_DEFAULT_LEVEL=1
|
||||||
CONFIG_LOG_COLORS=y
|
CONFIG_LOG_COLORS=y
|
||||||
# CONFIG_LOG_SET_LEVEL is not set
|
# CONFIG_LOG_SET_LEVEL is not set
|
||||||
CONFIG_LWIP_USE_IRAM=y
|
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||||
CONFIG_LWIP_HIGH_THROUGHPUT=y
|
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
|
||||||
CONFIG_TCPIP_RECVMBOX_SIZE=64
|
# CONFIG_LWIP_L2_TO_L3_COPY is not set
|
||||||
CONFIG_LWIP_ARP_TABLE_SIZE=10
|
CONFIG_LWIP_IRAM_OPTIMIZATION=y
|
||||||
CONFIG_LWIP_ARP_MAXAGE=300
|
CONFIG_LWIP_TIMERS_ONDEMAND=y
|
||||||
# CONFIG_LWIP_ESP_GRATUITOUS_ARP is not set
|
|
||||||
# CONFIG_LWIP_SOCKET_MULTITHREAD is not set
|
|
||||||
CONFIG_ENABLE_NONBLOCK_SPEEDUP=y
|
|
||||||
CONFIG_ESP_UDP_SYNC_SEND=y
|
|
||||||
CONFIG_ESP_UDP_SYNC_RETRY_MAX=5
|
|
||||||
CONFIG_LWIP_MAX_SOCKETS=10
|
CONFIG_LWIP_MAX_SOCKETS=10
|
||||||
|
# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set
|
||||||
|
# CONFIG_LWIP_SO_LINGER is not set
|
||||||
CONFIG_LWIP_SO_REUSE=y
|
CONFIG_LWIP_SO_REUSE=y
|
||||||
CONFIG_LWIP_SO_REUSE_RXTOALL=y
|
CONFIG_LWIP_SO_REUSE_RXTOALL=y
|
||||||
# CONFIG_LWIP_SO_RCVBUF is not set
|
# CONFIG_LWIP_SO_RCVBUF is not set
|
||||||
CONFIG_LWIP_RECV_BUFSIZE_DEFAULT=11680
|
# CONFIG_LWIP_NETBUF_RECVINFO is not set
|
||||||
CONFIG_LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT=10000
|
CONFIG_LWIP_IP4_FRAG=y
|
||||||
CONFIG_LWIP_IP_FRAG=y
|
# CONFIG_LWIP_IP6_FRAG is not set
|
||||||
CONFIG_LWIP_IP_REASSEMBLY=y
|
# CONFIG_LWIP_IP4_REASSEMBLY is not set
|
||||||
CONFIG_LWIP_IP_REASS_MAX_PBUFS=10
|
# CONFIG_LWIP_IP6_REASSEMBLY is not set
|
||||||
# CONFIG_LWIP_IP_SOF_BROADCAST is not set
|
# CONFIG_LWIP_IP_FORWARD is not set
|
||||||
# CONFIG_LWIP_IP_SOF_BROADCAST_RECV is not set
|
# CONFIG_LWIP_STATS is not set
|
||||||
CONFIG_LWIP_ICMP=y
|
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
|
||||||
# CONFIG_LWIP_MULTICAST_PING is not set
|
# CONFIG_LWIP_ESP_GRATUITOUS_ARP is not set
|
||||||
# CONFIG_LWIP_BROADCAST_PING is not set
|
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
|
||||||
# CONFIG_LWIP_RAW is not set
|
|
||||||
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
||||||
CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
|
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
||||||
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
|
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
|
||||||
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
|
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
|
||||||
CONFIG_LWIP_DHCP_DISCOVER_RETRANSMISSION_INTERVAL=250
|
|
||||||
# CONFIG_LWIP_AUTOIP is not set
|
# CONFIG_LWIP_AUTOIP is not set
|
||||||
CONFIG_LWIP_IGMP=y
|
# CONFIG_LWIP_IPV6_AUTOCONFIG is not set
|
||||||
CONFIG_ESP_DNS=y
|
|
||||||
CONFIG_DNS_MAX_SERVERS=3
|
|
||||||
# CONFIG_LWIP_NETIF_LOOPBACK is not set
|
# CONFIG_LWIP_NETIF_LOOPBACK is not set
|
||||||
CONFIG_TCP_HIGH_SPEED_RETRANSMISSION=y
|
|
||||||
CONFIG_LWIP_MAX_ACTIVE_TCP=16
|
CONFIG_LWIP_MAX_ACTIVE_TCP=16
|
||||||
CONFIG_LWIP_MAX_LISTENING_TCP=8
|
CONFIG_LWIP_MAX_LISTENING_TCP=8
|
||||||
CONFIG_TCP_MAXRTX=12
|
CONFIG_LWIP_TCP_MAXRTX=12
|
||||||
CONFIG_TCP_SYNMAXRTX=6
|
CONFIG_LWIP_TCP_SYNMAXRTX=6
|
||||||
CONFIG_TCP_MSS=1460
|
CONFIG_LWIP_TCP_MSS=1460
|
||||||
CONFIG_TCP_SND_BUF_DEFAULT=2920
|
CONFIG_LWIP_TCP_TMR_INTERVAL=250
|
||||||
CONFIG_TCP_WND_DEFAULT=10240
|
CONFIG_LWIP_TCP_MSL=60000
|
||||||
CONFIG_TCP_RECVMBOX_SIZE=16
|
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=11680
|
||||||
CONFIG_TCP_QUEUE_OOSEQ=y
|
CONFIG_LWIP_TCP_WND_DEFAULT=10240
|
||||||
CONFIG_TCP_OVERSIZE_MSS=y
|
CONFIG_LWIP_TCP_RECVMBOX_SIZE=16
|
||||||
# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set
|
CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
|
||||||
# CONFIG_TCP_OVERSIZE_DISABLE is not set
|
# CONFIG_LWIP_TCP_SACK_OUT is not set
|
||||||
# CONFIG_LWIP_TCP_TIMESTAMPS is not set
|
# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
|
||||||
|
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
|
||||||
|
# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set
|
||||||
|
# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set
|
||||||
|
CONFIG_LWIP_TCP_RTO_TIME=3000
|
||||||
CONFIG_LWIP_MAX_UDP_PCBS=4
|
CONFIG_LWIP_MAX_UDP_PCBS=4
|
||||||
CONFIG_UDP_RECVMBOX_SIZE=6
|
CONFIG_LWIP_UDP_RECVMBOX_SIZE=6
|
||||||
CONFIG_TCPIP_TASK_STACK_SIZE=4096
|
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096
|
||||||
|
CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
||||||
|
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
|
||||||
|
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
||||||
|
# CONFIG_LWIP_PPP_SUPPORT is not set
|
||||||
|
CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3
|
||||||
|
CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5
|
||||||
|
# CONFIG_LWIP_MULTICAST_PING is not set
|
||||||
|
# CONFIG_LWIP_BROADCAST_PING is not set
|
||||||
CONFIG_LWIP_MAX_RAW_PCBS=4
|
CONFIG_LWIP_MAX_RAW_PCBS=4
|
||||||
# CONFIG_LWIP_IPV6 is not set
|
# CONFIG_LWIP_IPV6 is not set
|
||||||
# CONFIG_LWIP_STATS is not set
|
CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
|
||||||
# CONFIG_ESP_LWIP_MEM_DBG is not set
|
CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
|
||||||
# CONFIG_LWIP_DEBUG is not set
|
CONFIG_LWIP_ESP_LWIP_ASSERT=y
|
||||||
|
# CONFIG_LWIP_NETIF_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_PBUF_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_ETHARP_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_API_LIB_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_SOCKETS_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_IP_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_ICMP_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_IP6_DEBUG is not set
|
||||||
|
# CONFIG_LWIP_ICMP6_DEBUG is not set
|
||||||
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||||
# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
|
# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
|
||||||
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
|
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
|
||||||
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
|
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
|
||||||
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
|
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
|
||||||
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
|
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
|
||||||
|
# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set
|
||||||
# CONFIG_MBEDTLS_DEBUG is not set
|
# CONFIG_MBEDTLS_DEBUG is not set
|
||||||
CONFIG_MBEDTLS_HARDWARE_AES=y
|
|
||||||
# CONFIG_MBEDTLS_HARDWARE_MPI is not set
|
|
||||||
CONFIG_MBEDTLS_HARDWARE_SHA=y
|
|
||||||
CONFIG_MBEDTLS_HAVE_TIME=y
|
CONFIG_MBEDTLS_HAVE_TIME=y
|
||||||
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
||||||
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
||||||
|
@ -301,29 +380,19 @@ CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
|
||||||
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
|
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
|
||||||
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
|
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
|
||||||
CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
|
CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
|
||||||
|
# CONFIG_util_assert is not set
|
||||||
|
CONFIG_ESP_SHA=y
|
||||||
|
CONFIG_ESP_AES=y
|
||||||
|
CONFIG_ESP_MD5=y
|
||||||
|
CONFIG_ESP_ARC4=y
|
||||||
# CONFIG_ENABLE_MDNS is not set
|
# CONFIG_ENABLE_MDNS is not set
|
||||||
# CONFIG_MQTT_USING_ESP is not set
|
CONFIG_MQTT_PROTOCOL_311=y
|
||||||
CONFIG_MQTT_USING_IBM=y
|
CONFIG_MQTT_TRANSPORT_SSL=y
|
||||||
CONFIG_V3_1=y
|
CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
|
||||||
# CONFIG_V3_1_1 is not set
|
CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
|
||||||
CONFIG_DEFAULT_MQTT_VERSION=3
|
# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set
|
||||||
CONFIG_MQTT_CLIENT_ID="espressif_sample"
|
# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set
|
||||||
CONFIG_MQTT_KEEP_ALIVE=30
|
# CONFIG_MQTT_CUSTOM_OUTBOX is not set
|
||||||
CONFIG_MQTT_USERNAME="espressif"
|
|
||||||
CONFIG_MQTT_PASSWORD="admin"
|
|
||||||
CONFIG_CLEAN_SESSION=y
|
|
||||||
# CONFIG_KEEP_SESSION is not set
|
|
||||||
CONFIG_DEFAULT_MQTT_SESSION=1
|
|
||||||
CONFIG_NO_TLS=y
|
|
||||||
# CONFIG_TLS_VERIFY_NONE is not set
|
|
||||||
# CONFIG_TLS_VERIFY_PEER is not set
|
|
||||||
# CONFIG_TLS_VERIFY_CLIENT is not set
|
|
||||||
CONFIG_DEFAULT_MQTT_SECURITY=0
|
|
||||||
CONFIG_MQTT_SEND_BUFFER=2048
|
|
||||||
CONFIG_MQTT_RECV_BUFFER=2048
|
|
||||||
CONFIG_MQTT_SEND_CYCLE=30000
|
|
||||||
CONFIG_MQTT_RECV_CYCLE=0
|
|
||||||
CONFIG_MQTT_PING_TIMEOUT=3000
|
|
||||||
# CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL is not set
|
# CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL is not set
|
||||||
# CONFIG_NEWLIB_LIBRARY_LEVEL_NANO is not set
|
# CONFIG_NEWLIB_LIBRARY_LEVEL_NANO is not set
|
||||||
CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO=y
|
CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO=y
|
||||||
|
@ -331,17 +400,45 @@ CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO=y
|
||||||
# CONFIG_OPENSSL_DEBUG is not set
|
# CONFIG_OPENSSL_DEBUG is not set
|
||||||
CONFIG_OPENSSL_ASSERT_DO_NOTHING=y
|
CONFIG_OPENSSL_ASSERT_DO_NOTHING=y
|
||||||
# CONFIG_OPENSSL_ASSERT_EXIT is not set
|
# CONFIG_OPENSSL_ASSERT_EXIT is not set
|
||||||
# CONFIG_ENABLE_PTHREAD is not set
|
CONFIG_ENABLE_PTHREAD=y
|
||||||
# CONFIG_USING_SPIFFS is not set
|
CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5
|
||||||
|
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
|
||||||
|
CONFIG_PTHREAD_STACK_MIN=768
|
||||||
|
CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread"
|
||||||
|
CONFIG_SPIFFS_MAX_PARTITIONS=3
|
||||||
|
CONFIG_SPIFFS_CACHE=y
|
||||||
|
CONFIG_SPIFFS_CACHE_WR=y
|
||||||
|
# CONFIG_SPIFFS_CACHE_STATS is not set
|
||||||
|
CONFIG_SPIFFS_PAGE_CHECK=y
|
||||||
|
CONFIG_SPIFFS_GC_MAX_RUNS=10
|
||||||
|
# CONFIG_SPIFFS_GC_STATS is not set
|
||||||
|
CONFIG_SPIFFS_PAGE_SIZE=256
|
||||||
|
CONFIG_SPIFFS_OBJ_NAME_LEN=32
|
||||||
|
CONFIG_SPIFFS_USE_MAGIC=y
|
||||||
|
CONFIG_SPIFFS_USE_MAGIC_LENGTH=y
|
||||||
|
CONFIG_SPIFFS_META_LENGTH=4
|
||||||
|
CONFIG_SPIFFS_USE_MTIME=y
|
||||||
|
# CONFIG_SPIFFS_DBG is not set
|
||||||
|
# CONFIG_SPIFFS_API_DBG is not set
|
||||||
|
# CONFIG_SPIFFS_GC_DBG is not set
|
||||||
|
# CONFIG_SPIFFS_CACHE_DBG is not set
|
||||||
|
# CONFIG_SPIFFS_CHECK_DBG is not set
|
||||||
|
# CONFIG_SPIFFS_TEST_VISUALISATION is not set
|
||||||
CONFIG_IP_LOST_TIMER_INTERVAL=120
|
CONFIG_IP_LOST_TIMER_INTERVAL=120
|
||||||
# CONFIG_util_assert is not set
|
CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y
|
||||||
CONFIG_ESP_SHA=y
|
CONFIG_VFS_SUPPORT_TERMIOS=y
|
||||||
CONFIG_ESP_AES=y
|
CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1
|
||||||
CONFIG_ESP_MD5=y
|
CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128
|
||||||
CONFIG_ESP_ARC4=y
|
# CONFIG_WL_SECTOR_SIZE_512 is not set
|
||||||
# CONFIG_USING_ESP_VFS is not set
|
CONFIG_WL_SECTOR_SIZE_4096=y
|
||||||
|
CONFIG_WL_SECTOR_SIZE=4096
|
||||||
# CONFIG_ENABLE_UNIFIED_PROVISIONING is not set
|
# CONFIG_ENABLE_UNIFIED_PROVISIONING is not set
|
||||||
CONFIG_LTM_FAST=y
|
CONFIG_LTM_FAST=y
|
||||||
|
CONFIG_WPA_MBEDTLS_CRYPTO=y
|
||||||
|
# CONFIG_WPA_DEBUG_PRINT is not set
|
||||||
|
# CONFIG_WPA_TESTING_OPTIONS is not set
|
||||||
|
# CONFIG_WPA_WPS_WARS is not set
|
||||||
|
# CONFIG_WPA_11KV_SUPPORT is not set
|
||||||
|
|
||||||
# Deprecated options for backward compatibility
|
# Deprecated options for backward compatibility
|
||||||
CONFIG_TARGET_PLATFORM="esp8266"
|
CONFIG_TARGET_PLATFORM="esp8266"
|
||||||
|
@ -372,4 +469,55 @@ CONFIG_STACK_CHECK_NONE=y
|
||||||
# CONFIG_STACK_CHECK_ALL is not set
|
# CONFIG_STACK_CHECK_ALL is not set
|
||||||
# CONFIG_STACK_CHECK is not set
|
# CONFIG_STACK_CHECK is not set
|
||||||
# CONFIG_WARN_WRITE_STRINGS is not set
|
# CONFIG_WARN_WRITE_STRINGS is not set
|
||||||
|
CONFIG_MAIN_TASK_STACK_SIZE=3584
|
||||||
|
CONFIG_CONSOLE_UART_DEFAULT=y
|
||||||
|
# CONFIG_CONSOLE_UART_CUSTOM is not set
|
||||||
|
# CONFIG_CONSOLE_UART_NONE is not set
|
||||||
|
CONFIG_CONSOLE_UART_NUM=0
|
||||||
|
CONFIG_CONSOLE_UART_BAUDRATE=74880
|
||||||
|
# CONFIG_UART0_SWAP_IO is not set
|
||||||
|
# CONFIG_TASK_WDT is not set
|
||||||
|
CONFIG_TASK_WDT_TIMEOUT_S=15
|
||||||
|
CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150
|
||||||
|
CONFIG_MB_MASTER_DELAY_MS_CONVERT=200
|
||||||
|
CONFIG_MB_QUEUE_LENGTH=20
|
||||||
|
CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096
|
||||||
|
CONFIG_MB_SERIAL_BUF_SIZE=256
|
||||||
|
CONFIG_MB_SERIAL_TASK_PRIO=10
|
||||||
|
CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y
|
||||||
|
CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233
|
||||||
|
CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20
|
||||||
|
CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
|
||||||
|
CONFIG_MB_CONTROLLER_STACK_SIZE=4096
|
||||||
|
CONFIG_MB_EVENT_QUEUE_TIMEOUT=20
|
||||||
|
CONFIG_MB_TIMER_GROUP=0
|
||||||
|
CONFIG_MB_TIMER_INDEX=0
|
||||||
|
# CONFIG_L2_TO_L3_COPY is not set
|
||||||
|
# CONFIG_USE_ONLY_LWIP_SELECT is not set
|
||||||
|
# CONFIG_ESP_GRATUITOUS_ARP is not set
|
||||||
|
CONFIG_TCPIP_RECVMBOX_SIZE=64
|
||||||
|
CONFIG_TCP_MAXRTX=12
|
||||||
|
CONFIG_TCP_SYNMAXRTX=6
|
||||||
|
CONFIG_TCP_MSS=1460
|
||||||
|
CONFIG_TCP_MSL=60000
|
||||||
|
CONFIG_TCP_SND_BUF_DEFAULT=11680
|
||||||
|
CONFIG_TCP_WND_DEFAULT=10240
|
||||||
|
CONFIG_TCP_RECVMBOX_SIZE=16
|
||||||
|
CONFIG_TCP_QUEUE_OOSEQ=y
|
||||||
|
# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
|
||||||
|
CONFIG_TCP_OVERSIZE_MSS=y
|
||||||
|
# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set
|
||||||
|
# CONFIG_TCP_OVERSIZE_DISABLE is not set
|
||||||
|
CONFIG_UDP_RECVMBOX_SIZE=6
|
||||||
|
CONFIG_TCPIP_TASK_STACK_SIZE=4096
|
||||||
|
CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
||||||
|
# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set
|
||||||
|
CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
||||||
|
# CONFIG_PPP_SUPPORT is not set
|
||||||
|
CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
|
||||||
|
CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
|
||||||
|
CONFIG_ESP32_PTHREAD_STACK_MIN=768
|
||||||
|
CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
|
||||||
|
CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y
|
||||||
|
CONFIG_SUPPORT_TERMIOS=y
|
||||||
# End of deprecated options
|
# End of deprecated options
|
||||||
|
|
Loading…
Reference in New Issue